Skip to content

test(cuda.core): skip CUDA-GL interop tests on TCC devices - #3054

Merged
rparolin merged 2 commits into
NVIDIA:mainfrom
rparolin:fix/graphics-tests-skip-on-tcc
Oct 12, 2026
Merged

rparolin merged 2 commits into
NVIDIA:mainfrom
rparolin:fix/graphics-tests-skip-on-tcc

Conversation

@rparolin

@rparolin rparolin commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Skip test_graphics.py GL interop tests on TCC devices.

TCC is compute-only and has no OpenGL. Context setup raises a GLException that is not treated as "context unavailable", so 23 tests fail instead of skipping on Windows/TCC.

The fix adds _skip_if_tcc(), which checks Device().properties.tcc_driver. Both GL context helpers call it first.

Tested: test_graphics.py on Linux, 30 passed (same as before). The TCC skip path is not tested on real TCC hardware. It should be rerun on Windows with a TCC device to confirm that device reports tcc_driver.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label Oct 8, 2026
@rparolin
rparolin requested review from Andy-Jost and juenglin October 8, 2026 20:44
@rparolin rparolin self-assigned this Oct 8, 2026
@rparolin rparolin added this to the cuda.core 1.3.0 milestone Oct 8, 2026
@rparolin rparolin added P1 Medium priority - Should do P0 High priority - Must do! and removed P1 Medium priority - Should do labels Oct 8, 2026
@coderabbitai

coderabbitai Bot commented Oct 8, 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: fa875edf-9924-47ca-91fe-383d7ecbd90e

📥 Commits

Reviewing files that changed from the base of the PR and between f833a8c and b1ea1b4.


📒 Files selected for processing (3)
  • cuda_bindings/tests/test_graphics_apis.py
  • cuda_core/tests/test_graphics.py
  • cuda_python_test_helpers/cuda_python_test_helpers/graphics.py

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

  • Tests
    • Graphics tests are skipped when the selected CUDA device uses TCC mode, avoiding attempts to open an incompatible graphics context.

Walkthrough

Graphics test helpers query whether the selected CUDA device uses TCC mode. The graphics context managers skip before configuring headless mode or creating a GL context when the helper returns a reason.

Changes

Graphics test TCC handling

Layer / File(s) Summary
Query the selected device’s TCC setting
cuda_python_test_helpers/cuda_python_test_helpers/graphics.py
Adds tcc_skip_reason(). It returns a skip reason for TCC devices, returns None for other devices, and raises RuntimeError if a CUDA query fails.
Skip graphics tests before GL setup
cuda_core/tests/test_graphics.py, cuda_bindings/tests/test_graphics_apis.py
The graphics context managers check the helper result before configuring headless mode or creating a GL context. The core tests use _skip_if_tcc() for this check.

Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to b1ea1

TCC devices should skip the GL-dependent tests, while other devices continue through GL setup. No concrete merge-blocking behavior is established; confirmation on TCC hardware remains useful.

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

TCC is a compute-only driver model with no OpenGL, so GL context setup
raises a GLException that is not classified as "context unavailable".
All 23 test_graphics.py tests then fail instead of skipping on
Windows/TCC. Skip up front when Device().properties.tcc_driver is set.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@rparolin
rparolin force-pushed the fix/graphics-tests-skip-on-tcc branch from f95994f to f833a8c Compare October 8, 2026 20:52
@rparolin
rparolin enabled auto-merge (squash) October 8, 2026 20:55
@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown

Add Carrot credits or activate Agent usage billing to use Autopilot

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor
Doc Preview CI
Preview removed because the pull request was closed or merged.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, the test_graphics_apis.py tests do not need the same skip?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coderabbitai Do you know?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
ast-grep outline cuda_bindings/tests/test_graphics_apis.py --items all
rg -n -C3 'tcc|TCC|open_gl_window|is_gl_context_unavailable|cuGL|cuGraphics|skip|fixture' cuda_bindings/tests/test_graphics_apis.py
fd -i '^graphics\.py$'

Length of output: 2328


🏁 Script executed:

