You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ci: select the nightly-pytorch tests with a torch marker - #3666
The nightly-pytorch job selected its tests by file name (tests/test_utils.py tests/example_tests/), so the PyTorch tests in tests/test_utils_dlpack.py (#3499: 5 tests, 43 cases) were never collected there, and they skip everywhere else because PyTorch isn't installed. This PR selects by what the tests need instead:
cuda_core/pytest.ini
+ torch: test needs PyTorch; the nightly-pytorch CI job selects tests by this marker
.github/workflows/test-wheel-{linux,windows}.yml (nightly-pytorch)
- pytest ... tests/test_utils.py tests/example_tests/+ pytest ... -m "torch or samples" tests/
Tests marked torch:
test_utils_dlpack.py: the five tests that use the torch_module fixture.
test_utils.py: test_ml_dtypes_bfloat16_torch_dlpack, test_torch_tensor_bridge_dtypes, and the torch entries of the shared CPU/GPU parametrize lists, through a small _torch_param(...) helper so the numpy/CuPy/Numba cases of the same tests stay unmarked.
Notes:
samples is the existing marker on test_sample, so the job still runs the samples.
pytest.ini already has norecursedirs = cython, so collecting tests/ doesn't touch the Cython tests this job doesn't build.
The job no longer runs the non-torch tests in test_utils.py or the sample-harness unit tests; those run in standard CI.
test_protocol_import_does_not_load_torch and test_protocol_import_keeps_unrelated_torch_module_lazy are intentionally unmarked: they check that torch is not imported and run in standard CI.
Locally (PyTorch 2.14.1+cu130, CUDA available, cuda.core built from main):
-m torch selects 106 cases: 63 in test_utils.py, 43 in test_utils_dlpack.py. 99 pass; 7 skip only because CuPy isn't installed locally (the nightly job installs it via test-cu13).
-m "torch or samples" selects 150 cases (adds the 44 test_sample cases).
The only torch-named cases left unmarked are the two "doesn't load torch" tests above.
Confirming in CI: this job only runs in the nightly workflow (PyTorch 2.9.1 and 2.15.0, Linux and Windows), so it has to be started by hand (needs write access to NVIDIA/cuda-python):
Wait for this PR's CI workflow run to finish successfully and note its run ID (.../actions/runs/<run-id>).
Start the nightly workflow on this PR's mirror branch with that run ID:
The nightly-pytorch job ran a fixed list of files (tests/test_utils.py and
tests/example_tests/), so the PyTorch tests in tests/test_utils_dlpack.py,
added later, never ran anywhere.
Register a "torch" marker in cuda_core/pytest.ini and apply it to every
test that needs PyTorch: the five torch_module tests in
test_utils_dlpack.py, two tests in test_utils.py, and the torch entries of
its shared parametrize lists (through a small _torch_param helper). The
nightly-pytorch job now runs `-m "torch or samples" tests/`, so a new
torch test only needs the marker to be picked up.
ClosesNVIDIA#3594.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nightly PyTorch interop test runs on Linux and Windows now select tests marked for PyTorch or sample cases across the test suite.
PyTorch-dependent tests and sample cases are labeled consistently for these runs.
Test execution continues to produce JUnit reports and folded output.
The nightly Linux and Windows PyTorch jobs now discover tests under tests/ using the torch or samples markers. PyTorch-dependent cases in test_utils.py and test_utils_dlpack.py now carry the torch marker.
Changes: Nightly PyTorch test selection
Layer / File(s)
Summary
Mark PyTorch-dependent tests cuda_core/pytest.ini, cuda_core/tests/test_utils.py, cuda_core/tests/test_utils_dlpack.py
The marker registry declares torch. PyTorch-dependent parameters and tests use that marker.
Select marked tests in nightly jobs .github/workflows/test-wheel-linux.yml, .github/workflows/test-wheel-windows.yml
Both jobs discover tests across tests/ and select tests marked torch or samples.
Assessment against linked issues
Objective
Addressed
Explanation
Run the PyTorch-dependent tests in test_utils_dlpack.py in the nightly-pytorch jobs (3594)
✅
Possibly related issues
Issue 3578: The nightly job’s marker selection includes samples, matching the issue’s concern about sample tests selected by that job.
Issue 3597: The new torch marker makes PyTorch-dependent tests selectable by the nightly job, addressing the cited test-discovery gap.
Suggested reviewers:leofang, rwgk
Change: Other · Severity of issue fixed: Low
Merge Risk: Moderate · up to 03642
The nightly PyTorch jobs can report success without running the DLPack tests this change targets, if the tests checkout predates the new markers. The selection change is otherwise small and reversible. Make the step fail when the target tests are not selected, or keep the tests checkout compatible with the workflow, before relying on the nightly result.
Security architecture risk: Minimal · up to 03642
The change updates test selection in the existing Linux and Windows nightly jobs. Its demonstrated effect is on test coverage, not on production behavior or access permissions.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Finishing TouchesFix failing CI checks
Reviewing files that changed from the base of the PR and between fb1fc2a and 03642ab.
Files selected for processing: 5
.github/workflows/test-wheel-linux.yml
.github/workflows/test-wheel-windows.yml
cuda_core/pytest.ini
cuda_core/tests/test_utils.py
cuda_core/tests/test_utils_dlpack.py
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 6 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Major · Functional Correctness · Heavy lift
important: Nightly PyTorch runs can pass without the DLPack tests.
The nightly-pytorch step runs the workflow file from the nightly run's ref. It checks out tests at inputs.sha, which is the head of the latest successful main CI run. If that tests revision predates the torch marks, -m "torch or samples" omits all five DLPack tests. The step still passes when a sample test is selected and passes. The same applies to the Windows step.
The nightly workflow can start from a PR branch or from a main commit that is newer than the pinned tests revision. In both cases the workflow file and the tests can come from different revisions.
The nightly-pytorch step must not pass when the DLPack tests are not selected. Choose a mechanism that guarantees this for any tests revision the nightly run can check out.
Preview will be ready when the GitHub Pages deployment is complete.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CI/CDCI/CD infrastructurecuda.coreEverything related to the cuda.core moduletestImprovements or additions to tests
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3594. Part of #2077.
Summary
The nightly-pytorch job selected its tests by file name (
tests/test_utils.py tests/example_tests/), so the PyTorch tests intests/test_utils_dlpack.py(#3499: 5 tests, 43 cases) were never collected there, and they skip everywhere else because PyTorch isn't installed. This PR selects by what the tests need instead:Tests marked
torch:test_utils_dlpack.py: the five tests that use thetorch_modulefixture.test_utils.py:test_ml_dtypes_bfloat16_torch_dlpack,test_torch_tensor_bridge_dtypes, and the torch entries of the shared CPU/GPU parametrize lists, through a small_torch_param(...)helper so the numpy/CuPy/Numba cases of the same tests stay unmarked.Notes:
samplesis the existing marker ontest_sample, so the job still runs the samples.pytest.inialready hasnorecursedirs = cython, so collectingtests/doesn't touch the Cython tests this job doesn't build.test_utils.pyor the sample-harness unit tests; those run in standard CI.test_protocol_import_does_not_load_torchandtest_protocol_import_keeps_unrelated_torch_module_lazyare intentionally unmarked: they check that torch is not imported and run in standard CI.Evidence
Locally (PyTorch 2.14.1+cu130, CUDA available, cuda.core built from
main):-m torchselects 106 cases: 63 intest_utils.py, 43 intest_utils_dlpack.py. 99 pass; 7 skip only because CuPy isn't installed locally (the nightly job installs it viatest-cu13).-m "torch or samples"selects 150 cases (adds the 44test_samplecases).Confirming in CI: this job only runs in the nightly workflow (PyTorch 2.9.1 and 2.15.0, Linux and Windows), so it has to be started by hand (needs write access to NVIDIA/cuda-python):
Wait for this PR's CI workflow run to finish successfully and note its run ID (
.../actions/runs/<run-id>).Start the nightly workflow on this PR's mirror branch with that run ID:
In the nightly-pytorch jobs (Linux and Windows), confirm the five
test_utils_dlpack.pytests PASSED, for example:Merge Danger
Door: two-way.
Blast Radius: the nightly-pytorch job's test selection, plus marker-only changes in two test files (standard CI runs the same tests as before).
Reviewers: please feel free to push commits directly to this PR to improve it.
🤖 Generated with Claude Code