Skip to content

Optimize Tanimoto similarity for skinny queries - #284

Open
scal444 wants to merge 1 commit into
NVIDIA-BioNeMo:mainfrom
scal444:perf/issue268-transposed-tanimoto
Open

Optimize Tanimoto similarity for skinny queries#284
scal444 wants to merge 1 commit into
NVIDIA-BioNeMo:mainfrom
scal444:perf/issue268-transposed-tanimoto

Conversation

@scal444

@scal444 scal444 commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Optimizes small dimension queries by transposing the small dim and using optimal matrix dimensions. N=1 is still inefficient, but much less so.

@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Optimizes Tanimoto cross-similarity when the first input is skinny by swapping the tensor-operation axes and transposing writes back into the public matrix layout.

  • Adds specialized 8-, 16-, and 32-column tensor-kernel launch configurations.
  • Corrects shared-memory result stride handling for asymmetric tiles.
  • Adds CUDA tests covering tile thresholds, rectangular matrices, fingerprint widths, and empty fingerprints.

Confidence Score: 5/5

The PR appears safe to merge, with no actionable correctness, security, or build failures identified.

The asymmetric tile mappings, shared-memory indexing, transposed output storage, architecture-specific compilation paths, and tested boundary configurations preserve the existing similarity matrix and metric contracts.

Important Files Changed

Filename Overview
src/similarity_kernels.cu Adds asymmetric tensor-kernel launches and transposed output indexing while preserving the public query-by-database matrix layout.
src/load_store.cuh Changes the shared-memory result stride to the tile’s X dimension, matching kernel readback for asymmetric tiles.
nvmolkit/tests/test_similarity.py Adds reference-based coverage across skinny-query tile boundaries and verifies empty-fingerprint Tanimoto behavior.

Reviews (1): Last reviewed commit: "Optimize Tanimoto similarity for skinny ..." | Re-trigger Greptile

@scal444
scal444 requested a review from moradza September 1, 2026 19:18
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.

1 participant