Skip to content

test(helpers): narrow EGL device probe catch to MissingFunctionException - #3020

Open
juenglin wants to merge 1 commit into
NVIDIA:mainfrom
juenglin:egl-follow-up
Open

juenglin wants to merge 1 commit into
NVIDIA:mainfrom
juenglin:egl-follow-up

Conversation

@juenglin

@juenglin juenglin commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Description

closes #2864

Follow-up to #2865.

select_headless_egl_device_for_cuda in cuda_python_test_helpers/cuda_python_test_helpers/graphics.py is a capability probe, but it caught except Exception: return None, which violates the "Capability probes must not swallow real bugs" rule in cuda_core/tests/AGENTS.md. A real failure (ctypes drift, a pyglet internal rename, a transient EGL error) was swallowed and turned into None, which makes _configure_pyglet_headless() leave pyglet.options["headless_device"] unset and fall back to EGL device 0 -- the broken path on the multi-GPU systems #2865 fixes -- so the test would re-fail with the original CUDA_ERROR_INVALID_DEVICE and no sign the fix ran.

The only genuine "extension not available" signal here is pyglet.gl.lib.MissingFunctionException: link_EGL returns a stub for an unresolvable entry point (e.g. an EGL stack that has eglQueryDevicesEXT but not eglQueryDeviceAttribEXT), and the stub raises MissingFunctionException when called. Narrow the catch to that type and let everything else propagate. EGL_FALSE returns are already handled as "no match", and the caller already skips when libEGL is absent, so no ImportError handling is needed.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

select_headless_egl_device_for_cuda caught `except Exception: return None`,
which violates the "Capability probes must not swallow real bugs" rule in
cuda_core/tests/AGENTS.md. A real failure (ctypes drift, a pyglet internal
rename, a transient EGL error) was swallowed and turned into None, which
makes the caller fall back to EGL device 0 -- the broken path on the
multi-GPU systems NVIDIA#2865 fixes -- so the test re-failed with the original
CUDA_ERROR_INVALID_DEVICE and no sign the fix ran.

The only genuine "extension not available" signal is
pyglet.gl.lib.MissingFunctionException: link_EGL returns a stub for an
unresolvable entry point, and the stub raises it when called. Narrow the
catch to that type and let everything else propagate. EGL_FALSE returns
are already handled as "no match", and the caller already skips when
libEGL is absent, so no ImportError handling is needed.

Follow-up to NVIDIA#2865. Refs NVIDIA#2864.
@juenglin juenglin added this to the cuda.core 1.3.0 milestone Oct 5, 2026
@juenglin juenglin added the bug Something isn't working label Oct 5, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 5, 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.

@juenglin juenglin self-assigned this Oct 5, 2026
@juenglin juenglin added the test Improvements or additions to tests label Oct 5, 2026
@juenglin juenglin added P1 Medium priority - Should do cuda.core Everything related to the cuda.core module labels Oct 5, 2026
@juenglin

juenglin commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test f4fe917

@juenglin
juenglin requested a review from Andy-Jost October 5, 2026 17:56
@juenglin
juenglin enabled auto-merge (squash) October 5, 2026 18:02
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

@juenglin
juenglin requested a review from rparolin October 5, 2026 18:11

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

bug Something isn't working cuda.core Everything related to the cuda.core module P1 Medium priority - Should do test Improvements or additions to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[cuda.core] test_graphics.py fails on headless multi-GPU Linux: EGL device does not match current CUDA device

2 participants