Skip to content

Add PyLucene integration and CPU/GPU end-to-end tests - #2475

Draft
nvzm123 wants to merge 6 commits into
NVIDIA:mainfrom
nvzm123:zackm_cuvslucene-147
Draft

Add PyLucene integration and CPU/GPU end-to-end tests#2475
nvzm123 wants to merge 6 commits into
NVIDIA:mainfrom
nvzm123:zackm_cuvslucene-147

Conversation

@nvzm123

@nvzm123 nvzm123 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

This ports the cuVS-Lucene production changes from NVIDIA/cuvs-lucene#174 into java/cuvs-lucene after the project moved into the cuVS monorepo.

The port:

  • targets the Lucene 10.2 runtime ABI while retaining the established Lucene101AcceleratedHNSWCodec SPI name;
  • uses Lucene 10.2's Lucene101Codec as the accelerated codecs' explicit delegate;
  • exposes the correctly typed scalar and binary provider APIs while retaining legacy JVM descriptors with actionable failures;
  • initializes scalar- and binary-quantized vector formats lazily so SPI discovery cannot be poisoned by an unavailable optional Lucene format;
  • preserves the concrete throwable type when reflective format construction fails;
  • keeps PR Fix silent brute force fallback at aligned vector dimensions #2483's padded-dataset behavior for aligned and unaligned CAGRA serialization;
  • corrects GPU query-path documentation for multi-partition algorithm selection and global-document-ID result partitioning; and
  • verifies the exact contents of the published thin JAR, including SPI providers and exclusion of Lucene, base cuvs-java, and test-only payloads.

The PyLucene pytest suite and its test-only Java adapters are owned by the cuVS Bench backend in NVIDIA/cuvs#2385, not by the production cuvs-lucene artifact. The standard thin cuvs-lucene JAR remains the artifact under test; Lucene and the base cuvs-java JAR remain external classpath dependencies.

Apache does not publish PyLucene 10.2.0, so end-to-end validation uses a custom PyLucene wrapper generated against the same Lucene 10.2.0 sources as this project.

Test coverage

The in-tree Java coverage adds or strengthens:

  • fresh-JVM codec and vector-format SPI discovery;
  • lazy scalar and binary format construction with an empty provider cache;
  • Lucene 10.2 binary-format capability and constructor-failure classification;
  • legacy provider-descriptor compatibility; and
  • exact thin-JAR SPI and ownership checks during Maven verify.

The dependent pytest matrix in #2385 proves these execution paths:

  • CPU HNSW build and HNSW search;
  • GPU CAGRA build followed by one-layer or three-layer HNSW search; and
  • GPU CAGRA build and CAGRA search.

GPU-required cases assert the concrete accelerated writer, reader, and query implementations and fail on unavailable cuVS or CPU fallback. CPU cases explicitly verify a stock Lucene HNSW path.

The matrix covers a single live document, one and ten segments, 10-to-1 and 100-to-10 force merges, CAGRA searchWidth values 1, 16, and 32, deletions, selective filters, persisted HNSW graph degree/layers, exact filtered search, and deterministic brute-force recall. Assertions check rank-one self matches where applicable, exact hit counts, duplicate exclusion, inactive/filter-rejected document exclusion, and configurable recall floors.

Warning-free CAGRA cases use graphDegree=32, intermediateGraphDegree=64, and enough vectors to avoid graph-parameter clamping, including 24,832 vectors for the three-layer case.

Validation

Final producer revision: d6fcab0946837d7d3997cec4ed18189d3faa12e6.

Validated on an NVIDIA A10G with JDK 22, matching cuVS Java/native 26.10 artifacts, and Lucene/PyLucene 10.2:

The Maven suite retains existing warnings from randomized small-dataset graph clamping, JVM vector/native access, intentional fallback or invalid-configuration cases, and the Javadoc plugin's existing unknown includePackageNames parameter. The PyLucene suite emitted no cuVS graph-clamping or CPU-fallback warnings; it emitted the expected JVM notice for the incubating vector module.

A clean rebuild of all current-main native dependencies was not used for the final GPU rerun: after adding the container's missing matching libcufile-dev headers, the build exposed 5,420 native targets and was stopped as impractical for this Java/Python-only change. The final producer JAR itself was built from the exact revision above and tested against a compatible native runtime reporting cuVS 26.10.

Known randomized-test failure

Seed CC0EA94328BAB3E5 exposes an existing failure in TestCuVSVectorsFormat.testRandomWithUpdatesAndGraph: IllegalStateException: Index not found for field:field at CuVS2510GPUVectorsReader.java:425.

The same seed reproduces identically on this branch and on the untouched base commit 0fa5ebe5, including the secondary seed and stack trace. It is therefore not introduced by this port. Reproduction command from java/cuvs-lucene:

mvn -q -Dtest=TestCuVSVectorsFormat#testRandomWithUpdatesAndGraph \
  -Dtests.seed=CC0EA94328BAB3E5 \
  -Dtests.locale=ti-Ethi-ET \
  -Dtests.timezone=Greenwich test

The full validation listed above passes.

Follow-up multithreaded concurrency coverage is tracked in NVIDIA/cuvs#2407.

Co-authored-by: Corey J. Nolet <cjnolet@gmail.com>
Signed-off-by: Zack Meeks <zmeeks@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

nvzm123 added a commit to nvzm123/cuvs that referenced this pull request Aug 19, 2026
Use cuVS PR NVIDIA#2475 as the pinned source for matching native, cuvs-java, and cuvs-lucene artifacts. Refresh monorepo paths, validation commands, and adapter compatibility guidance.

Signed-off-by: nvzm123 <zmeeks@nvidia.com>
@nvzm123
nvzm123 marked this pull request as ready for review August 20, 2026 04:05
@nvzm123
nvzm123 requested review from a team as code owners August 20, 2026 04:05
@@ -0,0 +1,934 @@
# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We shouldn't be hosting python files in java directories. Please move to cuvs-bench.


"""PyLucene end-to-end coverage for CPU HNSW and GPU cuVS search paths.

The parametrized cases cover segment and force-merge topologies, CAGRA search

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Again, this should be hosted in cuvs-bench, not in cuvs-lucene.

Comment thread java/cuvs-lucene/README.md Outdated
python3 -m pytest -q -s src/test/python/test_pylucene_end_to_end.py
```

The cases live in `src/test/python/test_pylucene_end_to_end.py`; reusable

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I mentioned this in the prior PR in cuvs-lucene- you should not need to list special instructions in the docs for running the pylucene tests. They should be part of the cuvs-bench python test suite. Please remove all this stuff from the docs. You also should not need to explicitly state how to run the java tests for cuvs-lucene- running cuvs-lucene tests should be enough to run all the java tests in cuvs-lucene.

@cjnolet cjnolet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This still needs some work.

@nvzm123
nvzm123 marked this pull request as draft August 24, 2026 23:09
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