Repository navigation
Description
Part of #2077.
Problem
Three driver-linker (cuLink) tests in cuda_core/tests/test_linker.py never run in CI:
test_linker_link_ptx_culinktest_driver_linker_lifetime_no_heap_corruptiontest_driver_linker_preserves_error_log_after_close
They are gated on the module-level is_culink_backend = _linker._decide_nvjitlink_or_driver(). That is true only when nvJitLink is missing or older than 12.3, and every CI row has a current nvJitLink. So the driver backend, a supported fallback in cuda/core/_linker.pyx, is not tested anywhere, including two regression tests (heap corruption on linker lifetime, and error-log preservation after close()).
Fix
Add a culink_backend fixture that forces the driver backend for the duration of a test, and use it for these three tests instead of the module-level skip.
The backend decision lives in plain module globals in _linker.pyx (_use_nvjitlink_backend, _driver, _inited). Other tests in test_linker.py already monkeypatch them. The fixture should:
- set
_use_nvjitlink_backend = Falseand_driver = driver; - reset
_initedso_lazy_init()rebuilds the driver input-type tables; - restore all of it on teardown.
Only backend selection is faked; the tests still call the real cuLink* APIs. Check that no Linker or cached state created under the other backend leaks across the switch.
These tests JIT-link PTX through the driver. On CTK 13.5 rows, NVRTC 13.5 PTX is too new for the installed drivers, so they will run only on the CTK 12.9/13.0 rows until #3579 is fixed.
Done when
The three tests run on every CTK 12.9/13.0 GPU row (and on CTK 13.5 rows once the driver is current), and their "not currently run in any CI job" markers are removed.
Guidance for PRs that address this issue
- When making a fix that allows a test to run in CI, remove the comment about the test not running in CI from the code.
- When making a test run only in nightly CI, we need to concretely confirm that in nightly CI. Include instructions in the PR about how to kick off a nightly run for the specific PR in order to test that (see below).
- For every PR note that the reviewer should feel free to push commits directly to the PR to improve things. @mdboom does not have the bandwidth to shepard each of them through.
- Every PR should include a way to confirm automatically that the tests are now running in at least one CI configuration.
Running the nightly test suites for a PR
The nightly workflow can test a PR's own wheels and tests, but it has to be started by hand. Starting it needs write access to NVIDIA/cuda-python, so ask a maintainer if you don't have it.
-
Wait for the PR's CI workflow run to finish successfully, and note its run ID, the number in its URL (
.../actions/runs/<run-id>). -
Start CI: Nightly optional-deps on the PR's mirror branch, with that run ID. Either:
-
In the GitHub UI: Actions → CI: Nightly optional-deps → Run workflow. Set Use workflow from to
pull-request/<PR number>, enter the run ID in the run-ID field, and leave the link-checker-only box unchecked. -
From the command line:
gh workflow run ci-nightly.yml --repo NVIDIA/cuda-python --ref pull-request/<PR number> -f run-id=<run-id>
Supply the run ID. Without it, the nightly run tests
main's latest wheels and tests, not the PR's. -
-
Link the nightly run in the PR. Then confirm that the affected tests ran and passed, rather than skipped, in the relevant nightly jobs.
The nightly run tests the commit of that CI run. Repeat these steps after pushing changes that affect the nightly-only tests.
Activity