Add CUDA-Graphics (OpenGL) interop support to cuda.core#1608
Open
rparolin wants to merge 9 commits intoNVIDIA:mainfrom
Open
Add CUDA-Graphics (OpenGL) interop support to cuda.core#1608rparolin wants to merge 9 commits intoNVIDIA:mainfrom
rparolin wants to merge 9 commits intoNVIDIA:mainfrom
Conversation
Contributor
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
rparolin
commented
Feb 12, 2026
Andy-Jost
reviewed
Feb 12, 2026
Comment on lines
+243
to
+245
| HANDLE_RETURN( | ||
| cydriver.cuGraphicsMapResources(1, &raw, cy_stream) | ||
| ) |
Contributor
There was a problem hiding this comment.
optional: you could make the unmap more reliable (and avoid the duplicated calls to cuGraphicsUnmapResources) by making this into a resource, similar to the handle.
Contributor
|
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
- Remove unused GraphicsResourceHandle cimport (cython-lint) - Split long f-string to stay within 120-char line limit (ruff E501) - Rename unused variable buf to _buf (ruff F841) - Add noqa: S110 to intentional try-except-pass in test cleanup - Apply ruff auto-fixes (import sorting, formatting) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Author
|
/ok to test |
|
Member
|
@jakirkham as the original requester of #241, would it be possible for you to review and provide us your feedbacks here? 🙂 |
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.
Summary
Adds CUDA-Graphics (OpenGL) interoperability support to
cuda.core, enabling zero-copy sharing of GPU memory between CUDA compute kernels and OpenGL graphics renderers.GraphicsResource— Cython extension class for registering and managing OpenGL buffers/images with CUDA. Supportsfrom_gl_buffer()andfrom_gl_image()factory methods,map()/unmap()with context manager support, and automatic resource cleanup viaclose().GraphicsRegisterFlags— IntEnum for controlling registration behavior (NONE,READ_ONLY,WRITE_DISCARD,SURFACE_LOAD_STORE,TEXTURE_GATHER).GraphicsResourceHandle(shared_ptr with custom deleter) integrated into the existing resource handle infrastructure.gl_interop_plasma.py: real-time plasma effect rendered by a CUDA kernel directly into an OpenGL PBO, displayed via pyglet.New Public API
Files Changed
_graphics.pyx/_graphics.pxdGraphicsResourceandGraphicsRegisterFlags_cpp/resource_handles.cpp/.hppGraphicsResourceHandlecreation +cuGraphicsUnregisterResourcefunction pointer_resource_handles.pxd/.pyx__init__.pyGraphicsResourceandGraphicsRegisterFlagstests/test_graphics.pyexamples/gl_interop_plasma.pypixi.toml/pixi.lockpyglettest dependencyScreenshot