Skip to content

fix(samples): waive CUDA-GL interop on non-NVIDIA GL contexts - #3077

Open
yimoj wants to merge 1 commit into
NVIDIA:mainfrom
yimoj:fix/gl-interop-context-waiver
Open

yimoj wants to merge 1 commit into
NVIDIA:mainfrom
yimoj:fix/gl-interop-context-waiver

Conversation

@yimoj

@yimoj yimoj commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

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() 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).

@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label Oct 12, 2026
@coderabbitai

coderabbitai Bot commented Oct 12, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/cuda-python/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 8a7c1ade-ea0a-4fd9-8e59-900315240c0a

📥 Commits

Reviewing files that changed from the base of the PR and between c7e6f09 and 28b188f.


📒 Files selected for processing (3)
  • samples/cuda_core/glInteropFluid/glInteropFluid.py
  • samples/cuda_core/glInteropMipmapLod/glInteropMipmapLod.py
  • samples/cuda_core/glInteropPlasma/glInteropPlasma.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 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. On other GPUs, they display an explanation and exit as waived instead of attempting to run with an unsupported context.

Walkthrough

The Fluid, MipmapLod, and Plasma samples now check whether their OpenGL context is on an NVIDIA GPU. When it is not, they print the helper’s reason, close the window, and exit 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 28b18

The samples retain the waiver path for non-NVIDIA GL contexts in documented checkout use. Hardware-specific runtime validation remains outstanding, but no concrete merge-blocking risk is established.

✨ 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.

@github-actions

Copy link
Copy Markdown
Contributor

@juenglin
juenglin requested a review from lijinf2 October 12, 2026 18:55

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.core Everything related to the cuda.core module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant