Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A critical codegen arity error prevents compilation, with documentation nits also unresolved.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds AArch64 Neon squared-L2 kernels for packed 2-bit and 4-bit vectors, plus SIMD absolute-difference support and benchmark coverage.
Changes:
- Adds
SIMDAbsDiffimplementations, tests, and exports. - Adds Neon U2/U4 squared-L2 kernels and dispatch updates.
- Registers the 2-bit scalar-quantization benchmark.
File summaries
| File | Summary | Findings |
|---|---|---|
diskann-wide/src/traits.rs |
Defines SIMDAbsDiff. |
— |
diskann-wide/src/test_utils/ops.rs |
Adds absolute-difference test support. | — |
diskann-wide/src/reference.rs |
Adds scalar reference implementations. | — |
diskann-wide/src/lib.rs |
Re-exports the trait. | — |
diskann-wide/src/emulated.rs |
Implements and tests emulated absolute differences. | — |
diskann-wide/src/doubled.rs |
Propagates the operation across doubled vectors. | — |
diskann-wide/src/arch/aarch64/u8x16_.rs |
Adds Neon U8 absolute-difference support and tests. | — |
diskann-wide/src/arch/aarch64/macros.rs |
Adds the Neon intrinsic wrapper macro. | — |
diskann-quantization/src/spherical/__codegen/aarch64.rs |
Adds Neon spherical L2 instantiations. | Critical (3 votes): Incorrect CompensatedSquaredL2::new arity causes codegen compilation failure in four entries. Nit (3 votes): Rename SquardL2 to SquaredL2. |
diskann-quantization/src/bits/distances.rs |
Adds Neon U2/U4 squared-L2 kernels and dispatch. | — |
diskann-benchmark/src/index/inmem/scalar.rs |
Registers the 2-bit benchmark. | Nit (2 votes): Update the policy comment to include the 2-bit variant. |
Review details
Suppressed comments (3)
diskann-quantization/src/spherical/__codegen/aarch64.rs:117
- This L2 codegen entry point passes
shifttoCompensatedSquaredL2::new, but that constructor takes onlydim(vectors.rs:543), so enabling thecodegenfeature cannot compile. Remove the unusedshiftparameter and callnew(dim)here.
shift: &[f32],
dim: usize,
) -> Result<DistanceComputer, AllocatorError> {
let reify = Reify::<_, _, AsQuery<2>, AsData<2>>::new(
vectors::CompensatedSquaredL2::new(shift, dim),
diskann-quantization/src/spherical/__codegen/aarch64.rs:134
- This L2 codegen entry point passes
shifttoCompensatedSquaredL2::new, but that constructor takes onlydim(vectors.rs:543), so enabling thecodegenfeature cannot compile. Remove the unusedshiftparameter and callnew(dim)here.
shift: &[f32],
dim: usize,
) -> Result<DistanceComputer, AllocatorError> {
let reify = Reify::<_, _, AsData<4>, AsData<4>>::new(
vectors::CompensatedSquaredL2::new(shift, dim),
diskann-quantization/src/spherical/__codegen/aarch64.rs:153
- This L2 codegen entry point passes
shifttoCompensatedSquaredL2::new, but that constructor takes onlydim(vectors.rs:543), so enabling thecodegenfeature cannot compile. Remove the unusedshiftparameter and callnew(dim)here.
shift: &[f32],
dim: usize,
) -> Result<DistanceComputer, AllocatorError> {
let reify = Reify::<_, _, AsQuery<4>, AsData<4>>::new(
vectors::CompensatedSquaredL2::new(shift, dim),
- Files reviewed: 11/11 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+94
to
+98
| shift: &[f32], | ||
| dim: usize, | ||
| ) -> Result<DistanceComputer, AllocatorError> { | ||
| let reify = Reify::<_, _, AsData<2>, AsData<2>>::new( | ||
| vectors::CompensatedSquaredL2::new(shift, dim), |
Comment on lines
+39
to
+41
| "graph-index-sq-2-bit-f32", | ||
| imp::ScalarQuantized::<2, f32>::new().search(Topk), | ||
| )?; |
| DistanceComputer::new(reify, GlobalAllocator) | ||
| } | ||
|
|
||
| /// Instantiate the Neon SquardL2 implementation for |
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.
What does this implement/fix? Briefly explain your changes.
Any other comments?
Tested for performance on C100 and C200 using
graph-index-build-sq