-
Notifications
You must be signed in to change notification settings - Fork 117
[Review][Java] Extend Dataset
to work as an output data container
#1111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: branch-25.08
Are you sure you want to change the base?
Conversation
As @chatman pointed out in #1105, this needs a better name, as it would not be a "Dataset" neither a "Graph" in the lexicon of cuvs. |
Linking cjnolet/nv_elastic#22 |
Sorry for the delay. (It has been a packed day, today.) I like the idea of calling this the There might be value in differentiating whether the matrix is in |
+1 for this. We do this in all of our other APIs (python, c++) and it really helps us keep them clean and relatively self-documenting |
I like the idea of separate types, I was already planning to do this at implementation level (e.g. WDYT? |
…ed-dataset # Conflicts: # java/cuvs-java/src/main/java/com/nvidia/cuvs/Dataset.java # java/cuvs-java/src/main/java/com/nvidia/cuvs/spi/CuVSProvider.java # java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/BruteForceIndexImpl.java # java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/CagraIndexImpl.java # java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/HnswIndexImpl.java # java/cuvs-java/src/test/java/com/nvidia/cuvs/CagraBuildAndSearchIT.java
…ed-dataset # Conflicts: # java/cuvs-java/src/main/java22/com/nvidia/cuvs/spi/JDKProvider.java
…CuVSResources.access()
In #902 and #1034 we introduced a
Dataset
interface to support on-heap and off-heap ("native") memory seamlessly as inputs for cagra and bruteforce index building.As we expand the functionality of cuvs-java, we realized we have similar needs for outputs (see e.g. #1105 / #1102 or #1104).
This PR extends
Dataset
to support being used as an output, wrapping native (off-heap) memory in a convenient and efficient way, and providing common utilities to transform back and forth on-heap memory.This work is inspired by the existing raft
mdspan
andDLTensor
data structures, but tailored to our needs (2d only, just 3 data types, etc.). The PR keeps the current implementation simple and minimal on purpose, but structured in a way that is simple to extend.By itself, the PR is just a refactoring to extend the
Dataset
implementation and reorganize the implementation classes; its real usefulness will be in using it in the PRs mentioned above (in fact, this PR has been extracted from #1105).The implementation class hierarchy is implemented with future extensions in mind: atm we have one
HostMemoryDatasetImpl
, but we are already thinking to have a correspondingDeviceMemoryDatasetImpl
that will wrap and mange (views) on GPU memory to avoid (in some cases) extra copies of data from GPU memory to CPU memory only to process them or forward them to another algorithm (e.g quantization followed by indexing).Future work will also include add support/refactoring to allocate and manage GPU memory and DLTensors (e.g. working better with/refactoring
prepareTensor
).