Repository navigation
Allow null context in cuCtxSetCurrent - #52
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.
Fixes #16 for
cuCtxSetCurrent: CUDA permits a null context to unbind the calling CPU thread's current context (or do nothing for an empty context stack), but the JNI wrapper throwsNullPointerExceptionbefore calling CUDA.Remove that null rejection. The existing shared
getNativePointerValuehelper already maps a Java null to native zero, so the CUDA driver receives the documented null context. Other APIs' null handling is outside this change.Add two driver regression tests on fresh CPU threads: passing null with an empty stack, and passing null after creating a temporary context, then verifying no context remains current. The created context is destroyed in
finally; no kernels, transfers or device resets are performed and no test changes the caller thread's context.Validation:
NullPointerException: Parameter 'ctx' is null for cuCtxSetCurrent.-Xcheck:jni. JVM library-load logging confirms it loaded the freshly builtJCudaDriver-12.6.0-windows-x86_64.dllviajava.library.path, rather than silently using the published JAR's DLL.CUDA 12.6 contract: https://docs.nvidia.com/cuda/archive/12.6.0/cuda-driver-api/group__CUDA__CTX.html