Skip to content

Disable SVE targets under MemorySanitizer#17

Closed
groeneai wants to merge 1 commit intoClickHouse:ClickHouse/v6.5.15from
groeneai:fix/simsimd-sve-msan
Closed

Disable SVE targets under MemorySanitizer#17
groeneai wants to merge 1 commit intoClickHouse:ClickHouse/v6.5.15from
groeneai:fix/simsimd-sve-msan

Conversation

@groeneai
Copy link
Copy Markdown

Summary

MSAN cannot instrument ARM SVE intrinsics (predicated loads, vector arithmetic,
reductions). Even svdupq_n_f32(0.f, ...) β€” a literal constant β€” is flagged as
uninitialized because MSAN has no SVE-specific shadow propagation.

The existing mitigations from PRs #14 (zero-initialized probe buffer +
SIMSIMD_UNPOISON on results) are insufficient: MSAN reports the error inside
the SVE kernel during svld1_f32, svmla_f32_x, svaddv_f32, before control
returns to the dispatch wrapper where unpoisoning happens.

Fix

Disable all SVE compilation targets (SIMSIMD_TARGET_SVE, SVE2, SVE_F16,
SVE_BF16, SVE_I8) when building with MSAN. SimSIMD automatically falls back
to NEON/scalar implementations that MSAN can track correctly.

Placed immediately after the SVE/SVE2 default definitions (line 43) so the
#undef + #define 0 overrides take effect before any downstream #if.

Evidence

  • 4 arm_msan failures on ClickHouse PR #98677, all with identical
    simsimd_cos_f32_sve stack trace at spatial.h:818
  • All 4 failures occurred after PRs #98699/#98966 (buffer init + submodule
    update) were merged, confirming the previous fixes are insufficient for SVE
  • Zero NEON-related MSAN false positives in 90 days of ClickHouse CI data (CIDB)

πŸ€– Generated with Claude Code

MSAN cannot instrument ARM SVE intrinsics (predicated loads, vector
arithmetic, reductions).  Even `svdupq_n_f32(0.f, ...)` β€” a literal
constant β€” is flagged as uninitialized because MSAN has no SVE-specific
shadow propagation.  The existing mitigations (zero-initialized probe
buffer and SIMSIMD_UNPOISON on results) are insufficient because MSAN
reports the error *inside* the SVE kernel, before the dispatch wrapper
can unpoison anything.

Disable all SVE compilation targets when building with MSAN so SimSIMD
falls back to NEON/scalar implementations that MSAN can track correctly.
CIDB confirms zero NEON-related MSAN false positives in 90 days.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@groeneai
Copy link
Copy Markdown
Author

cc @rschu1ze β€” could you review this? Disables SVE compilation targets under MSAN to fix false-positive use-of-uninitialized-value reports in simsimd_cos_f32_sve. Previous mitigations (PR #14 UNPOISON wrapper, PR #98699 buffer init) are insufficient because MSAN reports errors inside SVE kernels before control returns to the dispatch wrapper.

@rschu1ze rschu1ze closed this Mar 31, 2026
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