Skip to content

Fix: Enlarge dummy buffer for SVE predicated loads to fix MSan false positive#307

Merged
ashvardanian merged 1 commit intoashvardanian:main-devfrom
ClickHouse:fix-msan-upstream
Mar 7, 2026
Merged

Fix: Enlarge dummy buffer for SVE predicated loads to fix MSan false positive#307
ashvardanian merged 1 commit intoashvardanian:main-devfrom
ClickHouse:fix-msan-upstream

Conversation

@alexey-milovidov
Copy link
Copy Markdown
Contributor

Summary

simsimd_capabilities probes SIMD functions with n=0 to pre-initialize dispatch function pointers. SVE implementations use do { } while (i < n) loops that always execute the body once, even with n=0. MemorySanitizer instruments SVE predicated loads (svld1_f32 etc.) as full-width vector reads regardless of the predicate mask, so it reports use-of-uninitialized memory when the buffer is smaller than the SIMD register width.

Increase the dummy buffer from 8 bytes (double[1]) to 256 bytes (double[32]) to cover the widest possible SVE vector (2048 bits).

This is a follow-up to #302 which initialized the buffer to zero but kept it at only 1 element.

CI report from ClickHouse's ARM MSan stress test: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98677&sha=a1b9d7f6170c510431fce962a869aa617d88d888&name_0=PR&name_1=Stress%20test%20%28arm_msan%29

…positive

`simsimd_capabilities` probes SIMD functions with `n=0` to pre-initialize
dispatch function pointers. SVE implementations use `do { } while (i < n)`
loops that always execute the body once, even with `n=0`. MemorySanitizer
instruments SVE predicated loads (`svld1_f32` etc.) as full-width vector
reads regardless of the predicate mask, so it reports use-of-uninitialized
memory when the buffer is smaller than the SIMD register width.

Increase the dummy buffer from 8 bytes (`double[1]`) to 256 bytes
(`double[32]`) to cover the widest possible SVE vector (2048 bits).

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@ashvardanian ashvardanian changed the base branch from main to main-dev March 7, 2026 13:30
@ashvardanian ashvardanian merged commit fe9327c into ashvardanian:main-dev Mar 7, 2026
ashvardanian pushed a commit that referenced this pull request Mar 7, 2026
### Patch

- Fix: Surround `#pragma clang` with checks for Clang (#192) (f871d80)
- Improve: Reduce native half-precision usage (486d8b5)
- Fix: Unpoison SIMD dispatch results for MemorySanitizer (#304) (2513ee7)
- Fix: Enlarge dummy buffer for SVE predicated loads (#307) (fe9327c)
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