Skip to content

Conversation

@ShawnShawnYou
Copy link
Collaborator

close #1521

Signed-off-by: zhongxiaoyao.zxy <[email protected]>
@gemini-code-assist
Copy link

Summary of Changes

Hello @ShawnShawnYou, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the extend rabitq quantization scheme by introducing SIMD optimizations. The core change involves a fundamental shift in how multi-bit quantized codes are stored and processed, moving to a bit-plane representation. This new structure facilitates more efficient inner product calculations, which are now handled by specialized functions integrated into the quantizer's core logic. Additionally, the underlying SIMD binary inner product computations have been refined to better manage numerical precision in specific scenarios.

Highlights

  • New Bit-Plane Packing Strategy: Implemented a new method for packing multi-bit quantized codes into bit planes, optimizing storage and access for SIMD processing in extend rabitq.
  • Introduction of Utility Functions: Added PackIntoPlanes to convert scalar codes into the new bit-plane format and RaBitQFloatSQIPByPlanes for efficient inner product calculation using this new structure.
  • Integration into Quantizer Logic: The new packing and plane-based inner product calculations have been integrated into the RaBitQuantizer's encoding (EncodeOneImpl) and query computation (ComputeQueryBaseImpl) methods.
  • SIMD Optimization Refinements: Enhanced SIMD (AVX, AVX2, AVX512) and generic RaBitQFloatBinaryIP implementations to handle edge cases where inv_sqrt_d (inverse square root of dimension) is very small, potentially improving numerical stability and performance.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mergify mergify bot added the module/simd label Jan 15, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces SIMD support for extended RaBitQ, which is a significant feature enhancement. The changes involve a new bit-plane data layout, new functions to handle this layout (PackIntoPlanes, RaBitQFloatSQIPByPlanes), and updates to SIMD kernels to support a new calculation mode. The core logic appears correct. My review focuses on several areas for improvement: a performance issue related to memory allocation within a loop, a missed opportunity for SIMD optimization in the new data packing function, an inconsistency in the AVX implementation compared to AVX2/AVX512, and a minor code style point about using a named constant for a magic number.

Signed-off-by: zhongxiaoyao.zxy <[email protected]>
@pull-request-size pull-request-size bot added size/L and removed size/M labels Jan 16, 2026
Copy link
Collaborator

@wxyucs wxyucs left a comment

Choose a reason for hiding this comment

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

lgtm

@wxyucs wxyucs added kind/feature New feature or request version/0.18 labels Jan 16, 2026
Copy link
Collaborator

@LHT129 LHT129 left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##             main    #1522      +/-   ##
==========================================
+ Coverage   91.11%   91.17%   +0.05%     
==========================================
  Files         327      327              
  Lines       19144    19164      +20     
==========================================
+ Hits        17444    17473      +29     
+ Misses       1700     1691       -9     
Flag Coverage Δ
cpp 91.17% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
common 85.66% <ø> (ø)
datacell 92.90% <100.00%> (-0.57%) ⬇️
index 90.88% <ø> (+0.34%) ⬆️
simd 100.00% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5d33fab...f988783. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Support SIMD and refactor code in Extend-RaBitQ

4 participants