Fix use-of-uninitialized-value in SVE accumulator operations#18
Merged
alexey-milovidov merged 1 commit intoClickHouse/v6.5.15from Mar 30, 2026
Merged
Conversation
Use `_m` (merge) instead of `_x` (don't-care) for SVE multiply-accumulate operations on accumulator vectors. The `_x` variant leaves inactive lanes undefined, but the final `svaddv` with `svptrue` sums all lanes including those undefined ones, causing MemorySanitizer to report use-of-uninitialized-value when vector length is not a multiple of the SVE register width. The `_m` variant preserves the accumulator value for inactive lanes, keeping them at their initialized zero. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 task
Member
|
Maybe we need to update library instead? |
1 task
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.
Summary
Use
_m(merge) instead of_x(don't-care) for SVE multiply-accumulate operations (svmla,svmls) on accumulator vectors inspatial.handdot.h.The
_xvariant leaves inactive lanes undefined, but the finalsvaddvwithsvptruesums all lanes — including those undefined ones. This causes MemorySanitizer to report use-of-uninitialized-value when the input vector length is not a multiple of the SVE register width. The_mvariant preserves the accumulator value for inactive lanes, keeping them at their initialized zero.Detected as
MemorySanitizer: use-of-uninitialized-value(STID: 1003-358c) insimsimd_cos_f32_sveduring ClickHouse CI stress tests on ARM with MSan: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100177&sha=a7031a78dd031fc0e90fbeebc0c95df386c5c1a7&name_0=PR&name_1=Stress%20test%20%28arm_msan%29Tracked as ClickHouse/ClickHouse#101232