# pytorch/pytorch v2.15.0: PyTorch 2.15.0 Release — retained record

> Retained github record from github:pytorch/pytorch.

Canonical: https://highsignal.app/data/records/4240d66f9b4dff4f

[← sources](https://highsignal.app/data)


source: [github](https://highsignal.app/data/github) (github:pytorch/pytorch)  published 2026-10-28 17:09 ingested 2026-10-29 02:33

[original source ↗](https://github.com/pytorch/pytorch/releases/tag/v2.15.0)

## extract

# PyTorch 2.15.0 Release Notes

- [Highlights](https://highsignal.app/data/records/4240d66f9b4dff4f#highlights)
- [Backwards Incompatible Changes](https://highsignal.app/data/records/4240d66f9b4dff4f#backwards-incompatible-changes)
- [Deprecations](https://highsignal.app/data/records/4240d66f9b4dff4f#deprecations)
- [New Features](https://highsignal.app/data/records/4240d66f9b4dff4f#new-features)
- [Improvements](https://highsignal.app/data/records/4240d66f9b4dff4f#improvements)
- [Bug fixes](https://highsignal.app/data/records/4240d66f9b4dff4f#bug-fixes)
- [Performance](https://highsignal.app/data/records/4240d66f9b4dff4f#performance)
- [Documentation](https://highsignal.app/data/records/4240d66f9b4dff4f#documentation)
- [Security](https://highsignal.app/data/records/4240d66f9b4dff4f#security)
- [Developers](https://highsignal.app/data/records/4240d66f9b4dff4f#developers)

# Highlights

<table>
  <tr><td><strong>Rewritten NCCL backend becomes the default</strong>, with a flight recorder that dumps on hangs and <code>TORCH_DIST_USE_NCCL2=0</code> or <code>nccl-legacy</code> as rollback paths</td></tr>
  <tr><td><strong>One-sided transports for <code>torch.distributed</code></strong>, with a NIXL backend and CUDA-graph-capturable transfers</td></tr>
  <tr><td><strong>FSDP2 and pipelining gain finer memory and communication control</strong>, with fp32 for precision-sensitive parameters, CUDA-graph-captured gradient accumulation, and gradient reduction overlapped with compute</td></tr>
  <tr><td><strong>Faster 4-bit (NVFP4) LLM decoding on NVIDIA Blackwell GPUs</strong> through fewer, better-overlapped kernel launches in NVGEMM</td></tr>
  <tr><td><strong>Apple Silicon gains FP8 and faster decode</strong>, with <code>float8_e4m3fn</code> and <code>_scaled_mm</code>, a new <code>grouped_mm</code> with a decode fast path (1.32–1.34x tokens/s on MoE decode), and public <code>torch.mps.Stream</code> APIs</td></tr>
  <tr><td><strong>Broader platform support</strong> with FlyDSL kernels on AMD gfx950, Tensor Data Mover support for gfx1250 (MI450), ROCm 10.0 wheels, simpler SYCL kernel authoring and multi-GPU profiling on Intel GPUs, CUDA 13.2 as the default wheel with CUDA 13.4 alongside it, and <code>torch.compile</code> on Python 3.15</td></tr>
</table>

For more details about these highlighted features, you can look at the release blogpost. Below are the full release notes for this release.

# Backwards Incompatible Changes

## Python Frontend

### `import torch` can no longer be re-executed in the same process, including via `importlib.reload(torch)` (#194654)

`importlib.reload(torch)` and `del sys.modules["torch"]` + re-import now raise, as does retrying `import torch` after it failed. Re-running the module body was already unsafe in exactly the same way as the retry, so the new check does not distinguish the two. Normal use is unaffected: a successful import leaves `torch` in `sys.modules` so the body never re-runs, and re-entrant imports from a backend extension during autoload still short-circuit on `sys.modules` without reaching the check.

Version 2.14:
```python
import importlib
import torch

importlib.reload(torch)
# RuntimeError: Only a single TORCH_LIBRARY can be used to register the namespace triton; ...
# (re-importing after a failed `import torch` failed with similarly misleading errors or could segfault)
```

Version 2.15:
```python
import importlib
import torch

importlib.reload(torch)
# ImportError: `torch` can only be initialized once per process, so this module cannot
# be imported again: neither via `importlib.reload(torch)`, nor by re-importing after
# a failed `import torch`.
```

### Nested tensors are no longer allowlisted for `torch.load(..., weights_only=True)` (#194380)

Nested jagged and strided nested tensors are no longer on the default `weights_only` allowlist. Loading a checkpoint that contains one with `weights_only=True` (the default) now fails with `Unsupported global: GLOBAL torch.nested._internal.nested_tensor._rebuild_njt was not an allowed global by default` (or `GLOBAL torch._utils._rebuild_nested_tensor` for strided nested tensors). To load checkpoints containing nested tensors, allow them explicitly with `torch.serialization.safe_globals` (see below), or use `weights_only=False` for trusted files.

Version 2.14:
```python
loaded = torch.load("njt.pt", weights_only=True)  # works
```

Version 2.15:
```python
from torch.nested._internal.nested_tensor import _rebuild_njt, NestedTensor
with torch.serialization.safe_globals([_rebuild_njt, NestedTensor]):
    loaded = torch.load("njt.pt", weights_only=True)
```

### Operators called through `torch.ops.*` and `torch._C._dispatch_call_boxed` now use PyTorch's own warning and exception translation instead of pybind11's (#193451)

We make `torch.ops.*` calls go through the same exception and warning translation as the rest of the library. This means that some exception translation that used to be handled by pybind is now handled natively. User-defined pybind exception translation is thus lost. Restoring it may be done in a future release as part of a broader exception handler improvement.

In addition, `TORCH_WARN` warnings from these operators now reach Python's `warnings` module, so they raise when warnings are turned into errors (`-W error`). `std::out_of_range` still becomes `IndexError` (#195713).

Version 2.14:

```python
# C++ op: throw std::invalid_argument("bad size");
try:
    torch.ops.my_lib.my_op(x)
except ValueError:  # pybind11 translation
    ...
```

Version 2.15:

```python
# C++ op: TORCH_CHECK_VALUE(false, "bad size");
try:
    torch.ops.my_lib.my_op(x)
except ValueError:
    ...

# TORCH_WARN from the op is now a Python warning
with warnings.catch_warnings():
    warnings.simplefilter("ignore")
    torch.ops.my_lib.my_op(x)
```

## Autograd

### Selective activation checkpointing now saves, rather than recomputes, the outputs of operators with an ordered effect unless the policy returns `CheckpointPolicy.MUST_RECOMPUTE` (#196956)

In eager mode, if a `create_selective_checkpoint_contexts` policy returns `CheckpointPolicy.PREFER_RECOMPUTE` for a non-aliasing operator with an ordered effect (e.g. via `register_effect(torch.library.EffectType.ORDERED)`), that choice is now overridden and its outputs are saved, so the side effect is no longer replayed during backward. This can increase activation memory. To keep the 2.14 behavior, return `CheckpointPolicy.MUST_RECOMPUTE` for that operator. Operators in the `c10d` namespace are excluded. Under `torch.compile`, `CheckpointPolicy.MUST_RECOMPUTE` on an effectful operator now raises at compile time: `RuntimeError: AOTAutograd does not support MUST_RECOMPUTE for effectful operations because forward effects cannot join the backward effect-token chain.` Use a save policy instead.

```python
policy = lambda ctx, op, *args, **kwargs: CheckpointPolicy.PREFER_RECOMPUTE
checkpoint(fn, x, use_reentrant=False, context_fn=lambda: create_selective_checkpoint_contexts(policy))
# 2.14: an effectful op in fn runs twice; 2.15: once (use CheckpointPolicy.MUST_RECOMPUTE to replay)
```

## Distributed (c10d)

### The `nccl` backend now uses a rewritten, cleaned-up NCCL implementation by default (#192281, #192895, #193237, #193241)

`backend="nccl"` (also the default CUDA backend of `init_process_group()`) now creates the new implementation. The legacy implementation is available as `backend="nccl-legacy"` for this release only: **`nccl-legacy` and `TORCH_DIST_USE_NCCL2=0` will be removed in the next release**, so migrate to `nccl` or `nccl-lazy`.

Use `nccl` (eager initialization) by default. Use `nccl-lazy` when you need independent point-to-point communicators: collectives run on one eagerly created communicator, and each send/recv peer pair gets its own lazily created communicator and stream, so concurrent P2P to different peers can overlap (as in the legacy backend).

Differences from the legacy backend:

- Communicators are created eagerly in `init_process_group()`/`new_group()`, allocating GPU memory even for unused groups.
- Each group is bound to one CUDA device: `device_id`, else `LOCAL_RANK % torch.cuda.device_count()` (or the global rank modulo the device count); `torch.cuda.set_device()` is not used. Tensors on another GPU fail with `Expected tensor on cuda:X but found tensor on cuda:Y` or `ProcessGroupNCCL is bound to device cuda:X but an operation was issued on cuda:Y`. Pass `device_id` if needed; several GPUs per process requires `nccl-legacy`.
- `dist.get_backend_impl(...)` returns the new backend class, so `isinstance(..., ProcessGroupNCCL)` is `False` and legacy-only methods such as `comm_split_count()` are missing.
- An async `all_gather`'s `work.get_future()` value is the list of per-rank outputs, not a one-element list holding a stacked tensor; read the output list passed to `all_gather` instead (works on both backends).

To temporarily restore the legacy behavior in 2.15, set `TORCH_DIST_USE_NCCL2=0` on every rank before creating the process group, or use `nccl-legacy`:

Version 2.14:
```python
dist.init_process_group("nccl")  # ProcessGroupNCCL
```

Version 2.15:
```python
dist.init_process_group("nccl", device_id=torch.device("cuda", local_rank))  # new implementation
dist.init_process_group("nccl-lazy", device_id=torch.device("cuda", local_rank))  # independent P2P communicators
dist.init_process_group("nccl-legacy")  # legacy implementation, removed in the next release
```

## Distributed Checkpointing

### Distributed checkpoint metadata now records tensor strides, so checkpoints saved with PyTorch 2.15 cannot be loaded by PyTorch 2.14 or earlier (#194251)

`TensorProperties` gains an optional `strides` field in the pickled `.metadata` file. In older versions `dcp.load` raises a `CheckpointException` reporting `too many values to unpack (expected 5)`. There is no flag to write the old format.

Version 2.14 (loading a 2.15 checkpoint):
```python
dcp.load(state_dict, checkpoint_id="/ckpt/step_100")
# CheckpointException: ... too many values to unpack (expected 5)
```

Version 2.15:
```python
dcp.load(state_dict, checkpoint_id="/ckpt/step_100")  # loads 2.14 and 2.15 checkpoints
```

## Distributed FSDP2

### With `MixedPrecisionPolicy(reduce_dtype=None)`, `fully_shard` now accumulates and reduces gradients in the parameter's `grad_dtype` (its original dtype by default) instead of in `param_dtype` (#194434)

**This is BC-breaking**: `mp_policy.reduce_dtype=None` no longer defaults to `mp_policy.param_dtype`.
* [popular case] fp32 params, `MixedPrecisionPolicy(param_dtype=bf16)`
  * before: grad accumulation and reduce happen in bf16
  * after: grad accumulation and reduce happen in fp32 (2x reduce-scatter bytes)
* [rare case] bf16 params, `MixedPrecisionPolicy(param_dtype=fp32)`
  * before: grad accumulation and reduce happen in fp32
  * after: grad accumulation and reduce happen in bf16

How to deal with BC: explicitly set `mp_policy.reduce_dtype`.

In grad accumulation (no reduce-scatter), the unsharded param's `.grad` always holds the accumulated value, visible via `model.parameters()` while unsharded. Before this change, `.grad` was `None` when `reduce_dtype` was set and differed from `param_dtype` (FSDP kept the sum in a hidden `reduce_dtype` buffer).

Version 2.14:
```python
# fp32 parameters
mp_policy = MixedPrecisionPolicy(param_dtype=torch.bfloat16)
fully_shard(model, mp_policy=mp_policy)
# gradients accumulate and reduce-scatter in bf16
```

Version 2.15:
```python
# fp32 parameters
mp_policy = MixedPrecisionPolicy(param_dtype=torch.bfloat16)
fully_shard(model, mp_policy=mp_policy)
# gradients accumulate and reduce-scatter in fp32

# to keep the 2.14 behavior, set reduce_dtype explicitly
mp_policy = MixedPrecisionPolicy(param_dtype=torch.bfloat16, reduce_dtype=torch.bfloat16)
fully_shard(model, mp_policy=mp_policy)
```

## Distributed Pipelining

### `torch.distributed.config.pipeline_per_direction_p2p` is renamed to `pipeline_per_edge_p2p` and now uses one communicator per directed rank-to-rank edge (#196666)

The old names were removed with no alias: setting the attribute raises `AttributeError: torch.distributed.config.pipeline_per_direction_p2p does not exist`, and `TORCH_DISTRIBUTED_PIPELINE_PER_DIRECTION_P2P` is silently ignored.

Version 2.14:
```python
dist_config.pipeline_per_direction_p2p = True
```

Version 2.15:
```python
dist_config.pipeline_per_edge_p2p = True  # or TORCH_DISTRIBUTED_PIPELINE_PER_EDGE_P2P=1
```

## Profiler

### C++ stack traces are now symbolized with `dladdr` instead of `addr2line` by default (#195462)

`TORCH_DISABLE_ADDR2LINE` now defaults to on, since `addr2line` is slow and can hang. C++ frames in `TORCH_SHOW_CPP_STACKTRACES=1` errors and CUDA memory snapshots now show the library path and offset, plus the symbol name only if exported (otherwise `??`). To restore `addr2line`, set `TORCH_DISABLE_ADDR2LINE=0` or `TORCH_SYMBOLIZE_MODE=addr2line`.

```bash
TORCH_SHOW_CPP_STACKTRACES=1 TORCH_DISABLE_ADDR2LINE=0 python train.py
```

### CUDA memory snapshots record the allocator's `mallocWithAddress` tag in a new `internal_metadata` field instead of appending it to `user_metadata` (#193432)

`user_metadata` in `torch.cuda.memory._snapshot()` trace entries is now exactly what was set with `torch.cuda.memory._set_memory_metadata` (which now also accepts a dict). Tools that searched `user_metadata` for `mallocWithAddress` must read `internal_metadata` instead.

```python
# 2.14
tagged = [e for e in trace if "mallocWithAddress" in e["user_metadata"]]
# 2.15
tagged = [e for e in trace if e.get("internal_metadata") == "mallocWithAddress"]
```

### Remove the deprecated `FunctionEvent.metadata_json` property (#198265)

Accessing it now raises `AttributeError: 'FunctionEvent' object has no attribute 'metadata_json'`, and the `metadata_json` constructor argument is removed. Use `FunctionEvent.metadata`, a dict populated when `_ExperimentalConfig(expose_kineto_event_metadata=True)` is set (not the deprecated `event_metadata`).

```python
metadata = event.metadata_json  # 2.14: JSON string
metadata = event.metadata  # 2.15: dict[str, Any] or None
```

### Rename the experimental CUPTI monitor profiler backend to Cuspy, without aliases for the old names (#195881)

In `_ExperimentalConfig(custom_profiler_config=...)`, `"cupti_monitor"` is now `"cuspy"` and `"cupti_monitor_async_export"` is now `"cuspy_async_export"`; old names silently fall back to the default Kineto backend. `prof.take_pending_cupti_export()` is now `take_pending_cuspy_export()` (the old name raises `AttributeError`). Prefer the new `torch.profiler.CuspyConfig`.

```python
# 2.14
cfg = _ExperimentalConfig(custom_profiler_config='{"backend":"cupti_monitor"}')
# 2.15
cfg = _ExperimentalConfig(custom_profiler_config='{"backend":"cuspy"}')
```

## Dynamo

### Higher-order ops now reject input mutation and aliasing in their bodies unless the op opts in (#185738)

Before, Dynamo let any higher-order op body mutate or alias its inputs by default. Ops that do not implement those semantics could silently produce invalid graphs. Mutation and aliasing are now off by default. The built-in wrappers that support them (`wrap`, checkpoint, `autograd.Function`, autocast/set-grad wrappers) opt in. A `flex_attention` `mask_mod` may read captured views but must not mutate inputs or return aliases. Under `fullgraph=True`, unsupported mutation or aliasing raises `Encountered input mutation during higher order op tracing` or `Encountered aliasing during higher order op tracing`; otherwise, Dynamo graph breaks and falls back to eager execution. Rewrite the higher-order op body to avoid mutation or aliasing.

For example, rewrite an in-place `flex_attention` score modifier as an out-of-place operation:

Version 2.14:
```python
def score_mod(score, b, h, q, k):
    score.add_(1)
    return score.clone()
```

Version 2.15:
```python
def score_mod(score, b, h, q, k):
    return score + 1
```

## Inductor

### `torch.compiler.nested_compile_region(options=...)` now accepts only an allowlist of Inductor config patches (#195864, #195865)

Patches passed through `get_invoke_subgraph_compile_options(fw_inductor_config_patches=..., bw_inductor_config_patches=...)` used to accept any `torch._inductor.config` key, though many were silently ignored. Only `fallback_by_default` and `max_autotune` are now accepted; other keys raise `ValueError: Inductor config key '<key>' is not supported in forward nested compile-region options` (or `backward`). Apply other options to the whole compiled function. Patch dictionaries are now snapshotted when the options are created, so later mutation has no effect, and the default no longer implicitly sets `triton.autotune_at_compile_time=True`.

Version 2.14:
```python
opts = get_invoke_subgraph_compile_options(fw_inductor_config_patches={"triton.multi_kernel": 1})
```

Version 2.15:
```python
opts = get_invoke_subgraph_compile_options(fw_inductor_config_patches={"max_autotune": True})
compiled = torch.compile(fn, options={"triton.multi_kernel": 1})
```

### `torch.compiler.precompile` is now a module instead of a callable; capture with `torch.compiler.precompile.capture(...)` and reload with `torch.compiler.precompile.load(...)` (#197993, #198135, #198213)

Calling `torch.compiler.precompile(fn, *example_inputs)` now raises `TypeError: 'module' object is not callable`. `capture(fn, *, artifact_path, cache_path)` returns a context manager that you call once inside the `with` block; it writes both files when the block exits cleanly (or on `cap.save()`), and `load` now takes those paths. `decompositions=` moves to `tracer=MakeFxTracer(decompositions=...)`.

Version 2.14:
```python
python_code, cache = torch.compiler.precompile(lambda m, x: m(x), model, x)
f = torch.compiler.precompile.load(python_code, cache)
```

Version 2.15:
```python
with torch.compiler.precompile.capture(lambda m, x: m(x), artifact_path="m.py", cache_path="m.cache") as cap:
    cap(model, x)
f = torch.compiler.precompile.load("m.py", "m.cache")
```

## Composability

### Under functionalization, a regenerated output of `split`, `split_with_sizes` or `unbind` is now rebuilt as a single `slice` or `select` of its base, so its `grad_fn` is `SliceBackward0`/`SelectBackward0` instead of `SplitBackward0`/`SplitWithSizesBackward0`/`UnbindBackward0` (#194037)

This greatly reduces compile time for code that mutates many `split()` views (for example 32s to 15s with 128 views). Gradients are unchanged, but the in-place error now names the new op with output index 0: `RuntimeError: Output 0 of Select is a view and is being modified inplace.` Code that inspects `grad_fn` names, matches the old error text, or pattern-matches `split`/`unbind` nodes in functionalized graphs needs updating. There is no option to restore the previous behavior.

Version 2.14:
```python
>>> out = torch.func.functionalize(f)(x)  # f returns base.unbind(0)[1] after base.add_(1)
>>> out.grad_fn
<UnbindBackward0 object at 0x...>
```

Version 2.15:
```python
>>> out = torch.func.functionalize(f)(x)
>>> out.grad_fn
<SelectBackward0 object at 0x...>
```

## Release Engineering

### PyPI wheels now ship with CUDA 13.2, and CUDA 12.6 and CUDA 13.0 wheels are no longer published (#196249, #198913)

The default PyPI wheel moves from CUDA 13.0 to CUDA 13.2. The 2.15 wheels are `cu132` and `cu134`; `cu126` and `cu130` are no longer built. CUDA 13 wheels need NVIDIA driver 580 or newer and a GPU of Turing (`sm_75`) or newer, so Maxwell, Pascal and Volta GPUs and hosts with a CUDA 12.x driver should stay on 2.14.

Version 2.15:
```bash
# PyPI wheel now uses CUDA 13.2
pip install torch

# CUDA 13.4 wheels
pip install torch --index-url https://download.pytorch.org/whl/cu134

# To stay on CUDA 12.6 or CUDA 13.0, pin PyTorch 2.14:
pip install torch==2.14.0 --index-url https://download.pytorch.org/whl/cu126  # or cu130
```

### Python 3.10 wheels are no longer published (#198233, #199398)

PyTorch 2.15 raises the minimum supported Python version for binaries to 3.11: no `cp310` wheels are built for `torch` or the Triton wheels, and CI no longer tests on Python 3.10. On Python 3.10, `pip` cannot find a 2.15 wheel. Upgrade to Python 3.11 or newer, or stay on PyTorch 2.14.

Version 2.14:
```bash
python3.10 -m pip install torch  # cp310 wheel available
```

Version 2.15:
```bash
python3.11 -m pip install torch==2.15.0  # Python 3.11 through 3.15 (including 3.14t and 3.15t)
```

#

## retained text (truncated)



```
# PyTorch 2.15.0 Release Notes

- [Highlights](#highlights)
- [Backwards Incompatible Changes](#backwards-incompatible-changes)
- [Deprecations](#deprecations)
- [New Features](#new-features)
- [Improvements](#improvements)
- [Bug fixes](#bug-fixes)
- [Performance](#performance)
- [Documentation](#documentation)
- [Security](#security)
- [Developers](#developers)

# Highlights

<table>
  <tr><td><strong>Rewritten NCCL backend becomes the default</strong>, with a flight recorder that dumps on hangs and <code>TORCH_DIST_USE_NCCL2=0</code> or <code>nccl-legacy</code> as rollback paths</td></tr>
  <tr><td><strong>One-sided transports for <code>torch.distributed</code></strong>, with a NIXL backend and CUDA-graph-capturable transfers</td></tr>
  <tr><td><strong>FSDP2 and pipelining gain finer memory and communication control</strong>, with fp32 for precision-sensitive parameters, CUDA-graph-captured gradient accumulation, and gradient reduction overlapped with compute</td></tr>
  <tr><td><strong>Faster 4-bit (NVFP4) LLM decoding on NVIDIA Blackwell GPUs</strong> through fewer, better-overlapped kernel launches in NVGEMM</td></tr>
  <tr><td><strong>Apple Silicon gains FP8 and faster decode</strong>, with <code>float8_e4m3fn</code> and <code>_scaled_mm</code>, a new <code>grouped_mm</code> with a decode fast path (1.32–1.34x tokens/s on MoE decode), and public <code>torch.mps.Stream</code> APIs</td></tr>
  <tr><td><strong>Broader platform support</strong> with FlyDSL kernels on AMD gfx950, Tensor Data Mover support for gfx1250 (MI450), ROCm 10.0 wheels, simpler SYCL kernel authoring and multi-GPU profiling on Intel GPUs, CUDA 13.2 as the default wheel with CUDA 13.4 alongside it, and <code>torch.compile</code> on Python 3.15</td></tr>
</table>

For more details about these highlighted features, you can look at the release blogpost. Below are the full release notes for this release.

# Backwards Incompatible Changes

## Python Frontend

### `import torch` can no longer be re-executed in the same process, including via `importlib.reload(torch)` (#194654)

`importlib.reload(torch)` and `del sys.modules["torch"]` + re-import now raise, as does retrying `import torch` after it failed. Re-running the module body was already unsafe in exactly the same way as the retry, so the new check does not distinguish the two. Normal use is unaffected: a successful import leaves `torch` in `sys.modules` so the body never re-runs, and re-entrant imports from a backend extension during autoload still short-circuit on `sys.modules` without reaching the check.

Version 2.14:
```python
import importlib
import torch

importlib.reload(torch)
# RuntimeError: Only a single TORCH_LIBRARY can be used to register the namespace triton; ...
# (re-importing after a failed `import torch` failed with similarly misleading errors or could segfault)
```

Version 2.15:
```python
import importlib
import torch

importlib.reload(torch)
# ImportError: `torch` can only be initialized once per process, so this module cannot
# be imported again: neither via `importlib.reload(torch)`, nor by re-importing after
# a failed `import torch`.
```

### Nested tensors are no longer allowlisted for `torch.load(..., weights_only=True)` (#194380)

Nested jagged and strided nested tensors are no longer on the default `weights_only` allowlist. Loading a checkpoint that contains one with `weights_only=True` (the default) now fails with `Unsupported global: GLOBAL torch.nested._internal.nested_tensor._rebuild_njt was not an allowed global by default` (or `GLOBAL torch._utils._rebuild_nested_tensor` for strided nested tensors). To load checkpoints containing nested tensors, allow them explicitly with `torch.serialization.safe_globals` (see below), or use `weights_only=False` for trusted files.

Version 2.14:
```python
loaded = torch.load("njt.pt", weights_only=True)  # works
```

Version 2.15:
```python
from torch.nested._internal.nested_tensor import _rebuild_njt, NestedTensor
with torch.serialization.safe_globals([_rebuild_njt, NestedTensor]):
    loaded = torch.load("njt.pt", weights_only=True)
```

### Operators called through `torch.ops.*` and `torch._C._dispatch_call_boxed` now use PyTorch's own warning and exception translation instead of pybind11's (#193451)

We make `torch.ops.*` calls go through the same exception and warning translation as the rest of the library. This means that some exception translation that used to be handled by pybind is now handled natively. User-defined pybind exception translation is thus lost. Restoring it may be done in a future release as part of a broader exception handler improvement.

In addition, `TORCH_WARN` warnings from these operators now reach Python's `warnings` module, so they raise when warnings are turned into errors (`-W error`). `std::out_of_range` still becomes `IndexError` (#195713).

Version 2.14:

```python
# C++ op: throw std::invalid_argument("bad size");
try:
    torch.ops.my_lib.my_op(x)
except ValueError:  # pybind11 translation
    ...
```

Version 2.15:

```python
# C++ op: TORCH_CHECK_VALUE(false, "bad size");
try:
    torch.ops.my_lib.my_op(x)
except ValueError:
    ...

# TORCH_WARN from the op is now a Python warning
with warnings.catch_warnings():
    warnings.simplefilter("ignore")
    torch.ops.my_lib.my_op(x)
```

## Autograd

### Selective activation checkpointing now saves, rather than recomputes, the outputs of operators with an ordered effect unless the policy returns `CheckpointPolicy.MUST_RECOMPUTE` (#196956)

In eager mode, if a `create_selective_checkpoint_contexts` policy returns `CheckpointPolicy.PREFER_RECOMPUTE` for a non-aliasing operator with an ordered effect (e.g. via `register_effect(torch.library.EffectType.ORDERED)`), that choice is now overridden and its outputs are saved, so the side effect is no longer replayed during backward. This can increase activation memory. To keep the 2.14 behavior, return `CheckpointPolicy.MUST_RECOMPUTE` for that operator. Operators in the `c10d` namespace are excluded. Under `torch.compile`, `CheckpointPolicy.MUST_RECOMPUTE` on an effectful operator now raises at compile time: `RuntimeError: AOTAutograd does not support MUST_RECOMPUTE for effectful operations because forward effects cannot join the backward effect-token chain.` Use a save policy instead.

```python
policy = lambda ctx, op, *args, **kwargs: CheckpointPolicy.PREFER_RECOMPUTE
checkpoint(fn, x, use_reentrant=False, context_fn=lambda: create_selective_checkpoint_contexts(policy))
# 2.14: an effectful op in fn runs twice; 2.15: once (use CheckpointPolicy.MUST_RECOMPUTE to replay)
```

## Distributed (c10d)

### The `nccl` backend now uses a rewritten, cleaned-up NCCL implementation by default (#192281, #192895, #193237, #193241)

`backend="nccl"` (also the default CUDA backend of `init_process_group()`) now creates the new implementation. The legacy implementation is available as `backend="nccl-legacy"` for this release only: **`nccl-legacy` and `TORCH_DIST_USE_NCCL2=0` will be removed in the next release**, so migrate to `nccl` or `nccl-lazy`.

Use `nccl` (eager initialization) by default. Use `nccl-lazy` when you need independent point-to-point communicators: collectives run on one eagerly created communicator, and each send/recv peer pair gets its own lazily created communicator and stream, so concurrent P2P to different peers can overlap (as in the legacy backend).

Differences from the legacy backend:

- Communicators are created eagerly in `init_process_group()`/`new_group()`, allocating GPU memory even for unused groups.
- Each group is bound to one CUDA device: `device_id`, else `LOCAL_RANK % torch.cuda.device_count()` (or the global rank modulo the device count); `torch.cuda.set_device()` is not used. Tensors on another GPU fail with `Expected tensor on cuda:X but found tensor on cuda:Y` or `ProcessGroupNCCL is bound to device cuda:X but an operation was issued on cuda:Y`. Pass `device_id` if needed; several GPUs per process requires `nccl-legacy`.
- `dist.get_backend_impl(...)` returns the new backend class, so `isinstance(..., ProcessGroupNCCL)` is `False` and legacy-only methods such as `comm_split_count()` are missing.
- An async `all_gather`'s `work.get_future()` value is the list of per-rank outputs, not a one-element list holding a stacked tensor; read the output list passed to `all_gather` instead (works on both backends).

To temporarily restore the legacy behavior in 2.15, set `TORCH_DIST_USE_NCCL2=0` on every rank before creating the process group, or use `nccl-legacy`:

Version 2.14:
```python
dist.init_process_group("nccl")  # ProcessGroupNCCL
```

Version 2.15:
```python
dist.init_process_group("nccl", device_id=torch.device("cuda", local_rank))  # new implementation
dist.init_process_group("nccl-lazy", device_id=torch.device("cuda", local_rank))  # independent P2P communicators
dist.init_process_group("nccl-legacy")  # legacy implementation, removed in the next release
```

## Distributed Checkpointing

### Distributed checkpoint metadata now records tensor strides, so checkpoints saved with PyTorch 2.15 cannot be loaded by PyTorch 2.14 or earlier (#194251)

`TensorProperties` gains an optional `strides` field in the pickled `.metadata` file. In older versions `dcp.load` raises a `CheckpointException` reporting `too many values to unpack (expected 5)`. There is no flag to write the old format.

Version 2.14 (loading a 2.15 checkpoint):
```python
dcp.load(state_dict, checkpoint_id="/ckpt/step_100")
# CheckpointException: ... too many values to unpack (expected 5)
```

Version 2.15:
```python
dcp.load(state_dict, checkpoint_id="/ckpt/step_100")  # loads 2.14 and 2.15 checkpoints
```

## Distributed FSDP2

### With `MixedPrecisionPolicy(reduce_dtype=None)`, `fully_shard` now accumulates and reduces gradients in the parameter's `grad_dtype` (its original dtype by default) instead of in `param_dtype` (#194434)

**This is BC-breaking**: `mp_policy.reduce_dtype=None` no longer defaults to `mp_policy.param_dtype`.
* [popular case] fp32 params, `MixedPrecisionPolicy(param_dtype=bf16)`
  * before: grad accumulation and reduce happen in bf16
  * after: grad accumulation and reduce happen in fp32 (2x reduce-scatter bytes)
* [rare case] bf16 params, `MixedPrecisionPolicy(param_dtype=fp32)`
  * before: grad accumulation and reduce happen in fp32
  * after: grad accumulation and reduce happen in bf16

How to deal with BC: explicitly set `mp_policy.reduce_dtype`.

In grad accumulation (no reduce-scatter), the unsharded param's `.grad` always holds the accumulated value, visible via `model.parameters()` while unsharded. Before this change, `.grad` was `None` when `reduce_dtype` was set and differed from `param_dtype` (FSDP kept the sum in a hidden `reduce_dtype` buffer).

Version 2.14:
```python
# fp32 parameters
mp_policy = MixedPrecisionPolicy(param_dtype=torch.bfloat16)
fully_shard(model, mp_policy=mp_policy)
# gradients accumulate and reduce-scatter in bf16
```

Version 2.15:
```python
# fp32 parameters
mp_policy = MixedPrecisionPolicy(param_dtype=torch.bfloat16)
fully_shard(model, mp_policy=mp_policy)
# gradients accumulate and reduce-scatter in fp32

# to keep the 2.14 behavior, set reduce_dtype explicitly
mp_policy = MixedPrecisionPolicy(param_dtype=torch.bfloat16, reduce_dtype=torch.bfloat16)
fully_shard(model, mp_policy=mp_policy)
```

## Distributed Pipelining

### `torch.distributed.config.pipeline_per_direction_p2p` is renamed to `pipeline_per_edge_p2p` and now uses one communicator per directed rank-to-rank edge (#196666)

The old names were removed with no alias: setting the attribute raises `AttributeError: torch.distributed.config.pipeline_per_direction_p2p does not exist`, and `TORCH_DISTRIBUTED_PIPELINE_PER_DIRECTION_P2P` is silently ignored.

Version 2.14:
```python
dist_config.pipeline_per_direction_p2p = True
```

Version 2.15:
```python
dist_config.pipeline_per_edge_p2p = True  # or TORCH_DISTRIBUTED_PIPELINE_PER_EDGE_P2P=1
```


```



document fetched 2026-10-29 02:33
