Skip to content

Unpoison SVE scalar reductions for MemorySanitizer - #21

Merged
alexey-milovidov merged 1 commit into
ClickHouse/v6.5.15from
fix-msan-unpoison-sve-reductions
Apr 6, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse/v6.5.15from
fix-msan-unpoison-sve-reductions

Conversation

@alexey-milovidov

Copy link
Copy Markdown
Member

LLVM's MSan does not instrument ARM SVE intrinsics — there is zero handling of aarch64_sve_* in MemorySanitizer.cpp (as of LLVM 20), only a file-level FIXME: This sanitizer does not yet handle scalable vectors. This causes false positives when svaddv produces scalar results that MSan considers uninitialized.

Add SIMSIMD_UNPOISON calls after every svaddv reduction in SVE function bodies across spatial.h, dot.h, binary.h, and sparse.h. Define the macro in types.h with __msan_unpoison when MSan is active.

See also: llvm/llvm-project#165028
Upstream PR: ashvardanian#342

LLVM's MSan does not instrument ARM SVE intrinsics — there is zero
handling of `aarch64_sve_*` in MemorySanitizer.cpp (as of LLVM 20),
only a file-level "FIXME: This sanitizer does not yet handle scalable
vectors". This causes false positives when `svaddv` produces scalar
results that MSan considers uninitialized.

Add `SIMSIMD_UNPOISON` calls after every `svaddv` reduction in SVE
function bodies across spatial.h, dot.h, binary.h, and sparse.h.
Define the macro in types.h with `__msan_unpoison` when MSan is active.

See also: llvm/llvm-project#165028
@alexey-milovidov
alexey-milovidov merged commit d5ccfcd into ClickHouse/v6.5.15 Apr 6, 2026
alexey-milovidov added a commit to ClickHouse/ClickHouse that referenced this pull request Apr 6, 2026
Point to the merge commit that includes both the `_x` → `_m` fix
and the `SIMSIMD_UNPOISON` fix for SVE scalar reductions.

Contrib PR: ClickHouse/SimSIMD#21
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.

1 participant