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
Add a standalone RaBitQ quantizer under preprocessing/quantize
Imports the standalone RaBitQ GPU quantizer as a first-class preprocessing
component, alongside the existing scalar, binary and pq quantizers. It is
independent of cuvs::neighbors::ivf_rabitq and shares no code with it.

Public API (cuvs::preprocessing::quantize::rabitq, header-installed with the
rest of include/cuvs):

  rotator_kind { matmul, fht_kac }, delta_kind, params
  rotator     - kind + padded_dim + the rotation state (raft containers)
  quantizer   - params + const_scaling_factor + dim/padded_dim
  pipeline    - composes the two; neither owns the other
  init_rotator / init_quantizer / init_pipeline
  rotate, transform, transform_residuals

The rotator and the quantizer are independent peer types, mirroring how
IVFGPU already holds RotatorGPU and DataQuantizerGPU as siblings; `pipeline`
is the pq-like convenience that composes them. The factories take a `dim`
rather than a dataset because RaBitQ needs no training: they generate the
random rotation and derive the scaling constant from (dim, ex_bits, seed).

State is plain caller-owned data in raft containers, following
binary::quantizer, so the rotator travels with the codes and no serialize API
is required - matching every other preprocessing quantizer, none of which has
I/O (persistence lives at the index layer, cf. detail/dataset_serialize.hpp).

Import notes:
- The imported sources land in detail/rabitq/ essentially verbatim, wrapped in
  ...::rabitq::detail. Include paths, the enclosing namespace and the error
  macros are the only edits; kernels and numerics are untouched.
- CUDA_CHECK/CUBLAS_CHECK, which printed and called exit(), are now
  RAFT_CUDA_TRY/RAFT_CUBLAS_TRY so failures throw instead of killing the
  process.
- class RotatorGPU is dissolved: it owned raw cudaMalloc buffers and its own
  cublasHandle_t. Its state now lives in the public rotator, and detail exposes
  free launchers over caller-owned buffers, taking the cuBLAS handle and the
  stream from raft::resources.
- The pipeline's scratch buffer comes from the workspace resource instead of
  cudaMalloc, and its glue kernels run on the resource stream.
- The fht_kac segment size is derived from the padded dimension, matching the
  standalone.

Known follow-up: quantize.cu and rescale_search.cu still launch on the default
stream. Since cuVS builds with CUDA_API_PER_THREAD_DEFAULT_STREAM that does not
implicitly sync with the resource stream, so pipeline.cu bridges them with two
TODO(rabitq)-marked host syncs. Threading a stream through those two files
removes both.

Tested on an RTX PRO 6000 (sm_120a): PREPROCESSING_TEST passes 368/368,
including 141 new RaBitQ cases covering both rotator kinds, uint8/uint16 codes,
padded/pow2/non-pow2 dims, rotation norm preservation, non-degenerate codes,
finite factors and run-to-run determinism.
  • Loading branch information
Stardust-SJF committed Jul 26, 2026
commit f3a31aa2831876cf50460b4352d1a070823353ca
5 changes: 5 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,11 @@ if(NOT BUILD_CPU_ONLY)
src/preprocessing/quantize/scalar.cu
src/preprocessing/quantize/binary.cu
src/preprocessing/quantize/pq.cu
src/preprocessing/quantize/rabitq.cu
src/preprocessing/quantize/detail/rabitq/rotator.cu
src/preprocessing/quantize/detail/rabitq/rescale_search.cu
src/preprocessing/quantize/detail/rabitq/quantize.cu
src/preprocessing/quantize/detail/rabitq/pipeline.cu
src/preprocessing/spectral/spectral_embedding.cu
src/preprocessing/pca/pca.cu
${select_k_inst_files}
Expand Down
468 changes: 468 additions & 0 deletions cpp/include/cuvs/preprocessing/quantize/rabitq.hpp

Large diffs are not rendered by default.

695 changes: 695 additions & 0 deletions cpp/src/preprocessing/quantize/detail/rabitq/fht.cuh

Large diffs are not rendered by default.

209 changes: 209 additions & 0 deletions cpp/src/preprocessing/quantize/detail/rabitq/pipeline.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Imported from the standalone RaBitQ GPU quantizer. Behaviour unchanged;
* only include paths, error macros and the enclosing namespace differ.
*/

//
// RaBitQ pipeline — orchestration only. Composes the rotator launchers and the
// fused quantizer entry points; the only device code here is trivial glue
// (row padding, centroid subtraction).
//

#include "pipeline.cuh"
#include "quantize.cuh"

#include <raft/util/cuda_rt_essentials.hpp>
#include <raft/core/error.hpp>
#include <raft/core/resource/cuda_stream.hpp>
#include <raft/core/resource/device_memory_resource.hpp>

