Skip to content

Unpoison SIMD dispatch results for MemorySanitizer#304

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

Unpoison SIMD dispatch results for MemorySanitizer#304
ashvardanian merged 1 commit intoashvardanian:main-devfrom
ClickHouse:fix-msan-unpoison-upstream

Conversation

@alexey-milovidov
Copy link
Copy Markdown
Contributor

@alexey-milovidov alexey-milovidov commented Mar 5, 2026

Summary

  • MSan cannot track initialization through SIMD intrinsics (SVE, NEON, SSE, AVX), causing false-positive "use-of-uninitialized-value" reports
  • Add __msan_unpoison calls after every dispatch macro to mark results as initialized
  • Uses __has_feature(memory_sanitizer) to detect MSan builds; compiles to no-op otherwise

The error was triggered in ClickHouse ARM MSan stress test: simsimd_cos_f32_svesvdupq_n_f32 is opaque to MSan.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98677&sha=7d4c987f3c650a78b950b264d2676b8b7bc0979e&name_0=PR&name_1=Stress%20test%20%28arm_msan%29

ClickHouse PR: ClickHouse/ClickHouse#98807

MSan cannot track initialization through SIMD intrinsics (SVE, NEON,
SSE, AVX), causing false-positive "use-of-uninitialized-value" reports.
Add `__msan_unpoison` calls after every dispatch macro to mark results
as initialized.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@ashvardanian ashvardanian changed the base branch from main to main-dev March 5, 2026 10:55
@ashvardanian ashvardanian merged commit 195246a into ashvardanian:main-dev Mar 7, 2026
ashvardanian pushed a commit that referenced this pull request Mar 7, 2026
MSan cannot track initialization through SIMD intrinsics (SVE, NEON,
SSE, AVX), causing false-positive "use-of-uninitialized-value" reports.
Add `__msan_unpoison` calls after every dispatch macro to mark results
as initialized.

Co-authored-by: Alexey Milovidov <[email protected]>
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