You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(samples): waive CUDA-GL interop on non-NVIDIA GL contexts - #3077
Follow-up to the sample migration in #2959; related OpenGL availability handling is tracked in #2767 (this PR does not close that issue).
The migration replaced the old example wrapper's unconditional GL-sample skip with actual sample execution. A window can now open successfully on a non-NVIDIA GL context, such as Microsoft/D3D12, but these samples still attempt CUDA resource registration. The existing graphics tests already reject such contexts.
Reuse gl_context_not_on_nvidia_gpu_reason() in glInteropFluid, glInteropMipmapLod, and glInteropPlasma after creating the GL window and before registering CUDA resources. Ineligible contexts report the reason, close the window, and exit with the negotiated sample-waiver code. NVIDIA GL contexts continue normally, and genuine CUDA errors remain failures.
Only these three samples change. No new tests are added: the existing GL-helper tests cover vendor eligibility, and the sample harness already runs all three examples for three frames.
Validation
Ruff checks and formatting checks pass for the three changed samples.
python -m compileall -q passes for the three changed samples.
git diff --check passes.
Targeted existing sample tests could not collect locally because the environment has no importable CUDA package. WSL and native NVIDIA GL runtime validation remain outstanding; no hardware-backed success is claimed.
Checklist
New or existing tests cover these changes.
The documentation is up to date with these changes (no documentation changes are required).
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
📝 Summary
Summary by CodeRabbit
Bug Fixes
The fluid, mipmap LOD, and plasma graphics interop samples now check whether the active OpenGL context is running on an NVIDIA GPU. If the context is unsupported, the sample displays the reason, closes its window, and exits as waived rather than attempting to run. With a supported context, the samples continue to run as usual.
The Fluid, MipmapLod, and Plasma samples now check whether their OpenGL context is on an NVIDIA GPU. If the helper reports an unsupported context, each sample prints the reason, closes the window, and exits with EXIT_WAIVED.
Changes: OpenGL context waivers
Layer / File(s)
Summary
Load the helper and check the GL context samples/cuda_core/glInteropFluid/glInteropFluid.py, samples/cuda_core/glInteropMipmapLod/glInteropMipmapLod.py, samples/cuda_core/glInteropPlasma/glInteropPlasma.py
Each sample imports the shared context-check helper. After window creation, each sample checks the context and exits with EXIT_WAIVED when the helper returns a reason.
Suggested reviewers:danielfrg
Priority: ⬇️ Low
Change: Bug fix
Merge Risk:⚪ Minimal · up to 03fe8
These samples now waive before CUDA registration when GL reports a non-NVIDIA vendor, avoiding the unsupported interop path. No concrete source-level merge blocker is established; hardware-backed validation can remain a follow-up.
✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
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
bugSomething isn't workingcuda.coreEverything related to the cuda.core module
2 participants
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.
Description
Follow-up to the sample migration in #2959; related OpenGL availability handling is tracked in #2767 (this PR does not close that issue).
The migration replaced the old example wrapper's unconditional GL-sample skip with actual sample execution. A window can now open successfully on a non-NVIDIA GL context, such as Microsoft/D3D12, but these samples still attempt CUDA resource registration. The existing graphics tests already reject such contexts.
Reuse
gl_context_not_on_nvidia_gpu_reason()inglInteropFluid,glInteropMipmapLod, andglInteropPlasmaafter creating the GL window and before registering CUDA resources. Ineligible contexts report the reason, close the window, and exit with the negotiated sample-waiver code. NVIDIA GL contexts continue normally, and genuine CUDA errors remain failures.Only these three samples change. No new tests are added: the existing GL-helper tests cover vendor eligibility, and the sample harness already runs all three examples for three frames.
Validation
python -m compileall -qpasses for the three changed samples.git diff --checkpasses.Checklist