Update dependency torch to v2.13.0#35
Open
renovate[bot] wants to merge 1 commit into
Open
Conversation
79bb96d to
8a80e22
Compare
8a80e22 to
6f9c396
Compare
6f9c396 to
6c384de
Compare
6c384de to
3b53041
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
==2.9.1→==2.13.0Release Notes
pytorch/pytorch (torch)
v2.13.0: PyTorch 2.13.0 ReleaseCompare Source
PyTorch 2.13.0 Release Notes
Highlights
nn.LinearCrossEntropyLosscombines the final prediction and loss computation to cut peak GPU memory by up to 4x for large-vocabulary language model training.torch.compiletargeting, and Intel XPU exposes new device telemetry APIs.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.compileon CPU in environments without a GPURunning a
torch==2.13.0+rocm7.2wheel in an environment where no GPU is available (torch.cuda.is_available()isFalse) breakstorch.compileon the CPU path: the first compile raisesRuntimeError: Can't detect vectorized ISA for CPU(#189194). This is a regression fromtorch==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
+rocmwheel 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/manylinuxremoved CPython 3.13t (free-threaded) on 2026-05-07, because 3.13twas experimental and has been superseded by the now-non-experimental CPython 3.14t. As a result,
PyTorch 2.13 no longer ships
cp313twheels (Linux, Triton, and related artifacts). Users on thefree-threaded interpreter should move to Python 3.14t.
PyTorch 2.12:
# cp313t (free-threaded 3.13) wheels were available python3.13t -m pip install torchPyTorch 2.13:
# Use free-threaded Python 3.14t instead python3.14t -m pip install torchBare
PyObjectis no longer allowed in operator schemas (#184209)Bare
PyObjectwas accidentally accepted in operator schema strings inPyTorch 2.12. This was undocumented and is now rejected, since
torch.compiledoes not support arbitrary
PyObjectinputs to custom ops. Ifyou parse or register a schema with a bare
PyObjectargument or return type,you will now get a schema parse error.
PyTorch 2.12:
PyTorch 2.13:
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 installbuild flow.
PyTorch 2.12:
# Build PyTorch with Bazel bazel build //:torchPyTorch 2.13:
Enforce C++20 minimum in header guards (#178150). In PyTorch 2.13, C++20 is now required to import PyTorch headers.
StorageImpl's built-in copy-on-write (COW) materialization is replaced by a pluggable materializer hook (#179063)StorageImplno longer knows about COW directly. Its internal COW entry pointsStorageImpl::is_cow(),StorageImpl::maybe_materialize_cow(), and the friendcow::materialize_cow_storage()have been removed in favor of a single pluggableMaterializeFnhook (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, refcountedshared 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
StorageImplCOW symbols directly; they will fail to compile against 2.13with errors such as
no member named 'is_cow' in 'c10::StorageImpl'. Migrate to thenew hook API (
set_materializer()/has_materializer()/clear_materializer()).PyTorch 2.12:
PyTorch 2.13:
Convert
shared_ptr<Node>tointrusive_ptr<Node>(#181139). This changes the signature ofTensor::grad_fn. Accesses toTensor.grad_fn()should change fromstd::shared_ptr<Node>toc10::intrusive_ptr<Node>. Similarly, construction of a C++ autograd function should change:PyTorch 2.12:
PyTorch 2.13:
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(), thenames=keyword on factory functions (e.g.torch.zeros,torch.empty,torch.ones), and the C++Dimname/DimnameListAPIs. 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.binaryand.binary_tensoroperators no longer alias their input but rather return fresh tensors. Previously these ops mutated theqaccuminput 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 aUserWarningstating 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:
Updated:
Creating tensors with the quantized dtypes
quint8,qint8, andqint32is now deprecated and emits a warning. This covers both Python and C++ call sites; see #184982 for migration guidance (#184984)PyTorch 2.12:
PyTorch 2.13:
Rename distributed collective ops to the
_singlenaming scheme and deprecate the old names (#186123, #186124, #186125, #186134, #186135, #186144)To align the public
torch.distributedcollective APIs with the naming used by torchcomms'TorchCommBackend,all_gather_into_tensoris renamed toall_gather_singleandreduce_scatter_tensortoreduce_scatter_single. The previous names continue to work as thin wrappers that delegate to the new functions, but now emit aFutureWarning.PyTorch 2.12:
PyTorch 2.13:
New Features
Python Frontend
torch.Tag.inplaceandtorch.Tag.out, that let an operator declare how it writes its result:inplacemeans it mutates a tensor in place, andoutmeans it writes into a caller-provided output tensor. Native PyTorch operators are tagged automatically, and custom operators defined withtorch.librarycan opt in by adding the tag. To be taggedinplace, an operator must take the tensor it mutates as its first positional argument (declared asTensor(a!), and the only mutable argument) and return that same tensor. Tagging a custom operator this way improves its behavior undertorch.compile:inplaceops now go throughauto_functionalize, so the reinplacing pass can analyze clones and skip unnecessary copies, and bothinplaceandoutops get their fake/meta kernels generated for free. See the Python custom operators tutorial for how to author and tag custom operators. (#181100, #181099, #184199, #184200, #184201, #184202, #184203, #180851, #180852)const_data_ptr()Python binding totorch.Tensorfor read-only data pointer access (#180382)abbrproperty totorch.dtypethat returns a dtype's short string abbreviation (e.g.torch.float32.abbrreturns"f32") (#177296)Functions (#182206)rearrangein thetorch.funcnamespace for einops-style tensor reshaping (#173183)torch.nn
nn.LinearCrossEntropyLoss, a fused linear-projection plus cross-entropy loss module that avoids materializing the full logits tensor (#181573, #185852, #172286, #186113)Autograd
torch.autograd.graph.region_activation_memory_budget(#185979)dicttotorch.autograd.gradandtorch.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 onProcessGroupNCCL, enabling symmetric memory to work with out-of-tree backends such as torchcomms (#184260)Support accessing the
ReduceOp.PREMUL_SUMfactor from Python when implementing process group backends in Python (#185863)Expose the NCCL 2.30
maxP2pPeersconfig 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_kwargsparameter tostep(), enabling loss functions that require arguments beyond(output, target)(such as chunked cross-entropy needing token counts for scaling) (#181057)Distributed FSDP2
FSDPModule.set_separate_reduce_scatter_groupto give reduce-scatter its own NCCL communicator, enabling opt-in overlap of all-gather and reduce-scatter (#186335)set_reduce_scatter_max_input_buffersto keep multiple reduce-scatter input buffers in flight, so backward compute no longer stalls waiting to recycle a single reduce-scatter buffer (#186000)Profiler
Dynamo
torch.compiler.set_default_backendto override the defaulttorch.compilebackend globally, so out-of-tree backend authors don't need to passbackend=at every call site (following the pattern oftorch.set_default_dtype/torch.set_default_device). Explicitbackend=arguments still take precedence (#178944)torch.compile(f, isolate_recompiles=True)to give eachtorch.compilecall its own isolated cache bucket, preventing cross-compile interference in cache lookups and recompile-limit checks when multipletorch.compilecalls target the same function (#178351)register_multi_grad_hooksupport to@leaf_function, allowing a backward hook to fire once per backward pass when allrequires_gradinputs have their gradients computed (#179609)Inductor
FlexAttentiontemplate (chosen when query length is 1) with a new configurablePARTITION_SIZEkernel option (#159835)decomp_comms) that eliminatesall_gatherfor Gram-matrix optimizer patterns (Muon/Shampoo) under FSDP, gated byconfig.aten_distributed_optimizations.allow_comms_decompositions, yielding 1.25-1.95x training speedups (#184370)Ahead-Of-Time Inductor (AOTI)
TORCH_TARGET_VERSION, so shims introduced in newer releases are only exposed when the target version supports them (#181916)torch._inductor.aoti_compile_and_package/aoti_load_packageAPI, including packaging and loading of the multiple.sofiles emitted per kernel (#182251)torch_exception_get_what,torch_exception_get_what_without_backtrace, andSTABLE_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)aoti_torch_stream_native_handleandtorch::stable::accelerator::Stream::nativeHandle(), gated behindTORCH_FEATURE_VERSION >= 2.13, for retrieving a native stream handle from the stable ABI (#183930)Release Engineering
CUDA
CUDAGraph.get_graph_data()for graph topology introspection (#183165)MPS
torch.distributions.Dirichleton MPS by adding_sample_dirichletand_dirichlet_gradMetal implementations (#185458, #185854)grid_sampler_2dbackward support on MPS (#179756)grid_sampler_3dbackward support on MPS (#179388)lcmsupport on MPS via a new Metal kernel (#186279)c10/metal/reduction_utils.h(#180708) and a complex->bool specialization (#185938)ROCm
enable_language(HIP)(#180485)XPU
torch.xpu.*(#181082, #183427, #183428, #183429, #183430, #183431)scaled_mmon XPU (#173630, #176043)Improvements
Python Frontend
torch.load(#170592)Storage.pin_memory/Storage.is_pinneddevice-agnostic (#186223)op_overloadstoOpOverloadPacketto enumerate an operator's overloads (#182993)torch.nn
num_splitsin FlashAttention-2 and bump the flash-attention submodule (#179760)linear_biasinlinear_cross_entropyon the reference and chunked paths (#185129, #185276)Optimizer
SequentialLRwrong learning rate initialization whenmilestonescontain 0 (#185986)Autograd
torch.nextafter(#148820)torch.autograd.enforce_grad_layout_policyto control the memory layout policy for accumulated gradients (#180552)Distributed
When TorchComms is enabled, route
new_groupthroughsplit_groupfor subgroup creation, raisingNotImplementedErrorfor argumentssplit_groupcannot honor (e.g.use_local_synchronization=True,sort_ranks=False) instead of silently falling back (#185416)Delegate
dist.new_groupto 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
DeviceMeshnon-overlapping check stricter (#172343)Allow
elastic_launch/launch_agentto accept a pre-created torchelastic health check server, so it can be started before rendezvous (#180543)Add an
overlap_pp_commflag to pipeline schedules (defaultTrue) that, when set toFalse, 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
.out, inplace, functional, andforeach), expanding strategy coverage to hundreds of additional ops (#185386)scatter, upsample/interpolation backward, anti-aliased upsample, batch norm backward, andaten.detach_.default(#186149, #180311, #184626, #182743, #181876)Distributed FSDP2
torch.func.jvp) on models wrapped withfully_shardorreplicate, including with mixed precision (#182732)Linear Algebra Frontend
HalfandBFloat16dispatch support fortorch.traceon CPU (#184874)torch.linalg.lu(#185344)Profiler
.events()output (#180275)FX
split_modulenow supportstorch.Sizecrossing graph split boundaries by decomposingsize()calls into per-dimensionsym_sizenodes, and builds submodules lazily for faster inference graph splitting (#179839)CapabilityBasedPartitionercan now opt out of horizontal fusion viaskip_horizontal_fusion=True, partitioning only through direct data dependencies (#184904)Enable rewriting of FX traces containing complex tensors during compilation (#169832)
Dynamo
divmod(#185655)einops0.8.2 (#185619),record_functionas a decorator (#184703),inference_moderetracing helpers (#185066),mark_dirtyin the autograd Function HOP (#184267),warn_onlydeterministic toggles (#180373), and the_maybe_view_chunk_catfunctional collective (#180389)__setitem__/__delitem__) on more container types in Dynamo viasq_ass_item/mp_ass_subscriptslots (#182862, #182996)torch.accelerator.device_indexandtorch.xpu.devicein the device context manager (#181846, #181847)torch.compile: accepttl.constexprvalues as kernel arguments (#181783) and handlecapture_tritonas a no-op during tracing (#183555)SeqSpecfor list/tuple specs with better walk-spec errors (#185327), addObjectSpec(#182764), pipe dynamic spec throughtorch.compile(#184501), and revisit guarding inmark_dynamicAPIs (#181469)torch.compiledevice mismatch errors with a dedicatedFakeTensorDeviceMismatchErrorand actionable guidance to place inputs, parameters, and buffers on the same device (#185412).any()/.all()(#180406), clearertorch._checktensor predicate errors (#185777), user-friendly reasons for skipped frames (#183596), carets in stack traces (#182393), and reporting why a symbol was created dynamically insymbolic_shapeslogs (#168331)Inductor
pin_memoryfortorch.ones,torch.zerosandtorch.full(#174595)pointer_range_32optimization (#179604)x_scale/x_zpandReinterpretViewstrides (#181090)aot_inductor.autotune_per_kernel_allocconfig to allocate-run-delete tensors per kernel during AOTI autotuning, avoiding OOM on large models (#181176)AsyncCompilefuture waits with thecompile_worker_wait_timeoutsetting (#181293)a100_default_flex_configentries forhead_dim=192(#181835)aten.multinomialto avoid graph breaks (#182423)_scaled_mm_v2(#182527)combo_kernel_autotune_groupingby default (#182567)cudagraph_partition_memory_budgetconfig for partition reordering (#183569)bincount,uniquevariants, and AMP scale ops so they compile without graph breaks (#183590)addmmwhen the bias is a narrowing dtype cast (fp32->bf16/fp16) to preserve bias precision in XPU AMP training (#183680).gradbuffer is invalidated on a later run (gradient accumulation) (#184003)index_add-style atomic scatter mutations into Triton template epilogues behind a config flag (#184179)cpp.marchInductor config knob so AOTInductor cpp-only builds can override or suppress the default CPU architecture flag (#184297)rsqrt,exp2,log2,log10,tan,acos,asin,atan,atan2,floor,logical_xor) (#184538)fake_modeargument tostandalone_compile(withdynamic_shapes="from_example_inputs") so it can reuse the caller'sFakeTensorMode/ShapeEnvinstead of always creating a fresh one (#184776)signbiton unsigned integer dtypes (#185985)keep_static_cubin_rawconfig to retain cubin bytes in cached kernels so caches restored on another machine avoid recompilation (#186404)BatchLinearLHSFusion's matcher to also match the inlinedtorch._C._nn.linearform so the (opt-in) fusion can fire on Dynamo-inlined linear (#186632)torch._C._nn.linearoperations are grouped into a single batched kernel (#180477)detach()method calls (#180513)Ahead-Of-Time Inductor (AOTI)
update_constant_buffer(#181114)shim.h(#178120)cudaMemcpyfor AOTI constant loading to reduce peak memory usage (#184823)proxy_executorerror messages (#180884)cpp_wrapper(#182089)AOTIModelPackageLoader(#182149)Export
torch.exportsave/load (#181676)torch.export-able (#179686)UpdateConstantBufferFromCpufor host-to-device copy (#181637)AOTAutograd
merge_view_inputserror messages, so non-differentiable view input mutation errors identify the specific offending inputs (#180424)Composability
_transformer_encoder_layer_fwdso it traces undertorch.compile(#183916)torch.compileon AArch64 (#184555)c10dcollectives in standalone compile (#181836)Foreach
_foreach_max(#173483)ONNX
adaptive_max_pool2dandadaptive_max_pool3ddecompositions for ONNX export (#184396)C++ Frontend
set_python_moduleontorch::Library(#182720)==overloads forHeaderOnlyArrayRef(#185379)torch::stable::Generator(#186423)c10::layouttypecaster fortorch.layout(#179607)def_static(#175644)Release Engineering
setup.pyto CMake (#177641)CUDA
BinaryDivFloorKernel.cu(#179260)opmath_tini1andi1eCUDA kernels (#183778)resize_with address hint (#178215)bfloat16in_embedding_bag_per_sample_weights_backwardon CUDA (#185889)parsePerProcessMemoryFraction's return type with other parsers (#185139)cuda-bindingsversion is too old (#185990)torch.cuda.current_solver_handlefor cuSOLVER handle sharing (#176705)cuDNN
cudnn_frontendsubmodule to 1.24 (#185554)MPS
bernoulli(#182210),native_dropout(#182232),uniform/normal/randint(#182386),randperm(#182528), comparison opseq/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), andcumsum/cumprod(#185609),native_group_norm(#183830,native_group_norm_backward#184437),topkandkthvalueMetal kernels (#184106), single-block and multi-block sort, including a stable sort path (#180714, #182242, #181736)histc(#178624)outvariants of unary ops (#184743)is_causalsupport (#181855), head dim 256 (#181852), float mask support (#183458), and a clearer error for causal + attn mask (#181856).contiguous()calls:Col2Im(#181949),Im2Col(#182709),Repeat(#182718),LossOps(#182714), andHistogramKernel(#181951)NDHWC+DHWIOfast path forConv3donchannels_last_3d(#184612)torch.mps.empty_cache()(#181485)stride > 0in pool ops (#184875),F.fold(#182067),im2col(#183593), and bernoulli probabilities (#185065)dropout_p(#184126)ROCm
cub::DeviceHistogramhipify mappings (#180433)head_dim != head_dim_v,use_deterministic_algorithms,gfx1100andgfx1151promoted out of experimental, partial FAv3 support ongfx950(#184288)XPU
last_level_cache_sizeandis_integrated_gputo XPU device properties (#184499, #182624)_fused_adagrad_(#185577)torch.xpu.devicein Dynamo device management (#181847)bmm_outer_productTriton override on XPU (#180441)Functorch
vmapbatching rule fortorch.unbind_copy(#178035)vmapbatching rule forTensor.view(dtype)(aten::view.dtype) (#180728)Sparse Frontend
mat1/mat2layouts insspaddmmand clarify error messages (#179037)Bug Fixes
Python Frontend
opt_dtypevalidation totorch.nanmean()for consistent error handling (#172809)torch.nansuminteger output dtype throughnan_to_num+sumfor correct results (#183808)CUDAStream::stream()(#184237)logspace/linspaceref tests with upstream XFAIL state (#178734)Dataloader Frontend
DataLoaderfile descriptor leak fromatexitcleanup (#176607)torch.nn
stride/padding/kernel_sizelength inslow_conv3d(#181063)math_channel_shuffle(#181029)deltatype innn.HuberLossconstructor (#184012)torch/serialization.pyso it matches the true values (#180959)layer_normon CUDA for tensors with more than 2^32 elements (#181600)NestedTensorinputs inflex_attentionwith a clear error instead of an unclear backend failure (#183516)reflection_pad1dbackward CUDA launch for large batches (#185024)lp_poolinfinity norm handling ([#Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.