8000 Read virtual-memory access locations from the nested object by RicheyWorks · Pull Request #63 · jcuda/jcuda · GitHub
[go: up one dir, main page]

Skip to content

Read virtual-memory access locations from the nested object - #63

Draft
RicheyWorks wants to merge 1 commit into
jcuda:masterfrom
RicheyWorks:fix/access-descriptor-location
Draft

RicheyWorks wants to merge 1 commit into
jcuda:masterfrom
RicheyWorks:fix/access-descriptor-location

Conversation

@RicheyWorks
Copy link
Copy Markdown

getCUmemAccessDescs obtains each descriptor's nested location, but reads the CUmemLocation field IDs from the outer CUmemAccessDesc. cuMemSetAccess consequently uses a wrong object/field pairing and aborts under JNI checking before CUDA can validate the request.

Read the location id/type from the already obtained javaLocation. Two changed lines, no signatures or flag conversions changed. This is separate from #58's allocation-property/handle marshalling and #48's access-policy-window conversion; neither is included in this branch.

Add three isolated child-JVM regression cases for no-access/read/read-write descriptors. The default mode submits a deliberately unmapped address with a nonzero size: safe JNI conversion must allow CUDA to return CUDA_ERROR_INVALID_VALUE. It requires no allocation, mapping or pending allocation fix. Children enable JNI checking, capture diagnostics and have a 30-second timeout; contexts are destroyed on completion, and unsupported VMM devices skip explicitly.

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

  • Published 12.6.0 driver: all three default cases abort inside isolated children with Field type (instance) mismatch in JNI get/set field operations.
  • Driver rebuilt with only these two changed reads and pristine jcuda-common 9d41fb5: all three pass, zero failures/errors/skips. A logged direct run confirms the rebuilt DLL and successful native error return, without JNI warnings.
  • Additional separate integration worktree combines this patch with Fix virtual-memory allocation handle and property marshalling #58 solely to create a valid allocation fixture. Optional mapped mode runs all three cases successfully. Direct logged runs confirm a 2 MiB allocation/mapping for each permission value 0, 1 and 3, successful cuMemGetAccess round-trips and cleanup. This combined result depends on Fix virtual-memory allocation handle and property marshalling #58; the independent regression above does not.
  • Existing MSVC/CMake, checksum-verified workspace CUDA 12.6 headers/driver import library; integration include/link settings checked explicitly. Java uses proposed parent Target Java 8 in the parent compiler configuration jcuda-parent#2 installed normally. No installation or global environment changes.
  • No overlapping cuMemSetAccess/CUmemAccessDesc contribution found; upstream master 5ecd90c remains current. No kernels, data access/transfers, reset or ingestion pause.
  • No full CUDA suite, peer-device access, null descriptor handling/count validation, other platforms or GPU models validated. Setting/querying permissions is not a memory-access enforcement or performance test.

Independent mode after rebuilding this branch:

m
8000
vn -f JCudaJava/pom.xml -Dtest=JCudaDriverAccessDescriptorTest "-DargLine=-Djava.library.path=<rebuilt-driver-directory>" test

Optional actual-mapping validation, after applying #58 and rebuilding the combined driver:

mvn -f JCudaJava/pom.xml -Dtest=JCudaDriverAccessDescriptorTest -Djcuda.test.vmmMappedAccess=true "-DargLine=-Djava.library.path=<combined-driver-directory>" test

Children enable JNI checking automatically. Mapped mode caps allocations at 16 MiB and frees mapping, virtual reservation, physical handle and context. On the test host only 2 MiB was used per case. CUDA contract: virtual memory management.

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