ghstack-ci
预览截图
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "ghstack-ci":https://skillpi.com/zh/skills/deepskill-10e012ff8fc5c8ec94367467f9dfd32c5356364bb4014a17c73eb65949b5dfc6。安装前核对上游来源和版本:https://github.com/pytorch/pytorch。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
关于管理 PyTorch ghstack 堆栈的 CI:在结果有用时运行 CI;对其他 PR 使用 [no-ci] 以延迟 CI,适用于创建、提交、更新、重新堆叠或合并 PR 堆栈时的流程说明。
介绍来源: third_party · pytorch · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 管理 PyTorch ghstack 堆栈的 CI, 方法是运行 CI , 其结果现在有用, 并用 [no- ci] 延迟其他 PR 。 在创建,提交,更新,重新包装,或登陆一叠PR时使用.
- 适合谁
- 来源文档未说明。
- 输入和输出
- 来源文档未说明。
- 软件、账号及付费要求
- 来源文档未说明。
- 限制与区别
- 来源文档未说明。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: ghstack-ci
description: Manage CI for PyTorch ghstack stacks by running CI where its results are useful now and deferring other PRs with [no-ci]. Use when creating, submitting, updating, restacking, or landing a stack of PRs.CI for ghstack stacks
Keep CI usage low by running it where the results can guide the current
work. Explicitly mark deferred PRs with the [no-ci] title prefix, and
remove it when their results become useful. Follow explicit user CI
preferences.
Use the exact [no-ci] spelling described in
Skip CI while iterating.
Choosing where to run CI
- Run CI on PRs being prepared for review or landing, or when its results are needed to diagnose a failure or validate a change on a CI-only platform.
- Run CI on an upper PR when it provides needed integration coverage for several changes together. Stack position alone is not a reason to defer it.
- Consider deferring speculative or rapidly changing PRs whose results will not affect the next decision, or upper PRs waiting on a known lower-stack fix. Keep CI enabled wherever it is needed to investigate that fix.
For stacks longer than five PRs, the bottom five are a useful starting point when preparing to land from the bottom: consider deferring higher PRs until their results are needed. Five is a hint to limit repeated CI during iteration, not a quota or a cap. Use fewer or more as the work needs. For example, in a stack A through H, CI might be useful on A through E while F through H are still speculative. Enable G too if its integration results are needed now; after A and B land, reassess F through H instead of automatically enabling a fixed number of PRs.
Before GitHub writes or workflow reruns, follow CLAUDE.md and AI_POLICY.md. Show the exact PR numbers, old/new titles, and runs to rerun, and obtain explicit approval for any actions not already approved. Existing approval for those exact changes does not need to be repeated.
Submitting or updating a stack
- Identify the full stack in dependency order, from bottom to top, including
commits that will become new PRs. Use commit ancestry and
Pull-Requesttrailers, and refresh existing PR titles and states withgh. Exclude landed changes. GitHub can show a ghstack PR as closed after it lands; confirm landing onmainrather than relying only on theMERGEDstate. - Choose PRs whose results are useful now. Prefix the other titles with
[no-ci], for example[no-ci] Add another operator. Preserve the rest of each title and avoid adding the prefix twice. Record the PR numbers and reasons for deferring them in the task notes. - Before creating new PRs with ghstack, put the prefix in the commit subjects for deferred PRs. The initial PR title comes from the subject, so setting it only after creation can let CI start.
- For existing PRs, add or remove the prefix in both the live PR title
and the corresponding commit subject before submitting updates.
Ordinary
ghstacksubmissions preserve GitHub titles;ghstack -ureplaces them from commit subjects. Keep their prefix state consistent so a laterghstack -ucannot undo the CI decision. When rewording a commit, read and preserve its currentPull-Request:andghstack-source-id:trailers, and follow the repository's submission rules.
Adding [no-ci] does not cancel CI that is already running.
Enabling CI and advancing the stack
After updates, restacks, reorders, or lower PRs landing, refresh the stack and reassess where CI is useful. To enable a PR, remove the leading prefix and its separating space from both its live title and commit subject. Preserve explicit user requests to defer CI. If a prefix's origin or purpose is unknown in the current context, ask before removing it unless the user has already explicitly authorized enabling CI for that PR. Do not assume task notes from a previous session are available.
Enable CI after removing the title prefix: push an actual update with
ghstack, or rerun the latest workflows that failed at the [no-ci] gate
for that PR's current head. A title edit alone does not start CI.
Set pr_number to the selected PR and inspect its current checks:
gh pr checks "$pr_number" --repo pytorch/pytorch --json name,state,workflow,link,bucket,completedAt
Set check_link to a candidate failed gate's Actions link. For a link
with the path /pytorch/pytorch/actions/runs/12345/job/67890, the run ID
is 12345. Extract it and inspect the run:
run_id="${check_link#*/actions/runs/}"
run_id="${run_id%%/*}"
gh pr view "$pr_number" --repo pytorch/pytorch --json headRefOid
gh run view "$run_id" --repo pytorch/pytorch --json headSha,conclusion,jobs
gh run view "$run_id" --repo pytorch/pytorch --log-failed
Confirm that the run's headSha matches the PR's headRefOid and its logs
show failure at the [no-ci] gate. Rerun each distinct selected run ID
once with gh run rerun "$run_id" --repo pytorch/pytorch; several checks
may belong to the same run. Avoid stale heads and unrelated failures.
Record the updated enabled and deferred PRs in the task notes when done.
Before landing
Enable CI for every open PR included in the landing, including lower
dependencies. Remove [no-ci] from their live titles and commit subjects,
and wait for the required checks to pass on their current heads before
requesting the merge. The prefix intentionally fails a merge-blocking
gate, and the live PR title becomes the landed commit subject. CI on an
upper PR does not replace required checks on the lower PRs being landed.
版本历史
-
v2.15.0
GitHub ↗
原版更新说明
# 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 ``` ## 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) ``` ### ROCm wheels move to ROCm 7.14 and 10.0; ROCm 7.2 wheels and gfx900/gfx906 kernels are dropped (#194919) gfx900 (MI25) and gfx906 (MI50/MI60, Radeon VII) users can stay on 2.14 (`rocm7.2`) or build from source with those targets in `PYTORCH_ROCM_ARCH`. ```bash pip install torch --index-url https://download.pytorch.org/whl/rocm7.14 # or rocm10.0 ``` ### Linux CUDA wheels no longer depend on the cuRAND library (#194850) PyTorch only uses the cuRAND device API, so `torch` no longer links `libcurand`, no longer preloads it on `import torch`, and the wheel's CUDA requirements no longer include cuRAND. Extensions or libraries that call the cuRAND host API (for example `curandCreateGenerator`) and relied on `pip install torch` bringing in the cuRAND library can fail to load `libcurand.so` and must now install it themselves. Version 2.15: ```bash pip install torch pip install "cuda-toolkit[curand]==13.2.2" # match the toolkit version of your wheel ``` ## CUDA ### `torch.histc(..., out=...)` on CUDA now raises an error when `out` does not have the same dtype as the input (#196100) CUDA used to silently cast into any `out` dtype. It now matches CPU and MPS and rejects mismatches, even widening ones. Compute without `out` and cast instead. Version 2.14: ```python >>> torch.histc(x, bins=4, min=-2.0, max=2.0, out=int64_out) # silently truncated ``` Version 2.15: ```python RuntimeError: torch.histogram: input tensor and hist tensor should have the same dtype, but got input float and hist long int >>> int64_out.copy_(torch.histc(x, bins=4, min=-2.0, max=2.0)) # workaround ``` ### On CUDA, cuBLAS and cuBLASLt workspaces are now allocated for each operation instead of being cached per handle and stream (#194311) Graphs captured separately on one stream could share the cached workspace and fail on replay with `CUDA error: an illegal memory access was encountered`. Workspaces are now freed after each op, so `torch.cuda.memory_allocated()` excludes them and the handle from `torch.cuda.current_blas_handle()` has no ATen workspace attached. Set `TORCH_CUBLAS_WORKSPACE_CACHE=1` to restore caching (unsafe with multiple graphs on one stream). `TORCH_CUBLASLT_UNIFIED_WORKSPACE` now only takes effect with caching enabled. ROCm has a matching change (#196920). Version 2.14: ```python >>> torch.mm(a, a, out=out) >>> torch.cuda.memory_allocated() - before > 0 # workspace stays allocated True ``` Version 2.15: ```python >>> torch.cuda.memory_allocated() - before # freed after the op 0 ``` ## CPU (AArch64) ### Float32 `torch.sin` and `torch.cos` on Arm CPUs (NEON and SVE) now use SLEEF's 3.5-ULP kernels instead of the 1.0-ULP kernels, matching the accuracy of the x86 AVX2 implementation and running 1.7x-2.4x faster on Neoverse V1/V2 (#196315) Float32 `sin` and `cos` results on Arm can now differ from earlier releases in the last bits. Bit-for-bit comparisons against stored golden outputs, `torch.equal`, or `torch.testing.assert_close` with `rtol=0, atol=0` may fail; default `assert_close` tolerances are unaffected. There is no switch to restore the previous kernels; if you need tighter accuracy, compute in float64 and cast back. Version 2.14: ```python >>> x.cos() # float32 on Arm: within 1 ULP ``` Version 2.15: ```python >>> x.cos() # float32 on Arm: within 2 ULP >>> x.double().cos().float() # workaround: correctly rounded ``` ## MPS ### The MPS backend now requires macOS 15 (Sequoia) or newer (#199261, #200290) macOS 14 has reached end of life, so its MPS workarounds were removed. On macOS 14, `torch.backends.mps.is_available()` returns `False` and allocating on `mps` raises the error below. To keep using MPS, stay on PyTorch 2.14 or upgrade macOS; CPU builds still run on older macOS. C++ extensions: `at::mps::MacOSVersion::MACOS_14_4` was removed. ```python >>> torch.ones(2, device="mps") # 2.15 on macOS 14 RuntimeError: The MPS backend is supported on macOS 15.0+. Current OS version can be queried using `sw_vers` ``` ## XPU ### Remove the `allocator` property from `torch.xpu.MemPool`, aligning with other accelerators (#192041) `torch.xpu.MemPool` no longer exposes the allocator it was constructed with, so `pool.allocator` now raises `AttributeError`. Keep your own reference to the allocator instead; passing one to the `MemPool` constructor is unchanged. Before: ```python pool = torch.xpu.MemPool(allocator.allocator()) my_allocator = pool.allocator ``` After: ```python my_allocator = allocator.allocator() pool = torch.xpu.MemPool(my_allocator) ``` ## Complex Frontend ### Ops that are undefined for complex inputs now raise `TypeError` instead of `RuntimeError` (#192350) This covers order-dependent ops (`sort`, `argsort`, `topk`, `argmax`/`argmin`, `max`/`min` with `dim`, `maximum`/`minimum`, `fmax`/`fmin`, `aminmax`), `isposinf`/`isneginf`, `view_as_real`/`imag` on real tensors, and `view_as_complex` on complex tensors, matching Python (`1j < 2j` is a `TypeError`). `except RuntimeError:` no longer catches these; catch `(RuntimeError, TypeError)`. Ops not yet implemented for a dtype (e.g. `rad2deg`, `nansum`, `heaviside` on complex, `topk`/`argmax` on bool) now raise `NotImplementedError`, which `except RuntimeError:` still catches. Full `max()`/`min()`/`amax`/`amin` are unchanged. ```python torch.sort(torch.randn(3, dtype=torch.cfloat)) # 2.14: RuntimeError: Sort does not support complex dtypes on CPU # 2.15: TypeError: Sort does not support complex dtypes on CPU ``` # Deprecations ## Optimizer ### Passing a bare `set` of parameters to an optimizer is deprecated and now emits a `FutureWarning`; it will become an error in a future release (#198710) Set iteration order can change between runs, so optimizer state could silently mismatch parameters on reload. The warning reads: `optimizer parameters need to be organized in ordered collections, but the ordering of tensors in sets will change between runs. Please use a list instead.` ```python opt = torch.optim.Adam(set(model.parameters())) # 2.15: FutureWarning opt = torch.optim.Adam(list(model.parameters())) # recommended ``` ## Linear Algebra Frontend ### MAGMA is deprecated for LU factorization with pivoting on CUDA: `torch.linalg.lu_factor`, `torch.linalg.lu`, and the ops that use it internally (`torch.linalg.solve`, `torch.linalg.inv`, `torch.linalg.det`, `torch.linalg.slogdet`) now always use cuSOLVER (#190661) This only affects code that sets `torch.backends.cuda.preferred_linalg_library("magma")`: pivoted LU now uses cuSOLVER anyway; a new built-in batched LU kernel replaces MAGMA's for large batches. When MAGMA is preferred, the first call warns: `linalg.lu_factor: MAGMA, as a linear algebra backend, is deprecated and will be removed in future releases.` `pivot=False` still uses MAGMA when it is preferred. To avoid the warning, use the default or cuSOLVER backend. ```python torch.backends.cuda.preferred_linalg_library("magma") LU, pivots = torch.linalg.lu_factor(A) # 2.14: MAGMA; 2.15: cuSOLVER + UserWarning torch.backends.cuda.preferred_linalg_library("default") # recommended ``` ## Profiler ### `torch.autograd.profiler.load_nvprof`, `parse_nvprof_trace` and `EnforceUnique` are deprecated and will be removed in PyTorch 2.17 (#198396) `nvprof` does not support recent GPUs. They now emit a `FutureWarning` such as `` `torch.autograd.profiler.load_nvprof` is deprecated and will be removed in PyTorch 2.17. `` Use `torch.profiler.profile` or Nsight Systems with `torch.autograd.profiler.emit_nvtx()`. ```python events = torch.autograd.profiler.load_nvprof("trace.prof") # 2.14 with torch.profiler.profile() as prof: # 2.15 run_workload() ``` ### `FunctionEvent.event_metadata` is deprecated in favor of `FunctionEvent.metadata` (#198405) `metadata` is a typed `dict[str, Any]` with everything `event_metadata` had. Accessing `event_metadata` emits `FutureWarning: `event_metadata` is deprecated. Use `metadata` instead.` ```python grid = event.event_metadata.grid # 2.14 grid = event.metadata["grid"] # 2.15 ``` ## Inductor ### Deprecate `torch._inductor.config.triton.use_block_ptr` because Triton removed its block-pointer API (#191007) With a Triton that no longer provides block pointers, `use_block_ptr=True` is now a no-op that falls back to the default indexing path with a one-time `FutureWarning: config.triton.use_block_ptr=True but the installed Triton no longer provides the block-pointer frontend API`, instead of failing with `CompilationError: ... Block pointers have been removed in favor of the tensor descriptor API`. Use tensor descriptors instead. Version 2.14: ```python torch._inductor.config.triton.use_block_ptr = True ``` Version 2.15: ```python torch._inductor.config.triton.use_tensor_descriptor = True ``` ### Deprecate the no-op `torch._inductor.config.use_mixed_mm` and `torch._inductor.config.mixed_mm_choice` settings (#193721) These settings have been ignored since the tuned `mixed_mm` path was removed. Reading or setting either now emits a one-time `FutureWarning` such as `torch._inductor.config.use_mixed_mm is deprecated and does not do anything`. `autoheuristic_collect.mixed_mm` and `autoheuristic_use.mixed_mm` were removed, and `"mixed_mm"` is no longer the `TORCHINDUCTOR_AUTOHEURISTIC_USE` default. Delete these settings from your code. Version 2.14: ```python torch._inductor.config.use_mixed_mm = True # silently ignored ``` Version 2.15: ```python # FutureWarning; delete the line ``` ### Rename `torch._inductor.config.benchmark_epilogue_fusion` to `benchmark_template_fusion` and `max_epilogue_benchmarked_choices` to `max_template_fusion_benchmarked_choices` (#198430) The settings also cover prologue fusion, so the old names were misleading. The old names remain as deprecated aliases that emit a one-time `FutureWarning`. The environment variable is now `TORCHINDUCTOR_BENCHMARK_TEMPLATE_FUSION`; `TORCHINDUCTOR_BENCHMARK_EPILOGUE_FUSION` is still read as a fallback. Version 2.14: ```python torch._inductor.config.benchmark_epilogue_fusion = False ``` Version 2.15: ```python torch._inductor.config.benchmark_template_fusion = False ``` ## CUDA ### `torch.cuda.graph_annotations.clear_kernel_annotations()` is deprecated and now emits a `FutureWarning` (#195398) The CUDA graph kernel annotation registry now cleans up after itself: annotations are rekeyed to the executable graph when it is instantiated and dropped when that graph is destroyed. A global clear also discards annotations for graphs that are still live. Remove the call, and reset or delete a graph to drop its annotations. Version 2.14: ```python annotations = get_kernel_annotations() clear_kernel_annotations() ``` Version 2.15: ```python annotations = get_kernel_annotations() # No clear needed; g's annotations are dropped when g is reset or destroyed. ``` # New Features ## torch.nn - Add `torch.nn.functional.scaled_addmm` and in-place `scaled_addmm_`, which compute `beta * input + alpha * scaled_mm(mat1, mat2)` in a single cuBLASLt GEMM on CUDA with the same scaling recipes as `scaled_mm`; also supported under `torch.compile` (#195409, #195410) ## Optimizer - Add `torch.optim.functional`, a public module of functional optimizers (`adam`, `adamw`, `sgd`, `muon` and others) that run the same implementations as the optimizer classes while the caller manages parameters, gradients and state (#194986) ## Autograd - Add `ctx.input_grad_buffers` to custom `torch.autograd.Function` backward, exposing the engine's gradient accumulation buffers (or `None` when unavailable) so a fused kernel can accumulate an input's gradient in place and return `None` for it. Availability depends on backward order, so keep an out-of-place fallback; buffers must be updated synchronously within the current `backward` call, and the property is unavailable with `create_graph=True`, anomaly detection, or post-hooks on the producing node (#196491) - Add `torch.autograd.graph.queue_callback(callback)`, a public API to run a callback when the current backward pass finishes (#193958) ## Distributed (c10d) - Add an experimental one-sided transport API, `torch.distributed._transport`, with a NIXL backend and CUDA-graph-capturable stream-ordered transfers (#195643, #197032, #198889, #198918) - Add an experimental pure-Python watchdog, `torch.distributed._watchdog`, that detects hung CPU and GPU operations in Python distributed backends and dumps thread stacks on timeout (#192075) - Add `get_peer_cft_handle(peer)` and `get_multimem_cft_handle()` to NCCL symmetric memory for NCCL Compute Fabric Transport (#191685) - Add `ProcessGroupNCCL.Options.lazy_init` so `nccl` and `nccl-lazy` groups create their communicator on first use instead of allocating ~200 MiB in `new_group` (#200020) ## Distributed Checkpointing - `FsspecReader` and `FsspecWriter` are now public in `torch.distributed.checkpoint`, and `FsspecWriter` supports `dcp.async_save` through a new `cache_staged_state_dict` argument placed before `overwrite` (pass `overwrite` and later arguments by keyword); importing the old private `_fsspec_filesystem` module emits a `DeprecationWarning` (#188698) ## Distributed FSDP2 - Add `FSDPModule.set_manual_backward_finalization(True)` and `FSDPModule.finalize_backward()` to run gradient reduction and resharding at a chosen point instead of in the autograd final callback (#196640) - Add `finalize_backward(async_op=True)`, which returns a `GradientReductionHandle` so gradient reduction can overlap other compute (#196724) - Add `FSDPModule.set_keep_unsharded_storage()` to keep unsharded parameter storage allocated across `reshard()` (#198417) - Let tensor-subclass parameters free raw all-gather buffers right after `fsdp_post_all_gather` by implementing `fsdp_should_release_all_gather_outputs_after_post_all_gather()` (#194114) ## Distributed Pipelining - Add `PipelineStage.register_forward_context(factory)` to wrap each stage forward in a context manager that receives the stage and microbatch indices (#196462) - Add `torch.distributed.pipelining.analyze_pipeline_activation_liveness`, which computes activation lifetimes and reusable storage slots from a schedule (#196464) ## DeviceMesh - Add the experimental `DeviceMesh.abort()` to abort all process groups of a root mesh, avoiding hangs when a peer exits early (#189655) ## Profiler - Add `torch.profiler.ProfilerActivityConfig` and `torch.profiler.PerformanceMetricsConfig` to configure collection per activity group, such as CUDA hardware performance counters (#196065) - Add `torch.profiler.CuspyConfig` to enable the experimental Cuspy CUDA collection backend without `_ExperimentalConfig` (#196066) ## Dynamo - Add `torch.compiler.config.static_sources` (`TORCH_COMPILE_STATIC_SOURCES`), the inverse of `dynamic_sources`, listing sources that stay static even under automatic dynamic shapes, PGO, or `dynamic=True`, but not explicit `mark_dynamic` (#193626) - Let custom backends define a `_dynamo_backend_init` callable that runs when `torch.compile()` resolves the backend, so out-of-tree backends can load native libraries or set up devices and fail fast (#192345) ## Inductor - Add thread-based Inductor compile workers for free-threaded Python, selected with `TORCH_COMPILE_WORKER_MODE=thread` or `auto` to avoid process-spawn and pickling overhead (#179547, #179548) - Add an experimental FlyDSL GEMM autotuning backend for ROCm gfx950, covering FP16/BF16 `mm`, `grouped_mm` and MXFP4/MXFP8 `scaled_mm`, enabled by adding `FLYDSL` to `torch._inductor.config.max_autotune_gemm_backends` (#190903, #192877, #194032, #194303, #194981, #196719) ## Ahead-Of-Time Inductor (AOTI) - Add `num_runners` and `use_stream_affinity` arguments to `torch._inductor.aoti_load_package`, which keep each non-null CUDA or XPU stream on the same model instance across calls (#194783) - Add an optional lifecycle observer to the C++ `AOTIModelContainerRunner`: attach a `torch::inductor::AOTIModelContainerObserver` with `set_observer()` to get begin/end callbacks around inference, constant swaps and constant folding (#193999) ## Foreach - Add the public `torch.foreach` module (beta), which exposes the multi-tensor `torch._foreach_*` operations under stable, documented names (e.g. `torch.foreach.mul_(params, 3)`) with parameter names that follow the ordinary ops (#193607) ## C++ Frontend - Added `torch::stable::sort` to the stable ABI (#198038) - Made more `c10/util` helpers available header-only under `torch/headeronly/util` (#194673, #194781) - Add stable ABI conversions for `torch.dtype`/`torch.device` Python objects and a `torch::stable::is_tensor_pyobject` check (#192774) ## Release Engineering - Enable the FlashAttention backend of `scaled_dot_product_attention` in Windows CUDA builds and wheels for Ampere and newer GPUs. It was previously disabled on Windows, so SDPA fell back to the math backend; in a GQA benchmark (bf16, sequence length 2048) on an RTX 5090 the forward pass drops from 11.5 ms to 0.49 ms (#186343) - `torch.compile` now works on Python 3.15 (previously it raised `RuntimeError: torch.compile is not supported on Python 3.15+`; the check now applies to Python 3.16 and newer), and the Python 3.15 and 3.15t wheels are built against CPython 3.15.0rc2, after the ABI freeze, instead of beta releases (#178393, #199356) ## CUDA - Add `GreenContext.split` and `torch.cuda.green_contexts.SMPartition` for creating green contexts with disjoint SM allocations, plus a `GreenContext.sm_count` property reporting the SMs actually allocated; requires a CUDA driver and `cuda.bindings` 13.1 or newer (#198278) - Add `locality_domain_ids` to `GreenContext.split` and `SMPartition.split`, together with `get_num_locality_domains()` and `is_localization_supported()`, to restrict SM partitions to hardware locality domains; requires a CUDA driver and `cuda.bindings` 13.4 or newer (#198279) - Add a `"bfx9"` mode for `torch.backends.cuda.matmul.fp32_precision` that keeps FP32 inputs and outputs but lets cuBLAS use its BF16x9 algorithm on compute capability 10.0 and 10.3 GPUs; requires a CUDA 12.9 or newer build (#195301) - Record the Python launch stack of each CUDA graph node during capture with `annotation_config={"record_py_stacks": True}`, read via `torch.cuda.graph_annotations.get_kernel_py_stacks()` (requires CUPTI >= 13.3) (#198419) ## cuDNN - Support causal grouped-query attention with a paged KV cache in the cuDNN backend of `torch.nn.attention.varlen` (`varlen_attn` and `varlen_attn_out`), enabling head dimension 256 with a paged KV cache on Blackwell GPUs; requires cuDNN 9.24 or newer (#195650) ## MPS - Add a public MPS stream API (`torch.mps.Stream`, `current_stream()`, `default_stream()`, `set_stream()`, the `torch.mps.stream()` context manager) and `Tensor.record_stream` on MPS (#191415, #193464) - Add `torch.float8_e4m3fn` support on MPS (#194074, #196915, #196918, #196945, #196955, #197383, #197801) - Support `float8_e4m3fn` inputs in `torch.nn.functional.scaled_mm` on MPS (#196916) ## XPU - SYCL Kernel Programming Simplified: Add SYCL free-function kernel support to the XPU backend and migrate most existing SYCL kernels to it, so device code can be written as explicit free functions in a more intuitive style instead of verbose functors (#196387, #196932, #198200, #198720, #200289) - Enhanced XPU Runtime Capabilities: Support sharing `torch.xpu.Event` across processes, through `torch.multiprocessing` or `ipc_handle()` / `from_ipc_handle()` on an event created with `interprocess=True` (#191182, #192495, #193399, #192514) - Improved XPU Profiling Experience: Add kernel-level visibility into XPU Graph replay, cross-rank correlation for XCCL collectives, and per-kernel hardware counter collection across all Intel GPUs in multi-GPU workloads to the XPU profiler (#195128, #198200) # Improvements ## Python Frontend - Saturate out-of-range integer scalar bounds in `clamp` and `hardtanh` instead of wrapping or raising (e.g. `torch.clamp(uint8_tensor, min=-255)` is a no-op) (#193169) - Support empty batch dimensions in FFT operations on CPU, CUDA and MPS (#190483) - Add `skip_unsupported` to `FlopCounterMode` to warn instead of failing on higher-order operators without a FLOP formula, and count `flex_attention` FLOPs (#167224) - Support `Optional[list[Tensor]]` annotations in `torch.library.infer_schema` and `custom_op` (#187012) - Make `torch.iinfo` and `torch.finfo` hashable (#193290) - Name the context manager in tracebacks through `torch.no_grad`-style decorators (#186502) - Improve type stubs for `Tensor @ scalar` and `torch.utils` re-exports (#195220, #195289) - Add `uint16`, `uint32` and `uint64` support to `torch.clamp`, `torch.maximum` and `torch.minimum` on CPU and CUDA (#189953) ## torch.nn - Support soft-label targets with `reduction="none"` on the chunked `linear_cross_entropy` path (#188296) - Allow FlashAttention-4 in `scaled_dot_product_attention` with different query/key and value head dimensions (#193039) - Support deterministic `bicubic` `F.interpolate` backward (#193707) - Support `bicubic` mode for 5-D input in `F.grid_sample` (#194787) - Allow `varlen_attn` to dispatch causal attention to cuDNN (#193630) - Add `weight` to the `F.mse_loss` type stub (#196126) ## Optimizer - Validate `lambd` and `alpha` in `torch.optim.ASGD` (#193303) - Run the optimizer graph-capture health check on all accelerators (#194362) ## Autograd - Add backward and forward-mode AD for the `torch.special` Bessel functions (#189872) - Add forward-mode AD for `F.grid_sample` (#195280) - Add `torch._functorch.config.activation_memory_budget_require_full_coverage` to let `region_activation_memory_budget` apply to a whole compiled graph (#195932) - Allow reading `Tensor.grad_dtype` on non-leaf tensors (#190852) ## Distributed - Make Dynamo guards rank-portable under `compile_on_one_rank` (#196150, #196938, #196939, #196940) ## Distributed (c10d) - Extend the new NCCL backend: collective runtime estimation, the NCCL allocator for backend tensors, an opt-in shrink/grow `reconfigure()` path, legacy-matching errors, and windows and reconfiguration on ROCm (#192854, #192855, #199240, #194953, #193282, #194774) - Add a `comm_ptr` property returning the `ncclComm_t` on all NCCL backends (#197558, #198865) - Support `ReduceOp.PREMUL_SUM` in functional `all_reduce` and under `LocalTensorMode`, and backward for `MIN`/`MAX` (#190942, #193868, #191947) - Stop emitting a `FutureWarning` from `all_gather_into_tensor` and `reduce_scatter_tensor` (#193874) - Allow a CPU `device_id` in `init_process_group` (#198340) - Add `TORCH_NCCL_TEARDOWN_ON_TIMEOUT` to terminate on a legacy NCCL timeout instead of hanging (#196187) - Record the flight recorder for backends without built-in support (the new NCCL backend, MPI, UCC) and dump it on new NCCL backend health-check failures (#192233, #199092) - Add an expert-major receive layout and zero-copy dispatch/combine to the experimental token-switch MoE dispatch API (#187784, #187785) - Pass timeout and `enable_reconfigure` to dynamically created TorchComms communicators (#199099) - `is_symm_mem_enabled_for_group()` no longer requires the deprecated `enable_symm_mem_for_group()` call (#193115) ## DTensor - Support `torch.compile` for DTensor random ops on XPU (#187969) ## DistributedDataParallel (DDP) - Add manual backward finalization to `DistributedDataParallel`: set `ddp.require_manual_backward_finalization = True` and call `ddp.finalize_backward()`, so other work can overlap the in-flight gradient all-reduce (#196651) - Add a `lazy_bucket_allocation` option to `DistributedDataParallel` that allocates gradient buckets during backward and frees them afterward, lowering peak memory (#199110) ## Distributed FSDP2 - Add `param_dtype_override_fn` to `MixedPrecisionPolicy` for per-parameter mixed precision in `fully_shard`, keeping one all-gather per group (#196626) ## Distributed Pipelining - Add `WAIT_SEND_F`/`WAIT_SEND_B` schedule actions and an optional `max_outstanding_sends` limit on pending sends (#196726, #196727) - Add a `max_active_stages` argument to multi-stage schedules to control how many FSDP stages stay unsharded at once (#193972) - Label pipeline schedule actions in CUDA graph traces captured with `enable_annotations=True` (#195072) - Add `finalize_gradients` to pipeline schedule `step()` for gradient accumulation across several schedule runs with FSDP stages (#196641) ## TorchElastic - Add a `cas_backoff_max_seconds` rendezvous option that adds random backoff after failed rendezvous state writes (#185930) - Let custom `ErrorHandler`s see the `@record` entrypoint name and observe success through `record_success()` (#194269, #194746, #195034) ## DeviceMesh - Add a `preserve_rank_order` option to `DeviceMesh` so subgroups keep the mesh's rank order (#193224) ## Linear Algebra Frontend - Add CUDA TunableOp support for `torch._scaled_mm` (#186271) - Unify matmul shape-check error messages (#193583) - Add dynamic-shape TunableOp GEMM tuning with `torch.cuda.tunable.dynamic_dims_mask` and wildcard fallback (`PYTORCH_TUNABLEOP_WILDCARD_FALLBACK=1`) (#191658) ## Dynamo - Support more Python in compiled regions: `bytearray`, `types.SimpleNamespace`, `bytes()`, calling `classmethod`/`staticmethod`, list subclasses overriding `__new__`, `del` of captured variables, and more of `math`, `cmath`, `operator` and `heapq` (#192205, #199252, #193719, #196103, #197499, #197781, #191512, #189216, #196867, #197498, #197222, #198685, #195999, #192942, #192834, #195765) - Improve exception and object-model support: exception identity checks, `delattr` and `super().__init__(msg)` on exceptions, non-string `assert` messages, `property` attributes, `types.DynamicClassAttribute`, and closure-cell comparison (#191404, #196722, #196051, #197798, #194642, #199260, #197189) - Raise the real Python exception (e.g. `TypeError`) for user errors detected while tracing instead of graph breaking (#196432) - Trace more without graph breaks: setting `requires_grad = True` on in-region tensors, `Tensor.storage_offset()` on inputs, `Tensor.is_pinned()`, builtin function `__name__`, `hasattr`/`getattr` on opaque objects such as `ProcessGroup`, attribute reads on `autograd.Function` subclasses, `setattr` on `torch.split` outputs, and torchvision `roi_align` (#191129, #197224, #186494, #196049, #196050, #185316, #198514, #185528) - With `allow_rnn` disabled, graph break at the `nn.RNN`/`nn.GRU`/`nn.LSTM` call so the rest of the frame compiles (#186614) - Avoid recompiles when ops on constant inputs produce unused results (#191143, #191144, #191145) - Improve out-of-tree accelerator support: `DeviceInterface` streams and events, renamed PrivateUse1 tensor classes, cross-stream deallocation safety, and `torch.mtia` streams (#194343, #195432, #197187, #195649) - Forward `torch.compile(..., name=...)` to custom backends as `kwargs["name"]` (#196229) - Improve diagnostics: less warning spam on backend fallbacks, carets in graph-break stacks, and clearer recompile reasons and error hints (#185155, #186249, #185466, #185419, #197464, #197450, #195691) - `aot_compile` serializes more functions (`functools.wraps` helpers, `types.MethodType`, closure cells) and prunes unpicklable values no guard reads (#196472, #196473, #196474, #196476, #196478, #196479, #196481, #196684, #196685, #196686, #196687, #196691, #196692, #197750, #197752, #197754, #197755, #197833, #197762) - `load_compiled_function(..., f_globals=...)` and loaded `aot_compile` modules resolve guarded globals against the live scope and re-read them on each call; a guarded global missing from `f_globals` fails with `KeyError on G['NAME']` (#196815, #196817, #196818, #196908, #196897, #197218, #196904) - Make `aot_compile` module dispatch more robust and improve its error messages for guard mismatches, missing globals, unpicklable values and incompatible artifacts (#197055, #196826, #197047, #196823, #197149, #197048, #197220, #197050, #197257, #197319, #196816, #196693, #196819, #197391, #198061, #196470, #197756) - `maybe_mark_dynamic` accepts `min`/`max` for an initial value range, and passing only one of them to `mark_dynamic` no longer crashes (#194625) - Keep the device index of `torch.cuda.synchronize()` unresolved under the experimental `torch.distributed.config.compile_on_one_rank` mode, so the artifact is not rank-specific (#196937) ## Inductor - Extend NVGEMM epilogue fusion (CuTeDSL-generated dense epilogues, grouped reduction epilogues, `swap_ab` configs) and support `nvidia-cutlass-operators` 0.2.0 (#190820, #190821, #190822, #191514, #191515, #192298, #194792, #194793, #194873, #195231, #195538, #193940, #196984) - Extend host-side TMA descriptors to the Blackwell persistent TMA GEMM template, and support Triton kernels that need global scratch memory in the static launcher (#191133, #193857, #194126, #196410, #196998) - Add CUDA Graph Trees options `triton.cudagraph_managed_input_rerecord_limit`, `triton.cudagraph_initial_mempool_allocation_gb` and `triton.cudagraph_dynamic_shape_rerecord_limit` to limit re-recording and memory-pool fragmentation (#191369, #196378, #197433) - Add `autotune_cudagraph_benchmarking_iters` and hold the benchmark lock across multi-kernel comparisons to reduce autotuning noise (#196413, #192876) - Add B200, GB300 and more ROCm GPUs to Inductor's device table so roofline heuristics such as `pad_mm` use datasheet values (#194297, #196398, #196506, #196944, #198220) - Improve combo kernels with runtime per-subkernel block-size tuning and grouping across dependency layers (#189003, #192622) - Support the ROCm 7.14+ CK-Tile GEMM API and avoid compile-time blowups in ROCm Composable Kernel builds (#189646, #195023) - Add `fusion_memory_timeline_peak_memory_increase_gb` and `fusion_memory_timeline_peak_memory_pct_threshold` to reject fusions that raise peak memory (#190344) - Add an opt-in Triton `bmm` template for a batch-broadcast left operand (`bmm_shared_a`) (#193049) - Add `alignment_asserts_inputs` to assert, rather than silently clone, misaligned graph inputs (#196379) - Accept out-of-tree backend config values as `"<device>.<key>"` in `torch.compile(options=...)` (#194998) - Honor `assume_32bit_indexing` for dynamic size arguments (#194127) - Keep Triton FP fusion on for templates to preserve numerics with Triton 3.9 (#199500) - Apply split/cat optimizations to `torch.concatenate` (#195174) - Reuse the CUTLASS sm120 kernel generators on sm121 GPUs (#197621) - Add an opt-in `bmm_skip_dynamic_shape_dim_check` to decompose CPU `bmm` whose batch size cannot be proven (#197016) - Add `"strict_pointwise"` and `"strict_reduction"` values to `torch._inductor.config.numerics` and make `"strict"` match eager numerics more closely (#192883, #195640) ## Ahead-Of-Time Inductor (AOTI) - Support `torch.compiler.nested_compile_region` in the AOTInductor C++ wrapper (#194703, #194704) - Support host-side TMA `TensorDescriptor` arguments in `torch.library.triton_op` (#193608) and Triton's `launch_pdl` option (#194079) in AOTInductor C++ wrappers - Return `AOTI_RUNTIME_FAILURE` from AOTInductor runtime entry points instead of letting C++ exceptions unwind across the C ABI (#194613) - Add `config.aot_inductor.check_upperbound` to control whether `AOTI_RUNTIME_CHECK_INPUTS=1` rejects dimensions above the compile-time upper bound (#196131) - Add `TORCHINDUCTOR_LITE_MODE=1` to apply `torch.compile(mode="lite")` globally, including to AOTInductor compilation (#195880) - Add `torch._inductor.config.unsafe_skip_scalar_range_asserts` to skip generated range asserts when compile-time bounds are too strict (#192857) - Reduce peak device memory during AOTInductor compilation (#197462, #197659) - Extend AOTInductor C++ wrapper kernel profiling to fallback, template and combo kernels (#179699, #198433, #179700, #191063) - `torch._inductor.aoti_load_package` now loads an extracted package directory directly (#195115) - Explain how to fix a missing pytree registration when loading a package that returns a custom type (#186900) - Add `AOTI_TORCH_SAVE_DIR` to choose where the AOTInductor debug printer saves tensors (#195869) ## Export - Include compile and frame IDs in non-strict export `TORCH_TRACE` logs (#186495) ## AOTDispatcher - Stop bypassing the AOTAutograd cache for `inference_mode` regions (#191409) ## Composability - Add meta implementations for `torch.histogramdd` helper ops, enabling fake-tensor tracing (#198897) - Keep backed dimensions with hint 1 symbolic in `expand` and broadcasting (#198258) - Support fake-tensor tracing of sparse compressed tensor constructors and `_to_dense` (#192091) ## Quantization - Support pruned tables in quantized `embedding_bag` on CUDA (#194934) ## C++ Frontend - Added support for no-GIL-compatible inline C++ extensions (#196802) - Added check for compatible `TORCH_TARGET_VERSION` and `libtorch` headers (#193962) - Clarified the error for unsupported symbolic C++ kernel signatures (#197736) - Support `torch.utils.cpp_extension` CUDA builds on Windows ARM64 (#191656) ## Release Engineering - Add CUDA 13.4 (GA release, `cu134`) wheel and libtorch builds for Linux x86_64, Linux aarch64 and Windows, with cuBLAS 13.8.1 and cuDNN 9.26; the Linux wheels depend on `cupti-python` 13.4.0 (not installed on Python 3.15 and free-threaded interpreters) (#196560, #194996, #196014, #199269, #194942, #197212, #198912, #194905, #192769, #197764) - Update the CUDA 13.2 wheels to CUDA 13.2.2, on Linux and Windows (#196351, #198843) - Update the bundled Triton to 3.9, including the Intel XPU Triton (#190440, #195006) - Add gfx1250 (MI450) to the ROCm wheel architectures and build the ROCm CI against ROCm 10.0 (#196610, #194794) - Update the XPU wheels to Intel Deep Learning Essentials 2026.1.3 (`intel-sycl-rt`, `dpcpp-cpp-rt` and `intel-opencl-rt` 2026.1.2, `oneccl` 2022.1.2, `intel-pti` 1.1.0), and build the Linux XPU CI and CD images with Intel OMIX (#195128, #187900) - Upgrade NVSHMEM to 3.7.2 (#194279) ## CUDA - Support scalar `scatter` for float8 dtypes on CUDA (#197199) - Extend CUDA graph kernel annotations: an `annotation_config` argument to `torch.cuda.graph` with a CUPTI backend (#191999), `key_by="source"` and `"auto"` modes that can annotate kernels inside nested `torch.cond` / `torch.while_loop` bodies (#196528, #196530, #197577), and a `cuda_graph_annotations` argument to `export_chrome_trace` that writes them into the trace (#194854) - `CUDAGraph.get_graph_data()` now reports kernel grid and block dimensions, dynamic shared memory size, and programmatic dependency edges (#196018, #196527) - Add `PYTORCH_CUDA_ALLOC_CONF` options `expandable_segments_reserve` and `expandable_segments_reserve_by_class` to shrink the virtual-address reservation of expandable segments (#192269), and explain these options when that reservation fails (#193211) - CUDA out-of-memory errors now say when a custom `MemPool` allocator returned a null pointer (#199363) - Add opt-in `TORCH_CUDA_CHECK_STRAY_CONTEXT=warn|error`, which makes `torch.cuda.set_device` warn or raise when another device already holds a CUDA primary context (#191036) ## CPU (AArch64) - Make float32 `sum` and `norm` on NEON use the same accumulation order as AVX2 and SVE256, so results are bitwise identical across these CPU types; NEON results can differ from earlier releases in the last bits (#197037, #197252) ## MPS - Add MPS support for `torch.logspace`, `torch.take`/`Tensor.put_`, `torch.frexp`, `torch.heaviside`, `torch.special.laguerre_polynomial_l`, and unsigned integer comparisons (#190495, #192980, #194110, #195265, #195225, #198860) - Add complex64 support on MPS for `linalg.lu_factor`, `linalg.lu_solve`, triangular solves and `tanh` backward (#188473, #195369, #195861, #195601) - Support `sinh`, `hypot`, `ldexp` and other math ops in `torch.compile` on MPS (#197403) - Add `PYTORCH_MPS_METAL_VERSION` to choose the Metal language version (#196881) - Raise an error under `torch.use_deterministic_algorithms(True)` for nondeterministic MPS ops (#195754) - Compute half and bfloat16 `torch.lerp` in float on MPS (#196923) - Add a native MPS implementation of `torch.nn.functional.grouped_mm` for mixture-of-experts models (#194933, #198725) - Add a native MPS implementation of `torch._int_mm`, which also enables it in AOTInductor on MPS (#193153) ## ROCm - Enable Composable Kernel (CK) SDPA flash attention on RDNA4 (gfx1200/gfx1201) (#188114) - Update AOTriton to 0.14.2b, adding FlyDSL SDPA kernels for gfx950 and gfx1201 and several attention correctness fixes (#197747) - Add a gfx950 pre-swizzled MX FP4/FP8 block-scale layout for `scaled_mm` (`SwizzleType.SWIZZLE_32_8`) (#190290), and allow all operand layouts in `torch._scaled_mm` with FP8 tensorwise scaling (#196884) - Add gfx1250 Tensor Data Mover support to Inductor for `mm`/`addmm`, pointwise and reduction codegen, and FlexAttention (#191166, #196525, #197329) - Fall back to the native RNN implementation when MIOpen RNN fails at runtime (#189658) - Report AOTriton attention launch failures from the attention op that caused them (#194100) ## XPU - Add `no_split` and `use_on_oom` support to `torch.xpu.MemPool` (#192048, #192033, #192038) - Support `torch.xpu.mem_get_info` and `torch.accelerator.get_memory_info` with a pluggable XPU allocator (#197412) - Add XPU support for `linalg.polar`, `linalg.qr` (out variant), `geqrf`, `linalg.householder_product`, `sparse.spsolve` and sparse `linalg.vector_norm`; `linalg.qr`, `geqrf` and `linalg.householder_product` now run natively instead of falling back to CPU (#188253, #187564, #189372, #194165, #189238, #193110) - Use the XPU SDPA backend for multi-query attention even when `enable_gqa=True` is not passed, consistent with the CUDA and CPU checks (#196731) - Support unsigned integer dtypes in `where` and float8 in `scatter` fill on XPU (#198720) - Add mixed-precision support to the fused `Adam` and `AdamW` implementations on XPU (#200289) - Support large tensors in `upsample_bilinear2d` channels-last by using 64-bit indexing (#200289) - Support stateless Philox RNG operations `_philox_normal` and `_philox_uniform` on XPU (#198200) - Enable symmetric memory on XPU by registering a SymmetricMemory allocator for `torch.xpu.MemPool` (#197065, #198720) - Support `Float4_e2m1fn_x2` and `Float8_e8m0fnu` in XCCL non-reduction collectives (#198200) ## Sparse Frontend - Enable FP8 2:4 sparsity on ROCm MI300 (#191682) # Bug Fixes ## Python Frontend - Fix `torch.asarray` on buffer-protocol objects to take the dtype from the buffer format (#188784) - Fix `torch.load` with `map_location="meta"` or `FakeTensorMode` losing storage sharing (#193566) - Fix `torch.aminmax` returning wrong results for overlapping `out=` tensors (#195342) - Fix `torch.accelerator.empty_host_cache()` segfaulting on MPS (#197593) - Fix `Multinomial.entropy()` precision for `float64` and after `expand()` (#198006) - Fix `torch.finfo(torch.float8_e5m2fnuz).eps` being off by 2x (#198855) - Fix `Tensor.__dlpack__` exporting tensors on a non-current non-CUDA device (#195721) - Fix `torch.isinf`/`isfinite` raising for fp8 dtypes without infinity (#197444) - Fix `torch.isfinite` reporting NaN as finite for `float8_e8m0fnu` (#199878) - Fix `torch.linspace` for `float16` and `bfloat16` on CPU, and `torch.linspace` and `torch.logspace` on CUDA, losing precision because the step was rounded to the output dtype; for example element 3 of `torch.linspace(0, 10, 38, dtype=torch.half)` on CPU was `0.8105` instead of the correctly rounded `0.8110` (#198415) ## torch.nn - Fix wrong gradients in cuDNN/MIOpen RNN backward with non-contiguous saved outputs, a repeated dropout mask in multi-layer MIOpen RNNs, and segfaults in RNN cells and the packed RNN fallback (#198773, #189285, #191232, #197560) - Fix CUDA `softmax`/`log_softmax` gradients, `layer_norm` (CUDA backward and ROCm forward) and memory-efficient SDPA on very large tensors (#188031, #193016, #199438, #199594) - Fix `varlen_attn` ignoring the `sdpa_kernel` backend selection, defects in its cuDNN backend, and FlashAttention-4 split selection (#193631, #194818, #198872) - Fix memory-efficient SDPA with `causal_lower_right` when the query is longer than the key (#193632) - Fix `grid_sample` returning zeros with the AVX512 CPU kernel (#197635) - Fix `weight_norm` producing `nan` gradients for empty inputs on CPU (#192179) - Raise errors instead of segfaulting in eval-mode `native_batch_norm` without running stats and in `max_pool1d`/`F.unfold` with overflowing sizes (#194031, #194112) - Fix `rms_norm` with an engaged but undefined C++ weight (#195574) - Fix `pixel_shuffle`/`pixel_unshuffle` meta errors for non-positive factors (#195224) - Keep the `Module.to_empty()` hint in meta-module `to()` errors with `TORCH_SHOW_CPP_STACKTRACES=1` (#191151) - Fix nondeterministic NaNs in memory-efficient attention forward with head dimension 256 or larger on Ampere, Ada and consumer Blackwell GPUs (#198922) - Unify padding and pooling shape checks across CPU, CUDA and MPS (#196457, #196230) ## Optimizer - Fix `Muon` overwriting momentum with bf16 grads (#194664) ## Autograd - Fix `torch.fmin`/`fmax` gradients when one input is NaN (#193035) - Fix hooks on a view after an in-place update of its base using a stale `grad_fn` (#196514) - Fix fast-mode `gradcheck` checking the wrong output or raising `IndexError` (#194222, #194991) - Fix `region_activation_memory_budget` across graph breaks (#194808) - Fix a segfault accessing a saved tensor after a pack hook raised (#189160) ## Distributed (c10d) - Fix new NCCL backend lifetime bugs: a crash or hang when `Work` outlives `destroy_process_group()`, tensors kept alive after `wait_tensor`, a stray CUDA context on GPU 0, failed nonblocking splits treated as ready, and errors destroying a group used in CUDA graphs (#195485, #193239, #198339, #199263, #199226) - Fix the flight recorder not attaching to `nccl` groups that use the new NCCL backend (#192858) - Fix single-rank legacy NCCL `reduce_scatter` dropping the `PREMUL_SUM` factor (#198961) - Fix all-zero gradients from coalesced functional collectives under `torch.compile` (#196077) - Fix functional `all_gather_single` with a negative `gather_dim` (#194865) - Fix `split_group` rejecting valid splits or hanging when backends differ from the default group (#195758, #197568) - Fix a segfault when registering a second device for a backend type without passing a backend (#195536) - Fix Python `ProcessGroup` subclasses' `reconfigure` overrides being bypassed from C++ (#198251) - Fix `LocalTensorMode` collectives on groups with unsorted ranks (#192777) - Fix `NCCL host communicator for group ... not found` errors from separately linked extensions (#193942) - Fix symmetric memory synchronization: no-op NVSHMEM `barrier()`/`put_signal()`/`wait_signal()`, stream ordering, rendezvous and multicast hangs, signal-pad races, and freeing memory still in use (#192579, #195947, #196350, #195596, #196546, #192300, #198306, #196003) - Fix `register_mem_pool(pool, symm=True)` on the `nccl` backend not registering later pool segments as symmetric windows (#200771) - Fix `all_gather` on the `nccl` backend failing with `RuntimeError: shape '[...]' is invalid for input of size 0` when outputs contain zero-element tensors (#200585) (not in the final RC; ships only if another RC is cut) ## DTensor - Fix context parallel FlexAttention with load balancing under graph capture and with non-default `BlockMask` block sizes (#188766, #198250) - Fix graph capture with uneven shards and symbolic-size `Shard` splits that leave trailing ranks empty (#195641, #198168) ## Distributed FSDP - Fix silently wrong gradients with `NO_SHARD` plus `CPUOffload(offload_params=True)` (#194519) - Fix mixed precision wrap overrides leaking between modules (#194895) ## Distributed FSDP2 - Fix FSDP2 unshard under `torch.inference_mode()` (#197327) - Fix silently wrong gradients with `set_all_reduce_hook` on a separate stream (#198804) - Fix `AttributeError: 'FSDPParam' object has no attribute '_unsharded_param'` in gradient accumulation with unused parameters (#194058) - Fix `fully_shard` keeping prefetched all-gather outputs alive, a reduce-scatter use-after-free, and `cudaErrorStreamCaptureUnjoined` under CUDA graph capture (#196460, #193686, #199677) - Fix wrong float8 values in the single-rank all-gather path for `uint8` views (#199733) ## Distributed (Miscellaneous) - Fix `multiprocessing.spawn` treating a child's `KeyboardInterrupt` as success (#194439) ## TorchElastic - Fix the etcd server's `find_free_port()` raising `UnboundLocalError` and `EtcdServer` leaking its subprocess (#191451, #197711, #197744) - Fix `get_socket_with_port()` returning in-use ports (TCPStore `EADDRINUSE`) and a file-store rendezvous file descriptor leak (#199015, #191425) - Fix truncated tailed worker logs and `launch_agent` shutdown errors hiding `ChildFailedError` (#195211, #195316) ## Distributed RPC - Fix a use-after-free in `RRef` error handling (#192960) ## Linear Algebra Frontend - Fix silently wrong second-order forward AD for `linalg.det`, `slogdet` and `solve` (#192667) - Fix wrong `torch.linalg.matrix_exp` results for some inputs (#196658) - Fix wrong CPU `torch._int_mm` results for strided size-1 dimensions (#194682) ## Profiler - Fix inflated profiler device times from events sharing a correlation id (#196282) - Fix Cuspy teardown heap corruption and `record_function` kwargs sent as raw JSON (#195471, #196352) - Fix several memory visualizer (MemoryViz) bugs, including wrong pool attribution and underreported peaks (#199335, #199415, #193989) ## FX - Keep `torch._check(not expr)` on a symbolic boolean as a runtime assertion, and fix a `TypeError` comparing two symbolic booleans (#186043, #186461) - Fix stale results from a float argument baked into a cached graph under `specialize_float=False` (#195040) - Fix pickling `GraphModule`s from `aot_export_module` and non-strict export, and graphs with fake view tensors in metadata (#186418, #194771) - Fix printing FX graphs with BSR or BSC tensors in node metadata (#195253) - Fix `replace_pattern` producing an invalid graph when adjacent matches share a node (#185365) - Fix memory leaks from `torch.fx.wrap` keeping caller frames alive and `torch.export` retaining every traced graph (#198561, #198295) - Make the FX accelerator splitter's fusion discovery deterministic (#198684) ## Dynamo - Fix guards treating `-0.0` and `0.0` as equal and rejecting `NaN` constants, which reused graphs with the wrong float (#192604, #192608) - Fix relational guards being skipped by the dict-version shortcut (#185911) - Guard autocast objects by value, fixing spurious recompiles and stale graphs (#194754) - Fix silently wrong results from `isinstance` with `@runtime_checkable` Protocols, zero-argument `super()` in classmethods, user descriptors, and closure-list mutations in local classes (#196124, #198435, #198410, #197830) - Fix `random` module draws returning stale values on cache hits, ignoring `random.seed()`, or using float32 (#196921, #197221, #199075) - Fix `torch.Tensor(torch.Size([...]))` selecting the wrong overload (#196717) - Fix wrong or missing gradients with custom `autograd.Function`s under `torch.func`, graph breaks at `torch.autograd.grad`, and shape-changing `Parameter.data` assignments (#193724, #185829, #186512) - Fix compiled optimizer tracing permanently setting `capturable=True` in the optimizer's `param_groups` (visible after a graph break, e.g. in `optimizer.state_dict()`) (#184704) - Fix `out=` variants of `torch.max`, `torch.min` and `torch.topk` recompiling on every new shape (#187952) - Fix memory leaks keeping CUDA tensors, Python stacks, and higher-order op inputs alive after compilation (#193015, #197567, #195954) - Fix crashes, internal errors and guard edge cases, including `list.pop()` with a shape-derived index, in-place ops on `__torch_function__` subclasses, activation checkpointing with dynamic shapes, `torch._C._infer_size`, nested `torch.compile` calls, and `torch.random.fork_rng` (#196590, #193969, #193254, #185471, #185742, #184793, #195413, #191977, #184977, #185373, #185462, #186168, #196865, #198330, #197191, #197745, #198153, #194749, #197049, #197585, #185300, #198060) - Fix stable Triton TMA descriptors, value-opaque object methods, and nanobind-bound C++ methods under `torch.compile` (#185469, #188799, #188632, #194556) - Fix a graph-breaking debug f-string (`f"{x=}"`) abandoning the whole frame (#186500) - Fix thread-safety issues on Python 3.14 and free-threaded builds, and eval-frame state such as `set_stance(skip_guard_eval_unsafe=True)` leaking between threads (#191281, #199210, #196637) - Match CPython behavior for builtin container subclasses, `dict_keys` views, `frozenset`, `deque` edge cases, `range.index`, `operator.length_hint`, and unbound numeric dunders (#193679, #193649, #193580, #197454, #195010, #195029, #195030, #196711, #196901, #198482, #198604, #198726) - Match CPython exception types and messages for constant-folded ops, `except X as e` scoping, `getattr()` argument checks, `.index()`, and attribute errors (#198590, #198380, #196526, #197443, #198476, #198512, #192509, #196080, #195496) - Fix minifier repros for non-UTF-8 output, symbolic shapes, FP64 softmax and `is_inference`, and keep the original backend failure (#186546, #196620, #194827, #194595, #193565) - Fix precompile and `aot_compile` artifacts: pruned interned values such as `torch.float32` failing on load (`argument 'dtype' must be torch.dtype, not _Missing`), one unserializable compile discarding others, and global-name collisions (#197749, #196505, #196756, #196895, #196822, #196814) - Fix `canonicalize_output_graph_node_order` moving ops out of `inference_mode`, making outputs require grad (#195518) - Fix minifier repros failing for `repeat_interleave` with `int32` repeats (#197035) ## Inductor - Disable the 4x-vectorized Triton RNG path, which produced correlated CUDA dropout masks since 2.13 (`TORCHINDUCTOR_USE_RAND4X=1` restores it) (#198680) - Fix silently wrong results from in-place mutations: reinplaced scatters and `index_put` whose sources alias the input, `remove_noop_ops` on copies of mutated inputs, fusions across repeated mutations of one buffer, and mutations of buffers already referenced by views (#198010, #198132, #198325, #198549, #198637) - Fix silently wrong results for non-contiguous reshape views and `torch.while_loop` whose `cond_fn` mutates a captured tensor (#192575, #195393) - Fix silently wrong gradients and results from mix-order reductions with views into a shared buffer (a regression since 2.10) or row counts not divisible by `XBLOCK` (#193103, #196565) - Fix corrupted gradients from a reused `nested_compile_region` that inherited donated-buffer indices (#193960) - Fix wrong results from the Triton FP8 blockwise `scaled_mm` template, including DeepSeek-style scales (#195751, #197028, #197458) - Fix wrong results from SDPA pattern fusion when the key is permuted other than `key.transpose(-2, -1)`, and failures with a 0-d tensor scale (#195383, #191496) - Fix wrong results in pre-/post-grad fusion passes: batched `aten.sub` dropping `alpha`, batched linear mixing dtypes, one-element tuple replacements, `merge_select_cat_aten`, and batch math fusion of `torch.clamp` and in-place dropout (#195463, #197069, #197832, #198638, #198285) - Fix compile failures in the partitioned scatter, joint-graph no-op removal and view cleanup passes and the constant `cumsum` pattern (#194366, #193052, #193708, #193422, #193959) - Fix compiled `torch.special.log_ndtr`, `torch.frexp` and `torch.nextafter` edge cases (signed zeros, subnormals, `float16`/`bfloat16`), `torch.randn` with `align_random_eager=True`, and `torch.nan_to_num` on complex inputs (#191339, #195041, #196578, #194118, #190428) - Accumulate `float16`/`bfloat16` Triton scans such as `cumsum` in `float32` (#199088) - Fix boolean `index_put(..., accumulate=True)` on GPU (#193584) - Fix compiled max pooling with indices returning transposed indices for non-contiguous inputs, and `adaptive_max_pool3d` gradients on channels-last inputs (#197596, #199068) - Fix wrong `argmax`/`argmin` indices after layout changes or loop reordering (#195178) - Fix wrong results under `dynamic=True` when a dimension guarded equal to 1 is broadcast (#198774) - Fix dynamic-shape compile errors (`cannot determine truth value of Relational`, `GuardOnDataDependentSymNode`, `ValueRangeError`) with symbolic strides, unbacked tiling and reshapes, and negative `constant_pad_nd` padding (#185871, #196081, #199105, #195465) - Fix wrong results on XPU from the `mm_plus_mm` and `bmm`/`baddbmm` Triton templates (#189516) - Fix crashes and wrong output from the Triton `grouped_mm` template on very large inputs (#192649) - Fix static-launcher `float16`/`bfloat16` scalar arguments being passed with the wrong width (#184065) - Fix CUDA Graph Trees capturing cross-device extern kernels, `Detected N tensor(s) in the cudagraph pool not tracked as outputs` errors with pending backwards, static kernels partitioned out under `cudagraph_skip_dynamic_graphs`, and backward graphs treating activations as static inputs (#190555, #194124, #197139, #197438) - Fix `NameError` for complex indexed assignment with `mode="reduce-overhead"` and graph partitioning (#199414) - Fix `CUDA driver error: misaligned address` in backward for misaligned saved inputs (#192263) - Emit runtime asserts for backed `SymInt` inputs when `prefer_deferred_runtime_asserts_over_guards=True` (#185588) - Fix reordering of consecutive side-effectful ops that lower to different kernel types (#188301) - Fix a CPU buffer being passed to a CUDA kernel after an incorrect device-copy elimination (#199402) - Fix wrong results on MPS when masked loads were deduplicated (#199673) - Fix user-defined Triton kernels with mutated offset views (out-of-bounds reads), non-builtin `tl.constexpr` values, aliased `triton.language` imports, `float` literals, and buffer views in the FX wrapper backend (#192227, #189692, #196237, #190340, #193820) - Fix autotuning errors with deduplicated `bmm` inputs, pipelined autotuning, stale benchmark futures, decompose-K or ROCm `multi_kernel_hints` (`NoValidChoicesError`), 0-d `addmm` biases, `CantSplit` template-fusion choices, and deterministic combo kernels (#188268, #193094, #196148, #196453, #196510, #197214, #199113, #189724) - Honor `max_autotune_gemm_search_space="EXHAUSTIVE"` with decompose-K and benchmark all candidates under the same CUDA graph policy (#192285, #194649) - Fix crashes, stack overflows and graph cycles in overlap scheduling, `control_deps` lowering and manual collective bucketing, and remove duplicate waits on one collective (#192268, #192628, #192903, #195517, #197323, #199227, #199228) - Fix FlexAttention decoding reading the query at wrong offsets after a pointwise op, max-autotune failures with inlined captured buffers, and `TORCHINDUCTOR_EMIT_POINTER_RANGE_32=0` being ignored (#198543, #194555, #194136) - Fix NVGEMM errors in block-scaled GEMMs, with a broken optional `cutlass.operators` install, and when benchmarking aliased inputs (#194727, #198292, #199072) - Fix CPU backend compile errors for boolean vector masks, a spurious `ZeroDivisionError` from integer `%`, wrong mkldnn transposed-convolution channels, and integer `bmm` returning `int64` (#184155, #199560, #192025, #184950, #191324) - Fix ROCm CK-Tile GEMM autotuning dropping all `float16` kernels and `float8_e4m3fnuz`/`float8_e5m2fnuz` cast errors (#193902, #197905) - Fix failures after fp32 matmul precision was set through `torch.backends.cuda.matmul.fp32_precision` (#189955, #196860) - Fix kernel builds with only `libcuda.so.1`, the `CUDA_HOME` fallback for `nvcc`, ROCm on Windows, and DSL ops with `triton-rocm` (#186538, #197573, #194471, #195022) - Fail instead of hanging when a compile worker dies, and treat a cleared local cache as a miss (#192301, #196189) - Fix `AttributeError` with `torch._foreach_pow` on integer tensors (#198675) - Fix compile crashes for `float16`/`bfloat16` floor division of `arange` values, nested grouped-reduction epilogues, fallback kernels without tensor inputs, and an early `FakeTensorUpdater` (#197132, #195874, #197584, #196946) - Fix symmetric-memory `alloc_id` size-mismatch errors after reseeding `random` between compilations (#192089) - Fix Triton-based TFLOPS estimates being off by 1000x (#196372) - Fix Triton template kernels being compiled twice when the worker pool is warm (#197471) - Fix wrong results from fusions that dropped non-default kwargs such as `add(..., alpha=a)`; `add` with `alpha != 1` is no longer fused into `addmm` (#199871, #200442) - Fix `InductorError: AttributeError: 'NotImplementedType' object has no attribute 'expr'` when fusing a prologue with a `float16`/`bfloat16` cast into a Triton matmul (#201029) ## Ahead-Of-Time Inductor (AOTI) - Fix AOTInductor failures when operators fall back to ATen through the proxy executor or C shim, as under `torch.compile(mode="lite")` (#193767, #199204, #193768, #194261, #194262, #194324, #194700) - Fix AOTInductor C++ wrapper compile failures: undeclared `int_array_N` (#193621), duplicate stream variables in `while_loop` (#196324), kernel profiling (#179698), unbacked symbols in `torch.cond` predicates (#186094), and custom ops returning nested tensor lists (#194644) - Fix AOTInductor packages losing buffer mutations to constant folding (#185077) - Fix `cond`/`while_loop` models with subgraph tensor constants failing with `Can not find the original value for ..._constant0` (#199188) - Fix runtime constant folding dispatching the wrong kernel through the proxy executor (#199295) - Fix AOTInductor runtime leaks of constant handles and mmap-backed constants (#194480, #195090) and of hardware queues on ROCm (#193249) - Fix AOTInductor MPS artifacts failing to `dlopen` on other machines (#198232) and segfaulting on Metal compile errors (#196634) - Fix packaging of models that return `torch.return_types` outputs, e.g. from `torch.max` (#197128) - Fix AOTInductor dropping runtime assertions on data-dependent sizes in lite mode (#199294) ## Export - Fix data-dependent guard errors in export for tensor-valued `torch._assert` (now a runtime assertion), `scaled_dot_product_attention` with data-dependent head dims, and `torch.distributions` argument validation (#186306, #184983, #186291) - Fix `move_to_device_pass` leaving stale device arguments in generated code (#185105) - Fix deserializing exported programs with symbolic-size fake tensor constants (#185025) - Fix `... is not tracked with proxy` errors from the fake tensor dispatch cache (#185100) - Fix `torch.export.export` raising `GuardOnDataDependentSymNode` for `x[mask] = scalar` when `x` has a data-dependent size (#200412) ## AOTDispatcher - Fix compiling matmul or view ops on `Tensor` subclasses without `__torch_dispatch__` (#193968) - Fix a wrong copy-back into mutated inputs under `keep_inference_input_mutations` (#198622) - Fix AOTAutograd cache-key misses and crashes for some subclass metadata, and identical precompile fallback keys across ranks (#193419, #190080, #191427) - Fix `PendingUnbackedSymbolNotFound` when a compiled `saved_tensors_hooks` pack hook allocates unbacked SymInts (#193258) - Fix corrupted opaque constants in compiled graphs with tensor-subclass outputs (#193190) - Fix a min-cut partitioner crash on graphs with `torch.device` nodes (#196146) - Fix misaligned inputs reaching Inductor kernels after effect-token removal (#198005) - Fix version-counter errors in backward for inputs mutated outside the compiled graph (#185876) - Fix silently wrong results for `resize_()` on a no-op view of a returned intermediate (#191844) - Fix `assert_size_stride` failures on the second call of a compiled training graph under dynamic shapes (#194420) ## Composability - Fix wrong values and `nan` gradients when compiling `weight_norm` on 1-D parameters (#198772) - Fix compiled `torch.normal(mean, std)` output dtype with mixed float dtypes (#194557) - Fix fake/meta kernels: eager-matching `out=` dtype checks for many ops, symbolic `out=` bitwise shifts, and data-dependent `linalg.cross` (#192383, #193050, #193555, #194375, #195767) - Add fused GRU cell meta kernels so CUDA `nn.GRUCell` can be compiled (#191156) - Match eager in decompositions and refs on XPU (`native_layer_norm`), MPS (FFT strides, `logspace`) and MTIA (`masked_fill`) (#198647, #199030, #195611) - Fix `torch.cond` branch metadata mismatches from `math.trunc(s / 1)` on a `SymInt` (#186194) - Fix spurious `Tensor device mismatch` errors from the FakeTensor dispatch cache (#197583) - Raise `NotImplementedError` instead of `RuntimeError` for unsupported dtypes in linalg and norm ops, and for `mean`, `var`, `std` and related ops on integer tensors (#192352, #192351) - Validate `attn_bias` and key/value shapes in the overrideable fused SDPA fake kernel (#194271, #198303) - Match eager shape errors for meta transposed convolution and over-broadcast `addmm`/`addmv` inputs (#188328, #195594) - Fix a crash on modulo of plain ints in symbolic shapes, and simplify `C * (x // C)` back to `x` (#198395, #198808) - Fix guard errors for jagged `NestedTensor` inputs whose batch size changes or with `keepdim=True` reductions (#193059, #184628) ## Quantization - Fix FX FP16/BF16 linear weight folding `KeyError` for shared weights (#194292) ## ONNX - Fix `torch.onnx.export(dynamo=True)` hardcoding LSTM/GRU output length under dynamic shapes (#193192) ## C++ Frontend - Fixed `torch::nn::Sequential::clone()` renaming submodules (#195107) - Fixed `multi_head_attention_forward` crashing with `num_heads=0` (#195381) - Fixed `std::numeric_limits<c10::BFloat16>::signaling_NaN()` returning infinity (#195415) - Fix a clang `time_t` compile error in `torch/csrc/stable/macros.h` (#197021) ## Build Frontend - Fix Windows MSVC source builds computing wrong results in `parallel_for` kernels, including CPU `scaled_dot_product_attention` (#193792) - Fix cross-compiled builds producing a `_C.so` that the target interpreter cannot import (#189388) - Fix BLAS/LAPACK detection for ATLAS, vecLib, BLIS and FlexiBLAS (#196427, #196428, #196430) - Fix the C++20 requirement not propagating through the CMake `torch` target or being checked on MSVC (#190784, #197417) ## Release Engineering - Fix C++ compilation failures of `argmax` and `argmin` under `torch.compile` on s390x by moving the ZVECTOR `Vectorized` implementation to 16-byte vectors; s390x CPU builds now target z15 (#173072) - Fix the PEP 517 source distribution being left out of the GitHub release because it exceeded the 2 GiB asset limit (the plain source archive leaked into it), and check release asset sizes on every tag (#195783) - Fix CUDA builds from the source distribution or release tarball failing with "No download info given for 'nccl_external'": the NCCL pin files are now shipped, and a missing NCCL now fails with a message that names the fixes (`USE_SYSTEM_NCCL=1` or `USE_NCCL=0`) (#197544) - Fix ROCm 7.14 wheels printing `rocSHMEM Could not open libnuma` on `import torch` (#195672) - Fix Windows wheels failing to import with `[WinError 1114]` when an older `msvcp140.dll` (before 14.40) is already loaded (#196987) - Fix wheel license metadata listing license files for code that is not shipped, and Windows `MAX_PATH` failures while packaging them (#185813) - Fix standalone `cmake --install` scattering Python package files across the install prefix and writing into the source checkout (#191494) - Make Python 3.15 Linux wheels depend on `triton`, so `torch.compile` works on GPU after `pip install torch` (#200294) - Ship `top_level.txt` in wheels again, fixing slow `importlib.metadata.packages_distributions()` calls that delayed importing libraries like `transformers` (#201347) ## CUDA - Fix silently wrong results or illegal memory accesses from 32-bit index overflow on CUDA in `arange`, `range`, `linspace` and `logspace` (#197713), `cdist` backward (#198452), `bincount` (#189685), and `bmm` (#196431) - Fix CUDA batch norm under AMP overflowing to `inf` (#196125) - Fix a deadlock when a lazy-init callback such as `torch.cuda.manual_seed` re-enters CUDA lazy initialization (#182948) - Fix device-side assertions on CUDA 13 builds failing with `CUDA error: invalid argument` instead of reporting the assertion (#195899) - Fix CUDA graph annotation bugs: `mark_stream` mutating the caller's dict (#194851), leaked annotations (#198418), missing backward annotations with the CUPTI backend (#194853), and `get_graph_data()` failing on batch memory-operation nodes (#193091) - Fix `torch.cuda.make_graphed_callables` graphs being garbage-collected during an unrelated capture (#195397) - Fix `torch.cuda.empty_cache()` unmapping expandable segments on another device without synchronizing it (#197159), and expandable segments imported over IPC each reserving about 9/8 of device memory (#198129) - Recover from a corrupted or truncated JITerator kernel cache entry by recompiling the kernel (#186346) - Fix an illegal memory access in CUDA `embedding_bag` backward with `per_sample_weights` by adding the index bounds check the forward kernels already have (#193408) - Fall back to the ATen implementation of outer-product `bmm` when the Triton driver cannot be set up, instead of failing (#197695) ## cuDNN - Fix `scaled_dot_product_attention` with the cuDNN backend returning NaN query gradients on Hopper (H100/H200) for non-causal attention when the key/value sequence length is 64 modulo 128, and silently corrupting generation on B200 for models with fewer than 8 key/value heads; the wheels now ship cuDNN 9.26, and with older cuDNN versions the affected Hopper shapes fall back to another backend (#196861, #195492) ## CPU (x86) - Fix the vectorized `double` to `int64` conversion on AVX2 CPUs, which was only exact within +/-2^51 and rounded to the nearest integer instead of truncating toward zero; it now truncates toward zero across the full `int64` range like other CPU instruction sets. Also fix the vectorized `int64` to `double` conversion returning `-0.0` for `0` when the rounding mode is round-toward-negative (#196614, #196607) ## CPU (AArch64) - Fix contiguous float32, float16 and bfloat16 to `uint8` conversions of out-of-range values (for example `Tensor.byte()` on `-1`) on Arm CPUs saturating to `0` instead of wrapping around to `255` as on x86 and for strided inputs (#196646, #198744) - Fix `torch.compile` of 4-bit dynamically quantized matmul on Arm CPUs without the dot-product extension (#197518) ## MPS - Fix crashes and wrong results in MPS `linalg.svd`, `linalg.lstsq` and `linalg.solve` (#195949, #196128, #195872, #196139, #199063, #199694, #199031) - Fix `torch.compile` on MPS: wrong `argmax`/`argmin` indices, `channels_last` conv backward stride errors, and a misleading "Not enough SMs" warning (#199134, #199132, #174241, #192375) - Raise errors instead of aborting the process on MPS for mixed-dtype inputs (`batch_norm`, `mse_loss`, `addr`, ...), 1-D-weight `linear` backward, empty `BCELoss`, and failures inside dispatch blocks (#198740, #198738, #198739, #187989, #196204, #196893) - Fix silent wrong results for large MPS tensors in `torch.cat`, `arange`/`linspace`, `nll_loss`, padding and pooling, and fix `histogram` aborts and out-of-range counts (#189965, #198593, #198776, #198592, #195147, #196985, #194460, #195714, #198416) - Propagate NaN/Inf in MPS `addmm`/`addbmm`/`baddbmm` with `beta=0` and `add`/`sub` with `alpha=0` (#193850, #194474, #196661) - Fix MPS `pow` with integer exponents, and complex `std`/`var`, `pow` and logical ops (#195585, #195344, #195592) - Fix wrong MPS results in large `var`/`std` reductions, permuted `softplus`, `lerp` with a scalar weight, `rand` hitting its upper bound, bfloat16 `nextafter`, and small-input `expm1` (#198495, #197000, #196662, #197081, #193897, #198771) - Fix MPS `scaled_dot_product_attention` output shape with broadcast batch/head dims, and `scatter_add_`/`index_add_` on offset `bool` views (#189631, #195081) - Raise errors for MPS command buffer failures (such as out of memory) and MPS-to-CPU copies to `float64` instead of returning wrong outputs (#198883, #197722) - Fix crashes and hangs when running MPS ops from multiple threads, and hangs in MPS event `elapsed_time()` (#167541, #197836, #196395) - Fix DLPack export of sliced MPS tensors, Metal debug-layer validation failures, and `active_bytes` in MPS memory stats (#182924, #199452, #193838) - Fix `torch.linalg.svd` returning non-orthonormal `U`/`Vh` with `full_matrices=True`, inaccurate results for very small or large entries, and zero `pinv`/`lstsq` for small singular values (#200536, #200776, #200649) - Fix complex division (and complex `linalg.solve`, `solve_triangular`, `det`) returning NaN or 0 for extreme magnitudes, and complex `pow` returning 0 for every zero base (#200765, #200564) - Fix `var`/`std` returning 0 instead of NaN for NaN/Inf inputs, `float16` `addmm` overflowing to `inf` with `beta=0`, and `grouped_mm` silently accepting mismatched dtypes (#200758, #200657, #200659) - Fix `torch.compile` truncating `int64` constants to 32 bits (#201060) ## ROCm - Fix flash and memory-efficient attention failing on empty inputs; they now return empty outputs like CUDA (#195812, #195813, #196723, #198022) - Fix CK flash attention dropout returning a wrong seed/offset to autograd when the GPU is busy (#197563) - Fix incorrect SDPA results on gfx11 with AOTriton 0.11 and later (#194280) - Fix launch failures on large inputs in `pdist`/`cdist` (#188006) and the BMM outer-product kernel (#194131) - Fix FP8 GEMMs failing with `HIPBLAS_STATUS_INTERNAL_ERROR` on ROCm 7.14 (#197201) - Fix crashes and hangs when a captured backward pass creates a hipBLASLt handle during CUDA graph capture (#196399) - Fix incorrect Inductor BF16 atomic accumulation, e.g. `index_put_` with repeated indices, on gfx11/gfx12 (#198199) - Fix nondeterministic `torch.topk` output order on slices longer than 256 elements (#199425) - Fix `F.batch_norm` on sharded DTensor inputs (#197160) - Fix hipify narrowing 64-bit and unsigned `std::max`/`std::min` arguments to `int` (#199444) - Fix JIT C++ extensions failing with `hipblas/hipblas.h: No such file or directory` with ROCm from TheRock pip wheels (#196503) - Stop RCCL 2.28+ from printing a deprecation warning on every all-to-all (#197534, #199124) - Fix rare incorrect indices from `argmax`, `argmin`, `max` and `min` for large reductions on ROCm (#193291) ## XPU - Fix wrong `conv1d` backward results on XPU for some singleton-dimension layouts, caused by detecting the memory format before the 3D-to-4D view used by the oneDNN path (#194328) - Fix batch norm accuracy, `fft`/`ifft` on empty batches, `norm` global reductions, and half-precision `sampled_addmm` on XPU (#193929) - Fix precision loss in `addmm` and `baddbmm` for bf16/fp16 with non-trivial `alpha`/`beta` on XPU, which now accumulate in fp32 as CPU and CUDA do (#174864) - Fix `torch.xpu.mem_get_info` under-reporting free memory on Xe2 and later GPUs (#195987) - Fix XPU device indices not matching SYCL's order on platforms that enumerate an integrated GPU before the discrete ones (#198336) - Fix oneDNN SDPA with grouped-query attention and a mask broadcast in the head dimension (#194973) - Fix `torch.xpu.Event.record()` enqueueing two commands on first use, which could leave the event without profiling data and intermittently fail Inductor autotuning (#194609) - Fix "An event cannot be enqueued for signaling or waiting behind a command which is not enqueued in the backend" errors with oneCCL on Intel® Arc™ B-Series Graphics, by limiting reusable events to the IPC case (#197396) - Fix `_safe_softmax` incorrectly zeroing rows that contain NaN on XPU (#195708) - Fix incorrect `_weight_int4pack_mm` results on XPU (#195708) - Fix undefined behavior with NaN inputs in `topk`, a spurious `group_reduce` assert, and fused moving-average observer/fake-quantize dtype mismatches on XPU (#194185) - Fix an abort in the XPU flash attention backward with an empty batch, and return BSHD-contiguous input gradients from the XPU efficient attention backward (#198200) - Fix `weight_norm` running out of memory for 1-D inputs on XPU, and a host-to-device metadata race in nested `_transform_bias_rescale_qkv` (#200289) - Fix RNG stream reuse for large tensors on XPU (#200289) - Fix Inductor treating every XPU kernel that uses scratch memory as spilling registers (#197061) ## Complex Frontend - Fix `F.dropout` raising `NotImplementedError` for complex inputs (#195373) ## JIT - Fix `torch.jit.Attribute` and `nn.Module` class annotations being lost on Python 3.14; this requires `typing-extensions>=4.13` (#195201, #199074) - Fix constant pooling merging `0.0` with `-0.0` (#192605) - Fix `torch.jit.export_opnames` missing ops inside `torch.jit.fork` subgraphs (#197333) ## Mobile - Fix a race in `CPUCachingAllocator` teardown (#196759) ## Sparse Frontend - Fix concurrent `torch.load` calls interfering in sparse tensor validation (#194751) - Fix wrong values from sparse compressed `add` with `out=` and ROCm COO `coalesce` (#197564, #199484) - Fix semi-structured bitmask conversion on non-CUDA devices (#193943) ## torch.func - Fix `torch.vmap` falling back to the slow loop for several loss ops and `addr` under `python -O` (#192859) # Performance ## Python Frontend - Reduce `TensorIterator` overhead and dtype refcount contention under free-threading (#194422, #194371) ## torch.nn - Speed up `nn.Module.__call__` by about 15% (#196236) - Add a channels-last CUDA `GroupNorm` kernel (#191945) - Speed up RMSNorm backward up to 2x on sm12x and chunked `linear_cross_entropy` by 6-10% (#192400, #196134) ## Distributed (c10d) - Speed up `all_gather_object` (#196185) - Share the parent `Store` connection across `split_group` child groups (#196665) - Use the NVLS multicast (multimem) barrier for CUDA symmetric memory when a multicast mapping is available (#192861) ## DistributedDataParallel (DDP) - Batch DDP's copy into `.grad` with `batched_grad_copy=True` (#190524) ## Distributed FSDP2 - Reduce reduce-scatter gradient memory for size-1 shard groups and low-precision gradients (#196348, #198668) ## Distributed Pipelining - Lower peak memory and improve overlap via lazy receive buffers and new `defer_reduce_grad_wait`/`unshard_lookahead` options (#196463, #196963, #196725, #196706) ## Linear Algebra Frontend - Add a built-in CUDA batched LU kernel that matches MAGMA, and improve LU backend selection without pivoting (#190329, #193004) ## FX - Reduce compile time in FX `from_node` provenance tracking (#193051) - Speed up the FX accelerator splitter on large graphs (#198519, #198654) ## Dynamo - Reduce per-call overhead of compiled code and helpers like `assert_size_stride` (#190623, #195951, #198019, #196771, #197451, #197733) - Reduce compile time: defer gen-2 GC while compiling (4.2s on one model; see `gc_gen2_threshold_during_compile`), skip empty graphs (custom backends are no longer called for such graphs), and speed up large functions (#193289, #193157, #195622) ## Inductor - Reduce compile time by caching in fusion search and codegen, hashing sources in the background, and compiling combo-kernel benchmarks in parallel (#186319, #192817, #192820, #194010, #194011, #198747, #198881, #198320) - Allow mix-order reduction fusion for more shapes, speeding up RMSNorm backward (#186370, #188660) - Reduce `cpp_wrapper` kernel call overhead by 40-50% (#192287) - Improve CPU FlexAttention BF16 performance by 6-29% (#191780) - Use larger reduction tiles on GB300, roughly doubling HBM bandwidth use (#193774) - Add gfx950 FlexAttention backward configs (1.8-2.3x faster) (#194151) - Improve NVGEMM NVFP4 decode performance on Blackwell and widen its autotuning candidates (#194651, #194652, #197485, #195539, #198293) - Compute only one triangle for large BF16 `X @ X.T` on SM100 (#194177, #194178) - Speed up collective bucketing, including up to 9x faster uneven reduce-scatter padding (#196647, #196621, #195616) - Simplify `slice_scatter` chains to reduce recomputation and peak memory (#192136, #195608, #195631) - Fix CPU OpenMP parallelization moving onto inner reduction loops under freezing, and recover an XPU inner-reduction regression (#190928, #190986) - Fuse `torch.cat`/`torch.stack` copies into foreach kernels for dynamic shapes (#198294) - Enable nested reduction fusion by default (`TORCHINDUCTOR_NESTED_REDUCTION=0` disables it), fusing patterns such as RMSNorm followed by MXFP8/NVFP4 quantization into one kernel (#190594, #190595, #191974, #193598, #196332, #196333, #196334) ## Ahead-Of-Time Inductor (AOTI) - Parallelize pinned host staging copies when loading CUDA constants (#195257) ## AOTDispatcher - Speed up the min-cut partitioner, reducing cold compile time by about 5% (#197724) ## Composability - Speed up FakeTensor view cache hits (#192821) - Reduce compile time in `ShapeEnv` (#193219, #193161, #195623) ## Quantization - Speed up AArch64 small-batch QNNPACK linear 2-4x (#193595) ## Foreach - Reduce `_foreach_norm`/`max` CUDA scratch memory (#190549) ## CUDA - Avoid CPU-GPU synchronization when assigning scalars through indexing on CUDA, e.g. `x[mask] = 1.0` (#189303, #188330, #198811) - Speed up CUDA `upsample_linear1d` by 5-25x for small outputs (#180885), pooling backward (#191086, #195119, #196156), dtype-conversion copies (#195542, #198723), 2D transpose copies (#194310), and `zero_` (#195303, #198565) - `torch.topk` on CUDA 13 Linux wheels uses ahead-of-time compiled radix-select kernels on Hopper and Blackwell (median 2.16x on H100) (#190899) - Fix a 10-30x slowdown of `gather`, `index_select`, `x[idx]` and `scatter_add` on rows of 16 or 32 bytes (#200995) ## cuDNN - Prefer the cuDNN backend for SDPA on sm86/sm89 for higher performance (#192799) ## CPU (x86) - Fix the CPU kernel dispatch cache never being populated, which made every dispatch to a CPU kernel repeat the CPU capability selection (#195328) ## CPU (AArch64) - Optimize `libtorch` code layout with LLVM BOLT, using profiles shipped in the repository. The new `USE_LLVM_BOLT` build option is on by default for Linux aarch64 CUDA builds when `llvm-bolt` 21 or newer is found and `USE_PRIORITIZED_TEXT_FOR_LD` is enabled, giving up to 30% faster workloads in some cases and up to 3% slower in others; set `USE_LLVM_BOLT=0` to opt out in source builds (#186245) - Use the native GEMV path for single-column (`n == 1`) BF16 GEMMs on Arm Neoverse CPUs built with oneDNN ACL, for about 5x faster single-thread GPT-2 BF16 decode on Graviton 4 and 5 (1.4x-2.7x with 8-64 threads on Graviton 5) (#198411) - Dispatch non-contiguous FP16 matmuls to oneDNN ACL GEMM kernels instead of the reference implementation on AArch64 (#198498) ## MPS - Move more MPS ops (`softmax`, `nll_loss`, padding, `where`, ...) to native Metal kernels, cutting launch overhead and driver memory growth with variable shapes (#196071, #195441, #195153, #195368, #193826, #198719, #198688, #198497, #196924, #189548, #199687, #198878) - Speed up MPS reductions, linear algebra, GEMV, convolutions, `histc`, masked fill, dropout and sort (#198494, #198611, #198635, #197397, #198646, #199278, #198721, #197862, #196241, #196900, #195944, #198732, #195950, #193623, #193167, #192164, #196016, #195020, #195011, #198960, #196922) - Speed up `softmax` over a non-innermost dim and `relu`, `clamp_min`, `leaky_relu` and other scalar-argument unary ops on row-strided views (#199758, #199933) ## XPU - Speed up SDPA training on XPU by aligning the oneDNN graph SDPA pattern with oneDNN v3.13 and integrating its GQA and dropout support (#195419) - Fuse the `GroupNorm` forward into a single kernel and speed up contiguous `cat` with vectorized stores on XPU (#194842) - Avoid register spilling in mixed fp32/bf16/fp16 elementwise kernels on XPU by adding vectorized type-casting loads (#194185) - Speed up `col2im` on XPU by replacing its hard-coded work-group size (#198720) - Reduce oneMKL LAPACK overhead on XPU by trimming scratchpad initialization, host synchronizations and re-allocation (#193110) ## JIT - Speed up `torch.jit.load` and graph pre-optimization (#194035, #193107, #193250, #194009) # Documentation ## Python Frontend - Document undefined behavior of bool tensors holding bytes other than 0/1, and clarify `Tensor.index_add_`'s `index` argument (#199012, #193403) ## torch.nn - Fix the `linear_cross_entropy` docstring snippet and `nn.RNN` example, and document bias with probability targets (#198941, #188433, #173888) ## Autograd - Document that custom `Function`/op backward gradients may have arbitrary strides and that `unpack_hook` order is unspecified (#195210, #198016) - Point `torch.utils.checkpoint` docs to `torch_remat` and drop the stale `use_reentrant` "version 2.9" error notice (#193998, #193720) - Fix math rendering on the autograd mechanics page (#192562) ## Distributed - Document the remaining NVSHMEM bindings (#193449) ## Distributed (c10d) - Add a tutorial for the distributed debug server (#178800) - Document `Backend.Options` and fix `irecv` and NCCL env var docs (#196123, #189623, #194701) ## Distributed FSDP2 - Document parameter-mutation limits of `fully_shard` (#198826) ## TorchElastic - Fix the `EtcdServer` example and `Worker` docstring (#198238, #199255) ## Profiler - Fix the `toggle_collection_dynamic` example (#190369) ## Dynamo - Remove references to the obsolete `dynamic_shapes` config (#198707) - Fix the PGO config example in the dynamic shapes docs (#191027) - Document more `torch._logging.set_logs` options (#188138) ## Inductor - Document the FlexAttention `ROWS_GUARANTEED_SAFE` requirement (#194154) ## Foreach - Fix in-place foreach type stubs to return the input list (#193466) ## Release Engineering - Fix docs search ranking module stub pages above the API symbols they document and listing duplicate results (#195042) - Link the build environment variable reference from `README.md` and `CONTRIBUTING.md`, and fix outdated build instructions there (#193617) - Document the issue and pull request workflow in `CONTRIBUTING.md` and add a maintainer guide to the community docs (#198527) ## MPS - Note MPS lacks `float64` support (#193545) ## ROCm - Document gfx1151 SDPA layouts, hipFile GPUDirect Storage, and MI300 matmul precision issues (#190771, #195478, #190736) # Security ## Python Frontend - Fix `torch.load(weights_only=True)` exposing uninitialized pybind11-backed objects (such as DTensor placements) when a checkpoint uses the `NEWOBJ` opcode without a matching `BUILD`; such checkpoints are now rejected as corrupt or malicious (#194647) - Fix a stack buffer overflow in `torch_shm_manager` (libshm) when the Unix socket path is too long (e.g. a long `TMPDIR`); it now raises an error (#195183) - After `import torch.distributed`, `torch.load(weights_only=True)` and `get_unsafe_globals_in_checkpoint` no longer treat builtin exceptions as safe globals (a process-wide allowlist added in 2.14), and loading no longer calls overridden `append`/`extend` on allowlisted `list` subclasses. Checkpoints with pickled exceptions now need `torch.serialization.add_safe_globals`; object collectives are unchanged (#200956) # Developers ## Distributed (c10d) - Make `FakeProcessGroup` support `all_to_all_single` with any sizes and add a `simulate_uniform_ranks` option (#193985, #194545) - Fix a clang build error and add `amd_smi` as a ROCm 7.14+ build dependency (#194104, #192520) - Add the private `torch.distributed._functional_collectives.wait_tensors`, which waits on all outputs of a multi-output functional collective at once; `torch.compile` uses it for coalesced collectives and `batch_isend_irecv` (#193892) ## Profiler - Kineto source now lives in `third_party/kineto` instead of a git submodule (#198648) - Remove the ignored `profiler_metrics` and `profiler_measure_per_kernel` `_ExperimentalConfig` arguments (now a `TypeError`), and deprecate the no-op `adjust_profiler_step` option (#198262, #193042) ## FX - Fix type annotations on `Tracer(autowrap_modules=...)` and `CodeGen.process_inputs` (#195467, #188287) ## Inductor - Add `DeviceInterface` and `DeviceOpOverrides` extension points for out-of-tree accelerator backends (#190326, #190614, #192896, #193908, #190615) - Add declarative `implies` support to Inductor/Dynamo `Config` (#196663) ## Ahead-Of-Time Inductor (AOTI) - Add `DeviceOpOverrides.aten_device_type()` so backends provide their ATen device type to AOTInductor C++ codegen (#193904) ## C++ Frontend - `c10::List` iterators satisfy `std::random_access_iterator`, and `List<T>::emplace` now constructs a `T` (#196002) ## Developer Experience - Add `spin test` to run `pytest` or `test/run_test.py` like CI (#198649) ## Build Frontend - Add an opt-in `USE_CMAKE_INSTRUMENTATION=1` build option to collect build metrics (CMake >= 4.3) (#189455) - Turn off `USE_FLASH_ATTENTION` automatically when no target CUDA architecture is sm80 or newer (#194502) - Fix the misspelled `CUDA_LIMIT_GPU_ARCHITECTURE` in CUDA architecture autodetection (#195695) - Honor `USE_MIMALLOC=OFF` on Windows and AArch64 (#199064) - Fix the FlashAttention CUDA build on Windows with MSVC in C++20 mode (#197382) ## Release Engineering - Move the CD wheel build scripts under `.ci/wheel/` (`.ci/manywheel/` to `.ci/wheel/linux/`, `.ci/macwheel/` to `.ci/wheel/mac/`, and the Windows pipeline to `.ci/wheel/windows/`) and share one `numpy` build pin (#189275) - Add a native-AOT stage to CUDA builds that exports CuTeDSL and Triton kernels ahead of time and embeds them into `libtorch_cuda`. The stage skips itself when it does not apply (for example CUDA older than 13 or no supported GPU architecture), but once it decides to export, a missing `nvidia-cutlass-dsl` (or Triton, installable with `scripts/install_triton_wheel.sh`) is a hard error; set `TORCH_NATIVE_AOT=0` to skip the stage (#194243, #196747, #196507) - Fix the CMake C and C++ compiler flag checks sharing one cache variable, so a result for one language could be reused for the other; the generated `HAS_<FLAG>` variables are now prefixed `HAS_C` and `HAS_CXX` (#197614) - Add a persistent `[no-ci]` PR title prefix that skips build, test and lint jobs, and make `@pytorchbot merge -i` ignore current failures across every PR in a ghstack stack (#196534, #197143) ## CUDA - Update the bundled CUTLASS to v4.8.0 and CUTLASS-Operators to v0.3.0 (#198179) ## CPU (AArch64) - Add the `AT_VEC_CUSTOM_MATH` compile definition, which hides the built-in vectorized math functions on AVX2, AVX512, NEON and SVE256 builds so that a vectorized math library other than SLEEF can be plugged in (#197419) ## MPS - Fix building with clang 16 and Apple clang 15 (#199115) - Fix building with a Metal 4 toolchain against older macOS SDKs, and deprecation warnings with the macOS 27 SDK (#196104, #197200) - `at::mps::MPSProfiler` `begin*`/`end*` methods take the `MPSStream*`; stream-less `begin*` overloads are deprecated (#192525, #193611) - Fix macOS builds failing on SDKs that lack the Metal 4 cooperative-tensor APIs (#195302) - Fix stale embedded Metal shaders in incremental macOS builds (#196202) - Fix MPS shader includes in editable installs (#195295) ## ROCm - `torch.utils.cpp_extension.ROCM_VERSION` now uses the ROCm SDK version instead of the HIP runtime version, and `collect_env` reports both (#194985, #193602) ## XPU - Build XPU with pure SYCL compilation and support Clang as the host compiler; expose `USE_SYCLTLA` and enable oneMKL sparse in the build system (#194185, #198720, #196387, #198200) - Upgrade oneDNN to v3.13 (#196712) ## Caffe2 - Fix source builds with CUDA 13.3 (#194659)
-
v2.14.1
GitHub ↗
原版更新说明
This release is meant to fix the following regressions and silent correctness issues: ## Silent correctness fixes - Fix incorrect `torch.linalg.lstsq` solutions on MPS for complex batched underdetermined systems ([#196113](https://github.com/pytorch/pytorch/issues/196113)), fixed by [#196128](https://github.com/pytorch/pytorch/pull/196128) - Fix non-orthogonal `U` and inaccurate small singular values from `torch.linalg.svd` on MPS for rank-deficient and ill-conditioned inputs ([#196112](https://github.com/pytorch/pytorch/issues/196112)), fixed by [#196139](https://github.com/pytorch/pytorch/pull/196139) and [#199063](https://github.com/pytorch/pytorch/pull/199063) - Update the CUDA 13.2 Linux binaries to CUDA 13.2.2 ([#196351](https://github.com/pytorch/pytorch/pull/196351)). This NVIDIA update resolves two critical issues that could produce incorrect results ([CUDA 13.2.2 release notes](https://docs.nvidia.com/cuda/archive/13.2.2/cuda-toolkit-release-notes/index.html#overview)): - cuBLAS: `cublasLtMatmul()` could ignore tensor-wide scaling for NVFP4 matrix multiplications (introduced in CUDA 13.2 Update 1) - Compiler: failed thread reconvergence could leave stale or corrupted register values in kernels with nested thread divergence (present since CUDA 12.8) ## Regression fixes - Fix `torch.linalg.svd`, `torch.linalg.svdvals` and `torch.linalg.lstsq` failing on MPS with a Metal pipeline-state error for inputs above 8192 elements ([#195937](https://github.com/pytorch/pytorch/issues/195937)), fixed by [#195949](https://github.com/pytorch/pytorch/pull/195949) and [#195950](https://github.com/pytorch/pytorch/pull/195950) - Fix internal assert in `torch.svd(out=)` on MPS for complex inputs ([#195822](https://github.com/pytorch/pytorch/issues/195822)), fixed by [#195872](https://github.com/pytorch/pytorch/pull/195872)
-
v2.14.0
GitHub ↗
原版更新说明
# PyTorch 2.14.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>NVGEMM</strong> brings CuTeDSL-generated CUTLASS kernels to Inductor, with epilogue fusion, scaled and NVFP4 GEMM, and grouped-reduction epilogues autotuned alongside Triton and ATen</td></tr> <tr><td><strong><code>torch.switch</code></strong> generalizes <code>torch.cond</code> to multi-way branching, and <code>torch.while_loop</code> can now be captured in a CUDA graph</td></tr> <tr><td><strong>Declarative dynamic shapes via <code>@dynamic_spec</code></strong>, shared across <code>torch.compile</code>, <code>torch.export</code> and <code>make_fx</code></td></tr> <tr><td><strong>Experimental <code>torch.compile</code> support for complex-valued tensors</strong>: Opt-in support decomposes supported complex operations into real and imaginary computations, enabling compiler backends to optimize more complex-number workloads.</td></tr> <tr><td><strong>A preview of our rewritten NCCL backend for PyTorch</strong>, ported from torchcomms, implementing the full collective contract with nonblocking communicators and eager communicator splitting and advanced features such as fault tolerance and windows designed as a drop-in replacement of existing NCCL c10d backend</td></tr> <tr><td><strong>Fault tolerance becomes a first-class <code>c10d</code> concept</strong>, with in-place process-group reconfiguration, one-sided RMA windows, and a Flight Recorder that works for any backend rather than only NCCL</td></tr> <tr><td><strong>Apple Silicon gains native linear algebra</strong>, including Jacobi-kernel SVD, <code>eigh</code>, QR and Cholesky, alongside a five-part reduction rewrite and a further MPSGraph to Metal kernel migration</td></tr> <tr><td><strong>Broader platform support</strong>: ROCm 7.14 wheels are produced from the TheRock pip SDK, Intel XPU adds native graph capture, and Inductor targets Rubin (<code>sm_107</code>)</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 ## torch.nn - `torch.nn.LinearCrossEntropyOptions` no longer accepts `acc_policy="balanced"`; use `"compact"` instead (#188283) The `"balanced"` policy was removed because `"compact"` provides the same weight-gradient accumulation precision with lower memory use on CUDA, already uses the equivalent scratch layout for mixed-precision inputs on other devices, and was never selected by `"auto"`. Constructing the options with `acc_policy="balanced"` now raises `ValueError: invalid acc_policy: 'balanced'; expected one of 'auto', 'accurate', 'compact'`. Before: ```python options = torch.nn.LinearCrossEntropyOptions(acc_policy="balanced") loss = torch.nn.functional.linear_cross_entropy( input, linear_weight, target, options=options ) ``` After: ```python options = torch.nn.LinearCrossEntropyOptions(acc_policy="compact") loss = torch.nn.functional.linear_cross_entropy( input, linear_weight, target, options=options ) ``` ## Autograd - Clamp and min/max boundary subgradients now follow the selected dispatcher schema's input space (#191142) This affects gradients exactly at nondifferentiable bounds or ties. A scalar clamp bound is a fixed parameter, so the input gradient at equality changes from `1` to the minimum-norm subgradient `0`. A Tensor bound is part of the differentiable input space, so `clamp`, `clamp_min`, and `clamp_max` now split the gradient evenly between the input and bound at an ordinary tie instead of assigning it entirely to the input. `fmin` and `fmax` use the same even tie split, and forward-mode AD for the min/max family is aligned with these rules. Code that intentionally depends on the old tie-breaking behavior can express it explicitly with `torch.where`, such as `torch.where(value >= bound, value, bound)`. Version 2.13: ```python import torch x = torch.tensor(0.0, requires_grad=True) torch.clamp_min(x, 0.0).backward() print(x.grad) # tensor(1.) value = torch.tensor(0.0, requires_grad=True) bound = torch.tensor(0.0, requires_grad=True) torch.clamp_min(value, bound).backward() print(value.grad, bound.grad) # tensor(1.) tensor(0.) ``` Version 2.14: ```python import torch x = torch.tensor(0.0, requires_grad=True) torch.clamp_min(x, 0.0).backward() print(x.grad) # tensor(0.) value = torch.tensor(0.0, requires_grad=True) bound = torch.tensor(0.0, requires_grad=True) torch.clamp_min(value, bound).backward() print(value.grad, bound.grad) # tensor(0.5000) tensor(0.5000) ``` ## Distributed - Custom Python process groups that implement `new_group()` must now accept a `backend` keyword argument (#188489) This applies when the default process group supplies its own `new_group()` method and `torch.distributed.new_group()` delegates subgroup creation to it. PyTorch now forwards the resolved backend so custom implementations can construct the requested subgroup correctly. Existing implementations without this parameter will raise `TypeError: ... got an unexpected keyword argument 'backend'`. Accept and use the argument, or accept and ignore it when the implementation has only one backend. Before: ```python class MyProcessGroup(...): def new_group( self, ranks, *, timeout=None, pg_options=None, group_name=None, group_desc=None ): ... ``` After: ```python class MyProcessGroup(...): def new_group( self, ranks, *, timeout=None, backend=None, pg_options=None, group_name=None, group_desc=None ): ... ``` - NCCL symmetric-memory pools no longer automatically upgrade segments allocated after `register_mem_pool(..., symm=True)` to symmetric windows (#192112) Registering those late segments from the CUDA allocator callback could invoke a collective NCCL operation on only some ranks while holding the allocator lock, causing an unrecoverable hang. Late segments now remain ordinary registered NCCL buffers. Applications that need newly allocated segments to use symmetric-window algorithms must collectively deregister and register the pool again after those allocations are created. Before: ```python backend.register_mem_pool(pool, symm=True) with torch.cuda.use_mem_pool(pool): tensor = torch.empty(size, device="cuda") # Newly allocated segments were automatically upgraded, but this could hang. ``` After: ```python backend.register_mem_pool(pool, symm=True) with torch.cuda.use_mem_pool(pool): tensor = torch.empty(size, device="cuda") # Collectively refresh registration after the pool grows. backend.deregister_mem_pool(pool) backend.register_mem_pool(pool, symm=True) ``` - Nonmember ranks now receive `GroupMember.NON_GROUP_MEMBER` instead of `None` from experimental `torch.distributed.split_group()` (#190725) When the calling rank is absent from every requested split, `split_group()` now returns the same nonmember sentinel as `new_group()`. Code that identifies nonmembers with `is None` must compare against `torch.distributed.GroupMember.NON_GROUP_MEMBER` instead. Before: ```python group = torch.distributed.split_group( split_ranks=[[0, 1], [2, 3]] ) if group is None: return ``` After: ```python group = torch.distributed.split_group( split_ranks=[[0, 1], [2, 3]] ) if group == torch.distributed.GroupMember.NON_GROUP_MEMBER: return ``` ## Linear Algebra Frontend - Remove the deprecated `torch.cholesky()` and `Tensor.cholesky()` APIs (#186817) Calls now raise a `RuntimeError` directing users to `torch.linalg.cholesky()`. The replacement returns a lower-triangular factor; callers that previously requested `upper=True` should take the conjugate transpose with `.mH`. Version 2.13: ```python lower = torch.cholesky(a) upper = torch.cholesky(a, upper=True) ``` Version 2.14: ```python lower = torch.linalg.cholesky(a) upper = torch.linalg.cholesky(a).mH ``` - Remove the deprecated `torch.qr()` and `Tensor.qr()` APIs (#186815) Calls now raise a `RuntimeError` directing users to `torch.linalg.qr()`. Replace the Boolean `some` argument with `mode="reduced"` or `mode="complete"`. Version 2.13: ```python q, r = torch.qr(a) q_full, r_full = torch.qr(a, some=False) ``` Version 2.14: ```python q, r = torch.linalg.qr(a, mode="reduced") q_full, r_full = torch.linalg.qr(a, mode="complete") ``` ## Profiler - The deprecated `use_cuda` argument has been removed from `torch.profiler.profile` and `torch.autograd.profiler.profile` (#192543) Passing `use_cuda` to either profiler now raises `TypeError: profile.__init__() got an unexpected keyword argument 'use_cuda'`. Select CUDA explicitly through `activities` when using `torch.profiler.profile`, or use `use_device="cuda"` with `torch.autograd.profiler.profile`. Version 2.13: ```python with torch.profiler.profile(use_cuda=True) as prof: run_workload() with torch.autograd.profiler.profile(use_cuda=True) as prof: run_workload() ``` Version 2.14: ```python with torch.profiler.profile( activities=[ torch.profiler.ProfilerActivity.CPU, torch.profiler.ProfilerActivity.CUDA, ] ) as prof: run_workload() with torch.autograd.profiler.profile(use_device="cuda") as prof: run_workload() ``` ## Dynamo - The `tvm` backend now uses TVM's relax frontend exclusively; the relay path has been removed (#190766, #189639) Relay was removed in TVM 0.20, so the backend now requires a TVM providing `tvm.relax.frontend.torch`. Two things are gone with it: the relay-only `scheduler` / `trials` options, replaced by a TVM pipeline passed as `options={"pipeline": ...}`; and the `tvm_meta_schedule` / `tvm_auto_scheduler` backend entry points, which no longer exist in `torch._dynamo.backends.tvm`. With an older TVM installed, `torch.compile(..., backend="tvm")` now raises `ImportError: Please install apache-tvm to use the tvm backend.` Version 2.13: ```python opt = torch.compile(model, backend="tvm", options={"scheduler": "meta_schedule", "trials": 20000}) # or through the relay-only entry points from torch._dynamo.backends.tvm import tvm_meta_schedule, tvm_auto_scheduler ``` Version 2.14: ```python import tvm pipeline = tvm.relax.get_pipeline("static_shape_tuning", target="llvm", total_trials=2000) opt = torch.compile(model, backend="tvm", options={"pipeline": pipeline}) # tvm_meta_schedule / tvm_auto_scheduler no longer exist: # ImportError: cannot import name 'tvm_meta_schedule' ``` ## C++ Frontend - Remove the deprecated zero-argument C++ overloads `c10::Scalar::isIntegral()` and `c10::isIntegralType(ScalarType)` (#187115) Code that calls either overload without specifying whether Boolean values count as integral will no longer compile. Pass `includeBool` explicitly; use `false` to preserve the removed overloads' behavior. Version 2.13: ```cpp bool scalar_is_integer = scalar.isIntegral(); bool dtype_is_integer = c10::isIntegralType(dtype); ``` Version 2.14: ```cpp bool scalar_is_integer = scalar.isIntegral(/*includeBool=*/false); bool dtype_is_integer = c10::isIntegralType(dtype, /*includeBool=*/false); ``` ## Release Engineering - `setup.py` is now a deprecation shim; build PyTorch through pip or `python -m build` (#180248) `setup.py` is now a thin shim. `install` and `develop` still forward to pip, but `build`, `bdist_wheel`, `clean`, `sdist` and the rest print the replacement command instead of falling through to setuptools. Builds that already go through a PEP 517 frontend are unaffected, since pip and `python -m build` never ran `setup.py`. The shim prints the schedule: `install`/`develop` keep forwarding through 2.15, every command stops working in 2.16, and `setup.py` is removed in 2.18. Version 2.13: ```bash python setup.py bdist_wheel ``` Version 2.14: ```bash python -m build --wheel --no-isolation ``` ## MPS - The C++ MPS macOS-version helper and its enum members have been renamed (#188645) Downstream C++ code that includes `<ATen/mps/MPSDevice.h>` must replace the exported `at::mps::is_macos_13_or_newer()` function with `at::mps::is_macos_at_least()`. The associated `MacOSVersion` members also drop the `VER` and `PLUS` portions of their names. No compatibility aliases are provided, so code using the old names will no longer compile. Version 2.13: ```cpp const bool supported = at::mps::is_macos_13_or_newer( at::mps::MacOSVersion::MACOS_VER_15_0_PLUS); ``` Version 2.14: ```cpp const bool supported = at::mps::is_macos_at_least( at::mps::MacOSVersion::MACOS_15_0); ``` ## Complex Frontend - Complex type promotion for `bfloat16` now uses the new `torch.bcomplex32` shell dtype instead of `torch.complex64` (#186928) `torch.bcomplex32` stores real and imaginary components as `bfloat16`. Operations that combine a `bfloat16` tensor with a complex scalar or otherwise request its corresponding complex type can therefore produce `bcomplex32` instead of `complex64`. Because `bcomplex32` is a shell dtype with limited operator support, an operation that previously ran in `complex64` may now raise a not-implemented error. Explicitly cast to `complex64` when the previous precision or operator coverage is required. Version 2.13: ```python x = torch.ones(4, dtype=torch.bfloat16) assert torch.result_type(x, 1j) == torch.complex64 ``` Version 2.14: ```python x = torch.ones(4, dtype=torch.bfloat16) assert torch.result_type(x, 1j) == torch.bcomplex32 # Preserve the previous complex64 behavior explicitly. y = x.to(torch.complex64) + 1j ``` # Deprecations ## Autograd - Selective activation checkpointing will change to honor surrounding `saved_tensors_hooks` by default; use the new `respect_saved_tensors_hooks` argument to choose the behavior explicitly (#190581) The current default, `None`, preserves the legacy behavior in which tensors retained by selective activation checkpointing bypass user hooks, but now emits a `FutureWarning` when hooks are active. Pass `True` to opt into the future behavior or `False` to preserve the legacy behavior without a warning. This option requires `use_reentrant=False`. Before: ```python with torch.autograd.graph.saved_tensors_hooks(pack, unpack): output = torch.utils.checkpoint.checkpoint( function, input, use_reentrant=False, context_fn=sac_context_fn, ) ``` After: ```python with torch.autograd.graph.saved_tensors_hooks(pack, unpack): output = torch.utils.checkpoint.checkpoint( function, input, use_reentrant=False, context_fn=sac_context_fn, respect_saved_tensors_hooks=True, ) ``` ## Distributed - Use `torch.compiler.config.compile_on_one_rank` instead of `torch.distributed.config.compile_on_one_rank` (#187869) The distributed spelling remains as a forwarding alias but now emits a `FutureWarning`. The preferred environment variable is also `TORCH_COMPILE_ON_ONE_RANK`; the older `TORCH_DISTRIBUTED_COMPILE_ON_ONE_RANK` remains supported for compatibility. Before: ```python import torch.distributed.config torch.distributed.config.compile_on_one_rank = True ``` After: ```python import torch.compiler.config torch.compiler.config.compile_on_one_rank = True ``` ## Profiler - The experimental `profiler_metrics` and `profiler_measure_per_kernel` options no longer enable CUPTI range profiling and now emit a `FutureWarning` when set to a non-default value (#187204) Kineto no longer supports this range-profiler path on PyTorch's supported CUDA versions. The arguments remain accepted temporarily for compatibility, but they are ignored and have no direct replacement. Before: ```python config = torch.profiler._ExperimentalConfig( profiler_metrics=["sm__cycles_elapsed.avg"], profiler_measure_per_kernel=True, ) ``` After: ```python config = torch.profiler._ExperimentalConfig() ``` - The `with_modules` profiler option is deprecated and now emits a `FutureWarning` (#192808) `with_modules=True` only collected module hierarchy for TorchScript models and did nothing in eager mode. For eager models, use `with_stack=True` to record `nn.Module` events. Before: ```python with torch.profiler.profile(with_modules=True) as prof: run_workload() ``` After: ```python with torch.profiler.profile(with_stack=True) as prof: run_workload() ``` ## Dynamo - `torch._dynamo.config.enable_faithful_generator_behavior` is deprecated and is now a no-op (#189894) Faithful (lazy) generator tracing has been the default and is the only supported behavior, so the dead eager-exhaustion path was removed. The config is kept as a deprecated setting that always behaves as `True`, so setting it does not error but no longer changes anything. Version 2.13: ```python # generators were eagerly exhausted on first execution with torch._dynamo.config.patch(enable_faithful_generator_behavior=False): torch.compile(fn)(x) ``` Version 2.14: ```python # the flag is ignored; generators are always traced lazily torch.compile(fn)(x) ``` ## CUDA - Deprecate `CUDAGraph.register_generator_state()`; CUDA graphs now register generator state lazily on first RNG use during capture (#176753) The method is now a no-op and emits a deprecation warning. Remove explicit registration calls; the graph automatically retains the required state when the generator is used during capture. Before: ```python graph = torch.cuda.CUDAGraph() state = generator.graphsafe_get_state() graph.register_generator_state(state) with torch.cuda.graph(graph): generator.graphsafe_set_state(state) output = torch.rand(16, device="cuda", generator=generator) ``` After: ```python graph = torch.cuda.CUDAGraph() state = generator.graphsafe_get_state() with torch.cuda.graph(graph): generator.graphsafe_set_state(state) output = torch.rand(16, device="cuda", generator=generator) ``` - Deprecate `GreenContext.set_context()` and `GreenContext.pop_context()`; use custom streams to activate a green context instead (#188419) These methods now emit a `FutureWarning`. Create a stream from the green context and use it with `torch.cuda.stream()` instead. Synchronization with streams outside the green context remains the caller's responsibility and should use CUDA events when needed. Before: ```python ctx = torch.cuda.green_contexts.GreenContext(num_sms=1) ctx.set_context() try: output = model(input) finally: ctx.pop_context() ``` After: ```python ctx = torch.cuda.green_contexts.GreenContext(num_sms=1) stream = ctx.Stream() with torch.cuda.stream(stream): output = model(input) ``` ## JIT - TorchScript APIs now emit visible `FutureWarning`s instead of normally hidden `DeprecationWarning`s (#189914) Calls such as `torch.jit.script`, `torch.jit.trace`, `torch.jit.save`, and `torch.jit.load` now visibly direct users toward `torch.compile` or `torch.export`. Imports of `torch.utils.mkldnn`, `torch.fx.experimental.optimization`, and `torch.distributed.optim` also avoid eagerly compiling TorchScript when those modules are merely imported. Before: ```python scripted = torch.jit.script(model) torch.jit.save(scripted, "model.pt") ``` After: ```python exported = torch.export.export(model, example_inputs) torch.export.save(exported, "model.pt2") ``` # New Features ## Python Frontend - Add `torch.accelerator.initial_seed()`, `torch.accelerator.get_rng_state()`, and `torch.accelerator.get_rng_state_all()` for backend-agnostic accelerator RNG inspection (#186597) - Add read-only DLPack export through `Tensor.__dlpack__(read_only=True)` and `torch.utils.dlpack.ReadOnlyTensorWrapper`, including copy-on-write-preserving exchange with compatible consumers (#188554) - Add `torch.Generator.philox_state()` so Python-authored kernels can reserve Philox counter ranges that remain correct across CUDA Graph capture and replay (#191019) ## Autograd - `torch.utils.checkpoint.checkpoint()` can now be called without a function to create an eager-mode decorator with checkpoint configuration separated from the wrapped function's arguments (#189411) ```python checkpointed_function = torch.utils.checkpoint.checkpoint( use_reentrant=False )(function) output = checkpointed_function(*args, **kwargs) ``` The curried form is initially supported in eager mode; existing direct calls remain the compatible form under `torch.compile`. - Add `torch.autograd.graph.node_creation_hook`, a thread-local context manager whose callback receives every fully populated autograd graph node created within its scope. The callback can inspect nodes, store metadata, or register backward pre-hooks and post-hooks, including for nodes created during higher-order differentiation and checkpoint recomputation (#189284) - Add `ctx.set_output_grad_dtype(*dtypes)` for custom `torch.autograd.Function` implementations. Called once from `forward` or `setup_context`, it declares the gradient dtype expected for each output independently of the output's storage dtype; a concrete dtype converts incoming gradients, while `None` leaves their dtype unchanged (#189634) - Add second-order gradient support for `torch.cdist` and `torch.nn.functional.pdist`, so grad-grad computations no longer fail because `_cdist_backward` or `_pdist_backward` lacks a derivative (#188901) ## Distributed - Add portable JSON serialization through `DebugMode.save_logs()` and `DebugMode.load_logs()` so distributed execution logs can be compared across separate processes or model configurations (#185010) - Add the public `torch.distributed.set_timeout()` API; the private `_set_pg_timeout()` alias remains available with a deprecation warning (#187387) - Add `torch.distributed.tensor.logspace` for constructing distributed logarithmically spaced tensors (#186398) - Add experimental `torch.distributed.get_backend_impl()` and `ProcessGroup.get_backend()` accessors for custom backend development (#187494) - Add `torch.distributed.tensor.linspace` for constructing distributed linearly spaced tensors (#187933) - Add fault-tolerant reconfiguration and one-sided window operations to the experimental `nccl2` backend (#189359, #189360) - Add the experimental `nccl-lazy` backend, which creates per-peer NCCL point-to-point communicators on demand (#189362) - Add the `CheckpointableTensor` protocol so distributed checkpointing can save and load `torch.Tensor` objects exposing `global_shape`, `global_offsets`, `local_offsets`, and `local_sizes` metadata (#189492) - Add an explicit `nccl-legacy` backend and the `TORCH_DIST_USE_NCCL2=1` opt-in for selecting the experimental replacement behind the `nccl` name (#191272) - Allow `ProcessGroupNCCL.Options.config.comm_name` to assign readable communicator names for NCCL logs and profiler tools (#191001) - Add `torchrun --log-line-prefix-template` and a `${hostname}` template variable for identifying the host that emitted each worker log line (#191265) - Allow pipeline schedules to consume explicitly pre-split positional inputs, keyword inputs, and targets through `arg_mbs`, `kwarg_mbs`, and `target_mbs` (#188500) - Add optional shell-completion generation to `torchrun` through `--print-completion` and the `shtab` package (#191289) ## Symmetric Memory - Add XPU support for symmetric-memory operations used by asynchronous tensor parallelism, enabling communication/computation overlap on Intel GPUs (#185102) ## Linear Algebra Frontend - Add `torch.linalg.polar()` for computing `A = U @ H` for matrices with at least as many rows as columns, using a portable SVD implementation and cuSOLVER QDWH acceleration for eligible CUDA inputs (#185837) - Add `torch.linalg.matrix_sqrth` for computing the principal square root of symmetric or Hermitian positive-definite matrices, with support for batched inputs, autograd, `vmap`, and `torch.compile` (#187987) - Add CUDA cuBLASLt support to TunableOp, including controls for the number of heuristic candidates through `torch.cuda.tunable.set_cublaslt_requested_algo_count()` and `PYTORCH_TUNABLEOP_CUBLASLT_REQUESTED_ALGO_COUNT` (#186270) ## Profiler - Memory snapshots can now include CPU pinned-memory allocations by passing `record_pinned_host_memory=True` to `torch.cuda.memory._record_memory_history()` (#182407) Pinned-memory allocator state and history are available in the snapshot's `host_segments` and `host_traces` fields. Pass `record_cuda=False` to record only pinned host memory; the web memory visualizer does not yet display host-memory data. - Profiler events now expose Kineto metadata as typed values through `FunctionEvent.metadata` when `expose_kineto_event_metadata=True` is enabled (#191756) The new dictionary avoids reparsing JSON strings and automatically includes metadata fields supported by the active profiler backend. ## Dynamo - Add `torch.compiler.nonstrict_trace` as a public API (#187737) - Add the prototype `switch` higher-order op, which selects between N branches by index and mirrors `jax.lax.switch`. It is available as `from torch._higher_order_ops.switch import switch` and lowers to `torch.ops.higher_order.switch`; autograd is not yet supported (#182902, #188374, #189028) - Declare dynamic shapes explicitly with `ShapesSpec` / `ParamsSpec`, now accepted by strict and non-strict `torch.export.export`, `make_fx(tracing_mode="fake")`, and `torch.compile` through a shared `dynamic_shapes=` keyword (#185982, #186751, #187602, #187010) - Support Dynamo and AOTAutograd tracing of permitted input mutations in the prototype `scan`, `map`, and `switch` higher-order ops when gradients are disabled; Inductor lowering for these mutations is not yet supported (#186474, #187568, #188903) - Support `torch.cuda.use_mem_pool` inside a compiled region, so allocations in the context - including fallback and extern kernels - are routed to the pool (#185057) - Support calls to `logging.Logger` methods that are explicitly registered in `torch._dynamo.config.reorderable_logging_functions`, so supported positional-argument logging calls run after the compiled region instead of causing graph breaks (#190840) ## Inductor - Add NVGEMM epilogue fusion so supported pointwise operations and output casts can be fused into autotuned matrix multiplications (#186183) - Add NVGEMM autotuning support for `torch.addmm`, including fused bias and supported pointwise epilogues (#189774) - Support FlexAttention FLASH-backend backward graphs that differentiate through the returned log-sum-exp output (#189784) - Add an opt-in `torch._inductor.config.reorder_for_locality_in_training` setting for applying locality-based graph reordering to training graphs (#186643) - Add opt-in CUDA Graph Trees generation cloning through `torch._inductor.config.triton.cudagraph_trees_generation_cloning = "user_visible"`, preserving live user-visible outputs across generations (#188078) - Add `bfloat16` support to `torch.fft` operations and `torch.stft` on CUDA and add `float16`/`bfloat16` support on XPU. Native CUDA `bfloat16` cuFFT execution requires SM80 or newer and power-of-two transform sizes; unsupported CUDA and XPU cases promote to `float32`. CPU FFT continues to reject these low-precision dtypes (#180766) - Add the opt-in `autotuning_inputs` log artifact, enabled with `TORCH_LOGS=autotuning_inputs`, to report Triton autotuning input shapes, dtypes, strides, and scalar values (#184399) - Add Inductor support for the prototype `switch` control-flow operator on CPU and GPU, including dynamic shapes, multiple outputs, and AOTInductor; CUDA graphs remain unsupported for graphs containing `switch` (#188976) - Add dynamic-shape support to `torch.compiler.precompile` for dimensions marked with `torch._dynamo.decorators.mark_unbacked`, allowing one artifact to serve multiple runtime sizes without guarding on the marked dimension (#189165) - Add `torch.compiler.cudagraph_mark_warmup_incomplete()` so code can request another CUDA Graph Trees warmup iteration (#191386) ## Ahead-Of-Time Inductor (AOTI) - Add `AOTInductorModelContainerCreateWithExternalConstants`, allowing callers to construct an AOTInductor model container from caller-owned weight tensors for zero-copy sharing such as CUDA IPC (#188643) The new C API skips loading constants from the package and leaves ownership with the caller. Existing model-container creation and constant-loading paths are unchanged unless external constants are explicitly provided. - Support explicit user-defined streams in the AOTInductor C++ wrapper. A compiled region that selects a stream with `torch.cuda.stream(...)` now emits stream-guard code so its kernels run on the requested stream, instead of always running on the default stream (#182971) ## Export - Add the `torch.fx.experimental.dynamic_spec.dynamic_spec` decorator for attaching a dynamic-shape specification to a function or `nn.Module.forward`. `torch.compile`, `torch.export.export`, and `make_fx` automatically use the attached specification; passing a conflicting call-site specification raises an error (#187639) ## Composability - Add a `length` argument to the prototype `torch._higher_order_ops.scan`, allowing a scan to run for a fixed number of steps when `xs=None`, matching the corresponding `jax.lax.scan` usage pattern (#188349) - Add grouped-query attention to the CUDA memory-efficient backend for `torch.nn.functional.scaled_dot_product_attention`, including native grouped key/value heads, implicit multi-query attention broadcasting, and backward support under `vmap` (#191085) ## C++ Frontend - Add `torch::stable::tensor_from_pyobject` and `torch::stable::tensor_to_pyobject` for converting between Python `torch.Tensor` objects and `torch::stable::Tensor` (#183323) - Move the `c10/util/complex_utils.h` helpers and the `ATen/NumericUtils.h` `_isinf` and `_isnan` implementations into the header-only ABI (#192552, #192557) - Add stable-ABI `torch::stable::permute` and the dtype overload of `torch::stable::view` (#192083) - Add stable-ABI `torch::stable::Tensor` overloads for `bitwise_and`, `bitwise_or`, `bitwise_left_shift`, `bitwise_right_shift`, `index_select`, `floor_divide`, and `is_pinned` (#191973, #192097) - Add `torch::stable::Tensor::has_storage()` (#189877) ## Release Engineering - Expand Python 3.15 and free-threaded (no-GIL) Python 3.15t binary coverage to Windows and macOS, completing support across the PyTorch release matrix (#189722, #190360, #190361, #186033) PyTorch 2.14 publishes Python 3.15 and 3.15t wheels for Linux on x86-64 and aarch64, Windows x86-64, and macOS on Apple silicon, covering the applicable CPU, CUDA, ROCm, and XPU builds. `torchvision` 0.29.0 publishes matching Python 3.15 and 3.15t wheels for the same supported platform and accelerator combinations. This is binary and eager-runtime support; `torch.compile` remains unsupported on Python 3.15 in this release. ## CUDA - Add a cuBLASLt backend for grouped GEMM on Hopper and Blackwell GPUs with CUDA 13.3 or newer (#177037, #190372) The backend supports `float16` and `bfloat16`, works with `torch.compile` and CUDA Graphs, and is selected by default for eligible `float16` workloads. Set `torch.backends.cuda.matmul.prefer_cublaslt_grouped_gemm = True` to opt into it for `bfloat16`. Matrices and leading dimensions must be 16-byte aligned, so some shapes may require padding and slicing. - Add `torch.cuda.memory._annotate_tensor()` for attaching metadata to a live CUDA tensor allocation after it is created (#190575) Each annotation is recorded as a timestamped memory-history event, multiple annotations accumulate without replacing allocation-time metadata, and memory snapshot tools display the annotations alongside the affected allocation. Memory history must be enabled with `torch.cuda.memory._record_memory_history()` for annotations to be observable. Only the native CUDA caching allocator supports annotations. - Add the public `torch.cuda.graph_annotations` module (#189417) - Annotate backward kernels in `mark_kernels` via `node_creation_hook` (#191563) - Allow multiple memory pools in a single `CUDAGraph` (#187929) - Add CUDA graph support for `torch.while_loop` (#186055) - Add destroy callbacks and object retention to `torch.cuda.CUDAGraph` (#190582) - Add replay start/end hooks to `torch.cuda.CUDAGraph` (#190602) - Add global CUDA graph capture-start/end and replay-start/end hooks, plus `torch.cuda.CUDAGraph.register_capture_start_hook()` (#192162) ## cuDNN - Add cuDNN SDPA support for head dimension 256 on SM90 and SM10.x GPUs with cuDNN newer than 9.22 and cuDNN Frontend 1.24 or newer; backward currently supports only `(d_qk, d_v) = (256, 256)` (#185553) ## MPS - Add native MPS support for binomial sampling (#187078) - Add MPS forward and backward support for `torch.nn.functional.ctc_loss` (#187716, #188187) - Add MPS support for `torch.linalg.matrix_exp`, including complex inputs, on macOS 15 or newer (#188954) - Add native MPS Poisson sampling, eliminating its CPU fallback (#173319) - Add native `float32` and `complex64` MPS implementations of `torch.linalg.svd`, `svdvals`, `eigh`, `eigvalsh`, and `lstsq`, while retaining CPU fallbacks for small matrices and matrices that exceed threadgroup memory (#185954) ## ROCm - Add initial, technology-preview support for AMD `gfx1250`; CK SDPA/GEMM, FP8 grouped GEMM, and int4 matrix multiplication remain unsupported (#187548, #188597, #188612) - Enable hipFile on Linux with ROCm 7.14 or newer (#191069, #192803) ## XPU - Add FP8 blockwise scaling support for MXFP8/MXFP4/NVFP4 recipes to `torch._scaled_mm` and `torch._scaled_mm_v2` on XPU (#181726, #181727, #187315) - Add XPU Graph native recording mode on non-PVC devices when PyTorch is built with oneAPI 2026.1 or newer (#188874) - Add `torch.xpu.list_gpu_processes` to query per-process GPU memory usage on XPU (#185192) # Improvements ## Python Frontend - Allow `torch.quantile` and `torch.nanquantile` to process `float32` and `float64` inputs larger than `2**24` elements on devices with `float64` support by computing ranks in `float64` (#187574) ## torch.nn - Allow the chunked path of `torch.nn.functional.linear_cross_entropy` to handle probability targets for `reduction="mean"` and `reduction="sum"` when the target dtype matches the input and the target does not require gradients (#187053) - Improve static typing for `torch.nn.Sequential` indexing so integer keys resolve to `Module` and slices resolve to `Sequential` (#187758) - Add the documented `memory_format` overload to `torch.nn.Module.to()` so static type checkers accept calls such as `module.to(memory_format=torch.channels_last)` (#185117) ## Optimizer - Add the `"spectral_unclamped"` scaling option to the `adjust_lr_fn` parameter of `torch.optim.Muon` (#187402) - Add a `maximize` parameter to `torch.optim.LBFGS` (#187309) - Make `torch.optim.LBFGS.step()` a no-op for an empty parameter group (#191666) ## Distributed - Expand `DTensor` sharding strategies for matrix, attention, sorting, scanning, softmax, and related operations (#186667, #179068) - Allow custom Python `ProcessGroup` implementations to use `batch_isend_irecv` and the coalescing manager (#186964) - Improve the Flight Recorder diagnostic emitted when a `TCPStore` check fails (#187191) - Allow pipeline parallel stages to use separate forward and backward point-to-point communicators, reducing cross-batch ordering hazards (#186173) - Add fault-tolerant reconfiguration support to Gloo process groups (#187381) - Make compile-on-one-rank graphs portable across ranks by replacing baked accelerator device indices with a runtime current-device operation (#186892) - Expand active `DTensor` single-dimension strategies for tensor operations (#186754) - Auto-qualify bare backend names and pass process-group options through custom TorchComms backend creation (#187856) - Add complete collective coverage to custom Python process groups, including single-tensor gather/scatter and the remaining point-to-point and collective operations (#188548, #188570) - Make TorchElastic NUMA binding and `ShardedTensor` device transfers work with accelerator backends beyond CUDA (#185266, #187939) - Use generic collective coalescing when aborting process groups so third-party backends can avoid multi-communicator teardown deadlocks (#189770) - Mark CUDA symmetric-memory allocations as GPUDirect RDMA capable on supported systems (#189941) - Add communicator memory suspend/resume support to the experimental `nccl2` backend (#189361) - Allow unknown device-qualified TorchComms backend names to register as custom backends without requiring manual changes to internal backend maps (#191034) - Add eager `split_group` support, complete `Work` semantics, nonblocking communicators, and uneven list collectives to the experimental `nccl2` backend (#190943, #191517, #191528, #191542) - Include `nccl-lazy` pair communicators in error reporting, suspend/resume operations, and memory statistics, and expand its shared backend coverage (#191553, #191556) - Add memory-pool registration and deregistration support to the experimental `nccl2` backend (#192108) - Add per-process-group collective sequence numbers and accurate split-group membership metadata to `nccl2` profiler traces (#192114, #192115) - Support non-overlapping final-spatial-dimension `DTensor` sharding for `Conv1d`, `Conv2d`, and `Conv3d` forward and backward (#192147) - Pass process-group descriptions and names to NCCL's `commName` field while preserving user-specified communicator names (#192487) - Support `DTensor` redistribution from final-dimension sharding to `Partial("sum")` (#191828) ## Distributed (c10d) - Upgrade NCCL to 2.30.7 for CUDA 13.0 and CUDA 13.2 builds (#187528) - Enable Inductor's `simple_overlap` scheduler pass by default for compiled distributed workloads, moving collective starts earlier and waits later without reordering collectives or increasing peak memory (#184235, #184240) ## Linear Algebra Frontend - Add backward support for `torch.linalg.polar` on CPU, CUDA, and MPS (#189732) - Enable `torch.linalg.eig` on ROCm 7.14 or newer through hipSOLVER's generic `Xgeev` API, and update generated linear-algebra tests to recognize hipSOLVER implementations that do not require MAGMA (#188720) - Allow `torch.backends.cuda.preferred_blas_library("ck")` to select the CK GEMM backend on ROCm `gfx90a` devices by separating GEMM support from CK attention support (#187267) - Expand ROCm backend coverage for `torch.linalg.eig`, `torch.linalg.ldl_solve`, `torch.linalg.solve`, and `torch.linalg.solve_triangular` through hipSOLVER and hipBLAS paths (#185557) ## Profiler - Record XPU profiler overhead as `OVERHEAD` activities, making collection costs visible on a dedicated track in exported traces (#187835) ## FX - Allow `split_const_subgraphs()` callers to supply an `is_impure_node` callback so destination-passing operations and other side-effecting nodes are preserved during dead-code elimination (#190716) - Make `get_source_partitions()` return input nodes, output nodes, and parameters in deterministic graph order (#188965) ## Dynamo - Extend `torch.compiler.nested_compile_region` reuse to source-backed objects, symbolic shapes, dataclasses, and namedtuples (#192003, #191806, #191817) - Expand compilation support for `staticmethod`, built-in leaf modules, cross-device `tensor.data` swaps, raw unbacked `SymInt` inputs, zero-length scans, and methods reached through `super()` (#190673, #185722, #185980, #187273, #188348, #183850) - Trace accelerator probes, channels-last `out=` tensors, sourceless `DistributedDataParallel`, `dist.reduce_scatter`, `SDPAParams`, and `torch.linalg.polar` (#185277, #185089, #187210, #190429, #190839, #188537) - Recognize out-of-tree Triton devices and accept module functions or constants as `torch._check` messages (#190324, #188576) - Match more Python built-ins and operators, including `min`/`max`, integer bases and formatting, `range`/slice coercion, object and container subclasses, mutable string splits, rich comparisons, item mutation, and `callable()` (#191401, #191402, #191408, #187129, #186976, #189021, #187588, #185999, #188306, #191406, #190259, #186971) - Expand iterator support for `itertools`, dict/set views, and range iterators (#188080, #189022, #186937, #187080, #186240, #188081, #188221, #189575) - Improve `deque`, dict, set, dict-view, `__dict__`, and list initialization fidelity (#187128, #188220, #191403, #189052, #191405, #186759, #186760, #186669, #186761, #186763, #188908, #187586, #187587, #187583, #187584) - Improve object representation and copying, exception attributes, and subgenerator closure behavior (#187775, #188909, #189053, #189576, #188105, #189024, #188825, #188834) - Trace module-level random calls, text-file encoding operations, and additional numeric operator slots (#188235, #188083, #189984, #186296, #189585, #185641) - Improve graph-break, guard-mismatch, in-place-view, backend-name, and exception diagnostics (#185763, #185083, #185903, #189333, #182972, #185508) - Support TVM's Relax frontend and pipeline-based tuning (#189010, #189638) ## Inductor - Make missing CUDA and ROCm warp-size metadata explicit so Inductor skips heuristics that require it instead of silently assuming a warp size of 32. Raise when a code path requires a concrete warp size but the metadata is unavailable (#183014) - Make autotuning subprocesses honor `ZE_AFFINITY_MASK` on XPU while preserving `CUDA_VISIBLE_DEVICES` behavior on CUDA (#183436) - Add a dedicated `XPUCompileError` for SYCL compilation failures and clear loaded XPU libraries when the code cache is reset (#183530) - Make partitioned-scatter selection memory- and contention-aware, enable it by default on ROCm, and replace the removed `partitioned_scatter_memory_budget` setting with memory-headroom controls; set `partitioned_scatter_enabled = False` to opt out (#184365) - Support ROCm Composable Kernel GEMM templates when compiling with the JIT C++ wrapper (#185505) - Fuse decomposed SiLU activations into CUTLASS GEMM epilogues and improve XPU GEMM template compatibility (#186197, #186198) - Accept multiword compiler commands such as `CXX="zig c++"` when building Inductor-generated C++ code on POSIX systems (#186336) - Add Intel Arc B580 and Arc Pro B70 specifications to Inductor's device-performance metadata (#187308) - Lower `uniform_` and `aten.uniform` through a native decomposition instead of always falling back to eager execution (#187887) - Enable Triton indirect-indexing assertions on ROCm with Triton 3.7 or newer, improving diagnostics for out-of-bounds accesses (#188075) - Allow XPU's static launcher to accept host and shared USM pointers recognized by the driver instead of requiring device memory (#188240) - Extend manual communication-overlap scheduling to bucket and defer waits for DDP and HSDP `all_reduce` operations (#188472) - Support grouped and FP8-scaled grouped GEMM Triton lowering on compatible ROCm hardware (#188600, #188742) - Apply per-region Inductor configuration patches throughout nested-region compilation and allow separate forward and backward patches (#189320, #190068) - Decompose semi-structured sparse CUTLASS matrix multiplication so Inductor can lower and autotune the underlying operation (#189366) - Report stuck compile workers and their current phase in structured `tlparse` traces through the configurable compile-worker watchdog (#189485, #189486) - Prefer device datasheet bandwidth for Inductor's bandwidth-driven heuristics and add Intel Data Center GPU Max 1100 metadata (#189819) - Lower `torch.float8_e8m0fnu` conversions directly on CPU and CUDA instead of relying on fallback conversion code (#190593) - Expand NVGEMM epilogue fusion to pointwise operations, multiple outputs, and grouped reductions, including scaled and centered outputs (#190643, #190808, #190809, #190810, #190813, #190817, #190823) - Suppress empty generated-code dumps from `TORCH_LOGS=output_code` during autotuning (#191381) ## Ahead-Of-Time Inductor (AOTI) - Support `int[]`, `SymInt[]`, and optional integer-list arguments in AOTI eager cache keys, enabling cached compilation for operators such as `new_zeros`, `mean.dim`, and `count_nonzero.dim_IntList` (#187360) - Support lazy autotuning when compiling with the AOTInductor dual-wrapper, so Triton autotuning is deferred to a first JIT pass rather than being done during ahead-of-time compilation (#184735) - Support `torch.cond` and `torch.while_loop` when compiling with the AOTInductor dual-wrapper (#184736) - Add an `AOTI_LOG_LOADING` environment variable. When it is set, AOTInductor prints timing and diagnostic messages for each stage of constant loading, prefixed with `[AOTI_LOAD]`, without requiring a rebuild (#186309) - Check the error codes returned by the generated `scatter`, `index_put`, `clone`, and tensor-handle shim calls, so a failure inside one of these fallbacks raises an error instead of being silently ignored (#190909, #190910) ## Export - Support serializing nested integer and floating-point list arguments, including empty nested lists, for custom operators in exported programs (#189424) - Support `ObjectSpec`, `SeqSpec`, and `DictSpec` container types when using shape specifications with strict export (#186167) ## Composability - Add `torch.linalg.vector_norm` to the core ATen decomposition table used by `ExportedProgram.run_decompositions()`, including correct `dim=()` handling (#185735) - Allow out-of-tree backends to define additional `out_dtype` combinations for `torch.mm`, `torch.bmm`, and `torch.baddbmm` under fake/meta tracing; CUDA and XPU restrictions remain unchanged (#187096) - Provide a targeted dynamic-shape error when a data-dependent expression conflicts with a `dynamic_spec` constraint (#187143) ## Foreach - Use the nvmath `_foreach_mm` path only when the loaded cuBLASLt version supports grouped GEMM (#189757) ## ONNX - Preserve constants introduced during export decompositions so `ExportedProgram` remains valid when ONNX symbolic operations are inserted during retracing (#185090) ## C++ Frontend - Enable stable-ABI error-message retrieval dynamically when the required runtime shim is available (#183823) - Treat `-Wdeprecated-declarations` diagnostics as warnings rather than errors in `c10`, ATen, and LibTorch builds (#189948) - Reject negative CUDA storage-resize requests instead of wrapping them to huge `size_t` allocation requests (#190652) ## Release Engineering - Enable ROCm 7.14 nightly manywheel builds through TheRock wheels (#190276) and add `libatomic` to the manywheel builder image (#192254) - Update the bundled Triton to 3.8.0 (#188251, #190349) - Add full CUDA 13.2 CI coverage for stable-version configurations (#190641), Inductor, H100, B200, and `DTensor` (#190948), plus B200 smoke tests (#191705) - Upgrade the XPU support package to 2026.1 (#189593) - Update OpenBLAS to v0.3.34 (#190314) - Update the Arm Compute Library (ACL) version used by aarch64 builds (#191316) - Relax the `nvidia-nvjitlink-cu12` runtime dependency of CUDA 12 wheels so it no longer forces an exact version (#186958) ## CUDA - Add CUDA compute capability 10.7 (`sm_107`) awareness for NVIDIA Rubin GPUs with CUDA 13.4 or newer in extension builds and Inductor code generation (#190654) - Update CUDA compatibility checks for Jetson devices using SBSA binaries with CUDA 13.2 or newer (#186285) - Move green contexts to cuda-python bindings (#185527) - Unify the `CUDAGraph` debug flag, move `debug_dump` to Python, and add capture hooks (#187749) - Trim the `cudaMallocAsync` pool and retry once before raising an out-of-memory error (#188110) - Improve CUDA errors by including excerpts from CUDA logs (#191334) - Add `torch.float16` and `torch.bfloat16` support to `torch.angle` on CUDA (#191301) ## cuDNN - Upgrade the CUDA 12.8, 12.9, and 13.x wheels to cuDNN 9.24 and re-enable convolution engine 5 after its nondeterminism issue was fixed (#187091, #189483) ## CPU (x86) - Add `Half` support to the eager `torch.polar` kernel (#192311) - Allow `xeon/run_cpu.py` to accept multiple values for `--ncores-per-instance` (#169916) ## MPS - Support `return_aux(max_scores=True)` in MPS `flex_attention` forward (#188362) - Support `SymInt` captures in MPS `flex_attention` score and mask functions, including dynamically shaped compiled graphs (#188403) - Add MPS support for `torch.linalg.polar` (#189701) - Support MPS `torch.nonzero` on tensors containing more than `2**32` elements (#188816) - Add complex MPS support for Cholesky factorization (#191836) - Support key/value batch broadcasting and returning log-sum-exp values from MPS `flex_attention` (#187722, #187768) - Add MPS backward support for antialiased bilinear and bicubic 2D upsampling (#188819) - Add complex MPS support to `torch.nan_to_num` and correctly resize empty `out=` tensors (#189489) - Add MPS `torch.geqrf` support and align the MPS `torch.linalg.qr` implementation with other backends (#189192) ## ROCm - Add `torch.utils.hipify` mappings for the `cublasMath_t` type, its enum values, and `CUBLAS_COMPUTE_16F`, so HIP-ported extensions that call `cublasGemmEx` with `CUBLAS_COMPUTE_16F` or set a cuBLAS math mode hipify cleanly without per-project aliases (#187752) - Migrate from `rocm_smi` to `amd_smi` (#190014) - Preload TheRock ROCm dependencies so wheels are self-contained (#188454) - Enable Inductor lowering for FMA on ROCm (#187165) ## XPU - Add device-wide synchronization support on XPU (#191900) - Add IPC memory handle sharing support to `XPUCachingAllocator` on XPU (#188789) - Support head dimensions 32 and 256 for XPU FlashAttention (#180646) - Enable TF32 `fpmath` mode for XPU deconvolution, matching the existing convolution behavior (#185606) - Fix XPU graph-capture hangs by deferring memory-pool block handling until capture ends (#187931) - Refine `clock_rate` and `power_draw` device property queries through `pyzes` 0.1.2 (#188248, #188256) - Add experimental C++ XPU device properties for Xe topology, including `xe_stack_count`, `xe_regions_per_stack`, `xe_clusters_per_region`, and `xe_cores_per_cluster` (#191477) - Support BMG-G31 architecture compilation for the SYCL-TLA CUTLASS backend on XPU (#187040) - Enable the XPU scope profiler to gather hardware metrics through the Kineto plugin (#165766) - Make Inductor use XPU's device-specific TF32 setting so compiled matrix multiplication matches eager behavior (#187948) - Enable SYCL native fast-math approximations for `exp`, `log`, `log1p`, and `tan` on XPU (#176262) ## Sparse Frontend - Add CUDA `float16` and `bfloat16` support to `torch.sparse.sampled_addmm`, including supported sparse-CSR backward paths (#187681) - Add sparse COO dispatch for `torch.linalg.vector_norm`, allowing it to replace deprecated `torch.norm` calls on sparse COO tensors (#185309) ## torch.func - Allow `torch.vmap` to handle the scalar overload of `torch.searchsorted` (#188974) - Expand `torch.vmap` coverage for copy-view operations by routing them through existing batching rules (#187256) - Add a batching rule for `torch.repeat_interleave` when `repeats` is batched; callers must provide a common `output_size` because per-example output lengths are data-dependent (#187702) - Add a native batching rule for in-place `Tensor.masked_fill_()`, avoiding the slow fallback and its performance warning under `torch.vmap` (#175513) - Expand scalar fill and comparison support under `torch.vmap`, including accelerator placement for scalar operands (#189176) # Bug Fixes ## Python Frontend - Fix `torch.arange` computing the wrong length for fractional arguments with an integer output dtype because it truncates those arguments too early (#185812) - Raise a clear unsupported-operation error for dense tensor factories targeting `device="mkldnn"` instead of triggering an internal assertion (#185711) ## Dataloader Frontend - Release CUDA IPC-backed dataset storage when `DataLoader` workers exit, preventing producer-side IPC references and allocations from being retained indefinitely (#190485) ## torch.nn - Enable eligible fused scaled dot-product attention backends for dense rank-3 inputs on CPU, CUDA/ROCm, and XPU instead of always falling back to the math implementation (#192271) Rank-3 inputs are normalized to rank 4 with a singleton batch dimension before backend selection. This fixes fused execution for rank-3 and vmapped inputs, but automatic backend selection can change floating-point numerics, dropout RNG consumption, whether the result is a view, and higher-order-gradient support. Fused CUDA backends do not support the second derivatives provided by the math backend; code that depends on those semantics should explicitly select the math backend. ```python from torch.nn.attention import SDPBackend, sdpa_kernel with sdpa_kernel(backends=[SDPBackend.MATH]): output = torch.nn.functional.scaled_dot_product_attention( query, key, value ) ``` - Reject `norm_type=0` in functional and module Lp pooling APIs with a descriptive `ValueError` instead of a deferred `ZeroDivisionError` (#187861) - Fix failures in memory-efficient scaled dot-product attention backward after `torch.autograd.graph.save_on_cpu()` changes an attention mask's aligned strides (#188246) - Fix a CUDA illegal memory access in memory-efficient scaled dot-product attention backward when only the floating-point attention mask requires gradients (#188302) - Make the cuDNN CTC loss backend correctly zero infinite losses and their gradients when `zero_infinity=True` (#176911) - Validate each output dimension for `replication_pad2d` and `replication_pad3d` so excessive negative padding raises a clear error instead of attempting to create a negative-sized tensor (#184254) - Fix silently incorrect CUDA gradients from channels-last `avg_pool2d` when padding is nonzero (#188345) - Make CPU eager and decomposed `torch.nn.functional.softshrink` cast scalar `lambd` values consistently for reduced-precision inputs (#186358) - Prevent CUDA `avg_pool3d` backward from corrupting gradients when an overlapping-window input contains more than `2**31` elements (#188229) - Reject non-positive `kernel_size` values in raw `fractional_max_pool2d` and `fractional_max_pool3d` operations instead of returning `-inf` outputs with invalid indices (#190480) - Support 64-bit indexing for channels-last CUDA bilinear upsampling so outputs with at least `2**31` elements no longer fail with `CUDA error: invalid configuration argument` (#185788) - Fall back to the ATen CUDA implementation when the fused RMSNorm override's normalized dimension exceeds the device's shared-memory capacity, avoiding compiler hangs or crashes (#186941) - Reject invalid `dim` types when constructing `torch.nn.Softmax` or `torch.nn.LogSoftmax` instead of failing later during the forward pass with a confusing overload error (#185055) - Handle misaligned input and weight storage in the fused RMSNorm override instead of raising `Misaligned Tensor data on argument #0` (#186235) - Make CUDA `float16` softmax with `dtype=torch.float32` use the same persistent-kernel range as the `float16` output path, fixing rounding inconsistencies for dimensions between 1025 and 2048 (#188247) ## Optimizer - Fix skipped updates and incorrect `float16`/`bfloat16` casts in fused CPU `torch.optim.SGD` and `torch.optim.Adagrad` (#192545) ## Autograd - Reject unsupported third-order derivatives for training-mode batch normalization instead of silently returning an invalid result; second-order derivatives and evaluation mode are unchanged (#186779) - Fix `torch.pow` backward when the base is a Boolean scalar by promoting the scalar before computing its logarithm, avoiding an internal assertion failure (#182564) - Fix `torch.pow` backward under `torch.compile(dynamic=True)` when a Python integer exponent becomes symbolic, avoiding the `NYI SymInt equality` crash without specializing on the exponent (#185851) - Make `native_group_norm` and `native_group_norm_backward` safely handle non-contiguous tensors, fixing `vmap` failures and possible out-of-bounds memory accesses (#186414) - Fix the `torch.ldexp` gradient for negative integer exponents so it returns `2.0 ** exponent` instead of zero (#186566) - Fix `DeviceContext` mode leaks during checkpoint recomputation and default-device restoration (#189286) - Fix end-of-backward leaf-stream synchronization across CUDA graph capture boundaries, avoiding opaque `cudaErrorStreamCaptureIsolation` failures and providing an actionable error when the crossing cannot be safely skipped (#189591) - Fix precision errors in the CUDA `native_group_norm_backward` kernel and its decomposition by applying the missing upcasts (#190245) - Stop `register_full_backward_pre_hook`-only modules from emitting a warning intended for `register_full_backward_hook` when their forward inputs do not require gradients (#190685) - Fix max-pooling double backward under `vmap` for channels-last inputs, which previously raised `NYI: querying is_contiguous inside of vmap` (#191678) - Preserve dynamic type names and argument indices in custom `torch.autograd.Function` validation error messages (#191748) - Improve `log2` and `log10` backward accuracy by using named mathematical constants, including a correctly rounded double-precision `log(10)` constant (#192613) ## Distributed - Fix construction of Python `ProcessGroup` subclasses through the `(store, rank, size)` constructor and ensure their virtual overrides are dispatched correctly (#186853) - Select registered custom communication backends instead of incorrectly falling back to NCCL or Gloo when the backend is unspecified (#179901) - Fix compiled DTensor backward paths producing data-dependent guards for valid symbolic local layouts (#187026) - Preserve local Philox seed and offset outputs when expanding DTensor scaled dot-product attention strategies across multidimensional meshes (#187199) - Respect nonzero `root` arguments in `torch.cuda.nccl.broadcast` instead of always broadcasting from the first tensor (#187216) - Fix ring-attention backward using mismatched maximum sequence lengths when context-parallel load balancing is enabled (#185493) - Fix DTensor backward strategies emitting placements for outputs disabled by `output_mask` (#187383) - Preserve the configured FSDP2 gradient-reduction dtype when parameters are frozen during the first forward and later unfrozen (#187376) - Make `torch.distributed.set_timeout()` a no-op for fake process groups and warn rather than fail for backends that cannot configure timeouts (#187693) - Prevent `LocalDeviceMesh` from returning stale coordinates after a temporary submesh is destroyed and its object ID is reused (#187052) - Fix asynchronous coalesced collectives failing CUDA graph capture under `torch.compile(mode="reduce-overhead")` because tensors were retained by the wrong work object (#187433) - Implement `barrier()` for the NCCL symmetric-memory backend instead of raising a not-implemented error (#188051) - Flush distributed-checkpoint streams before `fsync()` so buffered writes are persisted correctly on remote filesystems such as GCS (#183877) - Fix repeated `hipMemMap` calls causing symmetric-memory failures on ROCm (#188673) - Fix custom backend registration with a string `devices` argument incorrectly registering each character as a device type (#187960) - Fix FSDP `summon_full_params(offload_to_cpu=True)` accessing freed storage when the flattened parameter is already on CPU (#188990) - Include the local device in compiled DTensor cache keys so ranks cannot reuse kernels compiled for another device (#188401) - Prevent stale symmetric-memory signal data when virtual addresses are reused by placing and clearing the signal pad at the front of each allocation (#189088) - Fix collective validation, sequence tracking, complex tensors, barriers, and work cleanup in the experimental `nccl2` backend (#190138) - Preserve container object identity when FSDP recursively moves values but their elements do not change (#171617) - Make compile-on-one-rank graphs resolve process groups from their device mesh at runtime instead of serializing rank-specific process-group objects (#188215) - Fix `torch.distributed.nn.functional.broadcast` producing a zero source gradient for subgroups whose local and global source ranks differ (#190583) - Create TorchComms subgroups on the calling rank's actual device, including under launchers that do not set TorchComms rank variables (#189072) - Fix work-object and expandable-segment allocator lifetimes in the experimental `nccl2` backend (#190370) - Return `GroupMember.NON_GROUP_MEMBER` consistently from locally synchronized `new_group` calls on nonmember ranks (#190588) - Support the linear `avg` reduction in functional `all_reduce` backward instead of rejecting it after a successful forward pass (#190224) - Prevent subgroup creation hangs and duplicate-finalization crashes by making subgroup-name salts rank-consistent and finalizing each communicator once (#189073, #189074) - Fix single-operation point-to-point completion ordering and synchronous barrier semantics in the experimental `nccl2` backend (#190622, #190682) - Allow NCCL symmetric memory to use communicators created by the experimental `nccl2` backend (#191109) - Normalize `new_group` ranks through Python's integer protocol so tensor integer ranks work and non-integral values fail clearly (#191377) - Fix simulated `all_to_all_single` with uneven split sizes in `LocalTensorMode` and raise a clear error for inconsistent splits (#190311) - Accept device-qualified Gloo backends in `monitored_barrier` when TorchComms is enabled (#189070) - Prevent `CommDebugMode` hooks from leaking or double-running when a module executes more than once (#191452) - Warn when symmetric-memory collectives are launched concurrently on multiple streams, which can otherwise deadlock (#191482) - Choose a process group's default backend only from backend types that were actually registered (#189193) - Report the correct group-local rank and process-group identifier in NCCL work timeout and error logs (#191440) - Preserve the caller's current CUDA device in the experimental `nccl2` backend and validate full device identities (#191510) - Validate all-to-all split sizes consistently across Gloo, NCCL, and `nccl2` (#191511) - Prevent destroying one TorchComms subgroup from inadvertently destroying every live group (#191637) - Propagate `device_id` through `ProcessGroupWrapper` so debug wrappers do not hang with heterogeneous rank-to-GPU mappings (#182273) - Forward group identifiers through `nccl-lazy` so NCCL symmetric-memory rendezvous can find the primary communicator (#191544) - Reject unsupported reconfigurable mode for `nccl-lazy` instead of advertising incomplete membership-change support (#191549) - Disable NCCL NVLS in `nccl2` when deterministic algorithms are enabled, matching the legacy NCCL backend (#192104) - Prevent `nccl2` watchdog errors, timeouts, explicit aborts, and normal teardown from unconditionally terminating the process (#192105) - Fix Gloo and NCCL `split_group` crashes when the world process group was not the first backend instance created in the process (#192106, #192109) - Fix device-bound `nccl2` process-group initialization failing before the CUDA caching allocator has been initialized (#192107) - Give split and merged process groups independent backend options so child creation cannot corrupt parent metadata or share mutable options (#192110) - Fix `split_group(backend=...)` filtering for parent groups created with a bare backend name (#192111) - Prevent private `TCPStore` rendezvous under `torchrun` from hanging by using the agent store only for the agent's own address (#192113) - Fix `bfloat16` NCCL `PREMUL_SUM` factors being interpreted as zero and silently producing zero gradients (#190747) - Fix a use-after-free race while concurrently dumping Flight Recorder entries (#192232) - Run symmetric-memory allocation and rendezvous device work on the caller's current CUDA stream (#192308) - Recognize libuv's lowercase `address already in use` message when TorchElastic retries `TCPStore` creation (#191561) - Add missing collective-fingerprint checks for `allgather_into_tensor_coalesced` under `ProcessGroupWrapper` (#185123) - Fix DTensor AOT compilation misclassifying overload names containing `out` as output-variant operators (#187466) - Fix compiled functional point-to-point collectives that pass global peer ranks to subgroup operations requiring group-local ranks (#187924) - Preserve pipeline-stage module buffers while dynamic metadata inference runs representative forward and backward passes (#188558) - Fix DTensor backward support for `cumprod`, `cummax`, and `cummin` (#185228) - Make pipeline schedules select static metadata locally when a fake process group cannot perform cross-rank metadata inference, and report incomplete stage metadata clearly (#191538) - Restore the caller's cyclic garbage collector state after Flight Recorder `read_dir()` calls, including when loading fails (#191607) ## Distributed (c10d) - Fix `destroy_process_group()` hanging after collectives run on partially split process groups by keeping group names consistent across ranks (#190431) ## DTensor - Fix compiled functions failing when they return DTensor permutation views such as `transpose`, `permute`, or `movedim` (#191784) - Fix deferred `local_map` export failing inside nested compile regions (#186647) ## Linear Algebra Frontend - Fix `torch.linalg.cond()` reporting a misleading overflow error for a complex norm order; invalid orders now raise `ValueError` with a clear message (#188591) - Fix `torch.lu_unpack` segfaulting when `LU_pivots` has a shape inconsistent with `LU_data`; invalid shapes now raise a clear error (#187660) - Fix `torch.linalg.lstsq(driver="gelsy")` returning an incorrect rank on CPU when stale pivot values leaked between batched LAPACK calls (#187436) - Fix `torch.compile(dynamic=True)` failing on `torch.linalg.cond` with `p="fro"` or `p="nuc"` because symbolic tensor sizes were queried as concrete values (#187614) - Fix offline `TunableOp` tuning silently using the wrong GEMM shape when a padded leading dimension matches another matrix dimension (#189355) - Fix `CUBLAS_STATUS_NOT_SUPPORTED` failures in matrix multiplication on CUDA compute capability 11.0 by increasing the default cuBLAS workspace to 32 MiB (#189312) ## Indexing - Reject nonempty `torch.unravel_index()` inputs whose `shape` contains a zero-sized dimension with a clear `ValueError` instead of an uncaught division-by-zero `RuntimeError`; empty indices remain supported (#191092) - Fix assigning Python integers greater than `INT64_MAX` into `torch.uint64` tensors, which previously raised `Overflow when unpacking long long` (#191604) - Fix an illegal CUDA memory access in `torch.nn.functional.adaptive_avg_pool2d` backward for very large contiguous tensors whose element offsets exceed 32-bit indexing limits (#189082) ## Profiler - Exclude individual Python function events from `key_averages()` by default so frames such as `threading.py: wait` do not obscure operator-level hotspots; pass `include_python_functions=True` to retain the previous view (#188631) - Clamp incomplete Python function events to their parent event's end time so exported traces retain correct nesting instead of placing overrunning events on unrelated tracks (#190950) - Avoid importing the experimental CUPTI monitor during ordinary `record_function` profiling, preventing repeated warnings and tracebacks on systems with incompatible `cupti-python` versions (#187874) - Fix reference leaks when reading the `layout` and `dtype` properties of profiler tensor metadata (#187068) ## FX - Respect deferred runtime-assert bounds when deriving optimization hints for unbacked symbolic sizes, preventing negative storage sizes and downstream CUDA indexing failures (#190589) - Make selected Dynamo, Inductor, and FX tracing state thread-local to prevent race conditions when `torch.compile` is invoked concurrently from multiple threads (#168999) - Fix FX `GraphModule` serialization when generated code contains string type annotations (#185051) - Fix scripting FX-generated modules with nested `Optional[Dict[...]]` annotations on Python 3.14 (#190580) - Skip constant folding for `get_attr` nodes whose targets cannot be resolved or refer to modules (#191939) - Preserve non-persistent buffer registration when an FX `GraphModule` copies attributes, keeping those buffers out of `state_dict()` (#191708) - Fix Z3 translation validation for graphs containing symbolic boolean negation through `torch.sym_not` (#185147) - Fix FX-generated code raising `NameError` for complex constants whose imaginary component is `nan` or `inf` (#188596) - Preserve signed zero when FX code generation emits complex constants with a zero real or imaginary component (#185550) - Apply `skip_folding_node_fn` recursively to `call_module` subgraphs so FX constant folding does not evaluate skipped or symbolic nodes inside them (#189487) - Return valid `tuple[...]` annotations from `get_signature_for_torch_op` for operators that return multiple tensors (#189142) - Avoid a `linecache` loader warning when executing generated FX `GraphModule` code on Python 3.15 (#187221) ## Dynamo - Match CPython errors for invalid `next`, `set`, and `frozenset` calls (#190624, #189051) - Fix `torch.compiler.nested_compile_region` graph reuse, eager autograd, graph capture, and transposed captured buffers (#192006, #184700, #186137, #191785) - Fix nested graph breaks involving generators, hooks, context managers, custom operators, comprehensions, f-strings, and `DeviceMesh` submeshes (#188622, #191388, #187088, #191264, #191523, #189601, #187005, #187701, #188861) - Fix `eager_then_compile` for higher-rank inputs (#184689) - Fix precompile caches, package globals, and guard serialization for tensor subclasses, `torch.func`, and autocast (#191128, #191418, #190576, #191428, #184850, #187736, #184562) - Fix tensor-subclass metadata guards, fake-mode re-entry, metadata replay, and stale metadata after in-place mutation (#184684, #176977, #185732, #187057, #187890) - Fix compiled class definitions, scalar-tensor indexing, non-module globals, and conditional hook handles (#185998, #184625, #184653, #184712) - Graph-break on forward-AD dual tensors instead of silently dropping tangents; `fullgraph=True` now errors (#189644) - Preserve `ctx.needs_input_grad`, autocast state, overlapping-view storage, `vmap` gradients, and captured FlexAttention gradients (#191492, #186530, #187111, #186362, #188869) - Fix compiled-method attribute reads, `TorchDispatchMode` skip state, symbolic lazy modules, and stale tracing weak references (#190185, #190287, #188595, #190951) - Preserve dynamic f-string formatting and Python-side mutation order across graph breaks (#189830, #182638) - Match Python semantics for `vars`, pybind enums, pytree equality, call errors, numeric conversion, descriptors, custom `isinstance`, deque reinitialization, sequence/set operators, subclass types, slice errors, and attribute probing (#185128, #188605, #190649, #190797, #190257, #190776, #186491, #188171, #189554, #189274, #189145, #187777, #190970) - Fix Python 3.12 exception tables and free-threaded/Python 3.15 list-comprehension bytecode (#185731, #187086, #187103) - Fix TorchScript backends, CUDA repro probing, and backend device/dtype classification while preserving third-party minifier configuration (#188875, #185843, #190425, #190426, #187855) - Fix self-referential backward-compiler state when AOTAutograd compiles a second graph (#189325) ## Inductor - Fix handling of `torch.combinations`, indexed `randperm`, dynamic-output custom ops, tensor-subclass standalone compilation, `torch.cond` constants, duplicate kernel registrations, generic `associative_scan`, dynamic combo reductions, empty scatters, autograd `expand`, tuple graph outputs, aliased FX outputs, and fused positional arguments (#189305, #184066, #185601, #185638, #185838, #186262, #186633, #187275, #188466, #188758, #189887, #190255, #190976) - Match eager arithmetic, validation, dtype, NaN/infinity, signed-zero, and overflow semantics across `addmm`, remainder, min/max, low-precision scalar math, unsigned `abs`, CELU, Bessel functions, multiply-by-zero folding, `signbit`, floor division, `cummax`/`cummin`, `cumsum`, adaptive pooling, index propagation, and CPU integer arithmetic (#183511, #185168, #185970, #186818, #186933, #187024, #187321, #187354, #187580, #187941, #188049, #188361, #188556, #188862, #190328, #190427, #190531, #190566, #191132) - Fix wrong or unstable results in CPU outer-loop and Halide fusion, nested/split/TMA reductions, MPS special functions, scheduler-recomputed gradients, CPU `expm1`, small transposed GEMMs, and noncontiguous `uniform_` (#185855, #186121, #188771, #189291, #189896, #185873, #190533, #191127, #191709, #192344) - Fix CPU code generation for vectorized atomics and boolean `index_put_`, including an out-of-bounds atomic that could produce wrong results; fix max-autotune failures with reused GEMM inputs or outputs and zero-hinted symbolic rows (#185325, #185767, #186523, #191502, #191861, #192553) - Fix `_scaled_mm` scale-shape compilation; fall back safely for `_scaled_mm_v2` with swizzled MXFP8/NVFP4 scales; and fix complex signatures, `float8` storage, dtype bitcasts, and CUTLASS INT8 target filtering (#183964, #185501, #186384, #188209, #189561, #189584, #192414) - Fix convolution and attention pattern selection or fallback correctness for dynamic bias, transposed or dilated convolution, CUDA convolution backward, `ConvTranspose2d`, and unsupported 3D SDPA key permutations (#184132, #186067, #187372, #189660, #191260) - Fix dynamic-shape and symbolic-expression failures in split ranges, adaptive pooling, AOTI autotuning, regional wrappers, TMA `addmm`, `torch.cond`, fused epilogues, stride guards, tiling, and FX wrappers (#184566, #185369, #185778, #185890, #187371, #189529, #189890, #190965, #191605, #191811) - Prevent index-expression overflow, unsound loop-index inversion, and negative modular-term miscompilations (#186060, #189108, #190401, #190966) - Fix FlexAttention errors and wrong results involving large or sliced buffers, invalid `score_mod`, kernel options, sparse masks, and mixed or 64-bit captured indices (#185264, #185991, #186876, #187886, #187904, #188484, #188876) - Fix ordering and races in multi-stream event/control-dependency graphs, aligned input copies, bidirectional synchronization, replacement-created intermediates, captured events, and cross-warp reductions; honor `torch.use_deterministic_algorithms()` for compiled scans (#183803, #183804, #186022, #186023, #186025, #187224, #188533, #189095, #189096, #190519, #191714) - Fix premature reuse, leaks, and races in memory planning, cached launchers, failed autotuning, dynamic reduction caching, mutation dependencies, fallback storage reuse, and saved compiler-cache loading (#187678, #188607, #188907, #189124, #189288, #189735, #192526) - Reject incompatible custom-Triton epilogue fusion, fall back when descriptor alignment or template tiling is unsupported, and serialize custom-kernel `Enum` metadata correctly (#184248, #186922, #186932, #187209, #189494) - Fix CUTLASS and NVGEMM compilation, worker initialization, XPU wrapper selection, reshaped epilogues, newer CuTeDSL compatibility, target filtering, cache reentrancy, and CUDA Graph outputs (#186385, #186791, #187404, #188865, #189775, #189780, #189781) - Gate TF32 warnings, use an NVML clock-rate fallback, report CUDA Graph skip reasons, fix CUDA Graph capture for `torch.linalg.eigh`, and suppress internal `TypedStorage` warnings (#185541, #187427, #188384, #188641, #191383) - Fix imports, compiler probes, workers, template decoding, and generated builds across vendored `typing_extensions`, localized MSVC output, initialized CUDA, Windows path limits, Python 3.11/3.12, UTF-8 templates, dead workers, and library paths containing spaces (#185708, #185972, #187408, #187641, #187700, #189196, #189290, #191010) - Fix AOTInductor floor division by captured tensor constants, CUDA architecture packaging, and constant-graph code generation with lazy autotuning (#186242, #187888, #190073) - Fix duplicate MPS Metal kernel names and XPU compiled RNG or quantized tensor-subclass handling (#187894, #189310, #189509) - Fix manual collective-bucketing graph order and register DTensor shard-all-to-all autograd while adding an opt-in functional decomposition (#187341, #188137) - Restrict ROCm Origami GEMM selection to static shapes to avoid dynamic-shape `NoValidChoicesError` (#190024) ## Ahead-Of-Time Inductor (AOTI) - Fix compilation and dispatch failures for C++ wrapper fallback operators with `Any` arguments, including distributed operators such as `all_gather_into_tensor` (#188124) - Route custom operators with `SymInt`, `SymBool`, or `SymFloat` arguments through boxed C++ wrapper dispatch, avoiding runtime `API call failed` errors (#188154) - Box `None` passed to non-optional tensor arguments as an undefined tensor in C++ wrappers, matching eager custom-operator behavior (#188485) - Prevent C++ wrappers from dereferencing a null tensor handle when a Python fallback operator returns a one-element `Tensor[]` (#190551) - Emit portable `std::array::data()` pointers in generated CPU wrappers instead of relying on iterator-to-pointer conversion (#191240) - Package AOTInductor CUDA multi-architecture kernels for the requested deployment architecture instead of the physical compilation GPU (#185328) - Fix AOTInductor C++ wrappers recovering integer symbols from composed dynamic sizes through floating-point division, which could truncate valid runtime dimensions (#185841) - Fail fast with a clear error when loading a CUDA AOTInductor package in a process without CUDA or ROCm available (#186943) - Fix C++ wrapper fallback output indexing for mutable custom operators and remove invalid 16-byte alignment assumptions for misaligned tensor views (#187331) - Preserve C++ wrapper input slots when graphs contain Python-only custom-class inputs (#188030) - Pass the device the model was actually loaded on to custom operator fallbacks, instead of the device recorded when the model was compiled. Previously a model compiled for one GPU and then loaded on another would hand the wrong device to its custom ops (#184741) - Synchronize the default stream after copying model constants on AMD GPUs, fixing a race in which inference could read constants before the copy had completed (#186963) - Fix a 32-bit integer overflow when computing the SYCL global launch range in the AOTInductor runtime, which produced incorrect launch dimensions for large grids on XPU (#187307) - Release AOTInductor input tensor handles when runtime input validation fails, preventing a GPU memory leak (#189503) - Release untransferred AOTInductor constants when runtime constant folding fails, preventing a memory leak on the error path (#189505) - Prevent an AOTInductor constant-folding segmentation fault on XPU when no stream is provided (#189517) - Make the C++ wrapper's debug synchronization device-aware, fixing a regression on ROCm (#190071) - Fix a missing CUDA header in the generated constant graph when compiling with the dual-wrapper, which made the generated code fail to compile (#191050) - Skip CUDA stream event code generation in the AOTInductor C++ wrapper on XPU, where those APIs do not apply (#190637) ## Export - Fix `torch.export` dynamic-shape specifications for functions with `**kwargs`, accepting both call-like keys and specs nested under the variadic parameter while reporting ambiguous name collisions as `UserError` (#185730) - Prevent `ExportedProgram.module()` from raising `RecursionError` while generating guard messages for deeply nested symbolic-shape expressions (#186993) - Fix `torch.export.unflatten` failing to restore parameters, buffers, and constants for non-contiguously numbered repeated module calls (#188185) - Fix strict export of parameters from modules stored in unregistered Python containers by treating the traced-only parameters as constants instead of attempting to restore them from the eager module's state (#185728) - Fix non-strict export of tensor indexing under `vmap` when the index is a batched scalar tensor (#186894) ## AOTDispatcher - Resolve nested `AsyncCollectiveTensor` inputs before AOTAutograd tracing so compiled forward execution waits for in-flight data and backward metadata expects the correct local-tensor cotangents (#186442) - Prevent activation-memory-budget partitioning from crashing with `expected all tensors_saved_with_vc_check to be Tensors, got [Tensor, tuple]` when a required multi-output node is marked `MUST_SAVE` (#188014) - Prevent AOTAutograd common-subexpression elimination from merging forward-only values with nodes required by backward, preserving correct partitioning and reduction fusion (#184044) - Fix backward graphs missing symbolic-integer bindings by preserving both raw symbols and their ShapeEnv replacement targets, preventing unbound guard expressions and `FxGraphCache` lookup failures (#185473, #189783) - Fix incorrect alias-output slicing when Inductor clones a misaligned input (#191002) - Move `invoke_subgraph` inference-mode input mutations to the AOT epilogue so they are applied correctly (#191672) - Fix `control_deps` handling in the partitioner during forward/backward extraction (#187695) - Support mutable (`Tensor!`) custom ops in input-mutating `invoke_subgraph` regions by routing them through Python functionalization (#189543) - Fix common subexpression elimination (CSE) to correctly deduplicate NaN constant tensors by normalizing float/complex hashing and comparison (#191173) ## Composability - Raise `NotImplementedError` for unsupported Boolean operations and distinguish unsupported FFT dtypes from invalid real/complex domains with `NotImplementedError` and `TypeError` (#192348, #192349) - Preserve eager identity semantics for no-op dropout decompositions, preventing `torch.compile` and `torch.export` from replacing a `Parameter` with a cloned fake tensor when dropout is disabled (#185335) - Fix compiled `torch.nn.functional.multilabel_margin_loss` values and gradients when targets use `-1` padding (#189552) - Fix `torch.nansum` meta output shapes when `dim=()` should reduce all dimensions (#191530) - Make the `constant_pad_nd` reference decomposition fully functional so `torch.onnx.export(dynamo=True)` no longer fails functionalization for models using `torch.nn.functional.pad` (#185636) - Keep `torch.istft` length clamping and padding symbolic under dynamic shapes, avoiding recompilation and data-dependent guard failures when the requested length crosses the signal length (#186490) - Make compiled and fake/meta `torch.aminmax(..., out=...)` enforce the same exact output-dtype requirements as eager execution (#186227) - Make compiled `torch.nn.functional.celu` reject `alpha=0` with the same error as eager execution (#179375) - Avoid data-dependent guard failures in fake/meta tracing of native multi-head attention with unbacked symbolic sizes (#187144) - Avoid data-dependent guards in `torch.nn.utils.rnn.pad_sequence` decompositions when sequence lengths are symbolic (#187145) - Make the CUDA `native_layer_norm` decomposition reject mixed affine-parameter dtypes in the same cases as eager execution (#185693) - Fix incorrect compiled output and gradients for overlapping-input `torch.diagonal_scatter` operations (#182292) - Match compiled `max_unpool2d` output strides and channels-last memory format to eager CPU execution (#186602, #187195) - Route meta `view` operations through the symbolic-shape-aware kernel, avoiding `SymIntArrayRef expected to contain only concrete integers` failures (#189447) - Avoid data-dependent guard failures in the transformer encoder layer meta kernel when the input size is an unbacked symbol (#187860) - Prevent fake/meta decompositions of in-place operations from silently resizing their destination when operands cannot broadcast to its shape; compiled execution now raises the same shape error as eager execution (#191373) - Preserve symbolic tensor, scalar, and unbacked-binding metadata across `ProxyTensor` and `make_fx` tracing (#187231) - Preserve loop-local value ranges and use known ranges when simplifying symbolic `Min` and `Max` expressions, avoiding `vr must not be None` and spurious data-dependent guard failures (#187350, #186248) - Fix symbolic proxy tracing and repeated lowering edge cases involving natural powers, `torch.cond` contiguous-stride expressions, and equivalent rebound unbacked symbols (#188278, #189525, #190083) - Fix silently incorrect second-order gradients from post-dispatch `make_fx` tracing by decomposing `detach` by default; callers that provide an explicit decomposition table retain the previous behavior (#186845) ## Quantization - Fix a divide-by-zero crash (`SIGFPE`) in `torch.quantize_per_channel` on the per-channel `float_qparams` path for the `qint32` dtype; whole-byte quantized types now pack correctly instead of underflowing the packing factor to zero (#186767) - Add the missing overflow check to the FBGEMM build of the ARM `quantize_val` path, fixing incorrect quantized values that showed up as quantization test failures on some hardware (#187481) - Fix a GPU memory access fault that aborted quantized `embedding_bag` byte and 4-bit rowwise lookups on ROCm, caused by a bitwise-AND typo in the bit-field extraction primitive (#192571) ## Foreach - Prevent out-of-bounds metadata writes in CUDA foreach operations with complex scalar lists by respecting their reduced per-launch tensor capacity (#189915) ## ONNX - Fix signed right-shift export in the TorchScript exporter so negative values round toward negative infinity as they do in PyTorch (#191226) - Fix quantized `gather` export by unpacking quantized tensor inputs before lowering (#188272) ## C++ Frontend - Fix a memory leak when converting `StableIValue` to `std::string` (#190493) - Remove `noexcept` from `TensorMaker::computeStorageSize()` (#188062) - Fix uninitialized return in Chebyshev polynomial helpers for NaN inputs (#187767) - Guard the `Scalar(long long)` constructor on NetBSD and other LP64 BSDs (#188941) - Replace `FileBaton` with `filelock` to prevent stale-lock deadlocks in `CppExtension` (#190543) - Fix floating-point-to-integer range checks at wide-integer boundaries in `c10/util/overflows.h` (#190651) ## Build Frontend - Fix source-build linker failures on systems where CMake reordered static and shared libraries by linking `libcpuinfo` through the `c10` shared library instead of linking it separately into both `c10` and `torch_cpu` (#167328) - Fix Windows ARM64 builds failing to register a CPU quantized backend by recognizing the uppercase `ARM64` CMake processor name and enabling oneDNN (#189346) ## Release Engineering - Fix invalid ZIP64 archives for ROCm wheels larger than 4 GB by repackaging them with `auditwheel` (#189903) - Prevent an intermittent deadlock during `import torch` with ROCm wheels by shipping a bare `.so` alias (#189114) - Fix missing CUDA dependencies when extracting LibTorch from a wheel, which previously left the extracted tree with unresolved RPATHs (#184336) ## CUDA - Fix CUDA graph kernel-annotation remapping across sequentially captured graphs and with `keep_graph=True` (#186638, #187741) - Fix a heap overflow in `CachingHostAllocator` when rounding is disabled (#192722) - Preserve signed zero in `relu` and `clamp` (#185354) - Fix `int32` overflow in `embedding_bag(mode="max")` backward (#188661) - Include CUDA graph memory pools in `memory_reserved()` (#186809) - Use 64-bit sample offsets in `NLLLoss2d` backward (#190144) - Fix remap extents, causal key bounds, and 32-bit dropout offsets in memory-efficient attention (#192138) ## cuDNN - Fix cuDNN variable-length SDPA (#172108) - Disable cuDNN convolution engines 58 and 63 on `sm120` to prevent illegal memory accesses (#190112) - Declare the attention-mask dtype to cuDNN instead of inheriting the graph I/O dtype (#191612) - Update the cuDNN errata filter for `sm120` (#191701) ## CPU (x86) - Fix incorrect results from CPU flash SDPA when the innermost dimension of the inputs is not contiguous (#187506) - Prevent the Laguerre and Legendre polynomial kernels from returning uninitialized memory (#188027) ## CPU (AArch64) - Fix an integer overflow in the `bfloat16`/`float16` GEMM staging-buffer size calculation, which could corrupt results or crash on large matrix multiplications (#191096) - Fix CPU `embedding_bag` using the wrong index count for `scale_grad_by_freq`, producing incorrect gradients (#190264) ## MPS - Fix compiled MPS operations such as `torch.eye(256)` failing with `KeyError` when Inductor generates unsigned 16-, 32-, or 64-bit index expressions (#192020) - Preserve the MPS dispatch key through `torch.func` transforms so MPS autocast and autograd work under transforms such as `vmap` and `grad` (#187282) - Reject complex MPS average-pooling inputs with `NotImplementedError` instead of an internal MPSGraph error (#187671) - Propagate NaNs correctly through MPS scaled dot-product attention kernels (#188147) - Raise a clear error when MPS batch normalization receives an unsupported dtype (#188265) - Fix corrupted MPS prefill-attention output on macOS 26 by selecting the correct Metal cooperative-tensor ABI (#191794) - Fix Metal argument alignment that could make MPS kernels fail validation or crash under the Metal debug layer (#191640) - Fix `torch.hypot` producing incorrect results for extreme values (#192541) - Handle empty indices in MPS `index_add` and empty dimensions in threshold, `baddbmm`, and `addbmm` operations (#186990, #187719, #188808, #187879) - Fix `mm` and `addmm` with strided output tensors on macOS 14 and 15 (#187255) - Respect `storage_offset` when an MPS binary operation consumes a zero-dimensional CPU tensor view (#187229) - Make MPS `baddbmm` follow its documented behavior by not propagating NaN or infinity from the input when `beta=0` (#187522) - Fix MPS linear backward for inputs with more than four dimensions and prevent complex high-rank linear operations from aborting on macOS 27 (#187379, #190352) - Prevent `BatchNorm` backward from crashing for channels-last MPS tensors (#188371) - Fix incorrect MPS Conv2d output when a kernel spatial dimension is at least 256 (#188359) - Match CPU and CUDA nonfinite-value semantics for MPS `torch.div(..., rounding_mode="floor")` (#189252) - Make MPS-backed pinned memory correctly appear as a CPU tensor while retaining its shared Metal buffer (#181720) - Prevent dtype-converting MPS-to-CPU copies from overwriting their source and correctly copy non-dense views with matching strides (#189572, #189966) - Compute integer absolute values exactly instead of rounding through `float32` (#190053) - Handle zero `in_features` in MPS linear forward and backward without aborting (#190051) - Fix `torch.nextafter` returning its input unchanged for MPS `bfloat16` tensors (#190481) - Preserve exact integer values in MPS `torch.linspace` for large ranges (#189630) - Fix `int64` minimum and maximum reductions returning zero when a partial SIMD group contains only negative or positive values (#191104) - Fix adaptive max pooling for input sizes that are not divisible by the output size (#189659) - Fix large matrix multiplications producing incorrect results on M1 and M2 GPUs (#183535) - Keep MPS exponential samples strictly positive so `torch.multinomial(..., 1)` cannot select a zero-probability entry (#192621) - Make CPU and MPS `torch.logit` agree with other backends when `eps > 0.5` (#181297) - Fix MPS FFT operations when a transformed dimension is not among the tensor's final four dimensions (#186967) - Fix `torch.nn.functional.linear` dropping its bias for vector-shaped inputs on macOS 26 (#188619) - Raise clear unsupported-dtype errors for complex MPS inputs to `cummax`, `cummin`, and `logaddexp2` (#188038, #188800) - Fix MPS ternary-kernel dispatch for large tensors and mixed-dtype `out=` tensors, including `torch.clamp` (#189624) - Apply inter-layer dropout correctly in MPS LSTM backward and avoid NaNs when `dropout=1` (#190059) - Improve MPS layer-normalization correctness for small-variance rows and add 64-bit indexing support (#190492) - Fix biased MPS linear operations corrupting rows when a batch dimension exceeds 2^16 (#189496) - Validate MPS `EmbeddingBag` offsets consistently with CPU and CUDA instead of silently returning incorrect results (#187572) - Support `float32` affine parameters with `float16` or `bfloat16` MPS layer normalization in forward and backward (#190055) - Match CPU and CUDA RMSNorm precision by performing the fused affine multiplication in float32 (#189617) - Fix Conv2d forward and backward with non-contiguous MPS weights (#192303) - Raise clear unsupported-dtype errors for complex `igamma`/`igammac` and boolean `torch.linalg.cross` inputs on MPS (#188134, #187274) - Prevent intermittent crashes when stopping a Metal capture by draining work from all active MPS streams first (#191362) ## ROCm - Fix `torch.nn.functional.interpolate` with `mode="nearest"` failing on large channels-last inputs with `torch.AcceleratorError: HIP error: invalid configuration argument`. The channels-last `upsample_nearest2d` forward kernel launched a grid whose total thread count exceeded HIP's `UINT32_MAX` limit once the output approached 2^32 elements; this was a regression from 2.9 that showed up in diffusion VAE decode at large batch sizes (#180310) - Fix incorrect `torch.nn.LayerNorm` results for tensors with a very large number of rows when the normalized size is not a multiple of 4. The non-vectorized fallback exceeded HIP's launch limit; it now uses a grid-stride loop over rows (#186956) - Fix `torch.cuda.make_graphed_callables` failing to capture, or hanging, on ROCm when the callable uses hipBLASLt. Warmup and capture now run on the same stream so the hipBLASLt handle is created and cached before capture instead of being lazily created mid-capture (#187745) - Fix graph-capture error handling on ROCm 7.14 and later by using HIP's native capture errors instead of the compatibility precheck required by older ROCm versions (#187110) - Fix transposed convolution failing with `miopenStatusBadParm` when the computed spatial output is zero-sized. MIOpen rejects zero-length tensor descriptors, so these cases now short-circuit to an empty output (and zero gradients in backward), matching cuDNN and CPU behavior (#187431) - Fix a meta-kernel shape mismatch for memory-efficient scaled dot product attention on ROCm. The meta registration padded the log-sum-exp dimension to a 32-element alignment as CUDA does, while the ROCm backends return a compact log-sum-exp, breaking nested tensor SDPA backward and `torch.compile` (#190723) - Fix the memory-wait instructions used by the atomic-store commit path on `gfx10`, `gfx11`, and `gfx12` GPUs. These architectures have separate load and store counters, and `gfx12` renames the wait instructions, so the wrong instruction was previously emitted (#188067) - Fix failures when building HIP C++ extensions on Windows with `Don't know how to compile <file>.hip`. `.hip` sources produced by hipify are now registered with the MSVC compiler so they are dispatched to `hipcc` (#187665) - Fix out-of-bounds accesses in CK SDPA for tile-unaligned shapes by padding sequence-length allocations (#187152) ## XPU - Fix compiled `torch.signbit` for `float64` inputs on XPU by avoiding an incorrect Triton XPU signature (#188818) - Fix compiled `multi_margin_loss` with weights on XPU by using one-dimensional indexing in its decomposition (#188770) - Handle empty tensor inputs correctly in XPU `addmv` (#174193) - Fix oneDNN SDPA with GQA and a broadcasted mask on XPU (#190503) - Fix `max_unpool2d` channels-last stride mismatch on XPU (#190189) - Fix `bmm_outer_product` Triton override to support XPU tensors (#188783) - Raise `RuntimeError` instead of crashing when XPU cannot allocate a pinned host-memory buffer (#189681) - Route `GPU_USER_ANNOTATION` Kineto profiler events to `DeviceType::XPU` (#191841) ## Functorch - Fix a crash in `torch.func.vmap` when `out_dims=-1` and the mapped function returns an output that is independent of its vmapped input (#178495) ## JIT - Make TorchScript reject bare `list` and `tuple` value annotations consistently with `Attempted to use list without a contained type` or the equivalent tuple error; specify an element type such as `list[int]` instead (#188779) - Fix runtime compilation of JIT fuser kernels on ROCm 7 when HIPRTC's `bfloat16` conversion symbols collide with PyTorch's embedded definitions (#185656) - Fix `torch.jit.script` failing with `Cannot re-assign modules in a ScriptModule with non-scripted module` when a wrapper contains an already-scripted child with a `__jit_ignored_attributes__` submodule (#187863) ## Sparse Frontend - Create cuSPARSELt handles per device so sparse operations remain valid when a thread switches between CUDA devices (#189048) - Make grouped-matrix, batch-normalization, and sparse-matrix operations on ROCm Windows raise clear unsupported-operation errors instead of crashing with access violation `0xC0000005` when optional libraries are unavailable (#191680) # Performance ## Python Frontend - Reduce Python custom-op dispatch overhead and speed up CPU quantiles with partial selection (#187949, #186175, #188394) ## torch.nn - Reduce `linear_cross_entropy` memory and chunking costs, and avoid materializing RMSNorm copy-on-write tensors (#187219, #187838, #189202) ## Autograd - Reduce `autograd.Function.apply` overhead and constant-fold more generated backward formulas (#189582, #189788, #189800, #189577, #192611) ## Distributed - Balance packed-document context-parallel attention across ranks (#189902) ## Symmetric Memory - Improve symmetric-memory all-gather, peer-copy overlap, and large-scale rendezvous (#185359, #192530, #192623) ## Linear Algebra Frontend - Speed up CUDA `addmm`, batched LU factorization, and viewable batched `matmul` (#191706, #181998, #186178) ## FX - Speed up unused-submodule deletion and reduce boxed-call peak memory (#178320, #187186) ## Dynamo - Reduce compiled-call and TVM overhead and speed up native `itertools` tracing (#190390, #190571, #190392, #186973, #186974, #189012) - Avoid unnecessary guards, recompiles, and FlexAttention cache misses (#187782, #189482, #185739, #188177) ## Inductor - Reduce RNG clones, tune RDNA3 FlexAttention and ROCm reductions, enable XPU linear fusion, and enable Origami for ROCm max-autotuning by default (`TORCHINDUCTOR_ORIGAMI=0` opts out) (#188495, #177840, #181854, #183364, #186644) - Reduce combo-kernel, guard, NVGEMM-cache, and CPU expression overhead (#184323, #184752, #185966, #185967, #187013, #186356) - Improve combo and persistent reductions, XPU fallbacks, and optional `cat_linear` fusion (#186668, #186957, #187147, #187880, #187940, #188179, #188180) - Improve NVGEMM isolation and decode tuning, Blackwell split reductions, and host-side TMA launches (#188303, #188579, #188646, #188822) - Optimize FlexAttention predicates, broadcast-bias `baddbmm`, small GEMMs, softmax, and Triton 3.8 defaults (#188929, #189127, #189149, #189162, #189187) - Improve NVGEMM small-M and block-scaled kernels, compilation, launching, and caching; profile ten configurations by default (`TORCHINDUCTOR_NVGEMM_MAX_PROFILING_CONFIGS=5` restores five) (#189771, #189777, #189805, #189773, #189778, #189779, #189806, #189841, #189807) - Optimize Triton min/max with relaxed signed-zero ties (`torch._inductor.config.strict_signed_zero=True` preserves eager ties), combo-kernel register use, fusion locality, FlexAttention code generation, and peak-memory scheduling (#190404, #190689, #191349, #192247, #192449) - Reduce fusion-analysis, repro-generation, and symbolic-comparison overhead (#192675, #192818, #192819) ## Ahead-Of-Time Inductor (AOTI) - Add opt-in pinned asynchronous AOTInductor constant loading through `AOTI_COPY_USE_PINNED_ASYNC=1` (#186258) ## Export - Make large-graph export decomposition scale linearly (#177927) ## AOTDispatcher - Avoid an unnecessary `Tensor.detach()` in AOTAutograd backward (#189759) ## Composability - Reduce dynamic-shape tracing and wide-symbol substitution costs (#192677, #185884) - Optimize `reciprocal(sqrt(x))` and BatchNorm inference with `rsqrt` (#190206) ## Quantization - Speed up bias addition in dynamically quantized `float16` CPU linear layers (#189943) ## CUDA - Avoid synchronization and redundant initialization in CUDA kernels, optimize FFT fill, and tune Rubin elementwise kernels (#186508, #190269, #190953, #190546) ## cuDNN - Reduce cuDNN convolution cold-start overhead (#187212) ## MPS - Move interpolation, logical, indexing, Mish, median, and range operations to faster native Metal kernels (#186989, #187324, #187109, #187906, #187060, #188905, #188921, #191060) - Speed up Cholesky, LU factorization and solves, GEMV, and sequence-length-one linear decoding (#187022, #187038, #189200, #186927, #189855) - Optimize full, strided, batched, variance, normalization, and arg/min/max reductions (#187313, #188412, #191101, #191097, #191098, #191099, #191100) - Reduce allocator fragmentation, decoding memory, and synchronization overhead (#187441, #190438, #190115) - Optimize FlexAttention, 3D convolution, GLU, sigmoid, and log-sigmoid; accelerate attention prefill on supported macOS versions and GPUs (#188663, #188802, #192229, #187833, #187151, #187228, #182256) - Speed up concatenation and sliced-view copies, including pinned transfers (#188200, #188483, #188613, #189512) - Fix incorrect large-`int64` results while optimizing flat `torch.unique`, and reduce `torch.nonzero` memory use (#184780, #191274) ## ROCm - Prefer hipBLASLt on additional ROCm architectures (#185375) ## XPU - Fuse low-precision upcasts into XPU softmax and reduction kernels (#189999) ## JIT - Reduce JIT startup and compilation overhead (#181118, #188121, #183813) # Documentation ## Python Frontend - Document all accepted device-like arguments for `torch.set_default_device`, including integer accelerator indices and `None` (#187240) - Document the tensor-factory keyword arguments accepted by the `torch.normal(mean, std, size)` overload (#187820) - Clarify that the `index` argument to `Tensor.index_reduce_()` selects positions in `self` to accumulate into, rather than positions in `source` (#189008) - Document that `torch.searchsorted` does not validate sorting and has undefined behavior for unsorted input when no `sorter` is provided (#184888) - Correct the `torch.arange` dtype-inference note to refer to the `step` argument instead of the nonexistent `stop` argument (#188943) - Add docstrings for top-level in-place functions that have out-of-place equivalents (#189571) ## torch.nn - Clarify that `torch.nn.functional.gaussian_nll_loss` uses `eps` to clamp `var` to a minimum rather than adding it to `var` (#190058) - Add deterministic example output to the `torch.nn.Tanh` documentation (#189390) - Correct the documented `mat_b` shape for `torch.nn.functional.grouped_mm` and explain how to pass grouped linear weights (#191610) - Correct the `ceil_mode=True` output-size formula in the `torch.nn.MaxPool1d` documentation (#188735) - Document that repeated calls to `torch.nn.Module.parameters()` return parameters in a deterministic order when the module is unchanged (#189990) ## Optimizer - Fix incorrect learning-rate curves in the `torch.optim.lr_scheduler.ChainedScheduler` and `torch.optim.lr_scheduler.SequentialLR` documentation (#186468) ## Distributed - Correct typos in distributed memory-analysis documentation and related distributed and utility docstrings (#187079, #189357, #190827) - Document the callback signatures, return values, keyword-argument behavior, and usage of `distribute_module` (#188071) - Correct PyTorch brand name capitalization in distributed checkpoint and other documentation (#189248) - Document the experimental process-group reconfiguration APIs and provide an end-to-end usage example (#191384) - Document how to enable and verify NCCL symmetric-memory kernels through registered memory pools or symmetric-memory rendezvous (#192515) ## Linear Algebra Frontend - Clarify `torch.linalg.norm`, `torch.linalg.matrix_norm`, and `torch.linalg.vector_norm` behavior for complex inputs, and correct the documented `ord` values accepted by `torch.linalg.vector_norm` (#190381, #188204) ## Dynamo - Link the guard-overhead page to the developer blog post and document a profiler-based way to measure guard overhead (#191387) ## ONNX - Clarify that `output_names` labels outputs but does not reorder them (#175796) ## XPU - Update the XPU documentation with newly supported operating-system versions and simplified installation instructions (#187923, #190992) # Security ## Python Frontend - Validate tensor shapes and sequence bounds in `torch.quasirandom.SobolEngine` before native kernels index direction-number tables (#191198) - Make stream comparisons with non-stream objects safe and Python-consistent: equality returns `False`, `stream != None` now returns `True` instead of `False`, and ordering comparisons raise `TypeError` instead of returning `False` (#192523) ## torch.nn - Validate `grad_output` shapes in 2D and 3D `grid_sample` backward operations before CPU, CUDA, or MPS kernels can read out of bounds (#191915) - Validate channel counts in `replication_pad1d` and `replication_pad2d` backward operations to prevent out-of-bounds reads and segmentation faults (#189463) - Validate `mean`, `invstd`, and `counts` shapes before CUDA batch-normalization statistics gathering to prevent out-of-bounds reads (#190005) ## Distributed - Add an opt-in `weights_only=True` mode to distributed object collectives for restricted deserialization; the default remains unchanged for compatibility (#189353) - Validate symmetric-memory signal channels and peer ranks to prevent out-of-bounds device-memory access and adjacent-allocation corruption (#191596, #191842) - Parse Flight Recorder rank expressions with `ast.literal_eval()` instead of executing them with `eval()` (#191490) ## Mobile - Reject malformed mobile FlatBuffer modules whose function class-type index is out of range, preventing an out-of-bounds access and crash during loading (#186672) ## Sparse Frontend - Always validate sparse-tensor invariants when loading with `torch.load(..., weights_only=True)` so malformed checkpoints cannot create tensors whose indices cause out-of-bounds reads (#184750) Validation is an O(nnz) scan and applies regardless of the global `torch.sparse.check_sparse_tensor_invariants` setting. Fix or regenerate malformed sparse checkpoints that now raise errors such as `RuntimeError: size is inconsistent with indices`. Do not use `weights_only=False` as a workaround for untrusted files. # Developers ## torch.nn - Integrate Helion with the native-DSL registry and add reusable kernel instrumentation (#190636) ## Distributed - Extend process groups for reconfiguration, one-sided windows, lifecycle hooks, backend-routed rank/size, and safe ROCm builds (#186888, #186298, #186299, #186300, #187467) - Modernize RPC and backend extension APIs with atomic shared pointers, canonical `_single` collectives, custom-op `ProcessGroup` inputs, and Python entry points (#185633, #187140, #187459, #187388) - Support optional NCCL expert parallelism and keep experimental `nccl2` builds portable (#187366, #187385, #189938, #189958) - Add TorchElastic error enrichment, update sequence-number and `FakeStore` interfaces, and expose a backend-agnostic Flight Recorder hook (#187098, #188611, #189259, #189363) ## Distributed (c10d) - Add fake-backend `split_group` support and correct c10d type stubs (#186290, #191633) ## Symmetric Memory - Add the `USE_NCCL_EP` source-build option (#177437) ## Profiler - Add CUDA graph lifecycle hooks for the experimental CUPTI monitor (#191299) ## FX - Add source-stack provenance to compiler profiler timelines and preserve device indices in minifier repros (#186230, #186547) ## Dynamo - Make generated graphs and repros deterministic and robust for higher-order operators, symbolic storage sizes, and non-UTF-8 diagnostics (#181775, #186804, #190838, #190696) ## Inductor - Improve compiler provenance, custom-pattern matching, wrapper timing, and repro serialization (#183952, #184419, #187936, #190728) - Add optional external TLX backend integration (#189094) ## Ahead-Of-Time Inductor (AOTI) - Add optional kernel-context metadata for generated C++ wrappers (#184513) ## Export - Improve raw Triton export errors and draft-export report readability (#185827, #186070) ## C++ Frontend - Add portable lifetime annotations across borrowed C++ APIs (#190076, #190077, #190075, #190074, #189912) - Enforce C++20 headers and add safer integer conversions and borrowed-range support (#178150, #190092, #186635) ## Developer Experience - Add the contributor-facing `spin docs` wrapper (#182814) ## Build Frontend - Limit concurrent FlashAttention compilation and update `clang-tidy` (#192305, #191111) ## Release Engineering - Migrate builds from `setuptools` to `scikit-build-core` (#180247) ## MPS - Regenerate bundled Metal headers when sources change and clean up newer-SDK compiler warnings (#189179, #187087, #186822, #187753, #188416, #188910, #191636, #191970) ## ROCm - Support ROCm ASAN builds and derive hipCUB's CCCL version automatically (#188242, #188072) - Update CK/AITER for `gfx1033` and residual-NaN fixes, and fix a `libdrm` installer overflow (#183965, #187799) ## XPU - Consolidate XPU operator generation and align internals with oneAPI 2026 (#181233, #191470) - Move the XPU C++ memory-pool API to ATen (#192032) ## Caffe2 - Fix source builds with `fmt` 12.2 and Windows Clang 17 (#190691, #192376, #190929) ## JIT - Restore `TensorExpr` builds with LLVM 24 (#192381)
-
v2.13.0
GitHub ↗
原版更新说明
# PyTorch 2.13.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) - [Developers](#developers) # Highlights <table> <tr><td><strong>FlexAttention</strong> lands on Apple Silicon (MPS), with up to ~12x speedup over SDPA on sparse patterns, and gains a deterministic backward path on CUDA for reproducible gradient computation.</td></tr> <tr><td><strong>CuTeDSL "Native DSL" backend</strong> gives Inductor a second high-performance code path (alongside Triton) for key GPU operations, with faster compilation. [Prototype]</td></tr> <tr><td><strong><code>nn.LinearCrossEntropyLoss</code></strong> combines the final prediction and loss computation to cut peak GPU memory by up to 4x for large-vocabulary language model training.</td></tr> <tr><td><strong>torchcomms</strong>, a new communications backend for PyTorch Distributed, improves fault tolerance, scalability, and debuggability for large-cluster training.</td></tr> <tr><td><strong>FSDP2</strong> now overlaps reduce-scatter and all-gather communications via a dedicated process group (opt-in), increasing distributed training throughput.</td></tr> <tr><td><strong>Python 3.15 wheel support</strong> for PyTorch on Linux via the pytorch repository index, including builds compatible with free-threaded 3.15t.</td></tr> <tr><td><strong>Broader platform support</strong>: ROCm gains AOTriton 0.12b with native HIP CMake, Arm adds Armv9-A <code>torch.compile</code> targeting, and Intel XPU exposes new device telemetry APIs.</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. # Tracked Regressions ### ROCm wheels break `torch.compile` on CPU in environments without a GPU Running a `torch==2.13.0+rocm7.2` wheel in an environment where no GPU is available (`torch.cuda.is_available()` is `False`) breaks `torch.compile` on the CPU path: the first compile raises `RuntimeError: Can't detect vectorized ISA for CPU` ([#189194](https://github.com/pytorch/pytorch/issues/189194)). This is a regression from `torch==2.12.1+rocm7.2`, which compiles CPU code fine (detecting e.g. `VecAVX2`) in the same setup. The 2.13 ROCm wheel appears to rely on something present in the ROCm builder image to detect the CPU vectorized ISA, so it works when run on a ROCm image but fails on a plain CPU-only image. Workaround: run the `+rocm` wheel on a ROCm image, or install a standard CPU/CUDA build for GPU-less environments. # Backwards Incompatible Changes - Stop building CPython 3.13t (free-threaded) binaries (#182951) Upstream `pypa/manylinux` removed CPython 3.13t (free-threaded) on 2026-05-07, because 3.13t was experimental and has been superseded by the now-non-experimental CPython 3.14t. As a result, PyTorch 2.13 no longer ships `cp313t` wheels (Linux, Triton, and related artifacts). Users on the free-threaded interpreter should move to Python 3.14t. PyTorch 2.12: ```bash # cp313t (free-threaded 3.13) wheels were available python3.13t -m pip install torch ``` PyTorch 2.13: ```bash # Use free-threaded Python 3.14t instead python3.14t -m pip install torch ``` - Bare `PyObject` is no longer allowed in operator schemas (#184209) Bare `PyObject` was accidentally accepted in operator schema strings in PyTorch 2.12. This was undocumented and is now rejected, since `torch.compile` does not support arbitrary `PyObject` inputs to custom ops. If you parse or register a schema with a bare `PyObject` argument or return type, you will now get a schema parse error. PyTorch 2.12: ```python >>> from torch._C import parse_schema >>> parse_schema("foo(PyObject x) -> ()") # accepted ``` PyTorch 2.13: ```python >>> from torch._C import parse_schema >>> parse_schema("foo(PyObject x) -> ()") # raises a schema parse error ``` - Remove Bazel build support (#180883) The Bazel build was never broadly adopted and still depended on the antiquated Bazel 6, while the wider ecosystem has since moved to Bazel 9. All Bazel build files and CI jobs have been removed. Users building PyTorch with Bazel should migrate to the supported CMake/`pip install` build flow. PyTorch 2.12: ```bash # Build PyTorch with Bazel bazel build //:torch ``` PyTorch 2.13: ```bash # Bazel build files have been removed; build from source with pip instead pip install --no-build-isolation -e . ``` - `StorageImpl`'s built-in copy-on-write (COW) materialization is replaced by a pluggable materializer hook (#179063) `StorageImpl` no longer knows about COW directly. Its internal COW entry points `StorageImpl::is_cow()`, `StorageImpl::maybe_materialize_cow()`, and the friend `cow::materialize_cow_storage()` have been removed in favor of a single pluggable `MaterializeFn` hook (`void(*)(StorageImpl*)`) that a backend registers to run once, on the first mutable data-pointer access. COW is now just one consumer of this hook (`c10::impl::cow::materialize_cow`), and all COW behavior (lazy clone, refcounted shared data, copy-on-write) is unchanged. This also gives accelerator backends and eager-mode graph compilers a zero-fast-path-cost place to commit deferred allocations or materialize symbolic buffers on first mutation. This is a C++-only change. It affects out-of-tree backends/extensions that called the removed `StorageImpl` COW symbols directly; they will fail to compile against 2.13 with errors such as `no member named 'is_cow' in 'c10::StorageImpl'`. Migrate to the new hook API (`set_materializer()` / `has_materializer()` / `clear_materializer()`). PyTorch 2.12: ```cpp // Detect a COW storage and force it to materialize. if (storage.is_cow()) { storage.maybe_materialize_cow(); } ``` PyTorch 2.13: ```cpp // Register a one-shot materializer; it runs on the next mutable-data access // and then clears itself. COW registers c10::impl::cow::materialize_cow this way. storage.set_materializer(&my_backend_materialize); // void(StorageImpl*) // `has_materializer()` replaces `is_cow()` for "is a deferred materialization pending?" if (storage.has_materializer()) { /* ... */ } ``` - Convert `shared_ptr<Node>` to `intrusive_ptr<Node>` (#181139). This changes the signature of `Tensor::grad_fn`. Accesses to `Tensor.grad_fn()` should change from `std::shared_ptr<Node>` to `c10::intrusive_ptr<Node>`. Similarly, construction of a C++ autograd function should change: PyTorch 2.12: ```cpp std::shared_ptr<CustomCppNode> node(new CustomCppNode(), torch::autograd::deleteNode); ``` PyTorch 2.13: ```cpp auto node = c10::make_intrusive<CustomCppNode>(); ``` - The minimum supported NCCL version when building from source is now 2.23 (#186292) PyTorch now requires NCCL >= 2.23 at compile time, and the preprocessor/runtime gates that guarded NCCL features introduced in 2.23 or earlier have been removed. Users who build PyTorch from source against a system NCCL older than 2.23 will hit compile errors against the dropped gates. Upgrade the NCCL installation to >= 2.23 to build. The prebuilt PyTorch wheels already bundle a compatible NCCL, so pip/conda users are unaffected. - Remove named tensors (#173895) The named tensor feature (a long-deprecated prototype) has been fully removed to reduce overhead and code bloat. All associated Python and C++ APIs are gone, including `Tensor.names`, `Tensor.rename()`, `Tensor.refine_names()`, `Tensor.align_to()`, `Tensor.align_as()`, `torch.align_tensors()`, the `names=` keyword on factory functions (e.g. `torch.zeros`, `torch.empty`, `torch.ones`), and the C++ `Dimname` / `DimnameList` APIs. Code that previously relied on named dimensions must track dimension order positionally and avoid usage of any of these now-removed APIs or op overloads. - The `onednn::qconv2d_pointwise.binary` and `.binary_tensor` operators no longer alias their input but rather return fresh tensors. Previously these ops mutated the `qaccum` input buffer and returned it directly, violating the PyTorch invariant that custom operator outputs must not alias inputs. This silently bypassed aliasing checks via the old `-> Tensor(a!)` schema and would become a hard error in a future PyTorch version (as mentioned in #182063), so the schema and implementation were corrected to return a fresh output. Most users are unaffected, only code that calls these ops directly and relies on the in-place mutation of qaccum must now read the returned tensor instead. (#177171) # Deprecations - Custom operators that return an output aliasing one of their inputs are deprecated (#182063) When a custom operator returns an output that is the same tensor as (or otherwise aliases) one of its inputs under `torch.compile`, PyTorch now emits a `UserWarning` stating that this is deprecated and will become an error in a future version of PyTorch. Previously the warning stated the change would land in PyTorch 2.12; that timeline has been pushed back. To update your code, return a clone of the offending output instead of the input, or refactor the operator so it does not return the aliased tensor. Deprecated: ```python @torch.library.custom_op("mylib::foo", mutates_args=()) def foo(x: torch.Tensor) -> torch.Tensor: return x # output aliases the input -- deprecated ``` Updated: ```python @torch.library.custom_op("mylib::foo", mutates_args=()) def foo(x: torch.Tensor) -> torch.Tensor: return x.clone() # return a clone instead ``` - Creating tensors with the quantized dtypes `quint8`, `qint8`, and `qint32` is now deprecated and emits a warning. This covers both Python and C++ call sites; see [#184982](https://github.com/pytorch/pytorch/issues/184982) for migration guidance (#184984) PyTorch 2.12: ```python >>> x = torch.quantize_per_tensor(torch.randn(3), 0.1, 0, torch.quint8) ``` PyTorch 2.13: ```python >>> x = torch.quantize_per_tensor(torch.randn(3), 0.1, 0, torch.quint8) UserWarning: Creating tensors with quantized dtypes (quint8, qint8, qint32) is deprecated ``` - Rename distributed collective ops to the `_single` naming scheme and deprecate the old names (#186123, #186124, #186125, #186134, #186135, #186144) To align the public `torch.distributed` collective APIs with the naming used by torchcomms' `TorchCommBackend`, `all_gather_into_tensor` is renamed to `all_gather_single` and `reduce_scatter_tensor` to `reduce_scatter_single`. The previous names continue to work as thin wrappers that delegate to the new functions, but now emit a `FutureWarning`. PyTorch 2.12: ```python dist.all_gather_into_tensor(output, input) dist.reduce_scatter_tensor(output, input) ``` PyTorch 2.13: ```python dist.all_gather_single(output, input) dist.reduce_scatter_single(output, input) ``` # New Features ## Python Frontend - Add two new operator tags, `torch.Tag.inplace` and `torch.Tag.out`, that let an operator declare how it writes its result: `inplace` means it mutates a tensor in place, and `out` means it writes into a caller-provided output tensor. Native PyTorch operators are tagged automatically, and custom operators defined with `torch.library` can opt in by adding the tag. To be tagged `inplace`, an operator must take the tensor it mutates as its first positional argument (declared as `Tensor(a!)`, and the only mutable argument) and return that same tensor. Tagging a custom operator this way improves its behavior under `torch.compile`: `inplace` ops now go through `auto_functionalize`, so the reinplacing pass can analyze clones and skip unnecessary copies, and both `inplace` and `out` ops get their fake/meta kernels generated for free. See the [Python custom operators tutorial](https://docs.pytorch.org/tutorials/advanced/python_custom_ops.html) for how to author and tag custom operators. (#181100, #181099, #184199, #184200, #184201, #184202, #184203, #180851, #180852) - Add `const_data_ptr()` Python binding to `torch.Tensor` for read-only data pointer access (#180382) - Add an `abbr` property to `torch.dtype` that returns a dtype's short string abbreviation (e.g. `torch.float32.abbr` returns `"f32"`) (#177296) - Allow positional arguments to be passed as keyword arguments to autograd custom `Function`s (#182206) - Expose `rearrange` in the `torch.func` namespace for einops-style tensor reshaping (#173183) ## torch.nn - Add `nn.LinearCrossEntropyLoss`, a fused linear-projection plus cross-entropy loss module that avoids materializing the full logits tensor (#181573, #185852, #172286, #186113) ## Autograd - Add `torch.autograd.graph.region_activation_memory_budget` (#185979) - Support passing gradient inputs as a `dict` to `torch.autograd.grad` and `torch.autograd.backward` (#178140) ## Distributed - Add a registration API for symmetric memory arguments (`lib.register_symm_mem_args()`), letting operators (including out-of-tree ops) declare which arguments require symmetric-memory allocation (#173513) - Remove `NCCLSymmetricMemory`'s explicit dependency on `ProcessGroupNCCL`, enabling symmetric memory to work with out-of-tree backends such as torchcomms (#184260) - Support accessing the `ReduceOp.PREMUL_SUM` factor from Python when implementing process group backends in Python (#185863) - Expose the NCCL 2.30 `maxP2pPeers` config binding (#181686) - Add rocSHMEM Triton integration for symmetric memory on ROCm (#178658) - Support passing extra keyword arguments to the loss function in pipeline schedules via a new `loss_kwargs` parameter to `step()`, enabling loss functions that require arguments beyond `(output, target)` (such as chunked cross-entropy needing token counts for scaling) (#181057) ## Distributed FSDP2 - Add `FSDPModule.set_separate_reduce_scatter_group` to give reduce-scatter its own NCCL communicator, enabling opt-in overlap of all-gather and reduce-scatter (#186335) - Add `set_reduce_scatter_max_input_buffers` to keep multiple reduce-scatter input buffers in flight, so backward compute no longer stalls waiting to recycle a single reduce-scatter buffer (#186000) ## Profiler - Profiler/Kineto now emits channel metadata on CUDA backends (#185968) ## Dynamo - Add `torch.compiler.set_default_backend` to override the default `torch.compile` backend globally, so out-of-tree backend authors don't need to pass `backend=` at every call site (following the pattern of `torch.set_default_dtype`/`torch.set_default_device`). Explicit `backend=` arguments still take precedence (#178944) - Add `torch.compile(f, isolate_recompiles=True)` to give each `torch.compile` call its own isolated cache bucket, preventing cross-compile interference in cache lookups and recompile-limit checks when multiple `torch.compile` calls target the same function (#178351) - Add `register_multi_grad_hook` support to `@leaf_function`, allowing a backward hook to fire once per backward pass when all `requires_grad` inputs have their gradients computed (#179609) ## Inductor - Add flash-decoding support to the CPU `FlexAttention` template (chosen when query length is 1) with a new configurable `PARTITION_SIZE` kernel option (#159835) - Add Triton convolution backward kernels (input and weight gradients) as an autotuning backend in place of the ATen-only fallback (#178945) - Add an Inductor FX pass (`decomp_comms`) that eliminates `all_gather` for Gram-matrix optimizer patterns (Muon/Shampoo) under FSDP, gated by `config.aten_distributed_optimizations.allow_comms_decompositions`, yielding 1.25-1.95x training speedups (#184370) ## Ahead-Of-Time Inductor (AOTI) - Generated C shims for the AOTI stable ABI are now versioned and gated by `TORCH_TARGET_VERSION`, so shims introduced in newer releases are only exposed when the target version supports them (#181916) - Triton CPU AOTI models now work end-to-end through the public `torch._inductor.aoti_compile_and_package` / `aoti_load_package` API, including packaging and loading of the multiple `.so` files emitted per kernel (#182251) - Added stable C shim functions (`torch_exception_get_what`, `torch_exception_get_what_without_backtrace`, and `STABLE_TORCH_ERROR_CODE_CHECK`) so extensions built against the stable ABI can retrieve the original error message across the C API boundary (target version 2.13+) (#180135) - Added a stable AOTI stream shim `aoti_torch_stream_native_handle` and `torch::stable::accelerator::Stream::nativeHandle()`, gated behind `TORCH_FEATURE_VERSION >= 2.13`, for retrieving a native stream handle from the stable ABI (#183930) ## Release Engineering - Add Python 3.15 wheel builds across Linux (CPU/CUDA), Triton, ROCm, and XPU (#182954, #184600, #185409, #184829, #184891, #184906, #185094) ## CUDA - Add `CUDAGraph.get_graph_data()` for graph topology introspection (#183165) - Lightweight API to get private pool reserved memory bytes (#178240) ## MPS - Add FlexAttention support for MPS (#182552, #186215) - Add support for `torch.distributions.Dirichlet` on MPS by adding `_sample_dirichlet` and `_dirichlet_grad` Metal implementations (#185458, #185854) - Add `grid_sampler_2d` backward support on MPS (#179756) - Add `grid_sampler_3d` backward support on MPS (#179388) - Add `lcm` support on MPS via a new Metal kernel (#186279) - Add complex support to `c10/metal/reduction_utils.h` (#180708) and a complex->bool specialization (#185938) ## ROCm - Enable external events in CUDA graphs (#178264) - Enable GPU Address Sanitizer build (#183792, #176461) - Improve Inductor GEMM search space performance using the Origami project (#172512) - Use CMake native HIP language support, `enable_language(HIP)` (#180485) - New Inductor benchmarker based on Torch Profiler (#175097) ## XPU - Add XPU device telemetry APIs for temperature, frequency, power draw, engine utilization, memory bandwidth usage, and used device memory through `torch.xpu.*` (#181082, #183427, #183428, #183429, #183430, #183431) - Add FP8 blockwise scaling support for `scaled_mm` on XPU (#173630, #176043) # Improvements ## Python Frontend - Make it possible to load safetensors with `torch.load` (#170592) - Make `Storage.pin_memory` / `Storage.is_pinned` device-agnostic (#186223) - Add `op_overloads` to `OpOverloadPacket` to enumerate an operator's overloads (#182993) ## torch.nn - Expose `num_splits` in FlashAttention-2 and bump the flash-attention submodule (#179760) - Support `linear_bias` in `linear_cross_entropy` on the reference and chunked paths (#185129, #185276) ## Optimizer - Fix `SequentialLR` wrong learning rate initialization when `milestones` contain 0 (#185986) ## Autograd - Implement autograd derivatives for `torch.nextafter` (#148820) - Add `torch.autograd.enforce_grad_layout_policy` to control the memory layout policy for accumulated gradients (#180552) ## Distributed - When TorchComms is enabled, route `new_group` through `split_group` for subgroup creation, raising `NotImplementedError` for arguments `split_group` cannot honor (e.g. `use_local_synchronization=True`, `sort_ranks=False`) instead of silently falling back (#185416) - Delegate `dist.new_group` to custom process group subclasses (#184262) - Surface started-work metadata in NCCL watchdog timeouts (#183656) - Add a health check endpoint to the distributed debug server (#179326) - Make the `DeviceMesh` non-overlapping check stricter (#172343) - Allow `elastic_launch`/`launch_agent` to accept a pre-created torchelastic health check server, so it can be started before rendezvous (#180543) - Add an `overlap_pp_comm` flag to pipeline schedules (default `True`) that, when set to `False`, defers each pipeline RECV op to immediately before the compute op that consumes it, using rank-parity P2P ordering to avoid deadlock (helps platforms such as AMD ROCm where a pending RECV blocks unrelated compute) (#178815) ## DTensor - Migrate embedding and random ops to single-dim sharding strategies and increase op coverage (#180281, #180503) - Add auto-infrastructure that derives single-dim sharding strategies for autogenerated op variants (`.out`, inplace, functional, and `foreach`), expanding strategy coverage to hundreds of additional ops (#185386) - Register sharding strategies for additional ops: `scatter`, upsample/interpolation backward, anti-aliased upsample, batch norm backward, and `aten.detach_.default` (#186149, #180311, #184626, #182743, #181876) ## Distributed FSDP2 - Support forward-mode automatic differentiation (`torch.func.jvp`) on models wrapped with `fully_shard` or `replicate`, including with mixed precision (#182732) ## Linear Algebra Frontend - Add `Half` and `BFloat16` dispatch support for `torch.trace` on CPU (#184874) - Improve heuristics for the cuSOLVER vs cuBLAS backend switch in `torch.linalg.lu` (#185344) ## Profiler - The memory viz tool now more accurately represents GPU footprint when impacted by fragmentation (#180515) - The memory viz tool now aggregates stripes per-pool to improve visualization for large snapshots (#180613) - Profiler now also exposes CUDA occupancy metadata as a nested dictionary in the `.events()` output (#180275) ## FX - `split_module` now supports `torch.Size` crossing graph split boundaries by decomposing `size()` calls into per-dimension `sym_size` nodes, and builds submodules lazily for faster inference graph splitting (#179839) - `CapabilityBasedPartitioner` can now opt out of horizontal fusion via `skip_horizontal_fusion=True`, partitioning only through direct data dependencies (#184904) - Enable rewriting of FX traces containing complex tensors during compilation (#169832) ## Dynamo - Implement additional Python operators in Dynamo: bitwise and (#184788), bitwise xor (#184789), left/right shift (#183462), floor division (#185652), true division (#185653), remainder (#185654), and `divmod` (#185655) - Support tracing more constructs in Dynamo: `einops` 0.8.2 (#185619), `record_function` as a decorator (#184703), `inference_mode` retracing helpers (#185066), `mark_dirty` in the autograd Function HOP (#184267), `warn_only` deterministic toggles (#180373), and the `_maybe_view_chunk_cat` functional collective (#180389) - Support item assignment and deletion (`__setitem__`/`__delitem__`) on more container types in Dynamo via `sq_ass_item`/`mp_ass_subscript` slots (#182862, #182996) - Support `torch.accelerator.device_index` and `torch.xpu.device` in the device context manager (#181846, #181847) - Improve Triton support under `torch.compile`: accept `tl.constexpr` values as kernel arguments (#181783) and handle `capture_triton` as a no-op during tracing (#183555) - Improve dynamic shape specification: reduce verbosity in shape specs for the common case (#184271), add `SeqSpec` for list/tuple specs with better walk-spec errors (#185327), add `ObjectSpec` (#182764), pipe dynamic spec through `torch.compile` (#184501), and revisit guarding in `mark_dynamic` APIs (#181469) - Improve `torch.compile` device mismatch errors with a dedicated `FakeTensorDeviceMismatchError` and actionable guidance to place inputs, parameters, and buffers on the same device (#185412) - Improve error messages and diagnostics: clearer data-dependent errors for `.any()`/`.all()` (#180406), clearer `torch._check` tensor predicate errors (#185777), user-friendly reasons for skipped frames (#183596), carets in stack traces (#182393), and reporting why a symbol was created dynamically in `symbolic_shapes` logs (#168331) - Make Dynamo exceptions pickleable (#185725) - Inline decomposed quantization helpers in Dynamo (#185628) - Make Dynamo debug/repro utilities device-agnostic (#184851) ## Inductor - Support `pin_memory` for `torch.ones`, `torch.zeros` and `torch.full` (#174595) - Add a ROCm config flag to disable the `pointer_range_32` optimization (#179604) - Add a peak memory threshold config for combo kernels (#180578) - Enable autotuning and a fast compensation path for CPU static/dynamic smooth-quant qlinear, with correct handling of 0D `x_scale`/`x_zp` and `ReinterpretView` strides (#181090) - Add `aot_inductor.autotune_per_kernel_alloc` config to allocate-run-delete tensors per kernel during AOTI autotuning, avoiding OOM on large models (#181176) - Bound `AsyncCompile` future waits with the `compile_worker_wait_timeout` setting (#181293) - Add `a100_default_flex_config` entries for `head_dim=192` (#181835) - Add an explicit lowering (fallback) for `aten.multinomial` to avoid graph breaks (#182423) - Add an Inductor lowering for `_scaled_mm_v2` (#182527) - Enable `combo_kernel_autotune_grouping` by default (#182567) - Add `cudagraph_partition_memory_budget` config for partition reordering (#183569) - Add ATen fallbacks for `bincount`, `unique` variants, and AMP scale ops so they compile without graph breaks (#183590) - Unfuse the bias add from `addmm` when the bias is a narrowing dtype cast (fp32->bf16/fp16) to preserve bias precision in XPU AMP training (#183680) - Emit a clearer diagnostic when a backward CUDAGraph output installed as a `.grad` buffer is invalidated on a later run (gradient accumulation) (#184003) - Support split online softmax reductions in Inductor (#184069) - Support fusing `index_add`-style atomic scatter mutations into Triton template epilogues behind a config flag (#184179) - Add a `cpp.march` Inductor config knob so AOTInductor cpp-only builds can override or suppress the default CPU architecture flag (#184297) - Improve the Triton cache directory guidance when loading shared objects from a noexec filesystem fails (#184362) - Enable the Bert SDPA pattern rewrite on CUDA while keeping the original matmul/softmax math path (#184417) - Improve the Triton launcher argument-mismatch error with a clearer message and a cached preflight check (#184522) - Add broader CuteDSL op overrides (`rsqrt`, `exp2`, `log2`, `log10`, `tan`, `acos`, `asin`, `atan`, `atan2`, `floor`, `logical_xor`) (#184538) - Add an optional `fake_mode` argument to `standalone_compile` (with `dynamic_shapes="from_example_inputs"`) so it can reuse the caller's `FakeTensorMode`/`ShapeEnv` instead of always creating a fresh one (#184776) - Support `signbit` on unsigned integer dtypes (#185985) - Add a `keep_static_cubin_raw` config to retain cubin bytes in cached kernels so caches restored on another machine avoid recompilation (#186404) - Extend `BatchLinearLHSFusion`'s matcher to also match the inlined `torch._C._nn.linear` form so the (opt-in) fusion can fire on Dynamo-inlined linear (#186632) - Add a clearer error message with install instructions when a compatible Flash Attention package is unavailable for flex attention (#186827) - Add another anchor node to the batch-linear fusion pass so more small `torch._C._nn.linear` operations are grouped into a single batched kernel (#180477) - Extend the batch fusion pass to support `detach()` method calls (#180513) - Add a deterministic backward for the FlexAttention flash kernel (#174813) - Use rand4x for Inductor Triton random number generation (#184377) - Add a Quack-based CuTeDSL RMSNorm kernel (#182108) ## Ahead-Of-Time Inductor (AOTI) - Use fatbinary for multi-arch CUDA kernels (#184456) - Support mixed-device constants in `update_constant_buffer` (#181114) - Add FP8 header files in the AOTI `shim.h` (#178120) - Add throttled `cudaMemcpy` for AOTI constant loading to reduce peak memory usage (#184823) - Preserve AOTI `proxy_executor` error messages (#180884) - Enable Triton kernels in AOTI C++ wrapper on CPU (#181068) - Skip CPU vec ISA setup for device-only `cpp_wrapper` (#182089) - Expose torchbind constants from `AOTIModelPackageLoader` (#182149) - Improve AOTI error for Python custom ops (#186305) ## Export - Support serialization of opaque type constants in `torch.export` save/load (#181676) - Make functorch JVP operator `torch.export`-able (#179686) - Add `UpdateConstantBufferFromCpu` for host-to-device copy (#181637) ## AOTAutograd - Support CPU activation offloading in the rematerialization pass, including marking recomputed nodes for backward and adding a resize-to-0 deallocation op so offloaded tensors are freed after their host-to-device copy (#181937, #181938) - Use FX node names in `merge_view_inputs` error messages, so non-differentiable view input mutation errors identify the specific offending inputs (#180424) ## Composability - Add fake tensor support for `_transformer_encoder_layer_fwd` so it traces under `torch.compile` (#183916) - Enable Armv9-A target support for `torch.compile` on AArch64 (#184555) - Functionalize in-place `c10d` collectives in standalone compile (#181836) ## Foreach - Fix/add empty check for `_foreach_max` (#173483) ## ONNX - Add `adaptive_max_pool2d` and `adaptive_max_pool3d` decompositions for ONNX export (#184396) ## C++ Frontend - Add stable ABI for `set_python_module` on `torch::Library` (#182720) - Add `==` overloads for `HeaderOnlyArrayRef` (#185379) - Add `torch::stable::Generator` (#186423) - Add `c10::layout` typecaster for `torch.layout` (#179607) - Add default-args support to `def_static` (#175644) - Add support for controlling scientific notation in C++-side tensor printing (#173321) ## Release Engineering - Move the NCCL pin to 2.30 (#181313) - Advance the Triton pin to 3.7.1 (#181001, #186792) - Upgrade the XPU support package to 2026.0 (#182003) - Add a configurable threshold to avoid power-of-two rounding for large pinned memory allocations (#171662) - Move some pre-build steps from `setup.py` to CMake (#177641) ## CUDA - Debugging tool to verify that external inputs to a CUDA graph are alive before replay (#174649) - Add get/set/reset functions for BLAS workspace sizes (#177912) - Cleanup double import in `BinaryDivFloorKernel.cu` (#179260) - Return supported CUDA arch list when no GPU is present but GPU is compiled (#180356) - Detect and fix stale stream references in autograd during CUDA graph capture (#180090) - Use `opmath_t` in `i1` and `i1e` CUDA kernels (#183778) - Support `resize_` with address hint (#178215) - Support `bfloat16` in `_embedding_bag_per_sample_weights_backward` on CUDA (#185889) - Align `parsePerProcessMemoryFraction`'s return type with other parsers (#185139) - Improve error message when `cuda-bindings` version is too old (#185990) - Expose `torch.cuda.current_solver_handle` for cuSOLVER handle sharing (#176705) ## cuDNN - Add flag to select depthwise convolution backend (#176500) - Upgrade `cudnn_frontend` submodule to 1.24 (#185554) ## MPS - Migrate many ops from MPSGraph to native Metal kernels for `bernoulli` (#182210), `native_dropout` (#182232), `uniform`/`normal`/`randint` (#182386), `randperm` (#182528), comparison ops `eq`/`ne`/`lt`/`le`/`gt`/`ge` (#183019), bitwise ops (#182839), scatter/gather (#184028), copy-cast (#184740), `gelu`/`gelu_backward` (#181451), replication pad (#183065), embedding backward (#185119), `trace` (#183627), `count_nonzero` (#180725), `amax`/`amin`/`aminmax`/`all`/`any` (#180752), and `cumsum`/`cumprod` (#185609), `native_group_norm` (#183830, `native_group_norm_backward` #184437), `topk` and `kthvalue` Metal kernels (#184106), single-block and multi-block sort, including a stable sort path (#180714, #182242, #181736) - Support integer inputs to `histc` (#178624) - Support `out` variants of unary ops (#184743) - Improvements to SDPA Metal kernels: prefill attention kernels (#181575), GQA support (#183280), `is_causal` support (#181855), head dim 256 (#181852), float mask support (#183458), and a clearer error for causal + attn mask (#181856) - Add an ILP variant for binary tensor iterators and replace unary VEC4 with a generic ILP-per-thread dense kernel (#182155, #181509, #183055) - Make several Metal kernels stride-aware to avoid unnecessary `.contiguous()` calls: `Col2Im` (#181949), `Im2Col` (#182709), `Repeat` (#182718), `LossOps` (#182714), and `HistogramKernel` (#181951) - Enable `NDHWC`+`DHWIO` fast path for `Conv3d` on `channels_last_3d` (#184612) - Clear the MPSGraph cache in `torch.mps.empty_cache()` (#181485) - Add a private API to get the host alias of Metal storage (#180961) - Add input validation: `stride > 0` in pool ops (#184875), `F.fold` (#182067), `im2col` (#183593), and bernoulli probabilities (#185065) - Alert on non-deterministic algorithms on MPS (#185061) - Raise a clear not-implemented error for `dropout_p` (#184126) - Use proper precise log functions in unary kernels (#185381) ## ROCm - Additional `cub::DeviceHistogram` hipify mappings (#180433) - SDPA improvements via AOTriton 0.12b: `head_dim != head_dim_v`, `use_deterministic_algorithms`, `gfx1100` and `gfx1151` promoted out of experimental, partial FAv3 support on `gfx950` (#184288) ## XPU - Add `last_level_cache_size` and `is_integrated_gpu` to XPU device properties (#184499, #182624) - Add XPU dispatch for `_fused_adagrad_` (#185577) - Support mixed-type operations between Nested and Dense tensors on XPU (#182654) - Support `torch.xpu.device` in Dynamo device management (#181847) - Recognize additional Intel BMG device IDs on XPU (#183414) - Enable XPU device support for sparse Triton ops (#179805) - Enable the `bmm_outer_product` Triton override on XPU (#180441) - Improve test coverage for the XPU backend (#174370, #180881, #171154) - Support non-blocking pinned device-to-host copies on XPU (#186224) - Refactor the XPU oneDNN integration from the C API to the C++ API (#184486) ## Functorch - Add `vmap` batching rule for `torch.unbind_copy` (#178035) - Add `vmap` batching rule for `Tensor.view(dtype)` (`aten::view.dtype`) (#180728) ## Sparse Frontend - Validate `mat1`/`mat2` layouts in `sspaddmm` and clarify error messages (#179037) # Bug Fixes ## Python Frontend - Add `opt_dtype` validation to `torch.nanmean()` for consistent error handling (#172809) - Route `torch.nansum` integer output dtype through `nan_to_num` + `sum` for correct results (#183808) - Fix out-of-bounds read in `CUDAStream::stream()` (#184237) - Align XPU `logspace`/`linspace` ref tests with upstream XFAIL state (#178734) ## Dataloader Frontend - Fix `DataLoader` file descriptor leak from `atexit` cleanup (#176607) ## torch.nn - Validate `stride`/`padding`/`kernel_size` length in `slow_conv3d` (#181063) - Validate inputs in `math_channel_shuffle` (#181029) - Validate `delta` type in `nn.HuberLoss` constructor (#184012) - Lowercase the environment variable in `torch/serialization.py` so it matches the true values (#180959) - Fix int32 overflow in `layer_norm` on CUDA for tensors with more than 2^32 elements (#181600) - Reject `NestedTensor` inputs in `flex_attention` with a clear error instead of an unclear backend failure (#183516) - Fix SDPA incorrect early return on 0 head dim qk with valid v (#184914) - Fix `reflection_pad1d` backward CUDA launch for large batches (#185024) - Fix `lp_pool` infinity norm handling (#183997) ## Autograd - Fix checkpoint context cleanup on forward errors (#184018) - Fix `torch.autograd.enforce_grad_layout_policy` decorator state leak (#183868) ## Distributed - Fix `NCCLComm::abort()` to use the correct deregister API for window-registered handles (#181626) - Fix `FakeProcessGroup` `all_gather` on tensors that require grad (#181790) - Fix `gather` and `allgather_coalesced` on `FakeProcessGroup` to copy input to output (#182364) - Fix the `scatter` and `reduce_scatter` family on `FakeProcessGroup` to copy input to output (#182365) - Fix `all_to_all` on `FakeProcessGroup` and validate splits (#182366) - Fix conflict between `broadcast_buffers` and `init_sync` in DDP (#178054) - Fix `gather` on non-destination ranks for the TorchComms backend (#178533) - Fix TCPStore compilation with Clang 20 (#185785) - Fix NCCL symmetric memory mismatch by using an allocation-time counter instead of address for block ordering (#183489) - Fix a symbol lookup issue with the symmetric memory `__init__` (#186416) - Fix the value returned by `Work.exception()` so the exception can be inspected from Python instead of being unusable (#184697) - Fix false assertion errors in the flight recorder when using the `ncclx`, `gloo`, `rccl`, `rcclx`, `mccl`, or `hccl` backends (#179753) - Fix a failure when creating a subgroup on a fake backend via `new_group`, which has no underlying communicator to split (#186172) - Fix `torch.compile` of the `_c10d_functional` `all_gather_tensor_out` and `reduce_scatter_tensor_out` ops, which previously failed functionalization with "Found a custom (non-ATen) operator whose output has alias annotations" (#183597) - Fix `split_group` on multi-backend process groups (e.g. `init_process_group(backend="cpu:gloo,cuda:nccl")`) to split only the relevant backend instead of every backend, avoiding spurious warnings, extra rendezvous overhead, and inconsistent process-group shapes (#182057) - Fix `FakeProcessGroup` to reject `rank >= world_size` at construction time, which previously failed silently and only surfaced later when collectives indexed past `world_size` (#182363) - Fix the torchelastic agent hanging indefinitely (and never exiting) when workers become stuck in an uninterruptible (D-state) process that `SIGKILL` cannot reap; the final `proc.join()`/`proc.wait()` in `_close` is now bounded by a timeout and the unkillable PID is logged (#185414) - Fix pipelining producing incorrect results or cryptic runtime errors when a `PipelineScheduleMulti` topology communicates between non-adjacent stages (e.g. skip connections); this is now detected at initialization and raises a clear `RuntimeError` (#179293) - Fix `RuntimeError: only Tensors of floating point dtype can require gradients` when building a pipeline for models with non-float intermediates (such as Hugging Face transformer models) (#183582) - Make `LocalTensorMode` transparent to `torch.compile` so compilation proceeds as if the debugging mode were not active (#182667) - Fix `AssertionError` in elastic `c10d` rendezvous when a node's rank changes across rendezvous rounds (e.g. a node becomes rank 0 after a peer leaves) (#182375) - Fix shared-weight gradient double-counting in zero-bubble pipeline schedules (#181365) - Fix `None` gradient handling in pipeline backward send/recv (#182182) - Fix a pipelining crash when `split_module` interleaves `get_attr` nodes with placeholder nodes (#182644) ## Distributed Checkpointing - Fix optimizer state-dict save/load using the wrong process group for FSDP models initialized with a non-default process group, by forwarding the FSDP process group to `FSDP.optim_state_dict` and `FSDP.optim_state_dict_to_load` (#181261) - Fix `DefaultStager` crash when reused (#183424) ## DTensor - Fix Context Parallel load balancing for short sequences that cannot be split into the required head/tail chunks, falling back to regular CP sharding for correctness (#183968) - Fix `squeeze` leaving a DTensor's spec and local tensor out of sync (spec shape not matching the local tensor) by preventing `squeeze` from redistributing when `strict_view` is set (#175798) - Fix `.view()` failures (e.g. in `ColwiseParallel`/`RowwiseParallel`) after an uneven `Shard(dim>0)`->`Replicate` redistribute by making the local tensor contiguous (#184443) - Fix a device-side assert crash when tracing tensor-parallel models with `make_fx`, caused by sharding propagation recording dead global-shape shadow nodes into the graph (#185865) - Avoid the native sharding cache for symbolic IValue arguments, fixing stale cached output shardings that confused global and local shard shapes for shape-sensitive ops under compiled autograd (#183246) - Fix `upsample` backward crashes when the input is sharded (#182595) - Fix `Partial` placement being lost during the autograd layout invariant (#180511) - Fix `OpSpec.mesh` crash when specs contain `None` entries (#181541) - Fix `redistribute(backward_dtype=...)` ignoring the backward dtype (#182032) - Fix `_StridedShard` flag conflict during gradient accumulation (#183517) - Fix reduction strategy linearity (#183794) - Fix the cache key hashing for fake meshes (#184001) - Fix `FakeTensor` device hint in sharding propagation (#183970) - Fix `group_norm` scalar adjuster crash when `weight=None` (#184819) - Fix `to_local()` dropping the `_is_param` marker that `nn.Parameter` sets on custom tensors (#184422) - Fix `pad_tensor`/`unpad_tensor` creating unnecessary guards on symbolic pad sizes during tracing (#180887) - Fix DTensor + activation checkpointing + `torch.compile` crash caused by an unbound inner symbol at the root tracer (#181797) - Fix a `DTensorSpec` refcount leak in `OpSchema._recompute_comparison_key` (#181792) ## Distributed FSDP2 - Fix stale `post_accumulate_grad_hook` results under `CPUOffloadPolicy` (#180666) - Fix reduce-scatter of unused DTensor parameters that previously raised a mixed `Tensor`/`DTensor` error in `chunk_cat` (#183040) - Fix `IndexError` for modules called with no forward inputs by preserving empty args/kwargs, matching FSDP1 behavior (#183943) - Remove redundant stream waits (#183983) - Fix a tensor-parallel + FSDP2 + mixed-precision bug where the unsharded compute tensor was wrapped back into a `DTensor` with a stale fp32 dtype, causing sharding propagation to fail in eager and `torch.compile` (#183805) - Fix incorrectly reduced gradients when running a partial forward of a `fully_shard([norm, head])` group for chunked loss, where the model forward runs `norm` only and `head` is called standalone per chunk; unshard/reshard previously relied on `_modules_to_run_forward` and produced wrong results for this pattern (#180428) - Add a warning when a grad-requiring forward output is a view tensor, since in-place ops on the view silently drop the pre-backward hook and cause backward to skip the all-gather and fail (#181850) - Fix incorrect `clip_grad_norm` results with multiple data-parallel shard axes (e.g. `dp_shard` + `cp` passed via `DataParallelMeshDims`), which exposed separate `Shard` axes with the wrong float32 reduction order and an incorrect `Shard` instead of `_StridedShard`; the axes are now flattened into a single shard axis in the sharding spec (#183629) - Fix recomputed tensor metadata diverging from the original forward under activation checkpointing when `cast_forward_inputs` is enabled, by casting forward inputs during recompute (#182580) - Fix incorrect resharding of full-DTensor parameters when tensor parallelism is also applied by using `_StridedShard` (#186126) ## Linear Algebra Frontend - Validate pivot range in `torch.linalg.ldl_solve` CPU kernel (#181032) - Fix rocBLAS tunable GEMM solution handling in TunableOp (#182380) - Route fp16 backward GEMMs to rocBLAS to preserve subnormals (#183766) - Make collective bucketing tolerate hinted unbacked SymInts (#183544) ## Profiler - Fix an issue where profiler would issue a "Profiler clears events at the end of each cycle" warning even when no cycles are used in the schedule (#180387) - Ensure that Profiler does not keep driving Kineto transitions even when GPU collection has stopped (#180698) ## FX - Preserve user runtime asserts in FX pass (#184608) ## Dynamo - Fix Python container and operator semantics in Dynamo to match CPython: list (#185425) and tuple (#185427) constructors, `dict` update (#185428), `defaultdict` inplace union (#185429), `frozenset` copy identity (#185430), sequence search (#185431), `iand` on bool constants (#184503), `sequence * SymNode` spurious graph break (#185260), and `torch.Size` tensor shape handling (#184613) - Fix symbolic shape / fake tensor handling: `float`/`bool` + `SymNode` (#183362), `PendingUnbackedSymbolNotFound` for 0-d tensor `Scalar` args (#182660), `GuardOnDataDependentSymNode` on sparse tensors (#179616), and creating symbolic tensors from foreign fake tensors (#181794) - Fix use-after-free issues in `CUDAStream`/`Event` `tp_dealloc` overrides (#183403) and Dynamo dict guard cleanup (#183753) - Fix Dynamo crash when `DeviceMesh` is constructed inside `torch.compile` (#177201) - Fix `torch.compile` crash when an unsupported type is passed to a tensor method inside try/except (#182106) - Skip `wrap_inline` for exec'd Python functions (#181531) - Fix tensor subclass construction under `torch.compile` (#183337) - Preserve eager `torch.full` validation for `nn.Parameter` fill values in Dynamo (#183915) - Prevent accuracy minifier repro recursion (#184077) - Fix AOT export with flex attention `BlockMask` placeholders (#184611) - Accept extra kwargs in `CudagraphsBackend.__call__` (#182989) - Avoid `def forward(self, ..., self, ...)` SyntaxError in `dynamo_graph_capture_for_export` (#185314) - Fix scoped Chromium event reset (#184973) - Fix Dynamo binding of overridden function defaults (#184852) - Fix SAC `context_fn` clobbered by DDPOptimizer's `propagate_metadata` (#179496) - Clear retained fake tensor CUDA constants (#184445) - Fix Dynamo `.grad` reads for new in-graph parameters (#184972) - Graph break on CUDA `manual_seed` in Dynamo so compiled random calls stay reproducible (#185761) - Fix functional tensor `to_dense` no-op (#184586) - Preserve original tensor strides across activation offload/reload (#186396) - Graph break on duplicate autograd Function inputs (#184281) - Raise `IndexError` in compile mode matching eager mode (#184856) - Don't error on a skipped frame when `fullgraph=True` and a non-default stance is set (#183623) - Set the `is_compiling` flag for the whole `torch.compile` session (#184614) - Fix FxGraphCache pickling of opaque types with cyclic references (#180422) - Handle missing Windows C++ compiler in shape guard fallback (#185447) ## Inductor - Fix `max_autotune` BMM correctness with dynamic OpenMP threads (#169128) - Fix NaN output in CPU `LayerNorm` by guarding the Welford variance computation (#173989) - Fix `NameError` from Python name mangling for user-defined Triton kernels whose names start with double underscores (#176100) - Fix backward-pass shape mismatch in mix-order reduction for compiled models (#178098) - Do not apply `pointer_range_32` to user-defined Triton kernels on ROCm to avoid compilation crashes (#178541) - Fix the `e8m0_rceil_log2` pattern failing to register on any CUDA device (#178698) - Fix `cpp_wrapper` backward compilation failing with a `CudaKernelParamCache` assertion when set via `torch.compile` options (#178847) - Fix `FxGraphCachePickler` crash on unpicklable pybind11 extension types during cache key computation (#178853) - Fix C++ compile error when indexing a transposed tensor with an indirect (tensor) index on the CPU backend (#178962) - Fix TPU Pallas codegen to use subscript indexing for scalar and size-1 buffer accesses (#179099) - Fix incorrect `argmax`/`argmin` indices in the CPP Tile2D vectorized kernel for transposed inputs (#179525) - Fix user-kernel fusion to use `mutation_outputs` for the intermediate buffer and add epilogue source to the cache key (#179803) - Fix missing mask on `tl.atomic_add` for constant-index stores (#179833) - Add convolution input/weight dtype-mismatch check to match eager semantics (#179890) - Raise a catchable error instead of crashing on integer divide-by-zero for `fmod`/`remainder` on CPU (#179923) - Fix stride mismatch for user-visible reduction nodes caused by `dislike_padding` conflicting with contiguous storage layout (#180197) - Fix `check_bounds` forward-reference C++ compile error in the CPU backend (#180212) - Preserve Triton HIP compile options (`waves_per_eu`, `matrix_instr_nonkdim`, `kpack`) when combo kernels rewrite per-subkernel configs on ROCm (#180277) - Fix `torch.compile` crash on `cumsum` with broadcast input when the scan dimension is 129 or larger (#180369) - Fix AOTInductor `while_loop` codegen for the minimal-arrayref interface (wrap `ArrayRefTensor` inputs before assign) (#180370) - Fix SM100 `addmm` CUTLASS codegen and relax `addmm` tolerances (#180432) - Fix incorrect storage-offset propagation for `as_strided` (#180581) - Filter CUTLASS kernels by fast-accum only on Hopper to avoid `NoValidChoicesError` for `scaled_mm`/`scaled_grouped_mm` with `use_fast_accum=True` on Blackwell (#180586) - Make persistent-reduction config selection batch-invariant under deterministic mode (#180832) - Fix `UnicodeDecodeError` on Windows when using `icx-cl` as the CXX compiler by decoding subprocess output with `errors='replace'` (#180853) - Avoid emitting `tl.float64` in Triton scalar-shape-math codegen on XPU devices without fp64 support (e.g. Intel Arc A770) (#180854) - Fix silent incorrect results when `adaptive_avg_pool2d` is fused with downstream flatten + reduction for non-power-of-2 channel sizes (#180898) - Fix CPU C++ fusion crash on GroupNorm + SDPA + bmm (#181015) - Fix `num_warps` on AMD RDNA (wave32) GPUs so it is no longer incorrectly halved; only CDNA (`warp_size` 64) is halved (#181112) - Fix unsupported `index_expr`/`kindexpr` error when using `flex_attention` with bias/index expressions (#181207) - Fix unbacked-symbol bindings assertion in the `slice` lowering early-return path (#181219) - Preserve program order of random ops in the scheduler to avoid numerical mismatch vs eager when `fallback_random` is enabled (#181245) - Fix Inductor crash (`NotImplementedError: View`) when a `flatten()`-produced view is passed as the `conv2d` bias (#181363) - Include per-device autocast dtype in the AOTAutograd cache key to prevent reusing a graph compiled under one autocast dtype (e.g. `bfloat16`) when running under another (e.g. `float16`) (#181564) - Fix `_to_copy` decomposition so float64->float32 transfers to XPU devices without fp64 support no longer generate illegal fp64 buffers/crash (#181607) - Prevent `AutoHeuristic` initialization from crashing in non-CUDA (e.g. XPU) environments (#181745) - Fix `AttributeError` crash in `remove_noop_ops` when a node's meta val is a `SymInt`/`SymFloat` (auto dynamic shapes) instead of a Tensor (#181752) - Fix `ConcatKernel` channels_last contiguous check to handle symbolic shapes, avoiding a data-dependent (DDE) `LoweringException` (#181845) - Fix user-defined Triton kernel pointer args with no `tl.load`/`tl.store` being incorrectly eliminated (and not allocated) when epilogue fusion is enabled (#181868) - Properly truncate (downcast then upcast) the accumulator for Triton GEMM epilogue fusions so numerics match eager (#181918) - Skip non-tensor IR nodes (e.g. process groups) when realizing/marking mutated buffers in `_CollectiveKernel.create_inplace` (#181930) - Pass the correct device to `print_performance` in generated `benchmark_compiled_module` so timing works on non-CUDA devices (e.g. XPU) (#181957) - Serialize `CompiledFxGraph._original_gm` via `GraphPickler` to fix AOTAutograd/precompile cache serialization crashes for graphs with HOPs that have lifted buffers (e.g. `flex_attention` with a causal `BlockMask`) (#182088) - Avoid raw stream name collisions in generated Inductor code (#182139) - Disable the overlap-scheduling SPMD check by default to avoid an NCCL hang when ranks diverge on cache hit vs miss (#182281) - Fix CUDA graphs to support self-overlapping inputs and unbacked shapes via a storage-copy fallback instead of erroring on complex memory overlap (#182524) - Pass derived sym-int captures through `maybe_realize` in FlexAttention (#182610) - Fix `AutoHeuristic` crash in non-CUDA environments (e.g. XPU and CPU-only builds) (#182614) - Do not automatically move non-deterministic seed functions to GPU (#182748) - Fix `emulate_precision_casts` on CPU C++ codegen so explicit/emulated fp32->fp16->fp32 precision barriers are no longer optimized away (#182882) - Fix block-descriptor final shape expansion for discontiguous fused pointwise/reduction loads and stores (#182936) - Fix crash in FLOP counting (`count_flops_fx`) for `HigherOrderOperator` targets such as `flex_attention` during overlap/bucketing (#182992) - Raise device-mismatch errors for `index_add`/`index_copy`/`index_reduce` instead of silently succeeding under `torch.compile` (#183007) - Fix Triton `eager_input_vals` propagation (#183334) - Escape backslashes in user-defined Triton kernel source (#183421) - Fix TMA config lowering block sizes below the heuristic choice, which could trigger an illegal memory access on large tensors (#183438) - Fix CPU AOTInductor with user-defined Triton kernels when compile-time autotuning is disabled (#183463) - Fix `is_linear_add_bias` crash when the bias node argument is a Python float (#183514) - Fix convolution lowering and backward decomposition crash when a channel dimension is zero (#183539) - Fix Inductor embedding negative index checks (#183636) - Disable cudagraphs for input storage mutation (#183645) - Fix `torch.compile` crash on `cumprod` backward by disallowing fusion of split-scan nodes with reductions (#183653) - Fix CPU `argmax` logical index for transposed reductions (#183655) - Fix `while_loop` backward expanded gradient strides (#183658) - Fix the SDPA backward constraint for scalar gradient bases (#183662) - Fix Inductor multi-stream codegen on XPU to emit `torch.xpu` stream APIs instead of CUDA-only calls (#183693) - Fix BF16 Inductor failure on Neoverse V3 with GCC 12.4 (#183698) - Fix the tail reduction suffix width (#183699) - Support unused lifted `SymInt`s in `associative_scan` lowering (#183706) - Guard the fast Triton launcher to CUDA/HIP so XPU correctly falls back to the static launcher (#183707) - Fix CPU C++ codegen crash from misaligned loop-split groups after fusion (#183715) - Fix `set_.source_Tensor` lowering when the source is a view (#183724) - Fix CPU GEMM k-slicing cache-block indexing (#183733) - Skip cudagraph capture when the CUDA caching allocator is bypassed (#183780) - Fix bytes-vs-elements mismatch in `select_algorithm` input storage check (#183791) - Use libdevice `log` for strict Inductor numerics (#183844) - Add meta registration and dtype check for `div_` to match eager type-promotion semantics (#183859) - Fix `handle_synced_deallocation` for XPU (#183865) - Use `hipModuleLoadData` in `StaticCudaLauncher` on ROCm (#183926) - Fix `flex_attention` autotune logging to use size hints for symbolic dims, avoiding lowering failures under dynamic shapes (#183933) - Guard the SM100 E8M0 FP8 PTX lowering to NVIDIA so ROCm gfx11 uses the portable bit-manipulation fallback (#183949) - Enable the Python dispatcher when re-running fake propagation for fallback kernels so custom/backend fake implementations supply correct output layout metadata (#183961) - Fix a crash in `tuned_addmm` with max-autotune when the bias is an unrealized view (e.g. a transposed expression) (#183973) - Compute `gelu` backward in opmath dtype for improved numerical accuracy (#183985) - Cap Triton convolution warps for non-1x1 kernels to avoid miscompilation (#183989) - Fix graph partition signatures to only drop buffers removed during that partition's codegen, preserving globally-removed buffers still needed by later partitions (#184004) - Handle `float8_e4m3fn` dequantization on pre-sm89 CUDA devices to match eager bit patterns (#184008) - Fix the native matmul config numel cap (#184011) - Use CUDA libdevice for emulate-precision casts to match eager numerics (#184022) - Fix Inductor compile-worker shutdown so the sidecar's nested worker pool is terminated and shutdown no longer hangs until the parent wait timeout (#184038) - Fix `bucketize`/`searchsorted` on sliced or zero-stride lookup tensors (#184043) - Fix scaled softmax non-finite semantics (#184046) - Fix CPU FlexAttention aliased input lowering (#184071) - Rewrite Triton floating-point self-subtraction to produce exact zero (#184093) - Treat corrupt local autotune cache entries (bad JSON/invalid UTF-8) as cache misses instead of crashing compilation (#184096) - Recurse through list/tuple arguments when applying `needs_fixed_stride_order` so fallback custom ops receive tensor-list inputs in the recorded stride order (#184098) - Fix CPU Inductor vectorized `asinh` overflow (#184105) - Treat low-precision saved-for-backward activations as precision barriers so forward math observes the same truncated value backward will load (#184110) - Fix int to float8 casts in Inductor Triton codegen (#184115) - Fix Inductor random fallback for `RReLU` (#184136) - Fix scalar tensor lowering for `torch.jagged` layout to match eager and meta behavior (#184146) - Preserve `out_dtype` for `scaled_mm` by propagating it to `MMKernelInputs` (#184168) - Fix Inductor CUDA `frexp` exponent for non-finite inputs (#184176) - Fix Inductor cache directory fallback for unmapped users (#184208) - Guard dilation in `convolution_backward` lowering so dilated `conv2d` backward compiles under dynamic shapes (#184224) - Force persistent reduction for `sort` in combo kernels (#184227) - Fix `as_strided` storage offsets for graph input views (#184232) - Guard dilation to ints in `convolution_backward` lowering so the Triton backward conv template no longer references undefined sympy symbols under dynamic shapes (#184255) - Fix reinplacing through view `index_put` (#184263) - Skip CUDA graphs for `aten.topk` on ROCm/HIP to avoid a rocPRIM memory fault on cudagraph-tree replays (MI350 / ROCm 7) (#184265) - Fix module-table exhaustion during long exhaustive autotuning (#184285) - Fix Inductor `gather` bounds for negative indices (#184287) - Fix CUDA graph trees when used from Python-created threads (#184357) - Fix Inductor compile pools hanging when running inside daemonic multiprocessing workers (#184472) - Fix deterministic selection to correctly detect bound extern (`ExternKernelCaller`) choices (#184493) - Fix CPU integer floor-division overflow so `INT_MIN / -1` matches eager instead of trapping (#184497) - Include default dtype in the Inductor FX cache key (#184500) - Fix Triton compilation failure for scan/cumulative reductions (`cumsum`/`cummax`/`cummin`/`cumprod`) on unsigned integer dtypes (#184514) - Fix Inductor fallback aliasing for boxed scalars (#184516) - Extend convolution input/weight dtype-mismatch checks to all devices (#184518) - Fall back to the standard lowering path for CUDA FP8 dtypes that Triton cannot compile for the active target (#184521) - Check `constant_offset` alignment in `TMACompatibilityChecker` (#184564) - Fix `acc_type` for fp8 dtypes in mm autotuning (use `triton_type` and accumulate in fp32) (#184591) - Fix `torch.cond` subgraph buffer reuse by scoping `EfficientPeakEstimate` per subgraph during AOT codegen (#184623) - Fix backward (gradient) support for `addcmul_` and `addcdiv_` under `torch.compile` (#184629) - Fix Inductor loop indexing expression canonicalization (#184650) - Fix `ZeroTensor` view with symbolic sizes (#184651) - Fix invalid assert-message concatenation in CPU `cpp_micro_gemm` that broke AOTI compilation of AVX512 VNNI/WoQ-Int4 kernels (#184693) - Refuse TMA for known-unaligned buffers and fall back to regular loads/stores (#184717) - Record IR reads nested inside `constant_args` and kwargs in `ExternKernel.get_read_writes()` to prevent index producers from being incorrectly eliminated (#184751) - Map float8 types correctly between torch and Triton for Triton template ops to unblock fp8 max-autotune (#184806) - Fix `Py_None` reference counting in the C++ wrapper (#184869) - Emit embedded Triton code and cubin files when loading saved cache artifacts so kernels are not needlessly recompiled (#184953) - Fix Inductor subprocess compile pool leaking named semaphore resources when `torch.compile` runs inside a multiprocessing child process (#185070) - Fix TorchInductor CPU codegen crash during vectorization tiling when an index expression contains relational sub-expressions (e.g. `torch.compile(dynamic=True)` with `torch.func.grad`) (#185080) - Skip TMA codegen for dtypes lacking a tensor-map enum entry instead of crashing at runtime (#185223) - Synchronize non-blocking device-to-host copies before a CPU read to avoid a race condition (#185252) - Fix AOTInductor C++ codegen most-vexing-parse failure when a cached output is initialized from a constructor-call expression (#185257) - Fix CuTeDSL grouped GEMM 'Invalid leading dimension' failure by using `get_stride_order` for assorted A/B layouts (#185437) - Fix a `NameError` in combo kernels when TMA is enabled by handling `DelayReplaceLine` load expressions (#185514) - Make MSVC compiler detection on Windows robust against non-zero exit codes and empty output to avoid crashes (#185523) - Fix a `cat` lowering assertion error with 1-D statically-empty tensors (#185549) - Accept interpreted Triton kernels in `wrap_triton` when `TRITON_INTERPRET=1` is set (#185597) - Fix `wait_stream` reordering by registering it among the synchronization ops that preserve control dependencies (#185627) - Fix `standalone_compile` cache artifact save for grad-enabled graphs whose backward is lowered lazily (#185635) - Preserve explicit lowp-fp (fp16/bf16) round-trip rounding on CPU under `emulate_precision_casts` to match eager (#185847) - Separate value-producing symbolic expressions from indexing so codegen uses the correct dtype width (e.g. int64 `arange`) in tensor value computation (#185853) - Gate the narrowing-cast bias-add unfuse on XPU to fix an accuracy regression on ROCm (#185856) - Apply a layout constraint to the `view.dtype` lowering when falling back (#185879) - Fix pickling of custom decomposition tables that broke FX graph caching (#185909) - Fix `FakeTensorUpdater` handling of higher-order ops and their subgraphs (#185962) - Implement `get_stride` for `PermuteView` to avoid a `NotImplementedError` (#185992) - Preserve NaNs for CPU libm calls by avoiding fast-math rewrites in generated C++ (#186018) - Fix Inductor crash when logging compute estimations that are `SymFloat` under dynamic shapes in overlap scheduling (#186054) - Fix fake dtype inference for weighted `torch.bincount` so downstream codegen uses the correct dtype (#186077) - Preserve tensor dtype in the `scatter_upon_const_tensor` rewrite for low-precision const tensors (#186481) - Fix Inductor Triton compile/runtime crash from codegen emitting `tl.broadcast_to(False, ...)` by using `tl.full` instead (#186621) - Fix `diagonal_scatter` backward under `torch.compile` (#185146) - Fix a `SymInt` crash in the overlap scheduler's collective/compute node benchmarking (#186065) - Allow generator placeholders through control deps (#183863) - Fix `torch.cat` axis handling in Inductor pre-grad fusion (#183995) - Fix stale backed-symbol references in AOTI deferred runtime asserts (#184624) - Fix AOT FXIR parallel Triton kernel reload (#185134) - Fix `fp32`->`bf16`->`fp32` casts being dropped (#180575) - Fix CUDA `atan` numerics in Inductor (#183984) - Fix `flip` on 0-d tensors in the `prims.rev` lowering (#184104) - Fix the `softmax` decomposition for symbolic empty dims (#184454) ## Ahead-Of-Time Inductor (AOTI) - Fix undefined identifier error in `CppWrapper` due to false-positive caching (#178147) - Scale lazy TMA scratch by grid in `cpp_wrapper` (#182825) - Fix folded constant offset indexing in AOTI constant buffer update (#179225) - Add GPU stream synchronization after constant folding in AOTI (#181945) - Fix use-after-free in `pointer_to_optional_list` (#183764) - Fix Windows AOTI self-mmap size seek (#186386) - Promote scalar literals to tensors for AOTI eager compilation (#185313) - Use `c10::make_scope_exit` to avoid exception leaks (#184520) - Fix deadlock in `AOTInductorModelContainer::run()` during concurrent constant folding (#181941) - Track and unload `CUmodule` handles to prevent GPU code object leaks (#184860) - Fix MSVC const pointer emission in `cpp_wrapper` temporary arrays (#179846) - Fix MSVC path append in kernel context stack compression (#179857) - Add explicit headers for `cpp_wrapper` to fix MSVC compilation (#180120) - Fix inductor AOTI codegen for `float('inf')`/`float('-inf')` kernel args (#180297) - Fix `cond` subgraph arrayref dispatch with generic lambda (#180558) - Fix arrayref proxy executor tensor args (#182751) - Defer Triton compile kickoff out of static init (#182824) - Fix `cpp_wrapper` while loop carried mutations (#183657) - Fix AOTI CUDA device copy allocation (#185634) - Resolve relative `TORCHINDUCTOR_CACHE_DIR` (#185723) ## Export - Fix NaN float scalar input handling in export guard codegen and input constraint checks (#180399) - Fix `IndexError` during decomposition by also excluding lifted tensor constants and custom objects when identifying user-input placeholders (#181179) - Fix serialization of predispatch wrapper functions (JVP, vmap) in `torch.export` save/load (#181263) - Fix Triton HOP argument packing to preserve kernel argument metadata (#182101) - Simplify `Min`/`Max` of scaled symbolic terms (e.g. `Min(128*s, 512*s)` reduces to `128*s`) so export no longer rejects valid branch guards (#185092) - Clean up the buffer-registration hook on non-strict export trace failures to avoid a stray `AssertionError` on later eager buffer assignment (#184956) - Fix export dynamic shapes for sparse COO inputs (#184993) - Handle scalar tensor slice bounds in non-strict export (#184925) - Fix `torch.export.load` GIL contention during tensor deserialization (#175983) ## AOTAutograd - Fix `torch.compile` crash with batched matmul in `inference_mode` (#181913) - Fix expanded output tangent stride handling (#184519) - Fix AOT synthetic-base out view returns (#185029) - Preserve linalg error checks in AOT graphs (#184111) ## Composability - Fix data-dependent errors (unbacked SymInts) in `pixel_shuffle`, `pdist`, and reflection/replication padding ops (#183814) - Add differentiable decomposition for `max_pool2d/3d_with_indices` (#179104) - Add validation for invalid `MaxUnpool` output sizes in meta/decomposition kernels (#184706) - Add validation for invalid `conv2d` kernel size in meta and symbolic-shape kernels (#180448) - Add `addmv` decomposition dtype validation (#184140) - Add `fill_` meta value-tensor dimensionality validation (#179363) - Add `_weight_int8pack_mm` meta inner-dims and scales validation (#179364) - Fix `torch.empty(..., out=...)` shape validation under `torch.compile` (#182349) - Fix `torch.compile` wrong output shape for `norm()` with a negative `dim` (#182405) - Fix `frac` decomposition signed-zero handling (#183640) - Fix `pad_sequence` mixed-dtype padding decomposition (#184173) - Fix `istft` fake tensor length padding (#184532) - Fix `unfold_backward` decomposition for overlapping windows (#183996) - Fix split `Tensor` decomposition in Inductor (#184134) - Fix embedding negative indices in Inductor (#184107) - Fix flash SDPA activation dtype mismatch between meta and CPU implementations (#185573) - Preserve 5D nearest upsample decomposition layout (#184553) - Preserve `aten.hardtanh` meta semantics for export (#185298) - Fix `_fused_dropout` decomposition at keep-probability zero (#184979) - Fix `addmm` decomposition crash with `out_dtype` under `FakeTensorMode` (#179634) - Fix `torch.split` decomposition for empty dim with nonzero `split_size` (#181493) - Fix `torch.distributions.Gamma` under `torch.compile` (#174090) - Fix `miopen_batch_norm` meta `save_mean`/`save_var` dtype (#179365) - Fix reflection/replication pad stride mismatch under `torch.compile` (#179837) - Fix symbolic float `lp_pool2d` compilation (#184000) - Compare in opmath in `hardtanh_backward` decomposition (#185840) - Use `torch.sigmoid()` in `silu_backward` decomposition (#185041) - Fix `index_copy` decomposition shape checks (#184338) - Fix LSTM export hidden state metadata (#185716) - Fix private convolution fake symint handling (#185081) - Preserve strides in meta `zero` (#185360) - Fix runtime check for `non_overlapping_and_dense` (#186785) - Update `_cslt_sparse_mm` meta registration for hipSPARSELt (#181609) - Fix reflection/replication pad output memory format to match eager behavior on XPU (#184484) - Handle unbacked dims in folded matmul under `FakeTensor` (#183397) - Preserve unbacked batch dims in SDPA tracing under `ProxyTensor` (#183398) - Fix `mix_order_reduction` over-fusion via load count check (#179494) - Fix `torch.compile` crash from `aten.lift` functionalization on an already-functionalized tensor (e.g. `randint` followed by `lift`) (#185805) ## Quantization - Fix a segmentation fault when running fp8 qlinear on x86 CPU without AMX, caused by the qlinear primitive cache (#184317) ## Foreach - Fix `_foreach_sub` under compile (#184421) ## ONNX - Remove incorrect `CastLike` handling logic from `OpRecorder` (#182197) - Fix `_rotary_embedding_23_fake_impl` stride drift for 3D and 4D inputs (#184854) - Fix `invoke_subgraph` export with lifted tensor constants (#182230) - Fix ONNX dynamic-shape RNN capture (#184872) - Fix ONNX type promotion overload selection (#185005) ## C++ Frontend - Fix crash with invalid embedding bag `mode` (#186428) ## Build Frontend - Fix `-Winconsistent-dllimport` warning in `tensor_numpy` and `tensor_new` headers on Windows (#183703) - Fix missing symbol exports for `ValueError`/`NotImplementedError` on Windows (#175340) ## CUDA - Workaround for `nvrtcCompileProgram` changing locale in CUDA < 12.6.2 (#180569) - Zero `total_weight` before accumulating in `nll_loss2d` (#182082) - Fix `dtype` promotion in `max`/`min` kernel (#181505) - Round per-process memory fraction cap to avoid spurious OOM (#179444) - Fix `torch.cuda.ExternalStream(0)` to wrap the NULL stream (#183258) - Fix stream pool collision in conditional graph nodes (#185836) - Preserve internal precision for `native_group_norm` in eager (#183946) ## cuDNN - Don't route to cuDNN SDPA for batch size or head dim > 65536 (#180718) ## MPS - Fix LSTM train/eval error (#180873) and LSTM dropout not being applied correctly (#185351) - Fix `multinomial` SIGSEGV (#180493) - Fix async copy failing (#181017) - Work around a MetalPerformancePrimitives bug for `F.linear` on M5+ (#181466) - Fix sliced sum reduction (#182688) and Metal unary operator behavior on large strided tensors (#183447) - Fix `uint32` offset overflow in scatter/gather kernels for strided views crossing 2^32 elements (#182054) and move `col2im` offset/stride to `long` to avoid overflow corruption (#185664) - Fix NaN handling: `relu` (#183571), `softshrink` (#183710), `hardsigmoid` (#183939), `cholesky` (#184588), and `fast::tanh` overflow (#186286); return NaN for `std`/`var` on empty input (#184510) - Fix `layer_norm_backward` silent correctness bug for frozen inputs (#183893) - Fix Welford reduction codegen with dynamic shapes (#184206), a missing barrier in Welford reductions (#184328), and an Inductor undeclared identifier in multi-pass Welford reductions (#184502) - Fix SDPA vector kernel mask offset for partially broadcast masks (#184180) and additive mask scaling in prefill attention (#184400) - Fix `_amp_foreach_non_finite_check_and_unscale_` zeroing fp16/bf16 grads (#184286) and stop ignoring grad scale and `found_inf` (#186360) - Materialize neg bit in `copy_kernel_mps` (#184403) - Fix `sort` returning out-of-bounds indices for bool/int-max/NaN inputs (#184620) - Fix generator clone (#185002) - Fix `fill_` on byte-dtype views with misaligned storage offset (#183790) - Fix complex exp family on the real axis using `precise::sincos` (#184749) - Make `deviceCount()` consistent with Python to fix `at::manual_seed()` (#164571) - Fix `scale` not being cached (#184122) - Fix attention compilation on nightly (#186399) - Fix the FFT warning (#183061) - Disallow bitwise shifts for bool dtype (#186558) - Fix bucketization speed/correctness (#185622) - Make index copy fast (#185750) - Enable and fix large-tensor tests on MPS (#182863) ## ROCm - Support TheRock wheel distribution in `_find_rocm_home` (#180723) - Fix `warpMergeSortTopK` padding sentinel for integer dtypes (#182212) - Guard `ck_group_gemm` on `USE_ROCM_CK_GEMM` (#182615) - Fix large arange launch (#182657) - Fix `triu`/`tril` for 64-bit indexing for large matrices (#179717) - Drop dead CUDA/ROCm version gates from tests and helpers (#184879) - Fix `LayerNorm` backward kernel for AMD Strix Halo GPUs (#183864) - Decline CuteDSL `scatter_add` on ROCm (#185678) - For HSTU, fix CK flash-attn GQA `seqlen_q==1` garbage output (#186434) - Inductor fixes: - Add config flag to disable `pointer_range_32` optimization (#179604) - Fix `maybe_hipify_code_wrapper` for bare-token inputs (#183725) - Work around file handle limits in `StaticCudaLauncher` (#183926) - Preserve combo kernel HIP compile options (#180277) - `lookup_device_info` is now case-insensitive (#182284) - Windows - Fix MIOpen CTC loss crash on Windows (#179264) - Apply per-config HIP optimization flags via `CMAKE_HIP_FLAGS` (#183856) - Fix inconsistent `dllimport` (#183690, #183324, #183282, #183694) - Remove redundant cuSPARSE/hipSPARSE error-string forward declarations (#180327) - Remove MSVC flags from `CMAKE_HIP_FLAGS` (#183365) - Don't set `USE_ROCM_CK_SDPA` on Windows (#183962) ## XPU - Avoid generating fp64 Triton code for XPU devices that do not support fp64 (#180854) - Fix stream selection for XPU outputs in `CurrentWorkStream` (#179140) - Fix reflection and replication padding on XPU to preserve eager-mode output memory format (#184484) - Fix `addmm` shape handling and `addmv_out` stride preservation on XPU (#180985, #178498) - Fix XPU deallocation handling and `XPUPluggableAllocator` registration (#183865, #179392) - Fix numerical instability in `logcumsumexp` with complex inputs on XPU (#174492) - Fix `SyclExtension` Windows builds for oneAPI 2025.3 and later (#170701) - Fix `getGlobalIdxFromDevice(-1)` handling on XPU (#181361) ## Benchmark - Fix import-time device loading in benchmark timer (#181716) ## TorchScript - Fix OOB read in `MemoryReadAdapter::read` (#181193) - Validate tensor sizes/strides/storage_offset in C++ Unpickler (#183381) - Fix integer overflow in Unpickler storage size computation (#181310) - Fix `broadcast_shapes` op missing in selective builds (#180860) - Fix `binary_cross_entropy` SymInt error with dynamic shapes by registering `aten::broadcast_shapes` as a TorchScript builtin (#180583) - Fix use-after-free in symbolic-shape runtime fusion guard (#183760) - Apply bugfixes when enabling Link-Time Optimizations (#180868) # Performance ## Autograd - Use indexed storage for selective activation checkpointing (SAC) to avoid calling `policy_fn` during recompute (#176455) ## Distributed - Speed up store-based metadata exchange on `TCPStore` by using `multiGet` and a server-side `barrier`, reducing network round trips from `2*(world_size-1)` to `1` (#182132) - Coalesce the NCCL buffer and signal pad into a single symmetric-memory allocation so window registration runs only once (#183344) - Fuse slice-cat TP collective patterns (#184911) ## FX - Skip `GraphModule` reconstruction in `CSEPass` when no common subexpressions were eliminated (#185479) ## Dynamo - Fast path guardless cache hits (#184683) - Optimize jagged NestedTensor compile guards (#184053) - Skip Dynamo graph break for scalar-only binary ops when tensorify is enabled (#183584) - Avoid `repr` in Dynamo `ID_MATCH` guard text (#184796) - Add a pinned memory pool for activation-offloading `ao::offload` ops to avoid per-tensor `cudaHostAlloc` overhead (gated by the `pinned_memory_pool()` context manager) (#186162) ## Inductor - Eliminate unnecessary clones for dtype views in `auto_functionalize`, improving FP8 KV-cache performance (#173177) - Fix `basic_gnn_sage` fp32 single-thread performance regression (#177958) - Add a tail-size heuristic for CPP tail-loop vectorization to avoid masking/cast overhead in unprofitable cases (#178243) - Raise the split-reduction threshold to 524K on Blackwell+ to avoid over-splitting moderate reductions like softmax/entropy (#179729) - Add a pass to replace NVLink collectives with CopyEngine collectives during overlap to remove SM contention with matmuls (#179937) - Recalibrate the NCCL analytical model for comm/compute-overlap bucketing with auto-detected bandwidths and per-GPU-generation parameters, improving overlap (up to +14% MFU) (#180463) - Add `_FastCudaLauncher`, a vectorcall C extension for pre-bound kernel launch that reduces per-launch overhead (#180507) - Enable PadMM AutoHeuristics by default in deterministic mode, improving deterministic-mode inference speed (~14% on HuggingFace) (#181038) - Skip catastrophically slow polynomial `sympy.gcd` on very wide shape expressions, cutting some backward compiles from over 50 minutes to about 6 (#181275) - Add a 128x256x64 (`num_stages=4`) matmul config that speeds up large Hopper matmul shapes by ~1.3x and up (#181413) - Run Inductor joint-graph passes on `nested_compile_region` (`invoke_subgraph`) subgraphs created with options, which were previously skipped (#181834) - Use scaled persistent configs for the Blackwell scaled-mm TMA autotuning heuristic (#182009) - Generate vectorized loads in score-mods for speedups on contiguous, aligned key/value-dimension loads (#183406) - Enable reduction-broadcast vertical fusion for block-wise quantization (e.g. MXFP8/MXFP4) by reindexing pointwise nodes before `can_fuse_vertical`, reducing kernel count (#183521) - Use int32 indices in `grid_sampler_2d` lowering on CUDA/XPU when sizes fit, avoiding unnecessary int64 arithmetic (#184269) - Use the two-step variance path for small non-split CUDA reductions for better performance (#184383) - Emit `evict_first` for coalesced last-use loads in persistent reductions (#184395) - Use CPU-specific realization heuristic defaults to keep moderate pointwise bodies fused (#184411) - Faster FlexAttention CuteDSL codegen via vectorized mask-mod loads and packed-interval span lowering (#184438) - Avoid recomputing `log` in reused CPU pointwise so T5-style softmax bias inputs are materialized once (#184473) - Use an Inductor-owned CUDA benchmarking path with an L2-sized cache buffer to avoid Triton's fixed 256MB autotune cache allocation (#184479) - Improve compute/collective overlap scheduling by prioritizing collective prefetch candidates that fill more of the available overlap window (#185186) - Fuse the decomposed `_safe_softmax` SDPA math path back into a native `scaled_dot_product_attention` call (new SFDP patterns 29/30) (#185574) - Support CUTLASS EVT epilogue fusion through view/reshape between a GEMM and its pointwise consumer (#185796) - Restore dense MKL-DNN pointwise convolution speed by keeping the `forward_inference` prop kind only for channels-last/MKLDNN-layout, fixing a ~2x dense-contiguous slowdown (#185997) - Pre-bucket FSDP collectives in the compile overlap scheduler, merging many per-parameter all-gathers into bandwidth-saturating buckets (#179935) - Decompose small dot-shaped batched matmuls (`bmm`) (#183911) ## Ahead-Of-Time Inductor (AOTI) - Parallelize tensor-to-bytes conversion for AOTI weight serialization (#181280) - Enable shared model loading from a directory to avoid redundant unzipping (#172436) ## Composability - Use `torch.var_mean` to fuse paired var/mean reductions (#184843) - Avoid a Triton sort compile-time cliff in `create_block_mask` (#182745) ## C++ Frontend - Fix reduced-precision `rsqrt()` double promotion (#181232) ## Release Engineering - Add an operator microbenchmark comparison workflow for PRs (#179476) - Add a batch-invariant accuracy mode for benchmark perf tests (#180610) ## CUDA - Fix CUDA version check gating warp merge sort (#183527) - Allow specifying `nbits` to radix sort in `embedding_dense_backward_cuda` (#183578) (#183578) - Vectorize `scatter_add` with TMA bulk reduce on sm_90+ (Hopper) (#182675) ## CPU (x86) - Speed up random number generation for `bfloat16` and `half` tensors on x86 (roughly 2x faster) by using AVX2/VSX vectorized instructions in the `normal_`/`randn` kernel (#179834) ## CPU (AArch64) - Improve `bfloat16` transpose performance on AArch64 by adding a dedicated SVE-vectorized `transpose_mxn` implementation (#174097) - Add SVE128 dispatch for Arm CPUs (#176256) ## MPS - Fully utilize Philox state in distribution kernels (#182247) - 2D dispatch for strided unary kernels (#185291) - Templatize Im2Col to regain performance when 32-bit indexing suffices (#185860) - Faster norms (#186076) - Flatten 5D tensors to 4D in `batch_norm` for performance (#180335) ## ROCm - Set `MIOPEN_FIND_MODE=FAST` in op benchmark CI to prevent cold-cache timeout (#179795) - Fix FlexAttention fp16 default `num_warps` (8 -> 4) on AMD GPUs (#180720) - Fix perf regression in `index_add` and `index_reduce` (#182533) - Add no-fence optimization to the JIT reduce template (#176812) - Add target-dependent FlexAttention default forward configs (#181283) ## XPU - Add oneDNN-backed `nn.LSTM` inference support on XPU, replacing the per-timestep fused-cell path with a sequence-level primitive (#185531) ## Sparse Frontend - Optimize the layernorm + sigmoid epilogue by providing an ideal input shape to layernorm after sparse matmul (#183472) # Documentation ## Python Frontend - Fix `out_dtype` signatures for `bmm`, `mm`, `addmm`, `baddbmm` (#179182) - Add CUDA SDPA determinism section to `randomness.rst` (#182551) - Convert stub docs pages to MyST Markdown (#183498) - Expose `nonzero_static` docs (#185674) - Note `expand` materialization costs (#185400) - Fix `torch.trapz` documentation signature to match `torch.trapezoid` (#180571) - Clarify that `torch.normal` does not support integer dtypes (#180580) - Document actual keyword argument names for `tensor_split` (#182075) ## Dataloader Frontend - Document previously undocumented functions in the `torch.utils.data` documentation (#182682) ## Optimizer - Use `\gamma` consistently for `lr` in `Adafactor` math blocks (#184773) - Clarify `ReduceLROnPlateau` `threshold_mode` behavior (#180638) ## Distributed - Improve the wording of the `batch_isend_irecv` documentation (#183022) - Add documentation for 8 functions in `distributed.md` (#182544) - Add TorchComms backend documentation to `torch.distributed` (#182711) - Add a distributed training integration guide for out-of-tree accelerators (#182308) - Convert the torchelastic `elastic/quickstart.rst` from reStructuredText to MyST Markdown (#182569) - Convert the RPC `rpc/rref.rst` from reStructuredText to MyST Markdown (#182877) - Clarify that `--node-rank` is only used with static rendezvous (#182374) - Add API reference documentation for previously-undocumented functions in `torch.distributed.rpc` (#183393) - Add API reference documentation for previously-undocumented functional optimizer APIs in `torch.distributed.optim` (#182871) ## Distributed Checkpointing - Document previously undocumented functions in the `torch.distributed.checkpoint` API reference (#182887) ## DTensor - Clarify default dtype behavior in the `DTensor.redistribute` docstring (#181671) - Document undocumented functions in `distributed.tensor.parallel.md` (#182876) ## Distributed FSDP2 - Document previously undocumented functions in `distributed.fsdp.fully_shard` (#182866) ## Profiler - Remove references to `_KinetoProfile` in public docs (#180672) ## Export - Fix typos in attention bias, activation, and dataloader docs (#184244) ## ONNX - Remove stale Caffe2 references from ONNX TorchScript exporter docs (#180498) ## C++ Frontend - Fix typos in export wrapper docstring and transformer module comment (#181972) # Developers ## Optimizer - Add optimizer reparameterization helper for non-strict tracing (#181643) ## Autograd - Expose the PrivateUse1 backend name as an alias in `DeviceType` (#184835) - Show the forward op name instead of the backward node name in autograd anomaly/error messages (#180383) ## Distributed - Add a missing include to `GlooDeviceFactory.cpp` (#182800) - Fix a missing `#include <cuda.h>` in `CUDASymmetricMemoryTypes.hpp` (#183704) ## FX - Add a fast path in `GraphPickler.reducer_override` for primitive types (#181602) ## Inductor - Enable the Inductor SYCL-TLA standalone runner on XPU (developer benchmarking tooling) (#174958) - Add an optional Torch-Profiler-based Inductor autotuning benchmarker (off by default, env-gated) for more accurate timing of short-duration kernels (#175097) - Add a dedicated custom-pass class for `_pre_fusion_custom_pass` to match its scheduler-node signature (#179050) - Include `_post_fusion_custom_pass` in the FX graph cache hash (#179051) - Share storage for aliased inputs in the generated `benchmark_compiled_module` repro code to avoid OOM (#181119) - Enable frame pointers by default in AOTInductor shared libraries so profilers get accurate stacks (#181358) - Fix decomposition and lowering debug info (overload names) for the compiler bisector, including across subprocesses (#181452) - Add DOT graph dumps for Inductor debug traces (#184039) - Fix the Inductor `save_args` debug/repro tooling to serialize fake tensors and symbolic metadata so it works with dynamic shapes (#184428) - Fix the device argument in the generated combo-kernel benchmark script (#184868) ## Ahead-Of-Time Inductor (AOTI) - Add C-ABI-safe V2 interface for MinimalArrayref (#179483) - Add C-ABI-safe V2 interface for UpdateConstantsMap (#180533) - Add C-ABI-safe ExtractConstantsMapForEach (#183030) - Add C-ABI-safe UpdateConstantBufferPairs (#183031) - Add C-ABI-safe UpdateConstantBufferFromCpuPairs (#183032) - Add C-ABI-safe UpdateInactiveConstantBufferPairs (#183033) - Add C-ABI-safe AOTInductorModelCreateV2 (#185729) ## Composability - Change most HOPs to use `@register_fake` instead of `py_impl(FakeTensorMode)` (#186247) - Genericize graphsafe RNG in `aot_autograd` to support non-CUDA device backends (#182391) - Mark `graphsafe_run_with_rng_state` as cacheable for `FxGraphCache` (#185562) ## Release Engineering - Migrate the build to CMake / scikit-build-core: move NCCL checkout, source-file mirroring, header wrapping, `compile_commands` merging, and the `torch._C` extension/`version.py` build out of `setup.py` and into CMake (#181450, #177642, #177643, #177644, #180243) - Drop the setuptools `concat_license_files` hook and adopt PEP 639 `license-files`; replace deprecated `distutils` usage (#180237, #182120) - Install `libaotriton_v2.so` via cmake install for wheel packaging (#180242) - Embed the macOS OpenMP runtime in `PostBuildSteps` (#180239) ## XPU - Respect `MKLROOT`, `CMPLR_ROOT`, and `ONEAPI_ROOT` from `setvars.sh` in `FindMKL.cmake` so custom oneAPI installs are detected correctly (#183506) ## TorchScript - Add `torch._C._jit_replace_submodule` to swap submodules in scripted modules while updating parent types and remapping referenced types across graphs (#180296) - Use `TORCH_CHECK` instead of `AT_ASSERT` for single input/output node helpers, producing clearer error messages (#181282) - Expose `overlapsWithUsedNodes` and `getVmap` from `SubgraphRewriter` (#183333)
-
v2.12.1
GitHub ↗
原版更新说明
This release is meant to fix the following regressions and silent correctness issues: ## Regression fixes - Fix nondeterministic outputs in test_batch_invariance with FLASH_ATTN on NVIDIA B200 GPUs ([#181248](https://github.com/pytorch/pytorch/issues/181248)), fixed by updating Triton to 3.7.1 ([#186814](https://github.com/pytorch/pytorch/pull/186814)) - Fix illegal memory access in the Triton convolution2d_bwd_weight kernel on B100/B200 (sm100) GPUs ([#187081](https://github.com/pytorch/pytorch/issues/187081)), fixed by updating Triton to 3.7.1 ([#186814](https://github.com/pytorch/pytorch/pull/186814)) - Fix fill_ on byte-dtype views with misaligned storage offset ([#186821](https://github.com/pytorch/pytorch/pull/186821)) ## Releng / Build - Drop CPython 3.13t from the binary build matrix ([#182951](https://github.com/pytorch/pytorch/pull/182951))
此处仅展示最近 5 个版本。 在原站查看完整版本历史 ↗
当前收录版本
0.0.1
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
原始报告维度不完整,仅展示已提供的分数,不补算缺失项。
亮点
- 面向 PyTorch 开发者的高频刚需场景,有效解决 ghstack 堆栈 CI 资源调度痛点
- 功能闭环完整,显著提升开发迭代效率
亮点
- 触发场景描述精准完整,覆盖创建、提交、更新、重堆叠、合并等全生命周期
待提升项
-
文档过长 原报告严重程度:轻微
SKILL.md 内容约 600 行,超出建议的 500 行限制
改进建议:考虑将部分详细说明移至独立文档或通过链接引用,保持主文件简洁
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
来源文档未说明。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。