From 73e909d1c771d90c516afc14cac33c665cfaee47 Mon Sep 17 00:00:00 2001 From: pytorchbot Date: Mon, 29 Jun 2026 10:35:59 +0000 Subject: [PATCH 1/3] Bump PyTorch pin to nightly dev20260628 --- .ci/docker/ci_commit_pins/pytorch.txt | 2 +- .../c10/c10/util/BFloat16-math.h | 2 +- .../core/portable_type/c10/c10/util/complex.h | 10 +--- .../portable_type/c10/c10/util/complex_math.h | 2 +- .../c10/torch/headeronly/util/Half.h | 2 +- .../c10/torch/headeronly/util/complex.h | 55 +++++++++++++++++++ torch_pin.py | 2 +- 7 files changed, 61 insertions(+), 14 deletions(-) diff --git a/.ci/docker/ci_commit_pins/pytorch.txt b/.ci/docker/ci_commit_pins/pytorch.txt index 242371cbebe..4707c55adf3 100644 --- a/.ci/docker/ci_commit_pins/pytorch.txt +++ b/.ci/docker/ci_commit_pins/pytorch.txt @@ -1 +1 @@ -release/2.12 +96a8d1adb978002c194d21b6abea51682886b049 diff --git a/runtime/core/portable_type/c10/c10/util/BFloat16-math.h b/runtime/core/portable_type/c10/c10/util/BFloat16-math.h index 8291cd74481..bce89e8acd9 100644 --- a/runtime/core/portable_type/c10/c10/util/BFloat16-math.h +++ b/runtime/core/portable_type/c10/c10/util/BFloat16-math.h @@ -181,7 +181,7 @@ template < typename T, typename std::enable_if_t, int> = 0> inline T rsqrt(T a) { - return 1.0 / std::sqrt(float(a)); + return 1.0f / std::sqrt(float(a)); } template < typename T, diff --git a/runtime/core/portable_type/c10/c10/util/complex.h b/runtime/core/portable_type/c10/c10/util/complex.h index 4e699684bc3..be99e270aa1 100644 --- a/runtime/core/portable_type/c10/c10/util/complex.h +++ b/runtime/core/portable_type/c10/c10/util/complex.h @@ -31,19 +31,11 @@ C10_HOST_DEVICE T abs(const c10::complex& z) { #endif } -#if defined(USE_ROCM) -#define ROCm_Bug(x) -#else -#define ROCm_Bug(x) x -#endif - template C10_HOST_DEVICE T arg(const c10::complex& z) { - return ROCm_Bug(std)::atan2(std::imag(z), std::real(z)); + return std::atan2(std::imag(z), std::real(z)); } -#undef ROCm_Bug - template constexpr T norm(const c10::complex& z) { return z.real() * z.real() + z.imag() * z.imag(); diff --git a/runtime/core/portable_type/c10/c10/util/complex_math.h b/runtime/core/portable_type/c10/c10/util/complex_math.h index d369df50592..2b9bbea6c71 100644 --- a/runtime/core/portable_type/c10/c10/util/complex_math.h +++ b/runtime/core/portable_type/c10/c10/util/complex_math.h @@ -327,7 +327,7 @@ C10_HOST_DEVICE inline c10::complex atanh(const c10::complex& x) { template C10_HOST_DEVICE inline c10::complex log1p(const c10::complex& z) { #if defined(__APPLE__) || defined(__MACOSX) || defined(__CUDACC__) || \ - defined(__HIPCC__) + defined(__HIPCC__) || defined(__SYCL_DEVICE_ONLY__) // For Mac, the new implementation yielded a high relative error. Falling back // to the old version for now. // See https://github.com/numpy/numpy/pull/22611#issuecomment-1667945354 diff --git a/runtime/core/portable_type/c10/torch/headeronly/util/Half.h b/runtime/core/portable_type/c10/torch/headeronly/util/Half.h index a9c0b166ba2..e5aa622656c 100644 --- a/runtime/core/portable_type/c10/torch/headeronly/util/Half.h +++ b/runtime/core/portable_type/c10/torch/headeronly/util/Half.h @@ -236,7 +236,7 @@ C10_HOST_DEVICE inline float fp16_ieee_to_fp32_value(uint16_t h) { /* * - Choose either results of conversion of input as a normalized number, or * as a denormalized number, depending on the input exponent. The variable - * two_w contains input exponent in bits 27-31, therefore if its smaller than + * two_w contains input exponent in bits 27-31, therefore if it's smaller than * 2**27, the input is either a denormal number, or zero. * - Combine the result of conversion of exponent and mantissa with the sign * of the input number. diff --git a/runtime/core/portable_type/c10/torch/headeronly/util/complex.h b/runtime/core/portable_type/c10/torch/headeronly/util/complex.h index 733a22d5dbb..41430766952 100644 --- a/runtime/core/portable_type/c10/torch/headeronly/util/complex.h +++ b/runtime/core/portable_type/c10/torch/headeronly/util/complex.h @@ -3,6 +3,7 @@ #include #include +#include #include #if defined(__CUDACC__) || defined(__HIPCC__) @@ -588,6 +589,60 @@ struct alignas(4) complex { } }; +template <> +struct alignas(4) complex { + BFloat16 real_; + BFloat16 imag_; + + // Constructors + complex() = default; + // BFloat16 constructor is not constexpr so the following constructor can't + // be constexpr + C10_HOST_DEVICE explicit inline complex( + const BFloat16& real, + const BFloat16& imag) + : real_(real), imag_(imag) {} + C10_HOST_DEVICE inline complex(const c10::complex& value) + : real_(value.real()), imag_(value.imag()) {} + + // Conversion operator + inline C10_HOST_DEVICE operator c10::complex() const { + return {real_, imag_}; + } + + constexpr C10_HOST_DEVICE BFloat16 real() const { + return real_; + } + constexpr C10_HOST_DEVICE BFloat16 imag() const { + return imag_; + } + + C10_HOST_DEVICE complex& operator+=( + const complex& other) { + real_ = static_cast(real_) + static_cast(other.real_); + imag_ = static_cast(imag_) + static_cast(other.imag_); + return *this; + } + + C10_HOST_DEVICE complex& operator-=( + const complex& other) { + real_ = static_cast(real_) - static_cast(other.real_); + imag_ = static_cast(imag_) - static_cast(other.imag_); + return *this; + } + + C10_HOST_DEVICE complex& operator*=( + const complex& other) { + auto a = static_cast(real_); + auto b = static_cast(imag_); + auto c = static_cast(other.real()); + auto d = static_cast(other.imag()); + real_ = a * c - b * d; + imag_ = a * d + b * c; + return *this; + } +}; + } // namespace c10 HIDDEN_NAMESPACE_BEGIN(torch, headeronly) diff --git a/torch_pin.py b/torch_pin.py index 0c5cd50fe6d..97abed80dad 100644 --- a/torch_pin.py +++ b/torch_pin.py @@ -1,2 +1,2 @@ TORCH_VERSION = "2.12.0" -# NIGHTLY_VERSION = "dev20260318" Temporarily pinning to stable release candidate. Revert https://github.com/pytorch/executorch/pull/18287 +NIGHTLY_VERSION = "dev20260628" From a46a60b7d0e3a8ea3be30a43839cdf163c27dce9 Mon Sep 17 00:00:00 2001 From: RJ Ascani Date: Mon, 29 Jun 2026 15:58:26 -0700 Subject: [PATCH 2/3] Bump torchao to cb76f2943 (post-v0.17.0) The dev20260628 PyTorch nightly removes the aten.transpose.Dimname overload, which the pinned torchao (v0.17.0) still references in port_metadata_pass.py, breaking convert_pt2e in the quantization delegation CI jobs. This advances third-party/ao past pytorch/ao#4462, which drops that reference. Authored with assistance from Claude. Co-Authored-By: Claude Opus 4.8 (1M context) --- third-party/ao | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third-party/ao b/third-party/ao index 02105d46c61..cb76f2943f7 160000 --- a/third-party/ao +++ b/third-party/ao @@ -1 +1 @@ -Subproject commit 02105d46c61dc80a8c9d39d5836e827ba3af8439 +Subproject commit cb76f2943f74e969aa86c1c09e6e47cb55d4ad40 From 1a752423f69452d53aadc8b7dadcfc810b54784a Mon Sep 17 00:00:00 2001 From: RJ Ascani Date: Tue, 30 Jun 2026 11:40:48 -0700 Subject: [PATCH 3/3] Bump torchtune to 3c1872ac for torchao NF4Tensor relocation The torchao bump to cb76f2943 moved NF4Tensor out of torchao.dtypes.nf4tensor (into torchao.quantization) and removed TensorCoreTiledLayout, breaking 'import torchtune' for the model export and torchao-huggingface-checkpoint CI jobs. This advances the torchtune pin past pytorch/torchtune#2960 and #2958, which adapt those imports to the new torchao locations. Authored with assistance from Claude. Co-Authored-By: Claude Opus 4.8 (1M context) --- requirements-examples.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-examples.txt b/requirements-examples.txt index f1579edcb14..1f36b7c6108 100644 --- a/requirements-examples.txt +++ b/requirements-examples.txt @@ -3,5 +3,5 @@ datasets == 3.6.0 # 4.0.0 deprecates trust_remote_code and load scripts. For now pin to 3.6.0 timm == 1.0.7 torchsr == 1.0.4 -torchtune @ git+https://github.com/pytorch/torchtune.git@6f2aa7254458145f99d7004cbd6ebc8e53a06404 +torchtune @ git+https://github.com/pytorch/torchtune.git@3c1872ace149f03ef4ffec765d3f0a5fd0399497 transformers == 5.0.0rc1