Skip to content

Java bindings: evaluate replacing hand-written JNI with the Foreign Function & Memory API #1794

Description

@ramakrishnap-nv

The Java bindings added in #1524 are hand-written JNI. Java 22 and later ship the Foreign Function & Memory API (JEP 454), which calls the C API directly and would remove cuopt_jni.cpp and its build entirely.

Why it was not done now: the bindings target Java 17, which is still a common default. An earlier revision of #1524 did use FFM and required Java 22 or higher.

Trade-off to settle:

  • Hand-written JNI keeps the Java 17 floor, but every static native declaration and its entry point must be kept in sync by hand. Java bindings for LP, MIP and QP #1524 adds scripts/check_jni_symbols.sh to catch drift, since JNI resolves lazily and a mismatch otherwise surfaces only when something calls the method.
  • FFM removes the native shim and the drift class of bug, at the cost of requiring Java 22+.

cuVS uses FFM (via jextract) for its Java interface, so there is in-house precedent for the tooling.

Raised by @mlubin in review: #1524 (comment)

Part of #1535.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

awaiting responseThis expects a response from maintainer or contributor depending on who requested in last comment.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions