Skip to content
Merged
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
Request shared memory in the RaBitQ quantize kernels only when needed
sa_quantize_fused_kernel reads its shared memory only while searching for a
per-vector scale, but both launchers always requested padded_dim floats, which
fails from about padded dim 12256 because they never opted in. They now request
0 bytes when use_fast is on or ex_bits is 0, and otherwise launch through
safely_launch_kernel_with_smem_size. There is deliberately no 48 KiB gate:
static shared memory counts against the limit, so padded dim 12256 fails
although its dynamic request is below 48 KiB.

The two output modes have the same signature but not the same static shared
memory, so each keeps its own helper state. With one shared state, the
(delta, vl) kernel at padded dim 25184 left the full-factor kernel unable to
launch at any dimension for the rest of the process.

Tested on an RTX PRO 6000: transform in both output modes, with use_fast on and
off, passes at padded dim 10752, 12256, 12288, 14016 and 16384 for fht_kac, and
(delta, vl) passes at 12288 and 16384 for matmul. PREPROCESSING_TEST 372/372,
RABITQ_C_TEST 2/2.
  • Loading branch information
Stardust-SJF committed Nov 5, 2026
commit 2e5d05a55269c4154bacc07b445e3f3dcfda1e68
89 changes: 57 additions & 32 deletions cpp/src/preprocessing/quantize/detail/rabitq/quantize.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
* 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.
* Imported from the standalone RaBitQ GPU quantizer. Behaviour unchanged
* except that the launchers request only the shared memory they use and opt in
* to more than the default limit.
*/

//
Expand All @@ -15,6 +16,7 @@
// referenced by the benchmark.
//

#include "../../../../neighbors/detail/smem_utils.cuh"
#include "quantize.cuh"
#include "reductions.cuh"
#include "rescale_search.cuh"
Expand Down Expand Up @@ -289,6 +291,11 @@ __global__ void sa_quantize_fused_kernel(const float* __restrict__ d_residual,
// ---------------------------------------------------------------------------
// Launcher + free-function entry points.
// ---------------------------------------------------------------------------
// Keys the shared-memory state per kernel. Both output modes have the same signature but not the
// same static shared memory, so one must not be raised to the other's limit.
template <typename CodeT, bool kFullFactors>
struct quantize_smem_key {};

template <typename CodeT>
static void launch_quantize_fused(cudaStream_t stream,
const float* d_residual,
Expand All @@ -310,21 +317,30 @@ static void launch_quantize_fused(cudaStream_t stream,
int iB = static_cast<int>(ex_bits);
constexpr int nwarps = block / 32;

size_t q_smem = (padded_dim + 2 * nwarps) * sizeof(float);
sa_quantize_fused_kernel<CodeT, block, false><<<iN, block, q_smem, stream>>>(d_residual,
d_total_code,
iN,
iD,
iB,
const_scaling_factor,
use_fast,
coarse_samples,
fine_samples,
d_delta,
d_vl,
delta_mode,
nullptr,
nullptr);
// The kernel only reads its shared memory while searching for a per-vector scale.
const size_t q_smem = (use_fast || ex_bits == 0) ? 0 : (padded_dim + 2 * nwarps) * sizeof(float);
auto kernel = &sa_quantize_fused_kernel<CodeT, block, false>;
cudaKernel_t cuda_kernel;
RAFT_CUDA_TRY(cudaGetKernel(&cuda_kernel, reinterpret_cast<const void*>(kernel)));
cuvs::neighbors::detail::safely_launch_kernel_with_smem_size<quantize_smem_key<CodeT, false>>(
static_cast<std::uint32_t>(q_smem),
[&]() {
kernel<<<iN, block, q_smem, stream>>>(d_residual,
d_total_code,
iN,
iD,
iB,
const_scaling_factor,
use_fast,
coarse_samples,
fine_samples,
d_delta,
d_vl,
delta_mode,
nullptr,
nullptr);
},
cuda_kernel);
RAFT_CUDA_TRY(cudaGetLastError());
}

Expand Down Expand Up @@ -404,21 +420,30 @@ static void launch_quantize_full(cudaStream_t stream,
int iB = static_cast<int>(ex_bits);
constexpr int nwarps = block / 32;

size_t q_smem = (padded_dim + 2 * nwarps) * sizeof(float);
sa_quantize_fused_kernel<CodeT, block, true><<<iN, block, q_smem, stream>>>(d_residual,
d_total_code,
iN,
iD,
iB,
const_scaling_factor,
use_fast,
64,
64,
nullptr,
nullptr,
0,
d_centroid,
d_factors);
// The kernel only reads its shared memory while searching for a per-vector scale.
const size_t q_smem = (use_fast || ex_bits == 0) ? 0 : (padded_dim + 2 * nwarps) * sizeof(float);
auto kernel = &sa_quantize_fused_kernel<CodeT, block, true>;
cudaKernel_t cuda_kernel;
RAFT_CUDA_TRY(cudaGetKernel(&cuda_kernel, reinterpret_cast<const void*>(kernel)));
cuvs::neighbors::detail::safely_launch_kernel_with_smem_size<quantize_smem_key<CodeT, true>>(
static_cast<std::uint32_t>(q_smem),
[&]() {
kernel<<<iN, block, q_smem, stream>>>(d_residual,
d_total_code,
iN,
iD,
iB,
const_scaling_factor,
use_fast,
64,
64,
nullptr,
nullptr,
0,
d_centroid,
d_factors);
},
cuda_kernel);
RAFT_CUDA_TRY(cudaGetLastError());
}

Expand Down