8000 Preserve NVRTC lowered-name errors before converting output by RicheyWorks · Pull Request #66 · jcuda/jcuda · GitHub
[go: up one dir, main page]

Skip to content

Preserve NVRTC lowered-name errors before converting output - #66

Draft
RicheyWorks wants to merge 1 commit into
jcuda:masterfrom
RicheyWorks:fix/nvrtc-lowered-name-errors
Draft

RicheyWorks wants to merge 1 commit into
jcuda:masterfrom
RicheyWorks:fix/nvrtc-lowered-name-errors

Conversation

@RicheyWorks
Copy link
Copy Markdown

When nvrtcGetLoweredName fails (for example, before compilation), the JNI wrapper still passes its uninitialized output pointer to NewStringUTF. With NVRTC 12.6.85 on Windows this produces a misleading OutOfMemoryError, hiding the actual NVRTC error and preventing the normal exceptions-enabled path.

Return native failures before reading the output pointer or changing the Java result array. Release the temporary input string immediately after the native call, including on the later Java string allocation failure path. Successful names remain copied into Java-owned strings.

Validation: six isolated child-JVM cases with -Xcheck:jni: before compilation, invalid program, unregistered expression after compilation, exceptions enabled, successful name surviving program destruction, and null/empty output argument controls. Four fail against the published 12.6.0 JNI baseline; all six pass after rebuilding only JNvrtc against pristine upstream jcuda-common. The two controls pass before too. The error cases preserve the output sentinel and tail entry.

Windows x86_64, Temurin 22, existing MSVC/CMake, checksum-verified official CUDA/NVRTC 12.6 workspace headers/import libraries/DLLs. Library logging confirms the rebuilt JNI DLL. These are CPU-only compiler calls: no CUDA context, loaded module, GPU allocation or kernel launch. Maven uses the separately proposed Java 8 compiler baseline in jcuda-parent PR2; that build change is not included here.

Run with NVRTC DLLs available to the test process:

mvn -f JCudaJava/pom.xml -Dtest=JNvrtcLoweredNameTest -DargLine=-Djava.library.path=<rebuilt-JNI-directory> test

No full suite, other operating systems, or compiler versions tested. This draft is limited to lowered-name error handling; other NVRTC output functions are outside its scope. Upstream master and open PRs were checked for overlap.

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