Repository navigation
Preserve device identity array outputs when JNI copies storage - #61
Draft
RicheyWorks wants to merge 1 commit into
Draft
RicheyWorks wants to merge 1 commit into
RicheyWorks wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Device identity array outputs are lost when JNI supplies copied array storage.
setCudaDevicePropexplicitly releases the name, UUID and LUID outputs withJNI_ABORT;cuDeviceGetNameconditionally aborts based onisCopy, which also loses output with HotSpot's JNI checker. Successful queries can therefore leave empty arrays or the caller's old bytes.Request copy-back (
0) for these four output releases. The JNI contract permits copied critical-array storage; output should not depend on pinning or an implementation's copy flag. No signatures or field layouts change.This is one device-identity output contribution across driver/runtime. It is independent of jcuda/jcuda-common#4: these APIs release arrays directly, bypassing that shared PointerData helper, so the shared fix alone does not correct them. This branch contains neither that patch nor any other pending contribution.
Add three real metadata tests comparing runtime device name, UUID and LUID with driver queries. Prefill output arrays with sentinel bytes, require a nonempty driver name, compare NUL-terminated names and exact UUID/LUID bytes, and check the LUID node mask. Skip LUID where CUDA defines it as unavailable (non-Windows/TCC). Each test uses and destroys a private CPU-thread context without changing exception mode, allocating data buffers, launching kernels, transferring data or resetting a device.
Verification on Windows x86_64, RTX 4090 WDDM/driver 617.42, Temurin JDK 22/JUnit 4.13.1:
-Xcheck:jnibecause identity output is discarded.jcuda-common9d41fb5: all three pass under JNI checking, zero failures/errors/skips and no JNI warnings. JVM logging confirms both rebuilt DLL paths in a dedicated test directory.5ecd90c.JNI contract: critical-array release modes.