Skip to content

perf(index): use SIMD-dispatched l2_u8 in SQDistCalculator#6692

Merged
Xuanwo merged 2 commits into
lance-format:mainfrom
martji:perf/sq-use-simd-l2-distance
May 7, 2026
Merged

perf(index): use SIMD-dispatched l2_u8 in SQDistCalculator#6692
Xuanwo merged 2 commits into
lance-format:mainfrom
martji:perf/sq-use-simd-l2-distance

Conversation

@martji

@martji martji commented May 6, 2026

Copy link
Copy Markdown
Contributor

SQDistCalculator was calling l2_distance_uint_scalar (pure scalar loop) for L2/Cosine distance computation on quantized u8 vectors. This misses the runtime-dispatched SIMD implementations (AVX2 / AVX-512 VNNI) that were added in #6517 and wired into the L2 trait.

Replace the direct scalar call with l2_u8::l2_u8(), which automatically selects the best available SIMD backend at runtime:

  • AVX-512 VNNI: 64 elements/iter
  • AVX2: 32 elements/iter
  • Scalar fallback for other architectures

SQDistCalculator was calling l2_distance_uint_scalar (pure scalar loop)
for L2/Cosine distance computation on quantized u8 vectors. This misses
the runtime-dispatched SIMD implementations (AVX2 / AVX-512 VNNI) that
were added in lance-format#6517 and wired into the L2 trait.

Replace the direct scalar call with l2_u8::l2_u8(), which automatically
selects the best available SIMD backend at runtime:
  - AVX-512 VNNI: 64 elements/iter
  - AVX2: 32 elements/iter
  - Scalar fallback for other architectures

Co-Authored-By: Claude Opus 4.6 <[email protected]>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@Xuanwo

Xuanwo commented May 7, 2026

Copy link
Copy Markdown
Collaborator

@claude review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization has reached its monthly code review spending cap.

An organization admin can view or raise the cap at claude.ai/admin-settings/claude-code. The cap resets at the start of the next billing period.

Once the cap resets or is raised, comment @claude review on this pull request to trigger a review.

@Xuanwo Xuanwo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this change!

@codecov

codecov Bot commented May 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Xuanwo
Xuanwo merged commit d42115e into lance-format:main May 7, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants