Repository navigation
Cache each dispatched kernel with its exact type - #30
Merged
Merged
Conversation
The dynamic dispatchers in `c/lib.c` stored the kernel they find in a punned function pointer type, such as `simsimd_metric_dense_punned_t`, which takes `void const *`, and called it through that type, while the kernels take pointers to their own scalar type. Calling a function through a pointer of another type is undefined behavior, and Clang CFI (`-fsanitize=cfi-icall`) rejects such calls. Type the cached pointer as `__typeof__` of the dispatcher itself, which has exactly the signature of the kernels it dispatches to. Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov
pushed a commit
to groeneai/ClickHouse
that referenced
this pull request
Nov 17, 2026
…h protection Bumps `contrib/SimSIMD` to the merge of ClickHouse/SimSIMD#33. The CPU probe `_simsimd_capabilities_arm` reads `ID_AA64ZFR0_EL1` by its encoding instead of being compiled for `arch=armv8.5-a+sve`, and the bf16 kernels use `+simd+bf16` / `+sve+sve2+bf16` instead of `arch=armv8.6-a+...`. Nothing in `SimSIMD` is compiled for ARMv8.3 or later anymore, so it no longer needs `branch-protection=none` and all of its functions are signed under `-mbranch-protection=pac-ret`, without `retaa` that would raise SIGILL on cores without `FEAT_PAuth`. The bump also brings ClickHouse/SimSIMD#30 (typed kernel dispatch). Related: ClickHouse/SimSIMD#33 Related: ClickHouse#131748 Related: ClickHouse#131784 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 The dynamic dispatchers in
c/lib.cstored the kernel they find in a punned function pointer type, such assimsimd_metric_dense_punned_t, which takesvoid const *, and called it through that type, while the kernels take pointers to their own scalar type. Calling a function through a pointer of another type is undefined behavior, and Clang CFI (-fsanitize=cfi-icall) rejects such calls.This types the cached pointer as
__typeof__of the dispatcher itself, which has exactly the signature of the kernels it dispatches to. No behavior change otherwise.