Migrating to PyTorch v2.8.0
Version v2.8.0 introduces 6 breaking changes. This guide details how to update your code.
Released: 8/6/2025
⚠️ Check Your Code
If you use any of these symbols, you need to read this guide:
torch.segment_reducetorch.nn.Hardshrinktorch.autograd.Functiontorch.tensordottorch._dynamo.mark_dynamictorch._dynamo.maybe_mark_dynamictorch.condtorch._inductor.configtorch._functorch.config.custom_op_default_layout_constrainttorch.compileBreaking Changes
●Issue #1
Support for older NVIDIA GPU architectures (sm50 - sm60, corresponding to Maxwell and Pascal) has been dropped in PyTorch builds using CUDA 12.8 and 12.9 due to binary size limitations.
✓Solution
If you require support for sm50 or sm60 architectures, you must use a PyTorch build compiled with CUDA 12.6 or earlier.
●Issue #2
Calling an operation (op) with an input tensor whose dtype is unsupported by that op now raises a `NotImplementedError` instead of a generic `RuntimeError`.
✓Solution
Update exception handling blocks that catch `RuntimeError` for unsupported dtype inputs to catch `NotImplementedError` instead.
●Issue #3
Custom `torch.autograd.Function` implementations that perform in-place modifications on a view of a leaf tensor requiring gradients will now correctly raise a `RuntimeError`.
✓Solution
Ensure that custom forward methods in `autograd.Function` do not perform in-place operations on views of input tensors that require gradients, or explicitly use `ctx.mark_dirty(inp)` if mutation is intended and handled correctly.
●Issue #4
Calling `torch.tensordot` with an output tensor specified via the `out` argument that also has `requires_grad=True` now correctly throws a `RuntimeError`.
✓Solution
Ensure that the tensor passed to the `out` argument of `torch.tensordot` does not require gradients, or omit the `out` argument entirely if you intend for the result to be part of the computation graph.
●Issue #5
Specialization of a tensor shape marked as dynamic using `torch._dynamo.mark_dynamic` can now lead to an error if the compilation process introduces a new guard that forces specialization.
✓Solution
Replace calls to `torch._dynamo.mark_dynamic(x, dim)` with `torch._dynamo.maybe_mark_dynamic(x, dim)` to allow the compiler to handle dynamic marking more robustly.
●Issue #6
Several configuration variables related to `torch.compile` have been renamed or removed.
✓Solution
Consult the full release notes or documentation for the specific names of the removed or renamed Dynamo configuration variables and update your compilation setup accordingly.
Migration Steps
- 1Review your target CUDA version and GPU architectures. If you are using Maxwell (sm50) or Pascal (sm60) GPUs, downgrade your PyTorch installation to use a build compiled with CUDA 12.6 or earlier.
- 2Update any exception handling logic that catches `RuntimeError` specifically for operations failing due to unsupported input dtypes; change these catches to `NotImplementedError`.
- 3Inspect custom `torch.autograd.Function` implementations. If they modify input views in-place, ensure this behavior is safe, especially if the input requires gradients, to avoid the new `RuntimeError`.
- 4Verify calls to `torch.tensordot` using the `out` argument. If the output tensor requires gradients, remove the `out` argument or set `requires_grad=False` on the output tensor.
- 5If you use `torch._dynamo.mark_dynamic` in conjunction with `torch.compile`, consider replacing it with `torch._dynamo.maybe_mark_dynamic` to prevent potential specialization errors.
- 6Check any custom configuration settings used with `torch.compile` (Dynamo configs) and update them based on the renamed or removed variables mentioned in the release notes.
Release Summary
PyTorch 2.8.0 introduces high-performance quantized LLM inference on Intel CPUs, SYCL support for CPP extensions, and stricter validation for autograd and torch.compile. It includes significant breaking changes regarding CUDA architecture support and internal configuration renames.
Need More Details?
View the full release notes and all changes for PyTorch v2.8.0.
View Full Changelog