8000 Honor in-out capacities in driver graph enumeration by RicheyWorks · Pull Request #64 · jcuda/jcuda · GitHub
[go: up one dir, main page]

Skip to content

Honor in-out capacities in driver graph enumeration - #64

Draft
RicheyWorks wants to merge 1 commit into
jcuda:masterfrom
RicheyWorks:fix/graph-query-capacities
Draft

RicheyWorks wants to merge 1 commit into
jcuda:masterfrom
RicheyWorks:fix/graph-query-capacities

Conversation

@RicheyWorks
Copy link
Copy Markdown

Five driver graph-list wrappers pass an uninitialized native count to CUDA instead of reading the caller's in/out capacity: graph nodes, root nodes, edges, node dependencies and dependent nodes. CUDA may receive a capacity unrelated to the allocated native arrays. The wrappers also copy to the full Java array length rather than the requested capacity and copy undefined native output even after a CUDA error.

Use one shared capacity reader to validate a nonempty count array, read the initial value only for list queries, and ensure it fits every provided output array. Initialize the native count, allocate and copy only the requested capacity, and release native storage without copying outputs when CUDA reports failure. Count-only queries keep ignoring the count's initial value; successful list queries preserve CUDA's returned count and null padding. Entries beyond requested capacity remain untouched. Document validation exceptions on all five Java entry points. No signatures change.

This is one in/out-capacity marshalling defect across five related entry points, not five counted fixes. No graph-query contribution was found in issue/PR searches. This branch is independent of the other pending JNI fixes.

37 real graph-metadata cases, each in an isolated child JVM with JNI checking and a 30-second timeout:

  • Three empty nodes with two dependency edges; inspect exact node/edge identities without assuming enumeration order.
  • All five APIs: count-only, exact capacity, smaller capacity, null padding, negative/oversized capacity, and an empty count array.
  • Edge-array capacity mismatch and a native invalid-value response for a half-null edge request; invalid/error paths preserve Java output arrays.
  • Check entries beyond requested capacity retain their original object identity. Zero-capacity list handling preserves the native success/invalid-value boundary without copying output.

Verification on Windows x86_64, RTX 4090/driver 617.42, Temurin 22/JUnit 4.13.1:

  • Published 12.6.0 driver, final matrix: 37 tests, 32 failures, zero errors/skips. Only the five count-only controls pass. List retrieval also crashes isolated child JVMs on this host; no graph is launched.
  • Driver rebuilt with this patch and pristine jcuda-common 9d41fb5: all 37 pass under JNI checking, zero failures/errors/skips or JNI warnings. A logged direct edge-padding run confirms the rebuilt DLL path.
  • Existing MSVC/CMake, checksum-verified workspace CUDA 12.6 headers/driver import library; Java uses proposed parent Target Java 8 in the parent compiler configuration jcuda-parent#2 installed normally. No installation, global environment change or ingestion pause.
  • Graphs and private contexts are destroyed on completion. No graph instantiation/launch, GPU data allocation, transfers, kernels or reset. Baseline crash evidence remains private and is not included in the repository.
  • No runtime-API equivalent, v2 edge-data API, concurrent graph mutation, large-graph stress, full CUDA suite or other platforms/GPU models validated. Graph objects remain subject to CUDA's external synchronization requirements.

CUDA contract: graph management.

mvn -f JCudaJava/pom.xml -Dtest=JCudaGraphQueryCapacityTest "-DargLine=-Djava.library.path=<rebuilt-driver-directory>" test

The regression enables JNI checking in each child and propagates the selected library path.

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.

1 participant

0