8000 Correct native-to-Java stream access-policy window output by RicheyWorks · Pull Request #65 · jcuda/jcuda · GitHub
[go: up one dir, main page]

Skip to content

Correct native-to-Java stream access-policy window output - #65

Draft
RicheyWorks wants to merge 1 commit into
jcuda:masterfrom
RicheyWorks:fix/stream-window-output
Draft

RicheyWorks wants to merge 1 commit into
jcuda:masterfrom
RicheyWorks:fix/stream-window-output

Conversation

@RicheyWorks
Copy link
Copy Markdown

Stream access-policy-window getters write native output through the outer stream-attribute wrapper instead of its nested window. The window output helpers also truncate the float hit ratio through an integer cast, write the miss property into the hit-property field, and narrow the byte count through an integer cast before assigning a Java long.

Pass the nested window to the output helper, use the matching JNI scalar types and assign the distinct miss-property field. Eight changed lines across driver/runtime, no signatures changed. Fresh output windows are still created when absent; caller-provided window objects are updated in place.

This complements Kowala's existing #48, which changes the input/setter path. Its exact diff was checked; this branch changes only the output/getter path and does not contain #48. That input patch applies cleanly in a separate integration worktree with its original authorship preserved. One output-conversion contribution is counted once across both APIs and the affected window fields.

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

  • Six independent child-JVM cases: driver/runtime getters with fresh and sentinel-prefilled reused windows, plus stream-flag controls. Published 12.6.0 DLLs: four getter cases abort under JNI checking with a wrong-field-ID error; two controls pass.
  • Rebuilt both JNI libraries with only this output patch and pristine jcuda-common 9d41fb5: all six pass, zero failures/errors/skips. Direct getter runs log both rebuilt DLL paths. No setter or data allocation is needed in this independent mode.
  • Additional separate integration with Pass correct object to getCudaAccessPolicyWindow #48 revision a6908ccb637e025e8dcec629cc13961d1e02ff05: optional round-trip mode passes all six cases. Four direct logged fresh/reused driver/runtime runs verify the returned allocation address, 256 bytes, exact fractional ratio 0.375, hit property 2 and miss property 1, plus cleanup. This nondefault setup depends on Pass correct object to getCudaAccessPolicyWindow #48; the getter-only reproduction does not.
  • Existing MSVC/CMake and checksum-verified CUDA 12.6 workspace headers/import libraries. Java uses proposed parent Target Java 8 in the parent compiler configuration jcuda-parent#2 installed normally; the runtime dependency directory is added only to the test process PATH. No installation or global environment change.
  • Streams and private contexts are destroyed; optional 256-byte allocations are freed. No kernels, transfers, cache-performance test, reset or ingestion pause.
  • No full CUDA suite, kernel-node output path, synchronization-policy behavior, byte counts above 32 bits, other platforms or GPU models validated. Kernel-node callers and other variants of this output-conversion family remain follow-up work, not additional counted fixes.

Independent mode:

mvn -f JCudaJava/pom.xml -Dtest=JCudaStreamWindowOutputTest "-DargLine=-Djava.library.path=<rebui
8000
lt-native-directory>" test

Optional nondefault round-trip mode, after applying #48 and rebuilding both combined libraries:

mvn -f JCudaJava/pom.xml -Dtest=JCudaStreamWindowOutputTest -Djcuda.test.windowRoundTrip=true "-DargLine=-Djava.library.path=<combined-native-directory>" test

Each child enables JNI checking and has a 30-second timeout. Reused-window identity is preserved. No PR48 setter changes are duplicated here.

CUDA reference: window field types and properties, stream attributes.

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