#include <rmm/device_uvector.hpp>

#include <cuda_runtime.h>

namespace cuvs::preprocessing::quantize::rabitq::detail {

namespace {

__global__ void pad_rows_kernel(const float* __restrict__ d_src,

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 can be expressed with raft::linalg::map:

void pad_rows(raft::resources const& res,
              const float* d_src, float* d_dst,
              size_t N, size_t dim, size_t D) {
    raft::linalg::map_offset(
        res,
        raft::make_device_vector_view<float, size_t>(d_dst, N * D),
        [d_src, dim, D] __device__(size_t idx) {
            const size_t row = idx / D;
            const size_t col = idx % D;
            return col < dim ? d_src[row * dim + col] : 0.0f;
        });
}

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.

Now replaced with raft::linalg::map

float* __restrict__ d_dst,
int N, int dim, int D) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx >= N * D) return;
int row = idx / D;
int col = idx % D;
d_dst[idx] = (col < dim) ? d_src[row * dim + col] : 0.0f;
}

__global__ void subtract_row_kernel(float* __restrict__ d_rows,
const float* __restrict__ d_row,
int N, int D) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx >= N * D) return;
d_rows[idx] -= d_row[idx % D];
}

/// Pad (if dim < rotator.padded_dim) and rotate d_src into d_dst. When padding
/// is needed, pads directly into d_dst and rotates in place if the rotator
/// supports it (fht_kac); otherwise stages through a temporary (matmul).
void pad_and_rotate(raft::resources const& res,
const float* d_src, size_t N, size_t dim,
rotator_ref const& rotator, float* d_dst) {
const size_t D = static_cast<size_t>(rotator.padded_dim);
if (dim == D) {
rotate(res, rotator, d_src, d_dst, static_cast<int64_t>(N));
return;
}
auto stream = raft::resource::get_cuda_stream(res);
constexpr int kBlock = 256;
const size_t total = N * D;
const int grid = static_cast<int>((total + kBlock - 1) / kBlock);

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.

Suggested change
const int grid = static_cast<int>((total + kBlock - 1) / kBlock);
const int grid = raft::ceildiv<int>(total, kBlock);

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.

Now this handwritten grid disappeared.

if (supports_inplace_rotate(rotator)) {
pad_rows_kernel<<<grid, kBlock, 0, stream>>>(d_src, d_dst,
static_cast<int>(N), static_cast<int>(dim),
static_cast<int>(D));
RAFT_CUDA_TRY(cudaGetLastError());
rotate(res, rotator, d_dst, d_dst, static_cast<int64_t>(N));
} else {
rmm::device_uvector<float> d_tmp(
total, stream, raft::resource::get_workspace_resource_ref(res));
pad_rows_kernel<<<grid, kBlock, 0, stream>>>(d_src, d_tmp.data(),
static_cast<int>(N), static_cast<int>(dim),
static_cast<int>(D));
RAFT_CUDA_TRY(cudaGetLastError());
rotate(res, rotator, d_tmp.data(), d_dst, static_cast<int64_t>(N));
}
}

/// d_residuals = rotate(pad(data)) [- rotate(pad(centroid))].
/// require_rotated_c: full-factor mode always needs the rotated-centroid
/// buffer (zero-filled when there is no centroid).
void prepare_residuals(raft::resources const& res,
const float* d_data, size_t N, size_t dim,
rotator_ref const& rotator,
const float* d_centroid, float* d_rotated_centroid,
float* d_residuals, bool require_rotated_c) {
const size_t D = static_cast<size_t>(rotator.padded_dim);
auto stream = raft::resource::get_cuda_stream(res);
pad_and_rotate(res, d_data, N, dim, rotator, d_residuals);
if (d_centroid != nullptr) {
pad_and_rotate(res, d_centroid, 1, dim, rotator, d_rotated_centroid);
constexpr int kBlock = 256;
const size_t total = N * D;
subtract_row_kernel<<<static_cast<int>((total + kBlock - 1) / kBlock), kBlock, 0, stream>>>(

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 can be expressed with raft::linewise_op:

auto rows = raft::make_device_matrix_view<float, int64_t>(d_residuals, N, D);
raft::matrix::linewise_op<raft::Apply::ALONG_ROWS>(
  res, raft::make_const_mdspan(rows), rows, raft::sub_op{},
  raft::make_device_vector_view<const float, int64_t>(d_rotated_centroid, dim));

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.

Now expressed with raft::linewise_op:

d_residuals, d_rotated_centroid, static_cast<int>(N), static_cast<int>(D));
RAFT_CUDA_TRY(cudaGetLastError());
} else if (require_rotated_c) {
RAFT_CUDA_TRY(cudaMemsetAsync(d_rotated_centroid, 0, D * sizeof(float), stream));
}
}

