Skip to content

Expose Vamana build and serialize through cuvs-java - #2555

Open
shaunakkapur wants to merge 1 commit into
NVIDIA:mainfrom
shaunakkapur:feat/java-vamana-index
Open

Expose Vamana build and serialize through cuvs-java#2555
shaunakkapur wants to merge 1 commit into
NVIDIA:mainfrom
shaunakkapur:feat/java-vamana-index

Conversation

@shaunakkapur

Copy link
Copy Markdown
Contributor

Description

Adds a public cuvs-java API for building and serializing Vamana indexes using the generated Panama bindings that already exist.

The API follows the existing CAGRA provider pattern:

  • VamanaIndex exposes build, dimensions, and DiskANN serialization.
  • VamanaIndexParams exposes the native build parameters with Java-side validation.
  • VamanaIndexImpl owns the native handle and preserves the lifetime of a dataset view.
  • CuVSProvider, JDKProvider, and UnsupportedProvider expose the new builder.
  • The Vamana documentation gains Java examples.

serialize(Path filePrefix, boolean includeDataset) intentionally accepts a path prefix because the native call can write the graph at that prefix and the dataset at <prefix>.data.

The integration tests cover supported host and device datatypes, both native L2 metrics, dimensions, serialization layout, parameter validation, and resource ownership. This includes the float16 and device-backed paths added by the current native Vamana implementation.

Scope

This PR is build-and-serialize only. It does not add Vamana search, deserialization, sector_aligned, AiSAQ layout changes, or cuvs-lucene integration because those capabilities are not exposed by the current Vamana C API or belong to later work.

Testing

  • mvn verify passed for the earlier 15-test Vamana suite plus the existing unit tests.
  • mvn spotless:check passed.
  • ci/checks/run_spotless.sh passed without rewrites.
  • Javadocs passed with doclint enabled.
  • cuvs-lucene test compilation passed against the locally installed jar.
  • The four new compatibility cases—float16, device-backed matrices, L2SqrtExpanded, and infinity validation—are included in the 19-test suite. Full native execution of those additions is delegated to CI because the local C++ environment predates current Vamana fp16 support and cannot be rebuilt without newly required cuTile and cuFile development packages.

@copy-pr-bot

copy-pr-bot Bot commented Sep 4, 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.

cuVS provides a GPU Vamana builder and DiskANN-compatible serialization,
and the generated Panama bindings for it already exist in cuvs-java, but
there is no public API, so nothing can call Vamana from Java. This adds
VamanaIndex and VamanaIndexParams beside CagraIndex.

Scope is build and serialize only, matching the native surface. cuVS
exposes no Vamana search entry point, so neither does this.

serialize takes a Path prefix rather than an OutputStream, because one
native call writes two files, the graph at the prefix and the dataset at
prefix + ".data".

VamanaIndexParams.Builder mirrors the native RAFT_EXPECTS checks so an
invalid configuration fails in Java with a readable message instead of
inside a GPU kernel.

The native index may retain a non-owning device view of the dataset, so
the index holds a reference to keep it alive and closes it only when it
created the matrix from a float[][].

newVamanaIndexBuilder is added to CuVSProvider as a default method rather
than an abstract one so that providers written against an earlier version
of the interface keep compiling.
@shaunakkapur
shaunakkapur force-pushed the feat/java-vamana-index branch from 40d7748 to b7ecf25 Compare September 4, 2026 19:33
@shaunakkapur shaunakkapur changed the title [WIP] Expose Vamana build and serialize through cuvs-java Expose Vamana build and serialize through cuvs-java Sep 4, 2026
@shaunakkapur
shaunakkapur marked this pull request as ready for review September 4, 2026 19:49
@shaunakkapur
shaunakkapur requested review from a team as code owners September 4, 2026 19:49
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