Repository navigation
Conversation
Route the aarch64 pair and batch f32 L2 paths to an explicit ASIMD kernel with eight float32x4_t accumulators, 32/16/4-wide loops and a scalar tail, instead of relying on LLVM's 4-wide auto-vectorisation. NEON is part of the aarch64 baseline, so both dispatch tables select the kernel at compile time. Verification (Kunpeng 920): - cargo test -p lance-linalg --lib distance::l2: 107 passed - new tests: kernel parity vs l2_f32_scalar over random dims 4..4048, and batch parity at dims 8/16/100/256/1024 Microbenchmark (pinned core, base vs NEON): - cache-resident pair: 1.92x @dim64, 1.64x @256, 1.55x @1024, 1.36x @2176 - streaming 64 MiB: 1.14x @dim64 .. 1.04x @2176 - PQ sub-vector dims: 1.12x @dim8, 2.18x @Dim16 (no regression) End-to-end (pylance 15.0.0b19 wheel, 1M x 1024 smoke1m, nlist=256, 6 GiB index cache, pinned cores 64-79, same index searched by both wheels, median of alternating runs, recall@100 unchanged): - IVF_RQ (bits=1, refine=5) QPS: 7.35->9.45 (1.29x) @nprobe8, 4.70->6.50 (1.38x) @16, 2.45->3.40 (1.39x) @32 - IVF_FLAT QPS: 8.60->11.45 (1.33x) @nprobe8, 4.65->6.50 (1.40x) @16, 2.50->3.40 (1.36x) @32 - IVF_RQ build: 65.7s -> 54.7s (1.20x) - IVF_FLAT build: 78.2s -> 64.0s (1.22x)
Contributor
There was a problem hiding this comment.
No blocking correctness issue found. Pair and batch L2 checks pass on x86_64 and emulated aarch64, including the new NEON parity tests. Native performance remains unverified in this review: the reported gains are from Kunpeng 920, while the kernel becomes the default on all aarch64 targets.
This branch has not been deployed
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.
Summary
float32x4_taccumulators, 32/16/4-wide loops plus a scalar tail.L2_F32andL2_F32_BATCHdispatch tables. NEON is part of the aarch64 baseline, so both dispatches remain compile-time static (no runtime feature check).Performance (Kunpeng 920)
Microbenchmark, base vs NEON (ns/vector):
PQ sub-vector dimensions: 1.12x at dim 8, 2.18x at dim 16 (no regression).
End-to-end (1M x 1024 vectors, IVF nlist=256, 6 GiB index cache, pinned cores 64-79, the same index searched by both wheels, alternating runs, recall@100 unchanged):
Build time: IVF_RQ 65.7s -> 54.7s (1.20x), IVF_FLAT 78.2s -> 64.0s (1.22x).
Test plan
cargo test -p lance-linalg --lib distance::l2(107 passed, including the new NEON parity and batch parity tests)