Skip to content

Iterative CAGRA-Q - #1810

Open
irina-resh-nvda wants to merge 44 commits into
NVIDIA:mainfrom
irina-resh-nvda:iterative_cagra_q
Open

Iterative CAGRA-Q#1810
irina-resh-nvda wants to merge 44 commits into
NVIDIA:mainfrom
irina-resh-nvda:iterative_cagra_q

Conversation

@irina-resh-nvda

@irina-resh-nvda irina-resh-nvda commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

Build CAGRA on PQ datasets with Iterative CAGRA-Q

Iterative cagra graph construction using CAGRA-Q search.

This PR improves the iterative CAGRA build method by enabling PQ compression: the dataset is compressed before the iterative search starts, and CAGRA-Q is used to iteratively update the KNN graph.

This is the first time we are introducing building CAGRA on (PQ) quantized datasets directly.

@copy-pr-bot

copy-pr-bot Bot commented Feb 16, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

… search

- Configurable growth-phase in-build search params (itopk_size, search_width,
  max_iterations) and internal/smem dtype; itopk auto-forced on the final
  full-size iteration.
- Decouple compression params used during iterative construction from the
  target index compression.
- Add shuffle_dataset option; fix out-of-bounds access from the in-place raft
  gather by switching to an out-of-place gather.
…around)

The shuffle_dataset path used an out-of-place gather into a temporary buffer to
work around an illegal memory access in raft's in-place gather overload when
n_rows * row_len exceeded 2^31 (32-bit index overflow).

That bug is now fixed upstream in raft (NVIDIA/raft#3059, closes #3055), which
the cuvs raft pin now includes. Revert to the in-place gather to drop the extra
full-size temporary allocation and copy.
@irina-resh-nvda
irina-resh-nvda marked this pull request as ready for review July 15, 2026 08:48
@irina-resh-nvda
irina-resh-nvda requested review from a team as code owners July 15, 2026 08:48
@aamijar aamijar changed the title Iterative cagra q Iterative graph build using CAGRA-Q search Jul 22, 2026
@aamijar aamijar changed the title Iterative graph build using CAGRA-Q search Iterative CAGRA-Q Jul 22, 2026
@aamijar

aamijar commented Aug 10, 2026

Copy link
Copy Markdown
Member

It looks like a lot of files were edited to change the copyright header? I think we should revert those.
Update I fixed it in these commits:
355d240
8cd4191

This commit 6ad9234 reverted minor diff in a test file.

We should look through the merge conflicts due to Datasets API and resolve them.
Fyi a few cagra-q fixes are being worked on here #2413

This reverts commit d9c6bfd.
@copy-pr-bot

copy-pr-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@aamijar
aamijar removed request for a team and gforsyth August 14, 2026 02:14

@achirkin achirkin left a comment

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.

Please undo all changes to bench/ann/src/common. Let's keep CAGRA-Q compressed dataset support as before - by letting the compressed dataset be a part of index file / folder.
We should leave a proper refactoring of the benchmark harness for discussion and implementation in follow up work (if and how we want to pass compressed datasets as first-class input to the benchmarks).

@irina-resh-nvda

irina-resh-nvda commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Please undo all changes to bench/ann/src/common. Let's keep CAGRA-Q compressed dataset support as before - by letting the compressed dataset be a part of index file / folder. We should leave a proper refactoring of the benchmark harness for discussion and implementation in follow up work (if and how we want to pass compressed datasets as first-class input to the benchmarks).

I created a standalone PR for the vpq dataset serialisation. We can look through it and merge faster that this PR, and start working on the cuvsbench refactoring sooner.

I need the refactoring to rerun the benchmarks (the older performance numbers are obsolete now). I won't be comfortable merging this PR into main before the new benchmarks land

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request New feature or request non-breaking Introduces a non-breaking change

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

7 participants