/// The residual stage above runs on the resource stream, while the imported
/// quantizer entry points still launch on the (per-thread) default stream.
/// Bridge the two with a host-side sync until quantize.cuh takes a stream.
/// TODO(rabitq): drop once quantize_*_on_residuals is stream-aware.
void sync_before_quantize(raft::resources const& res) { raft::resource::sync_stream(res); }

/// Mirror of sync_before_quantize: make the codes written by the quantizer
/// visible to work the caller subsequently issues on the resource stream.
/// TODO(rabitq): drop together with sync_before_quantize.
void sync_after_quantize() { RAFT_CUDA_TRY(cudaStreamSynchronize(0)); }

template <typename CodeT>
void quantize_data_impl(raft::resources const& res,
const float* d_data, size_t N, size_t dim,
rotator_ref const& rotator,
const float* d_centroid, float* d_rotated_centroid,
size_t ex_bits, float const_scaling_factor, bool use_fast,
CodeT* d_total_code, float* d_delta, float* d_vl,
float* d_residuals,
int delta_mode, int coarse_samples, int fine_samples) {
prepare_residuals(res, d_data, N, dim, rotator, d_centroid, d_rotated_centroid,
d_residuals, /*require_rotated_c=*/false);
sync_before_quantize(res);
quantize_fused_on_residuals(
d_residuals, N, static_cast<size_t>(rotator.padded_dim), ex_bits,
const_scaling_factor, use_fast,
d_total_code, d_delta, d_vl, delta_mode, coarse_samples, fine_samples);
sync_after_quantize();
}

template <typename CodeT>
void quantize_data_full_impl(raft::resources const& res,
const float* d_data, size_t N, size_t dim,
rotator_ref const& rotator,
const float* d_centroid, float* d_rotated_centroid,
size_t ex_bits, float const_scaling_factor, bool use_fast,
CodeT* d_total_code, float* d_factors,
float* d_residuals) {
prepare_residuals(res, d_data, N, dim, rotator, d_centroid, d_rotated_centroid,
d_residuals, /*require_rotated_c=*/true);
sync_before_quantize(res);
quantize_full_on_residuals(
d_residuals, d_rotated_centroid, N, static_cast<size_t>(rotator.padded_dim), ex_bits,
const_scaling_factor, use_fast, d_total_code, d_factors);
sync_after_quantize();
}

} // namespace

void quantize_data(
raft::resources const& res,
const float* d_data, size_t N, size_t dim,
rotator_ref const& rotator,
const float* d_centroid, float* d_rotated_centroid,
size_t ex_bits, float const_scaling_factor, bool use_fast,
uint16_t* d_total_code, float* d_delta, float* d_vl,
float* d_residuals,
int delta_mode, int coarse_samples, int fine_samples) {
quantize_data_impl(res, d_data, N, dim, rotator, d_centroid, d_rotated_centroid,
ex_bits, const_scaling_factor, use_fast,
d_total_code, d_delta, d_vl, d_residuals,
delta_mode, coarse_samples, fine_samples);
}

void quantize_data(
raft::resources const& res,
const float* d_data, size_t N, size_t dim,
rotator_ref const& rotator,
const float* d_centroid, float* d_rotated_centroid,
size_t ex_bits, float const_scaling_factor, bool use_fast,
uint8_t* d_total_code, float* d_delta, float* d_vl,
float* d_residuals,
int delta_mode, int coarse_samples, int fine_samples) {
quantize_data_impl(res, d_data, N, dim, rotator, d_centroid, d_rotated_centroid,
ex_bits, const_scaling_factor, use_fast,
d_total_code, d_delta, d_vl, d_residuals,
delta_mode, coarse_samples, fine_samples);
}

void quantize_data_full(
raft::resources const& res,
const float* d_data, size_t N, size_t dim,
rotator_ref const& rotator,
const float* d_centroid, float* d_rotated_centroid,
size_t ex_bits, float const_scaling_factor, bool use_fast,
uint16_t* d_total_code, float* d_factors,
float* d_residuals) {
quantize_data_full_impl(res, d_data, N, dim, rotator, d_centroid, d_rotated_centroid,
ex_bits, const_scaling_factor, use_fast,
d_total_code, d_factors, d_residuals);
}