#!/bin/bash
sed -n '55,150p' cuda_bindings/tests/test_graphics_apis.py
ast-grep outline cuda_python_test_helpers/cuda_python_test_helpers/graphics.py --items all
rg -n -A45 -B3 '^def (is_gl_context_unavailable|open_gl_window)\(' cuda_python_test_helpers/cuda_python_test_helpers/graphics.py
rg -n -C3 'cudaDevAttrTccDriver|CU_DEVICE_ATTRIBUTE_TCC_DRIVER|cudaDeviceGetAttribute\(|cudaGetDevice\(' cuda_bindings/tests --glob '*.py'

Length of output: 9291


@juenglin suggestion: Yes—the GL smoke tests need the same early TCC skip.

In cuda_bindings/tests/test_graphics_apis.py, _gl_context() calls open_gl_window() without checking TCC mode. The reported GLException would propagate before the test reaches its cudaErrorOperatingSystem handling. Both parameterizations of test_cuda_gl_register_image_smoketest use this path.

Add the check before _configure_pyglet_headless(). Use cudart.cudaGetDevice() and cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrTccDriver, device) to avoid a dependency on cuda.core. Check both return statuses; query failures should fail, not skip.

Keep test_cuda_register_image_invalid enabled. It does not create a GL context and only checks that registration with an invalid handle returns an error.

This conclusion comes from code inspection. I did not test it on TCC hardware.

You are interacting with an AI system.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to work the skip into is_gl_context_unavailable then?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
ast-grep outline cuda_python_test_helpers/cuda_python_test_helpers/graphics.py --items all
ast-grep outline cuda_bindings/tests/test_graphics_apis.py --items all
rg -n -A65 -B3 '^def (is_gl_context_unavailable|open_gl_window)\(' cuda_python_test_helpers/cuda_python_test_helpers/graphics.py
rg -n -A55 -B3 '^def (_gl_context|_configure_pyglet_headless)\(' cuda_bindings/tests/test_graphics_apis.py

Length of output: 9434


@juenglin suggestion: Share the TCC check, but keep it separate from is_gl_context_unavailable().

That function classifies an exception after GL setup fails. TCC is a property of the selected CUDA device, so check it before GL setup. A GL context could also open on another GPU even when the selected CUDA device uses TCC.

Do not add generic GLException handling. The helper deliberately rejects it because it can indicate a real GL error.

A separate helper in cuda_python_test_helpers.graphics could return a skip reason for TCC. Both test suites could call it before configuring pyglet or opening a window. Use cuda.bindings for the device query, rather than introducing a cuda.core dependency. Let query failures propagate.

You are interacting with an AI system.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coderabbitai Please make the change you suggested.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📌 Tracking this review finding. CodeRabbit will verify future changes against the original feedback and will only mark it fixed when the code satisfies it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Fixed in #3054.

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

❌ Cannot commit CI fixes directly to a fork pull request. Request a fix PR instead.

Add tcc_skip_reason() to cuda_python_test_helpers.graphics so both
cuda_core/tests/test_graphics.py and cuda_bindings/tests/test_graphics_apis.py
skip CUDA-GL interop tests on a TCC device using one shared predicate.

The helper queries the current device via cuda.bindings.runtime (not
cuda.core) so the cuda_bindings suite does not take a cuda.core
dependency. Runtime query failures propagate rather than being masked
as a skip.

test_cuda_register_image_invalid stays enabled: it does not open a GL
context and only checks the error path for an invalid handle.

Signed-off-by: Ralf Juengling <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

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

Copy link
Copy Markdown
Contributor

/ok to test b1ea1b4

@rparolin
rparolin merged commit d2c30ce into NVIDIA:main Oct 12, 2026
544 of 552 checks passed
github-actions Bot pushed a commit that referenced this pull request Oct 13, 2026
Removed preview folders for the following PRs:
- PR #3045
- PR #3053
- PR #3054
- PR #3055
- PR #3078
- PR #3079
- PR #3080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.bindings Everything related to the cuda.bindings module cuda.core Everything related to the cuda.core module P0 High priority - Must do!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants