Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
742dba9
Fuse RaBitQ block reductions into one templated blockReduceSumN<N>
Stardust-SJF Jul 24, 2026
22172a1
Fix rescale-search shared-memory races by restructuring
Stardust-SJF Jul 25, 2026
f3a31aa
Add a standalone RaBitQ quantizer under preprocessing/quantize
Stardust-SJF Jul 26, 2026
1a5e2a3
Make the RaBitQ quantizer detail layer stream- and resource-aware
Stardust-SJF Jul 26, 2026
2c64068
Rename the RaBitQ factories init_* -> make_*
Stardust-SJF Jul 27, 2026
36028d1
Add the C API for the RaBitQ preprocessing quantizer
Stardust-SJF Jul 28, 2026
a2c5747
Merge branch 'main' into cuvs_ivf_rabitq_syn_fix_fused
tfeher Aug 3, 2026
2a1c334
Replace the RaBitQ glue kernels with raft primitives
Stardust-SJF Oct 29, 2026
93ea433
Generate the RaBitQ matmul rotation with the shared IVF-PQ helper
Stardust-SJF Oct 29, 2026
3af40d4
Add cuvsRabitqRotatorMakeFromState to restore a saved rotator
Stardust-SJF Oct 29, 2026
33020da
Batch RaBitQ transform() internally, sized to the L2 cache
Stardust-SJF Oct 29, 2026
69d8b96
Fix 32-bit factor index overflow in the RaBitQ full-factor kernel
Stardust-SJF Oct 29, 2026
e8cd13c
Accept host input in RaBitQ transform()
Stardust-SJF Oct 29, 2026
1618145
Rename pipeline to quantizer and the old quantizer to encoder in RaBitQ
Stardust-SJF Oct 30, 2026
140fab3
Merge branch 'pull-request/2362' into cuvs_ivf_rabitq_standalone_quan…
achirkin Nov 2, 2026
128268a
Merge branch 'main' into cuvs_ivf_rabitq_syn_fix_fused
achirkin Nov 2, 2026
e837738
Merge remote-tracking branch 'sjf/cuvs_ivf_rabitq_syn_fix_fused' into…
achirkin Nov 2, 2026
b5ccd94
Merge remote-tracking branch 'rapidsai/main' into pull-request/2362
achirkin Nov 2, 2026
42fcdfb
Merge branch 'pull-request/2362' into cuvs_ivf_rabitq_standalone_quan…
achirkin Nov 2, 2026
a6ad49e
Merge branch 'main' into cuvs_ivf_rabitq_standalone_quantizer
achirkin Nov 3, 2026
89d518e
Spec-based dataset api
achirkin Nov 3, 2026
8f1b9ce
Fix style
achirkin Nov 3, 2026
4a9e8f3
Fix style
achirkin Nov 3, 2026
f02247a
Merge branch 'cuvs_ivf_rabitq_standalone_quantizer' into fea-rabitq-spec
achirkin Nov 3, 2026
7db6e2f
Fix build errors
achirkin Nov 3, 2026
28ccd92
Merge branch 'cuvs_ivf_rabitq_standalone_quantizer' into fea-rabitq-spec
achirkin Nov 3, 2026
afb5f91
Merge pull request #1 from achirkin/fea-rabitq-spec
Stardust-SJF Nov 4, 2026
82b1325
Merge branch 'main' into cuvs_ivf_rabitq_standalone_quantizer
achirkin Nov 4, 2026
8e68cde
Merge remote-tracking branch 'rapidsai/main' into cuvs_ivf_rabitq_sta…
achirkin Nov 4, 2026
c6632a7
Fix the symbol visibility
achirkin Nov 4, 2026
d42a40a
Merge remote-tracking branch 'public/main' into cuvs_ivf_rabitq_stand…
Stardust-SJF Nov 5, 2026
a7f80d5
Throw instead of exiting on unsupported RaBitQ FHT dimensions
Stardust-SJF Nov 5, 2026
12ed643
Opt in to more shared memory for the RaBitQ scaling-factor kernel
Stardust-SJF Nov 5, 2026
2e5d05a
Request shared memory in the RaBitQ quantize kernels only when needed
Stardust-SJF Nov 5, 2026
b3db6d9
Forward the rescale sample counts to the RaBitQ full-factor path
Stardust-SJF Nov 5, 2026
2cc3b97
Document that RaBitQ delta is computed from signed code levels
Stardust-SJF Nov 5, 2026
6d27955
Document the 16-bit code requirement for RaBitQ ex_bits = 8
Stardust-SJF Nov 5, 2026
0a1302e
Show the RaBitQ delta formulas in the API page tables
Stardust-SJF Nov 5, 2026
3a5fa14
Update cpp/include/cuvs/preprocessing/quantize/rabitq.hpp
Stardust-SJF Nov 11, 2026
d3c0cab
Update cpp/tests/preprocessing/rabitq_quantization.cu
Stardust-SJF Nov 11, 2026
d916649
Apply the review cleanups to the RaBitQ quantizer
Stardust-SJF Nov 11, 2026
b741b07
Use cub::BlockReduce for the RaBitQ quantizer block reductions
Stardust-SJF Nov 11, 2026
c11432f
Take mdspan views in the RaBitQ quantizer detail layer
Stardust-SJF Nov 12, 2026
94ed09e
Use raft::warpReduce for the RaBitQ quantizer warp sums
Stardust-SJF Nov 22, 2026
1540b4c
Add missing cub includes
tfeher Nov 23, 2026
049f6d6
Merge branch 'release/26.12' into cuvs_ivf_rabitq_standalone_quantizer
tfeher Nov 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename the RaBitQ factories init_* -> make_*
Aligns the public factories with the verb cuVS already uses for functions that
return a new object, and with the split ivf_rabitq itself observes:

- make_* returns a new object. ivf_rabitq's internals use it for exactly that
  (make_compute_inner_products_with_lut_launcher and friends), and cuVS's public
  headers use it ~106 times across make_const_mdspan, make_scalar_view,
  make_list_extents, make_aligned_dataset, make_strided_dataset and others.
- init_* populates existing state and returns void, e.g.
  void IVFGPU::init_clusters(cluster_sizes). Every other init_* in the tree is a
  detail-level seeder (init_centroids, init_plus_plus, init_random_graph,
  init_key), never public API.

Before this change init_rotator / init_quantizer / init_pipeline were the only
init_* functions in the whole public API surface, and they return objects, so
make_* is both the conventional and the more accurate verb.

The detail layer keeps init_state_matmul / init_state_fht_kac: they fill a
caller-provided device buffer and return void, which is the init_* semantic.

PREPROCESSING_TEST still passes 368/368; no behaviour change.
  • Loading branch information
Stardust-SJF committed Jul 27, 2026
commit 2c6406893a4b563beca13d0d2c350af0601b3949
22 changes: 11 additions & 11 deletions cpp/include/cuvs/preprocessing/quantize/rabitq.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ enum class delta_kind : uint8_t {
* @brief RaBitQ quantizer parameters.
*
* These parameters fully describe the quantizer: RaBitQ is data-oblivious, so
* none of them are learned from a dataset (see init_quantizer / init_rotator).
* none of them are learned from a dataset (see make_quantizer / make_rotator).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This means there is no clustering involved. We also don't subtract a global mean value from the vectors, right? Do we have assumption about data distribution (e.g. zero mean), or it is not required?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For RaBitQ, it does not need any type of assumption for data distribution, and we also don't subtract a global mean value from the vectors.

Still, we provide a centroid option (something like the global mean) for subtraction. This can provide a tighter error bound in some cases (e.g., for IVF-RaBitQ).

*/
struct params {
/**
Expand Down Expand Up @@ -99,7 +99,7 @@ struct params {
* with one rotator are only comparable to queries transformed by the very same
* rotator. There is deliberately no serialization API here, so the caller owns
* this object and is responsible for keeping it alongside the codes (e.g. by
* storing `params::seed` and re-running init_rotator, or by embedding the
* storing `params::seed` and re-running make_rotator, or by embedding the
* buffers below in its own index format).
*
* A rotator is an independent peer of the quantizer: neither contains the
Expand Down Expand Up @@ -187,7 +187,7 @@ struct pipeline {
* raft::resources res;
* cuvs::preprocessing::quantize::rabitq::params params;
* auto rotator =
* cuvs::preprocessing::quantize::rabitq::init_rotator(res, params, dataset.extent(1));
* cuvs::preprocessing::quantize::rabitq::make_rotator(res, params, dataset.extent(1));
* @endcode
*
* @param[in] res raft resource
Expand All @@ -196,7 +196,7 @@ struct pipeline {
*
* @return rotator
*/
rotator init_rotator(raft::resources const& res, params const& params, int64_t dim);
rotator make_rotator(raft::resources const& res, params const& params, int64_t dim);

/**
* @brief Initializes a RaBitQ quantizer.
Expand All @@ -210,7 +210,7 @@ rotator init_rotator(raft::resources const& res, params const& params, int64_t d
* raft::resources res;
* cuvs::preprocessing::quantize::rabitq::params params;
* auto quantizer =
* cuvs::preprocessing::quantize::rabitq::init_quantizer(res, params, dataset.extent(1));
* cuvs::preprocessing::quantize::rabitq::make_quantizer(res, params, dataset.extent(1));
* @endcode
*
* @param[in] res raft resource
Expand All @@ -219,20 +219,20 @@ rotator init_rotator(raft::resources const& res, params const& params, int64_t d
*
* @return quantizer
*/
quantizer init_quantizer(raft::resources const& res, params const& params, int64_t dim);
quantizer make_quantizer(raft::resources const& res, params const& params, int64_t dim);

/**
* @brief Initializes a rotator and a quantizer from the same parameters.
*
* Equivalent to calling init_rotator() and init_quantizer() with the same
* Equivalent to calling make_rotator() and make_quantizer() with the same
* arguments. No training data is required.
*
* Usage example:
* @code{.cpp}
* raft::resources res;
* cuvs::preprocessing::quantize::rabitq::params params;
* auto pipeline =
* cuvs::preprocessing::quantize::rabitq::init_pipeline(res, params, dataset.extent(1));
* cuvs::preprocessing::quantize::rabitq::make_pipeline(res, params, dataset.extent(1));
* cuvs::preprocessing::quantize::rabitq::transform(res, pipeline.quantizer, pipeline.rotator,
* dataset, std::nullopt, codes.view(), delta.view(), vl.view());
* @endcode
Expand All @@ -243,7 +243,7 @@ quantizer init_quantizer(raft::resources const& res, params const& params, int64
*
* @return pipeline
*/
pipeline init_pipeline(raft::resources const& res, params const& params, int64_t dim);
pipeline make_pipeline(raft::resources const& res, params const& params, int64_t dim);

/**
* @brief Applies the random rotation to already-padded rows.
Expand Down Expand Up @@ -288,8 +288,8 @@ void rotate(raft::resources const& res,
* @code{.cpp}
* raft::resources res;
* cuvs::preprocessing::quantize::rabitq::params params;
* auto quantizer = cuvs::preprocessing::quantize::rabitq::init_quantizer(res, params, dim);
* auto rotator = cuvs::preprocessing::quantize::rabitq::init_rotator(res, params, dim);
* auto quantizer = cuvs::preprocessing::quantize::rabitq::make_quantizer(res, params, dim);
* auto rotator = cuvs::preprocessing::quantize::rabitq::make_rotator(res, params, dim);
* auto codes = raft::make_device_matrix<uint8_t, int64_t>(res, n_rows, quantizer.padded_dim);
* auto delta = raft::make_device_vector<float, int64_t>(res, n_rows);
* auto vl = raft::make_device_vector<float, int64_t>(res, n_rows);
Expand Down
18 changes: 9 additions & 9 deletions cpp/src/preprocessing/quantize/rabitq.cu
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void check_params(params const& p)
void check_rotator(rabitq::rotator const& rot)
{
RAFT_EXPECTS(rot.padded_dim > 0,
"rabitq: rotator is not initialized (padded_dim == 0); use init_rotator()");
"rabitq: rotator is not initialized (padded_dim == 0); use make_rotator()");
RAFT_EXPECTS(rot.padded_dim % 32 == 0, "rabitq: rotator.padded_dim must be a multiple of 32");
if (rot.kind == rotator_kind::matmul) {
RAFT_EXPECTS(rot.rotation_matrix.extent(0) == rot.padded_dim &&
Expand All @@ -70,7 +70,7 @@ void check_rotator(rabitq::rotator const& rot)

void check_quantizer(rabitq::quantizer const& q)
{
RAFT_EXPECTS(q.dim > 0, "rabitq: quantizer is not initialized (dim == 0); use init_quantizer()");
RAFT_EXPECTS(q.dim > 0, "rabitq: quantizer is not initialized (dim == 0); use make_quantizer()");
RAFT_EXPECTS(q.padded_dim == detail::padded_dim(q.dim),
"rabitq: quantizer.padded_dim is inconsistent with quantizer.dim");
check_params(q.params_quantizer);
Expand Down Expand Up @@ -300,9 +300,9 @@ void transform_residuals_full_impl(

} // namespace

rotator init_rotator(raft::resources const& res, params const& params, int64_t dim)
rotator make_rotator(raft::resources const& res, params const& params, int64_t dim)
{
RAFT_EXPECTS(dim > 0, "rabitq::init_rotator: dim must be positive");
RAFT_EXPECTS(dim > 0, "rabitq::make_rotator: dim must be positive");
check_params(params);

rotator rot{res};
Expand All @@ -326,9 +326,9 @@ rotator init_rotator(raft::resources const& res, params const& params, int64_t d
// RaBitQ needs no training data: `res` only supplies the stream, the workspace
// memory resource and the device properties used by the scaling-factor
// estimator below (and is unused when `params.use_fast` is false).
quantizer init_quantizer(raft::resources const& res, params const& params, int64_t dim)
quantizer make_quantizer(raft::resources const& res, params const& params, int64_t dim)
{
RAFT_EXPECTS(dim > 0, "rabitq::init_quantizer: dim must be positive");
RAFT_EXPECTS(dim > 0, "rabitq::make_quantizer: dim must be positive");
check_params(params);

quantizer q;
Expand All @@ -349,11 +349,11 @@ quantizer init_quantizer(raft::resources const& res, params const& params, int64
return q;
}

pipeline init_pipeline(raft::resources const& res, params const& params, int64_t dim)
pipeline make_pipeline(raft::resources const& res, params const& params, int64_t dim)
{
pipeline p{res};
p.rotator = init_rotator(res, params, dim);
p.quantizer = init_quantizer(res, params, dim);
p.rotator = make_rotator(res, params, dim);
p.quantizer = make_quantizer(res, params, dim);
return p;
}

Expand Down
26 changes: 13 additions & 13 deletions cpp/tests/preprocessing/rabitq_quantization.cu
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,15 @@ class RabitqQuantizationTest : public ::testing::TestWithParam<RabitqQuantizatio
{
const auto p = make_params();

auto pipe = init_pipeline(handle_, p, ps_.dim);
auto pipe = make_pipeline(handle_, p, ps_.dim);
verify_shape(pipe.rotator, pipe.quantizer);
verify_state(pipe.rotator);

// The peers built on their own must be interchangeable with the pipeline's:
// that is what makes the header's "store the seed and re-run init_rotator"
// that is what makes the header's "store the seed and re-run make_rotator"
// recipe safe.
auto rot = init_rotator(handle_, p, ps_.dim);
auto quant = init_quantizer(handle_, p, ps_.dim);
auto rot = make_rotator(handle_, p, ps_.dim);
auto quant = make_quantizer(handle_, p, ps_.dim);
verify_shape(rot, quant);
verify_state(rot);
ASSERT_EQ(rot.padded_dim, pipe.quantizer.padded_dim);
Expand All @@ -285,11 +285,11 @@ class RabitqQuantizationTest : public ::testing::TestWithParam<RabitqQuantizatio
}

// dim must be positive, and ex_bits must stay inside the tight-start table.
EXPECT_THROW(init_rotator(handle_, p, 0), raft::logic_error);
EXPECT_THROW(init_quantizer(handle_, p, -1), raft::logic_error);
EXPECT_THROW(make_rotator(handle_, p, 0), raft::logic_error);
EXPECT_THROW(make_quantizer(handle_, p, -1), raft::logic_error);
auto bad_params = p;
bad_params.ex_bits = 9;
EXPECT_THROW(init_quantizer(handle_, bad_params, ps_.dim), raft::logic_error);
EXPECT_THROW(make_quantizer(handle_, bad_params, ps_.dim), raft::logic_error);
}

// -------------------------------------------------------------------------
Expand All @@ -298,7 +298,7 @@ class RabitqQuantizationTest : public ::testing::TestWithParam<RabitqQuantizatio
void testRotate()
{
const auto p = make_params();
auto rot = init_rotator(handle_, p, ps_.dim);
auto rot = make_rotator(handle_, p, ps_.dim);
const int64_t pd = rot.padded_dim;
const int64_t n = ps_.rows;

Expand Down Expand Up @@ -363,7 +363,7 @@ class RabitqQuantizationTest : public ::testing::TestWithParam<RabitqQuantizatio
void testTransform()
{
const auto p = make_params();
auto pipe = init_pipeline(handle_, p, ps_.dim);
auto pipe = make_pipeline(handle_, p, ps_.dim);
const int64_t pd = pipe.quantizer.padded_dim;
const int64_t n = ps_.rows;
const size_t len = static_cast<size_t>(n) * static_cast<size_t>(pd);
Expand Down Expand Up @@ -623,7 +623,7 @@ TEST(RabitqQuantizationBasicTest, CodeWidthValidation)

params p;
p.ex_bits = 8; // 9 bits per code element
auto pipe = init_pipeline(handle, p, kDim);
auto pipe = make_pipeline(handle, p, kDim);

const int64_t kPadded = pipe.quantizer.padded_dim;

Expand Down Expand Up @@ -663,8 +663,8 @@ TEST(RabitqQuantizationBasicTest, MismatchedPeers)
{
raft::resources handle;
params p;
auto rot = init_rotator(handle, p, 128);
auto quant = init_quantizer(handle, p, 256);
auto rot = make_rotator(handle, p, 128);
auto quant = make_quantizer(handle, p, 256);
ASSERT_NE(rot.padded_dim, quant.padded_dim);

auto dataset = raft::make_device_matrix<float, int64_t>(handle, 4, 256);
Expand All @@ -690,7 +690,7 @@ TEST(RabitqQuantizationBasicTest, EmptyInput)
raft::resources handle;
constexpr int64_t kDim = 64;
params p;
auto pipe = init_pipeline(handle, p, kDim);
auto pipe = make_pipeline(handle, p, kDim);

auto dataset = raft::make_device_matrix<float, int64_t>(handle, 0, kDim);
auto codes = raft::make_device_matrix<uint8_t, int64_t>(handle, 0, pipe.quantizer.padded_dim);
Expand Down