Skip to content

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

Open
shaunakkapur wants to merge 2 commits into
NVIDIA:mainfrom
shaunakkapur:feat/java-vamana-index
Open

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

Conversation

@shaunakkapur

@shaunakkapur shaunakkapur commented Sep 4, 2026

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

All 19 tests in VamanaBuildAndSerializeIT pass in CI on both CUDA 12.9 and 13.3, alongside the existing unit tests, the Lucene build, and the C++ matrix. The suite covers float32 and unsigned byte builds, float16 on a device-backed matrix, both serialization modes, the DiskANN file layout assertions, L2SqrtExpanded, parameter validation against the native RAFT_EXPECTS checks, dataset ownership, and lifecycle.

Also verified locally against a libcuvs.so built from current main:

  • mvn verify, 19 of 19 plus the existing unit tests
  • mvn spotless:check and ci/checks/run_spotless.sh, no rewrites
  • javadoc:javadoc with doclint all,-missing
  • cuvs-lucene test-compile against the installed jar

An earlier run failed in conda-cpp-build on a RAFT and ucxx mismatch in the build environment, in raft/comms/detail/std_comms.hpp. That was unrelated to this PR, which contains no C++ or CMake changes, and it has since been resolved upstream.

@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
The previous run failed in conda-cpp-build on a RAFT and ucxx mismatch in
the build environment, unrelated to this PR. Upstream main has since built
green, so this empty commit re-runs the checks against current packages.
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