NVIDIA / NVIDIA/cuvs

[FEA] Evaluate exposing CAGRA graph size as a `long`

Open
#1,242 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C feature request
Dominant language
Cuda
Stars
854
Forks
236
Avg merge
3d 3h
Merged PRs (30d)
62

Description

Background

#1086 added getters for CAGRA index graph sizes/degrees/data-pointers via the C-API, for use from Java (etc.).

One sees that the graph-size is exposed as a uint32_t: Crucially, unsigned.

The problem

The challenge here is that Java has no support for unsigned types. When the graph-size is fetched via JNI (Panama), it is exposed as a signed int type. If used with a graph whose size exceeds 2**31, the Java code will likely run with an incorrect negative value. (First reported here.)

The workaround

The Java side currently addresses this via an up-cast to long.

Preferred solution:

It would be good to evaluate whether the graph-size should really be exposed as a long in the C API. It would save having to cast on the receiving end.
This would also be in line with how the number of rows in the dataset is exposed: as a long.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the C-API graph-size getters introduced by #1086 and the Java-side up-cast in PR #1216. Compare the graph-size type with the dataset row-count API, then determine whether changing the exposed type is safe for the C API and Java consumers. Done means values above 2**31 remain correct without relying on an unsigned-to-signed conversion.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, java
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.