Repository navigation
[Triton/Gluon] Fix Conv3D CPU tests with a CUDA default device - #5984
Conversation
Keep both CPU-specific tests independent of the global default device. Reproduce the rejection test failure after torch.set_default_device("cuda") and verify both CPU tests pass with explicit device selection.
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
saeid-rostami
left a comment
There was a problem hiding this comment.
Thanks @whx-sjtu , LGTM!
brunomazzottiamd
left a comment
There was a problem hiding this comment.
LGTM! Let's wait for CI to run and then merge.
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused test-only change correctly eliminates dependence on PyTorch’s global default device.
Review effort: Balanced
Findings: None
What changed in this PR
Pins Conv3D CPU-test tensors to CPU, preventing interference from a CUDA global default device.
Changes:
- Adds explicit
device="cpu"to four test tensor allocations. - Preserves CPU dimension validation and rejection coverage.
| File | Description |
|---|---|
op_tests/triton_tests/conv/test_conv3d.py |
Makes CPU-specific tests independent of global device state. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Summary
The Conv3D CPU tests allocate on the global default device. When another test selects CUDA, the CPU rejection test receives GPU tensors and fails with
DID NOT RAISE. Pin the inputs of both CPU-specific tests to CPU.Evidence
test_conv3d_execution_rejects_cpu_tensorswithDID NOT RAISE <class 'ValueError'>. Setting the global default device to CUDA reproduces the failure locally.After: Both CPU-specific tests pass with that same global default.
Validated on main
80a3b0b09448bb5b8ade9a5946bec7549601331aplus this patch, on gfx950 with PyTorch2.10.0+rocm7.2.4.git3d3aa833and pytest8.3.4. Black and Ruff pass. The failure was observed while testing #5822 against main.Merge Danger
Door: two-way
Blast Radius: tests
Only the four input allocations in the two CPU-specific tests change.