Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/187167
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit 7cd797e with merge base e59b1b1 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@claude review the PR |
|
Claude finished @aditew01's task in 1m 10s —— View job PR Review: Fix GCC15 AArch64 enablement issuesI reviewed all 5 changed files against
1.
|
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Based on #180850, this PR updates AArch64 CI toolchains to GCC15. The necessary GCC15 enablement fixes are part of #187167 and #185633. Pull Request resolved: #182016 Approved by: https://github.com/aditew01, https://github.com/Skylion007 Co-authored-by: Aditya Tewari <[email protected]>
Ahead of updating the AArch64 CI toolchains to GCC15 (pytorch#182016), this PR fixes issues that arise on the newer compiler version. ## Fixes included ### 1. HeaderOnlyArrayRef empty vector construction GCC 15 reports `-Werror=free-nonheap-object` from inlined `HeaderOnlyArrayRef<T>::vec()` while constructing an `std::vector<T>` from `Data` to `Data + Length`. For empty refs, `Data` may be null, and forming `Data + Length` still performs pointer arithmetic on that null pointer. The fix returns `{}` immediately for empty refs to avoid that. Failure message: ```text inlined from 'std::vector<T> c10::HeaderOnlyArrayRef<T>::vec() const [with T = long int]' at /pytorch/torch/headeronly/util/HeaderOnlyArrayRef.h:237:64, inlined from 'at::TensorIterator at::native::{anonymous}::_make_unfold_backward_iter_over_grad_out(at::Tensor&, const at::Tensor&, int64_t, int64_t, int64_t)' at /pytorch/aten/src/ATen/native/UnfoldBackward.h:52:65, inlined from 'void at::native::{anonymous}::unfold_backward_cpu_kernel(at::Tensor&, const at::Tensor&, int64_t, int64_t, int64_t)' at /pytorch/aten/src/ATen/native/cpu/UnfoldBackwardKernel.cpp:129:41: /usr/include/c++/15/bits/new_allocator.h:172:66: error: 'void operator delete(void*, std::size_t)' called on pointer '<unknown>' with nonzero offset [8, 9223372036854775800] [-Werror=free-nonheap-object] 172 | _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n)); | ^ cc1plus: some warnings being treated as errors ``` Files changed: - `torch/headeronly/util/HeaderOnlyArrayRef.h` ### 2. OperatorName namespace string insertion overlap `OperatorName::setNamespaceIfNotSet()` used `std::string::replace()` to copy from `name` back into an overlapping region of the same `name` buffer. GCC 15 inlines that path down to `memcpy` and reports `-Werror=restrict`. The fix uses `std::char_traits<char>::move()` for the overlapping move and `std::char_traits<char>::copy()` for the non-overlapping namespace prefix. Failure message: ```text inlined from 'constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::replace(size_type, size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /usr/include/c++/15/bits/basic_string.h:2434:29, inlined from 'bool c10::OperatorName::setNamespaceIfNotSet(const char*)' at /pytorch/aten/src/ATen/core/operator_name.h:44:19, inlined from 'bool c10::OperatorName::setNamespaceIfNotSet(const char*)' at /pytorch/aten/src/ATen/core/operator_name.h:38:8, inlined from 'virtual void OperatorNameTest_SetNamespaceIfNotSetWithExistingNamespace_Test::TestBody()' at /pytorch/aten/src/ATen/test/operator_name_test.cpp:17:58: /usr/include/c++/15/bits/char_traits.h:429:56: error: 'void* __builtin_memcpy(void*, const void*, long unsigned int)' accessing 28 bytes at offsets 11 and 0 overlaps 17 bytes at offset 11 [-Werror=restrict] 429 | return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n)); | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ cc1plus: some warnings being treated as errors ``` Files changed: - `aten/src/ATen/core/operator_name.h` ### 3. SVE PCH internal compiler errors GCC reports an internal compiler error while compiling AArch64 SVE vector helpers through the Inductor precompiled-header path, matching [GCC PR target/123457](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123457). The affected code is valid, but GCC 14/15 can ICE when those SVE intrinsics are compiled with `TORCH_INDUCTOR_PRECOMPILE_HEADERS` enabled. The workaround adds narrow `__attribute__((optimize("O0")))` guards around the specific helper functions that trigger the compiler bug for the affected GCC versions. Representative failure: ```text torch._inductor.exc.InductorError: CppCompileError: C++ compile error Output: during GIMPLE pass: ccp ... In member function 'at::vec::CPU_CAPABILITY::Vectorized<float> at::vec::CPU_CAPABILITY::Vectorized<float>::tanh() const': ... internal compiler error: Segmentation fault ``` Files changed: - `aten/src/ATen/cpu/vec/sve/vec_bfloat16.h` - `aten/src/ATen/cpu/vec/sve/vec_float.h` - `aten/src/ATen/cpu/vec/sve/vec_int.h` ### 4. SVE BF16 transpose tile aliasing The SVE BF16 transpose helper used `BFloat16` scratch tiles while also loading and storing those tiles through raw `uint16_t` SVE accesses. This keeps the existing tile representation and `uint16_t` helper path, but makes the scalar tile zero/copy operations access the raw `BFloat16::x` member. That avoids the mixed whole-object `BFloat16` / raw `uint16_t` access pattern that caused stale tile values with GCC15. Failure message: ```text ====================================================================== FAIL: test_transpose_copy (__main__.CPUReproTests) ---------------------------------------------------------------------- ... AssertionError: Tensor-likes are not close! Mismatched elements: 8 / 289 (2.8%) Greatest absolute difference: 2.0625 at index (16, 15) (up to 1e-05 allowed) Greatest relative difference: 1.0 at index (16, 8) (up to 0.016 allowed) ``` Files changed: - `aten/src/ATen/cpu/vec/sve/vec_bfloat16.h` Pull Request resolved: pytorch#187167 Approved by: https://github.com/aditew01, https://github.com/jansel
Based on pytorch#180850, this PR updates AArch64 CI toolchains to GCC15. The necessary GCC15 enablement fixes are part of pytorch#187167 and pytorch#185633. Pull Request resolved: pytorch#182016 Approved by: https://github.com/aditew01, https://github.com/Skylion007 Co-authored-by: Aditya Tewari <[email protected]>
Ahead of updating the AArch64 CI toolchains to GCC15 (pytorch#182016), this PR fixes issues that arise on the newer compiler version. ## Fixes included ### 1. HeaderOnlyArrayRef empty vector construction GCC 15 reports `-Werror=free-nonheap-object` from inlined `HeaderOnlyArrayRef<T>::vec()` while constructing an `std::vector<T>` from `Data` to `Data + Length`. For empty refs, `Data` may be null, and forming `Data + Length` still performs pointer arithmetic on that null pointer. The fix returns `{}` immediately for empty refs to avoid that. Failure message: ```text inlined from 'std::vector<T> c10::HeaderOnlyArrayRef<T>::vec() const [with T = long int]' at /pytorch/torch/headeronly/util/HeaderOnlyArrayRef.h:237:64, inlined from 'at::TensorIterator at::native::{anonymous}::_make_unfold_backward_iter_over_grad_out(at::Tensor&, const at::Tensor&, int64_t, int64_t, int64_t)' at /pytorch/aten/src/ATen/native/UnfoldBackward.h:52:65, inlined from 'void at::native::{anonymous}::unfold_backward_cpu_kernel(at::Tensor&, const at::Tensor&, int64_t, int64_t, int64_t)' at /pytorch/aten/src/ATen/native/cpu/UnfoldBackwardKernel.cpp:129:41: /usr/include/c++/15/bits/new_allocator.h:172:66: error: 'void operator delete(void*, std::size_t)' called on pointer '<unknown>' with nonzero offset [8, 9223372036854775800] [-Werror=free-nonheap-object] 172 | _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n)); | ^ cc1plus: some warnings being treated as errors ``` Files changed: - `torch/headeronly/util/HeaderOnlyArrayRef.h` ### 2. OperatorName namespace string insertion overlap `OperatorName::setNamespaceIfNotSet()` used `std::string::replace()` to copy from `name` back into an overlapping region of the same `name` buffer. GCC 15 inlines that path down to `memcpy` and reports `-Werror=restrict`. The fix uses `std::char_traits<char>::move()` for the overlapping move and `std::char_traits<char>::copy()` for the non-overlapping namespace prefix. Failure message: ```text inlined from 'constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::replace(size_type, size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /usr/include/c++/15/bits/basic_string.h:2434:29, inlined from 'bool c10::OperatorName::setNamespaceIfNotSet(const char*)' at /pytorch/aten/src/ATen/core/operator_name.h:44:19, inlined from 'bool c10::OperatorName::setNamespaceIfNotSet(const char*)' at /pytorch/aten/src/ATen/core/operator_name.h:38:8, inlined from 'virtual void OperatorNameTest_SetNamespaceIfNotSetWithExistingNamespace_Test::TestBody()' at /pytorch/aten/src/ATen/test/operator_name_test.cpp:17:58: /usr/include/c++/15/bits/char_traits.h:429:56: error: 'void* __builtin_memcpy(void*, const void*, long unsigned int)' accessing 28 bytes at offsets 11 and 0 overlaps 17 bytes at offset 11 [-Werror=restrict] 429 | return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n)); | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ cc1plus: some warnings being treated as errors ``` Files changed: - `aten/src/ATen/core/operator_name.h` ### 3. SVE PCH internal compiler errors GCC reports an internal compiler error while compiling AArch64 SVE vector helpers through the Inductor precompiled-header path, matching [GCC PR target/123457](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123457). The affected code is valid, but GCC 14/15 can ICE when those SVE intrinsics are compiled with `TORCH_INDUCTOR_PRECOMPILE_HEADERS` enabled. The workaround adds narrow `__attribute__((optimize("O0")))` guards around the specific helper functions that trigger the compiler bug for the affected GCC versions. Representative failure: ```text torch._inductor.exc.InductorError: CppCompileError: C++ compile error Output: during GIMPLE pass: ccp ... In member function 'at::vec::CPU_CAPABILITY::Vectorized<float> at::vec::CPU_CAPABILITY::Vectorized<float>::tanh() const': ... internal compiler error: Segmentation fault ``` Files changed: - `aten/src/ATen/cpu/vec/sve/vec_bfloat16.h` - `aten/src/ATen/cpu/vec/sve/vec_float.h` - `aten/src/ATen/cpu/vec/sve/vec_int.h` ### 4. SVE BF16 transpose tile aliasing The SVE BF16 transpose helper used `BFloat16` scratch tiles while also loading and storing those tiles through raw `uint16_t` SVE accesses. This keeps the existing tile representation and `uint16_t` helper path, but makes the scalar tile zero/copy operations access the raw `BFloat16::x` member. That avoids the mixed whole-object `BFloat16` / raw `uint16_t` access pattern that caused stale tile values with GCC15. Failure message: ```text ====================================================================== FAIL: test_transpose_copy (__main__.CPUReproTests) ---------------------------------------------------------------------- ... AssertionError: Tensor-likes are not close! Mismatched elements: 8 / 289 (2.8%) Greatest absolute difference: 2.0625 at index (16, 15) (up to 1e-05 allowed) Greatest relative difference: 1.0 at index (16, 8) (up to 0.016 allowed) ``` Files changed: - `aten/src/ATen/cpu/vec/sve/vec_bfloat16.h` Pull Request resolved: pytorch#187167 Approved by: https://github.com/aditew01, https://github.com/jansel
Based on pytorch#180850, this PR updates AArch64 CI toolchains to GCC15. The necessary GCC15 enablement fixes are part of pytorch#187167 and pytorch#185633. Pull Request resolved: pytorch#182016 Approved by: https://github.com/aditew01, https://github.com/Skylion007 Co-authored-by: Aditya Tewari <[email protected]>
Ahead of updating the AArch64 CI toolchains to GCC15 (#182016), this PR fixes issues that arise on the newer compiler version.
Fixes included
1. HeaderOnlyArrayRef empty vector construction
GCC 15 reports
-Werror=free-nonheap-objectfrom inlinedHeaderOnlyArrayRef<T>::vec()while constructing anstd::vector<T>fromDatatoData + Length. For empty refs,Datamay be null, and formingData + Lengthstill performs pointer arithmetic on that null pointer. The fix returns{}immediately for empty refs to avoid that.Failure message:
Files changed:
torch/headeronly/util/HeaderOnlyArrayRef.h2. OperatorName namespace string insertion overlap
OperatorName::setNamespaceIfNotSet()usedstd::string::replace()to copy fromnameback into an overlapping region of the samenamebuffer. GCC 15 inlines that path down tomemcpyand reports-Werror=restrict. The fix usesstd::char_traits<char>::move()for the overlapping move andstd::char_traits<char>::copy()for the non-overlapping namespace prefix.Failure message:
Files changed:
aten/src/ATen/core/operator_name.h3. SVE PCH internal compiler errors
GCC reports an internal compiler error while compiling AArch64 SVE vector helpers through the Inductor precompiled-header path, matching GCC PR target/123457.
The affected code is valid, but GCC 14/15 can ICE when those SVE intrinsics are compiled with
TORCH_INDUCTOR_PRECOMPILE_HEADERSenabled. The workaround adds narrow__attribute__((optimize("O0")))guards around the specific helper functions that trigger the compiler bug for the affected GCC versions.Representative failure:
Files changed:
aten/src/ATen/cpu/vec/sve/vec_bfloat16.haten/src/ATen/cpu/vec/sve/vec_float.haten/src/ATen/cpu/vec/sve/vec_int.h4. SVE BF16 transpose tile aliasing
The SVE BF16 transpose helper used
BFloat16scratch tiles while also loading and storing those tiles through rawuint16_tSVE accesses. This keeps the existing tile representation anduint16_thelper path, but makes the scalar tile zero/copy operations access the rawBFloat16::xmember. That avoids the mixed whole-objectBFloat16/ rawuint16_taccess pattern that caused stale tile values with GCC15.Failure message:
Files changed:
aten/src/ATen/cpu/vec/sve/vec_bfloat16.hcc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @aditew01 @robert-hardwick