Repository navigation
Unpoison Arm NEON inline-assembly outputs for MSan in Ruy. - #388
Merged
Merged
Conversation
copybara-service
Bot
force-pushed
the
test_1030729360
branch
from
November 27, 2026 13:51
0f2fbc6 to
166758a
Compare
Arm NEON kernels and packing routines in Ruy write their outputs inside `asm volatile` blocks that MemorySanitizer cannot instrument. When callers pass an uninitialized destination buffer to `ruy::Mul`, subsequent reads fail under MSan with `use-of-uninitialized-value` on Arm. Add `RUY_HAVE_MSAN` in `asm_helpers.h` and call `__msan_unpoison` on the written destination tile after each Arm64 and Arm32 NEON/NEON-dotprod kernel call and on the written packed data and sums buffers after inline-assembly packing. For strided destination matrices, unpoison only the `[start_row, min(end_row, dst->layout.rows))` rows per column: stride padding remains poisoned. Under MSan, `TestSet::EvalRuy` now poisons the destination storage before `ruy::Mul` and verifies that stride padding remains poisoned afterward. PiperOrigin-RevId: 1031222494
copybara-service
Bot
force-pushed
the
test_1030729360
branch
from
November 27, 2026 13:55
166758a to
922de12
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.
Unpoison Arm NEON inline-assembly outputs for MSan in Ruy.
Arm NEON kernels and packing routines in Ruy write their outputs inside
asm volatileblocks that MemorySanitizer cannot instrument. Whencallers pass an uninitialized destination buffer to
ruy::Mul,subsequent reads fail under MSan with
use-of-uninitialized-valueonArm.
Add
RUY_HAVE_MSANinasm_helpers.hand call__msan_unpoisonon thewritten destination tile after each Arm64 and Arm32 NEON/NEON-dotprod
kernel call and on the written packed data and sums buffers after
inline-assembly packing.
For strided destination matrices, unpoison only the
[start_row, min(end_row, dst->layout.rows))rows per column: stride paddingremains poisoned.
Under MSan,
TestSet::EvalRuynow poisons the destination storagebefore
ruy::Muland verifies that stride padding remains poisonedafterward.