Fix AArch64 segfaults by disabling strict-aliasing in GridSamplerKernel for GCC 12 and above#158117
Fix AArch64 segfaults by disabling strict-aliasing in GridSamplerKernel for GCC 12 and above#158117robert-hardwick wants to merge 1 commit intopytorch:mainfrom
Conversation
…ptimization See pytorch#157626 for more context
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/158117
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit b62f4d0 with merge base 4283d96 ( UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Note - there isn't a CI workflow that will correctly validate this fix since #157748 is still in progress and is not for AArch64 anyway. Suggest manual install a built wheel and check the 5 tests above to validate. |
|
Note: this needs to go into |
Do we have an upperbound after which strict aliasing starts working again? |
At this moment I don't know if there is an upper bound, but I can quickly check if gcc 15 is affected ( so far i know that 12, 13 and 14 are ) . The problem is I can't be sure if this is a compiler bug or whether there is some undefined behaviour in GridSamplerKernel, which is unlikely but can't be ruled out. |
|
On second thoughts, gcc-15 isn't available in manylinux yum repository yet - https://raw.repo.almalinux.org/almalinux/8/AppStream/aarch64/os/Packages/ so i can't check quickly : ( |
|
@robert-hardwick do you mind enabling a tests for this? |
not sure I follow, could you clarify what you mean here? The failing tests are already enabled in linux-aarch64.yml. |
|
@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 |
|
Landing in main so that a cherry-pick PR can be created for release 2.8.0 branch cut. |
This PR disables
strict-aliasingGCC C++ optimization flag on all AArch64 cpus for GCC versions 12 and above.Pull Request #152825 upgraded gcc version from 11 to 13 in manywheel which caused several segmentation faults in unit tests ( not visible in CI workflows because the jammy gcc version has not been updated yet ).
We Identified the problem also exists in GCC12 hence the
__GNUC__ >= 12Fixes #157626
fixes these tests failures when pytorch is built in GCC12 and above
cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @jerryzh168 @malfet @snadampal @milpuz01 @aditew01 @nikhil-arm @fadara01