fix(neon): under-aligned store in generic swizzle kernel#1374
Merged
serge-sans-paille merged 2 commits intoJul 8, 2026
Merged
Conversation
DiamonDinoia
reviewed
Jul 7, 2026
| SUBCASE("rotate_right") { swizzle_test<B>().rotate_right(); } | ||
| } | ||
|
|
||
| #if XSIMD_WITH_NEON |
Contributor
There was a problem hiding this comment.
no need to run this only in the neon case you can run this as a unit test on all architectures.
Contributor
Author
There was a problem hiding this comment.
Done — dropped the NEON guard; the test now iterates xsimd::supported_architectures (gated on Arch::available()), so the narrow swizzle kernels and reduce_max run for every enabled arch on each CI target.
Contributor
|
LGTM once @DiamonDinoia comment has been addressed. |
Contributor
|
Thanks 🙇 |
This was referenced Jul 8, 2026
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.
Fixes #1260.
The generic neon swizzle kernel stores the batch into a local
std::array<T, size>, which is only aligned toalignof(T)— 1 byte for the 8-bit batches that take this path (armv7 neon has novqtbl1q; 8/16-bit swizzles fall through to the generic kernel).store_alignedrequires the full batch alignment, so whenever the compiler places the array at a non-16-byte-aligned stack offset the alignment assertion fires:reduce_max → kernel::swizzle(neon) → store_alignedabort — exactly the Debian armhf backtrace in the issue.This is not armhf-specific: the same abort reproduces on arm64 macOS with
batch<unsigned char, xsimd::neon>compiled at-O2with assertions enabled:The fix declares the buffer
alignas(A::alignment()), matching the existing idiom inxsimd_neon64.hpp(alignas(A::alignment()) double data[] = …).Adds a NEON-guarded regression test exercising the generic swizzle kernel and
reduce_maxfor all four 8/16-bit batch types on theneonarch. One honest caveat: whether the assertion fires on the old code depends on the frame layout the compiler happens to pick (it fires in the issue's Debian build and in the-O2repro above, but not in a local-O0doctest build), so the test documents and exercises the path rather than deterministically aborting on regression.Full test suite passes on arm64 macOS (391 test cases / 5928 assertions).