fix: fall back to AVX2 f16 kernels on AVX-512 CPUs#7428
Open
paramt wants to merge 1 commit into
Open
Conversation
d54e2c9 to
8c2c58b
Compare
westonpace
approved these changes
Jun 23, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Fix f16 SIMD dispatch on x86 CPUs that have AVX-512F but do not have native AVX512-FP16 support.
Today, those CPUs are classified as
SimdSupport::Avx512. The f16 dispatch for L2, dot, cosine, and norm L2 handlesAvx512FP16andAvx2, but not plainAvx512, so it falls through to the scalar implementation. This change routes plainAvx512to the AVX2 f16 kernels while keepingAvx512FP16on the native AVX512-FP16 kernels.This matches the existing bf16 behavior:
lance/rust/lance-linalg/src/distance/l2.rs
Lines 183 to 185 in 5266629
lance/rust/lance-linalg/src/distance/dot.rs
Lines 153 to 155 in 5266629
lance/rust/lance-linalg/src/distance/cosine.rs
Lines 119 to 121 in 5266629
lance/rust/lance-linalg/src/distance/norm_l2.rs
Lines 118 to 120 in 5266629