Skip to content

Skip JIT LTO example when PTX cannot load#2151

Open
kiwigitops wants to merge 1 commit into
NVIDIA:mainfrom
kiwigitops:skip-jit-example-old-driver
Open

Skip JIT LTO example when PTX cannot load#2151
kiwigitops wants to merge 1 commit into
NVIDIA:mainfrom
kiwigitops:skip-jit-example-old-driver

Conversation

@kiwigitops
Copy link
Copy Markdown

Fixes #1851.

The jit_lto_fractal.py example compiles PTX before it runs the rest of the example. When the generated PTX is newer than the active driver can load, the broader test suite already treats that condition as a skip, but the example subprocess kept running and could fail with the Windows access-violation exit seen in the issue.

This adds jit_lto_fractal.py to the example system requirements using the existing _can_load_generated_ptx() helper, so the example is skipped under the same driver/backend mismatch instead of launching the subprocess.

Tested:

  • python -m compileall -q cuda_core/tests/example_tests/test_basic_examples.py
  • python -m ruff check cuda_core/tests/example_tests/test_basic_examples.py
  • git diff --check

Signed-off-by: kiwigitops <kiwisclubco@gmail.com>
@copy-pr-bot
Copy link
Copy Markdown
Contributor

copy-pr-bot Bot commented May 28, 2026

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.core Everything related to the cuda.core module label May 28, 2026
Comment on lines +51 to +54
def can_load_generated_ptx() -> bool:
from cuda.core._program import _can_load_generated_ptx

return _can_load_generated_ptx()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need to wrap it. Just move the import to the top.

SYSTEM_REQUIREMENTS = {
"memory_pool_resources.py": has_recent_memory_pool_support,
"gl_interop_plasma.py": has_display,
"jit_lto_fractal.py": can_load_generated_ptx,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

... and use it here directly:

Suggested change
"jit_lto_fractal.py": can_load_generated_ptx,
"jit_lto_fractal.py": _can_load_generated_ptx,

Comment on lines +103 to +107
def test_jit_lto_fractal_requires_loadable_ptx(monkeypatch):
from cuda.core import _program

monkeypatch.setattr(_program, "_can_load_generated_ptx", lambda: False)
assert not SYSTEM_REQUIREMENTS["jit_lto_fractal.py"]()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please do not add tests for tests.

@leofang leofang added P1 Medium priority - Should do test Improvements or additions to tests labels May 29, 2026
@leofang leofang added this to the cuda.core v1.1.0 milestone May 29, 2026
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 P1 Medium priority - Should do test Improvements or additions to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Test: The generated ptx will not be loadable by the current driver.

2 participants