Skip to content

Add a persistent GPU SubstructLibrary - #357

Merged
scal444 merged 1 commit into
NVIDIA-BioNeMo:mainfrom
scal444:substructlib-3a-library-core
Oct 7, 2026
Merged

scal444 merged 1 commit into
NVIDIA-BioNeMo:mainfrom
scal444:substructlib-3a-library-core

Conversation

@scal444

@scal444 scal444 commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

SubstructLibrary is the GPU counterpart of RDKit's SubstructLibrary: molecules are copied in once and packed and uploaded at finalize(), then any number of queries run against them. Molecules get IDs in the order they are added and become searchable at the next finalize(); queries keep searching the previously finalized molecules until then. Each GPU holds its molecules as one packed batch, new molecules go to the GPU with the fewest, and results are merged in ID order. Molecules the packed format cannot represent are matched with RDKit on the CPU.

Also changed up naming schemes from the previous PR to be a bit clearer.

PR 3 for #350

@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[High risk] Adds persistent GPU molecule library with new search API.

The PR appears safe to merge based on the changes since the previous review and the status of earlier findings.

Summary

The PR adds a GPU-resident substructure library with incremental finalization, ordered molecule IDs, multi-GPU searching, and RDKit fallback. Since the previous review, it prepares ring information when molecules are added and adds a regression test for ring queries.

Reviews (4) · Last reviewed commit: "Add a persistent GPU SubstructLibrary" · Reviewed by Greptile

Comment thread src/substruct/substruct_library.cpp
Comment thread src/substruct/substruct_library.cpp
Comment thread src/substruct/substruct_library.cpp Outdated
Comment thread tests/test_substruct_library.cu
@scal444
scal444 force-pushed the substructlib-3a-library-core branch from 3483d36 to 789884c Compare October 6, 2026 17:28
Comment thread tests/test_substruct_library.cu Outdated
@scal444
scal444 force-pushed the substructlib-3a-library-core branch from 789884c to dfe0aaf Compare October 6, 2026 18:26
Comment thread tests/test_substruct_library.cu
@scal444
scal444 requested a review from evasnow1992 October 6, 2026 18:59
Comment thread src/substruct/substruct_library.cpp Outdated

@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.

One comment, not a blocker but may be beneficial to address. Other changes look good to me.

SubstructLibrary is the GPU counterpart of RDKit's SubstructLibrary:
molecules are copied in once and packed and uploaded at finalize(), then
any number of queries run against them. Molecules get IDs in the order
they are added and become searchable at the next finalize(); queries keep
searching the previously finalized molecules until then. Each GPU holds
its molecules as one packed batch, new molecules go to the GPU with the
fewest, and results are merged in ID order. Molecules the packed format
cannot represent are matched with RDKit on the CPU.

Each GPU keeps one search workspace, and calls are serialized by the
library lock.

Also rename the resident-search API from NVIDIA-BioNeMo#351 to the codebase's host and
device vocabulary: ResidentTargetBatch / makeResidentTargetBatch become
PersistentDeviceTargets / makePersistentDeviceTargets,
hasSubstructMatchResident becomes a hasSubstructMatch overload, and
ResidentSubstructSearchWorkspace becomes SubstructSearchWorkspace. Declare
mergeBatch() in molecules.h so the library can append packed batches.
@scal444
scal444 force-pushed the substructlib-3a-library-core branch from dfe0aaf to 1bb8b65 Compare October 7, 2026 19:53
@scal444
scal444 merged commit 8265fc2 into NVIDIA-BioNeMo:main Oct 7, 2026
15 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