Skip to content

Add GPU BitBIRCH clustering - #372

Merged
scal444 merged 3 commits into
NVIDIA-BioNeMo:mainfrom
scal444:bitbirch-cpp
Oct 22, 2026
Merged

scal444 merged 3 commits into
NVIDIA-BioNeMo:mainfrom
scal444:bitbirch-cpp

Conversation

@scal444

@scal444 scal444 commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

python bindings + more extensive integration tests to come in the followup

bitBirchGpu clusters packed fingerprints of up to 4096 bits with one
BitBIRCH tree. Each insertion batch routes against a stable snapshot of the
tree; one ordered owner per leaf then merges or appends that leaf's rows,
summaries are refreshed bottom-up from per-batch deltas, and overflowing
leaves split at a barrier in leaf order, cascading into parents. Rows past
the first 16384 that would each merge into the same entry are first tried
as one group. Cluster IDs follow each cluster's earliest row.

Each step has one implementation for any branching factor: nodes keep
contiguous entry lists, split pair searches tile node entries, and leaf
owners compare a batch of rows against the whole leaf in one pass.
Similarities are correctly rounded FP32 quotients, which order exactly up
to 4096 bits; iSIM merge tests use exact integer terms.

Tests cover the iSIM primitives and small cases checked against the Python
reference model, including cascading splits and leaves split across two
pair-search tiles.
@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with no new actionable issue found.

Summary

Adds GPU BitBIRCH clustering for packed fingerprints, with optional majority centroids and cluster IDs ordered by earliest input row.

  • GPU clustering groups packed fingerprints and returns ordered cluster labels.

All three earlier concerns are addressed in the current code: offset spans have scalar fallbacks, split caches respect shared-memory limits, and tests cover both accepted groups and rejected-group fallback. The supplied threads were unnumbered, so they have no numbered ledger entries.

No new actionable issues found. This review inspected code; it did not run builds or GPU tests.

Reviews (3) · Last reviewed commit: "BitBIRCH review fixes: CUB block reducti..." · Reviewed by Greptile

Comment thread src/bitbirch.cu Resolved
Comment thread src/bitbirch.cu Resolved
Comment thread tests/test_bitbirch.cu Resolved
@scal444 scal444 changed the title [Draft] Add GPU BitBIRCH clustering Add GPU BitBIRCH clustering Oct 22, 2026
…ariant test

- Replace hand-written block sum/min/argmax and the iSIM reduction with
  cub::BlockReduce.
- Drop the exact-integer iSIM branch: every FP64 term is an integer, so FP64
  sums are already exact below 2^53, and the reduction order is fixed.
- insertRows: thread 0 reads the tree status and broadcasts it, so a failure
  in another block cannot split one block across a barrier.
- Copy centroids one word per thread during finalization (coalesced).
- Remove the int stashed in the reduction scratch and a shadowed local.
- Link cub_helpers/host_vector instead of the unused device library; link
  device to test_bitbirch, which uses ScopedStream.
- Add a seeded 20k-row test past the ordered warm-up that checks cluster
  invariants (threshold, majority centroids, dense first-row order,
  determinism) without stored fixtures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scal444

scal444 commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

PR 1/2 for #321

@scal444
scal444 requested a review from evasnow1992 October 22, 2026 21:09

@evasnow1992 evasnow1992 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Changes look good to me.

@scal444
scal444 merged commit 0af6a71 into NVIDIA-BioNeMo:main Oct 22, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants