Skip to content

Fix use-of-uninitialized-value in SVE accumulator operations#18

Merged
alexey-milovidov merged 1 commit intoClickHouse/v6.5.15from
fix-sve-msan-uninitialized
Mar 30, 2026
Merged

Fix use-of-uninitialized-value in SVE accumulator operations#18
alexey-milovidov merged 1 commit intoClickHouse/v6.5.15from
fix-sve-msan-uninitialized

Conversation

@alexey-milovidov
Copy link
Copy Markdown
Member

Summary

Use _m (merge) instead of _x (don't-care) for SVE multiply-accumulate operations (svmla, svmls) on accumulator vectors in spatial.h and dot.h.

The _x variant leaves inactive lanes undefined, but the final svaddv with svptrue sums 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 _m variant preserves the accumulator value for inactive lanes, keeping them at their initialized zero.

Detected as MemorySanitizer: use-of-uninitialized-value (STID: 1003-358c) in simsimd_cos_f32_sve during 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%29

Tracked as ClickHouse/ClickHouse#101232

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]>
@alexey-milovidov alexey-milovidov changed the base branch from main to ClickHouse/v6.5.15 March 30, 2026 19:03
@ClickHouse ClickHouse deleted a comment from CLAassistant Mar 30, 2026
@alexey-milovidov alexey-milovidov merged commit 5a0677a into ClickHouse/v6.5.15 Mar 30, 2026
@azat
Copy link
Copy Markdown
Member

azat commented Mar 31, 2026

Maybe we need to update library instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants