refactor: turbo quantizer#546
Open
richyreachy wants to merge 25 commits into
Open
Conversation
JalinWang
reviewed
Jul 8, 2026
iaojnh
reviewed
Jul 10, 2026
| unit_size_ = format->unit_size; | ||
| element_size_ = IndexMeta::ElementSizeof(data_type_, unit_size_, dimension_); | ||
| space_id_ = format->space_id; | ||
|
|
| @@ -586,6 +602,7 @@ class IndexMeta { | |||
| uint32_t dimension_{0}; | |||
| uint32_t unit_size_{0}; | |||
| uint32_t element_size_{0}; | |||
Collaborator
There was a problem hiding this comment.
为什么IndexMeta的element_size需要加上extra_meta_size而IndexQueryMeta的不用
|
|
||
| #pragma once | ||
|
|
||
| #include <turbo/quantizer/quantizer.h> |
Collaborator
Author
There was a problem hiding this comment.
turbo/quantizer做为基础类,可以看做和index类是并行的。
chinaux
reviewed
Jul 13, 2026
| } | ||
| } | ||
| if (quantize_type == QuantizeType::kUniform) { | ||
| if (zvec::ailego::internal::CpuFeatures::static_flags_.AVX512_VNNI) { |
Collaborator
There was a problem hiding this comment.
当调用方显式传 cpu_arch_type = kScalar时,上面的kDefault 会正确回退到nullptr,但 kUniform 仍会返回 VNNI 内核,行为不一致。建议对齐条件,或加注释说明 uniform 为何不受 arch 约束。
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.
This PR introduces a pluggable Quantizer abstraction in the
Turbomodule and provides the first concrete implementation along with scalar fp32 distance kernels.The goal is to establish a uniform interface that future quantizers (int8 uniform, int8 record, PQ, RaBitQ, …) can implement, decoupling quantization logic from index builders and searchers.
As parts of the initial concept introduction of
Turbo, the inclusive changes are as follows:Quantizerabstract base classDistanceImplcallable distance handleFp32Quantizerfirst concrete implementationScalarFp32 distance kernelsIndexMetaandIndexQueryMetaextensionsIndexFactoryquantizer support