void quantize_data_full(
raft::resources const& res,
const float* d_data, size_t N, size_t dim,
rotator_ref const& rotator,
const float* d_centroid, float* d_rotated_centroid,
size_t ex_bits, float const_scaling_factor, bool use_fast,
uint8_t* d_total_code, float* d_factors,
float* d_residuals) {
quantize_data_full_impl(res, d_data, N, dim, rotator, d_centroid, d_rotated_centroid,
ex_bits, const_scaling_factor, use_fast,
d_total_code, d_factors, d_residuals);
}

} // namespace cuvs::preprocessing::quantize::rabitq::detail
126 changes: 126 additions & 0 deletions cpp/src/preprocessing/quantize/detail/rabitq/pipeline.cuh
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Imported from the standalone RaBitQ GPU quantizer. Behaviour unchanged;
* only include paths, error macros and the enclosing namespace differ.
*/

//
// One-call RaBitQ quantization pipeline.
//
// This layer only orchestrates the two underlying components — the rotator
// (rotator.cuh) and the quantizer (quantize.cuh) — plus two trivial glue
// kernels (row padding, centroid subtraction). It adds no quantization logic
// of its own; use the components directly for custom pipelines (e.g.
// externally computed residuals).
//
// Pipeline: pad(dim -> rotator.padded_dim) -> rotate -> [subtract rotated
// centroid] -> fused quantization on the rotated residuals.
//
// Design note: the centroid is rotated with a separate 1-row rotate() call

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.

Won't this make kernel launch overhead a problem?

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.

I think this will not be a problem as launches are lightweight (μs) and only matter for small batches, whereas in most cases, the bottleneck should be the bandwidth for the following subtraction.

By the way, it can be possible to optimize this pipeline, such as subtracting before the rotation, or using a fused kernel.

// rather than appended to the data batch (as cuVS does). Appending is only
// free when a gather/copy pass over the data exists anyway; for contiguous
// input it would cost a full extra N x D copy, while a 1-row rotate is a
// single tiny launch.
//
// The rotator state is NOT owned here: callers pass a non-owning rotator_ref
// that borrows the buffers held by the public `rabitq::rotator` struct.
//

#ifndef RABITQ_GPU_PIPELINE_CUH
#define RABITQ_GPU_PIPELINE_CUH

#include <cstddef>
#include <cstdint>

#include <raft/core/resources.hpp>

#include "rotator.cuh"

namespace cuvs::preprocessing::quantize::rabitq::detail {

/// Quantize raw (unrotated, unpadded) vectors end to end, emitting per-vector
/// scalar factors (delta, vl).
///
/// d_data N x dim on device.
/// d_centroid optional (nullable) dim floats on device, UNrotated.
/// When non-null, residuals = rotate(pad(data)) -
/// rotate(pad(centroid)) and d_rotated_centroid must be
/// non-null (receives the rotated centroid, D floats).
/// When null, residuals = rotate(pad(data)) and
/// d_rotated_centroid may be null.
/// d_residuals N x D output (D = rotator.padded_dim): the rotated
/// residuals that the emitted codes refer to.
/// Remaining parameters mirror quantize_fused_on_residuals.
void quantize_data(raft::resources const& res,
const float* d_data,
size_t N,
size_t dim,
rotator_ref const& rotator,
const float* d_centroid,
float* d_rotated_centroid,
size_t ex_bits,
float const_scaling_factor,
bool use_fast,
uint16_t* d_total_code,
float* d_delta,
float* d_vl,
float* d_residuals,
int delta_mode = 0,
int coarse_samples = 64,
int fine_samples = 64);

void quantize_data(raft::resources const& res,
const float* d_data,
size_t N,
size_t dim,
rotator_ref const& rotator,
const float* d_centroid,
float* d_rotated_centroid,
size_t ex_bits,
float const_scaling_factor,
bool use_fast,
uint8_t* d_total_code,
float* d_delta,
float* d_vl,
float* d_residuals,
int delta_mode = 0,
int coarse_samples = 64,
int fine_samples = 64);

/// Full-factor variant: emits the (f_add, f_rescale, f_error) triplet used
/// for approximate-distance estimation. d_rotated_centroid (D floats) is
/// always required here — it participates in the factor computation — and is
/// zero-filled when d_centroid is null.
void quantize_data_full(raft::resources const& res,
const float* d_data,
size_t N,
size_t dim,
rotator_ref const& rotator,
const float* d_centroid,
float* d_rotated_centroid,
size_t ex_bits,
float const_scaling_factor,
bool use_fast,
uint16_t* d_total_code,
float* d_factors,
float* d_residuals);

void quantize_data_full(raft::resources const& res,
const float* d_data,
size_t N,
size_t dim,
rotator_ref const& rotator,
const float* d_centroid,
float* d_rotated_centroid,
size_t ex_bits,
float const_scaling_factor,
bool use_fast,
uint8_t* d_total_code,
float* d_factors,
float* d_residuals);

} // namespace cuvs::preprocessing::quantize::rabitq::detail

#endif // RABITQ_GPU_PIPELINE_CUH
Loading