Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/183586
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New FailuresAs of commit 9c47ac6 with merge base 12b535b ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Move 31 CUDA-specific tests (27 TunableOp + 4 backend library) and
3 helper methods into a new TestLinalgCUDA(TestCase) class. Guard
TestLinalg.setUp/tearDown tf32 behind torch.cuda.is_available().
OOT backends can skip via test_exclusions = {"TestLinalgCUDA": "*"}.
[ghstack-poisoned]
|
Note on the PR size - this shows 9300+ LOC changed because it moves 31 test methods and 3 helpers between classes within the same file (test_linalg.py). No test logic was added, removed, or modified - it's purely structural. I considered splitting it, but the 27 TunableOp tests share 3 helper methods (_tunableop_ctx,_set_tunableop_defaults, _compare_untuned_tuned_entries) that need to move together to avoid broken intermediate states. The 4 backend library tests are included for consistency. For easier review, Would it be possible to add the cc @fffrog |
|
Hi @RiyaP2508, this is a massive PR! :D To be honest, it’s a bit challenging to review such a large diff. We’d still suggest avoiding PRs of this size in the future—I’m sure it’s quite painful for @albanD to go through as well. However, for this specific PR, I’ll go through it carefully line-by-line, so there's no need to split it up now. |
|
Hey @RiyaP2508, sorry I couldn't finish reviewing this massive PR. It’s a bit overwhelming! :( I thought of a better way to handle this. The only downside is that you’ll have to submit the PR manually instead of using ghstack. The idea is to split your changes into two separate commits:
This way, the changes won't get mixed up. It makes it much clearer for the maintainer to see exactly what was added to What do you think? cc @albanD |
Hi @fffrog, thank you so much for the suggestion and for taking the time to look through this - I completely understand how overwhelming a diff this size can be, and I really appreciate your patience! Quick question before I restructure: this PR is part of a 3-PR ghstack for test_linalg:
Would you prefer I:
Happy to go with whichever works best for you. I understand the importance of keeping PRs smaller and more reviewable - will definitely batch moves more carefully going forward. Thanks again for the guidance! |
Hey @RiyaP2508, I think Option B is the better approach. We only need to refactor this current PR into two commits; the rest of the PRs can stay in their current ghstack form. The root cause is that |
understood. I will soon split them. Thank you! |
|
Starting merge as part of PR stack under #183588 |
…t_linalg"
## Summary
Move 31 CUDA-specific tests (27 TunableOp + 4 backend library) and 3 helper methods into a new `TestLinalgCUDA(TestCase)` class. Guard `TestLinalg.setUp`/`tearDown` tf32 settings behind `torch.cuda.is_available()`.
This is pure code movement — no test logic was changed. The high LOC count is entirely from moving methods between classes in the same file. OOT backends can skip the entire class via `test_exclusions = {"TestLinalgCUDA": "*"}`.
## Test plan
- [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` — 2926 passed
- [x] Syntax check passes
- [x] AST parse confirms TestLinalg: 262 methods, TestLinalgCUDA: 36 methods
cc: fffrog albanD
[ghstack-poisoned]
…t_linalg"
## Summary
Move 31 CUDA-specific tests (27 TunableOp + 4 backend library) and 3 helper methods into a new `TestLinalgCUDA(TestCase)` class. Guard `TestLinalg.setUp`/`tearDown` tf32 settings behind `torch.cuda.is_available()`.
This is pure code movement — no test logic was changed. The high LOC count is entirely from moving methods between classes in the same file. OOT backends can skip the entire class via `test_exclusions = {"TestLinalgCUDA": "*"}`.
## Test plan
- [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` — 2926 passed
- [x] Syntax check passes
- [x] AST parse confirms TestLinalg: 262 methods, TestLinalgCUDA: 36 methods
cc: fffrog albanD
cc albanD
[ghstack-poisoned]
…t_linalg"
## Summary
Move 31 CUDA-specific tests (27 TunableOp + 4 backend library) and 3 helper methods into a new `TestLinalgCUDA(TestCase)` class. Guard `TestLinalg.setUp`/`tearDown` tf32 settings behind `torch.cuda.is_available()`.
This is pure code movement — no test logic was changed. The high LOC count is entirely from moving methods between classes in the same file. OOT backends can skip the entire class via `test_exclusions = {"TestLinalgCUDA": "*"}`.
## Test plan
- [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` — 2926 passed
- [x] Syntax check passes
- [x] AST parse confirms TestLinalg: 262 methods, TestLinalgCUDA: 36 methods
cc: fffrog albanD
cc albanD
[ghstack-poisoned]
…t_linalg"
## Summary
Move 31 CUDA-specific tests (27 TunableOp + 4 backend library) and 3 helper methods into a new `TestLinalgCUDA(TestCase)` class. Guard `TestLinalg.setUp`/`tearDown` tf32 settings behind `torch.cuda.is_available()`.
This is pure code movement — no test logic was changed. The high LOC count is entirely from moving methods between classes in the same file. OOT backends can skip the entire class via `test_exclusions = {"TestLinalgCUDA": "*"}`.
## Test plan
- [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` — 2926 passed
- [x] Syntax check passes
- [x] AST parse confirms TestLinalg: 262 methods, TestLinalgCUDA: 36 methods
cc: fffrog albanD
cc albanD
[ghstack-poisoned]
…t_linalg"
## Summary
Move 31 CUDA-specific tests (27 TunableOp + 4 backend library) and 3 helper methods into a new `TestLinalgCUDA(TestCase)` class. Guard `TestLinalg.setUp`/`tearDown` tf32 settings behind `torch.cuda.is_available()`.
This is pure code movement — no test logic was changed. The high LOC count is entirely from moving methods between classes in the same file. OOT backends can skip the entire class via `test_exclusions = {"TestLinalgCUDA": "*"}`.
## Test plan
- [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` — 2926 passed
- [x] Syntax check passes
- [x] AST parse confirms TestLinalg: 262 methods, TestLinalgCUDA: 36 methods
cc: fffrog albanD
cc albanD
[ghstack-poisoned]
|
Starting merge as part of PR stack under #183588 |
1 similar comment
|
Starting merge as part of PR stack under #183588 |
## Summary Convert 8 tests verified to have no CUDA-specific code in body from `@onlyCUDA` to `@onlyAccelerator`, making them runnable on XPU, HPU, and PrivateUse1 backends. - 6 clean swaps: `test_norm_fused_type_promotion`, `test_powsum_dtype_kwarg`, `test_foreach_powsum_dtype_kwarg`, `test_triangular_solve_large`, `test_lu_solve_large_matrices`, `test_triu_tril_large_matrix_64bit` - 2 with `.cuda()` → `.to(device)` fix: `test_matmul_45724`, `test_logaddexp_cpu_vs_accelerator_complex` (renamed) ## Test plan - [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` — all passed - [x] Syntax check passes Pull Request resolved: #183587 Approved by: https://github.com/Skylion007, https://github.com/fffrog ghstack dependencies: #183586
…linalg (#183588) ## Summary Add `_get_other_device()` helper to `TestLinalg` and replace 16 hardcoded `torch.cuda.is_available()` + `'cuda'` wrong-device error-path blocks with device-agnostic equivalents using `torch.accelerator`. Also replace `complement_device` helper and convert 6 `device_type == 'cuda'` tolerance branches to `device_type != 'cpu'`. ## Test plan - [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` - all passed - [x] Syntax check passes cC: @fffrog @albanD Pull Request resolved: #183588 Approved by: https://github.com/Skylion007, https://github.com/fffrog ghstack dependencies: #183586, #183587
…ytorch#183586) ## Summary Move 31 CUDA-specific tests (27 TunableOp + 4 backend library) and 3 helper methods into a new `TestLinalgCUDA(TestCase)` class. Guard `TestLinalg.setUp`/`tearDown` tf32 settings behind `torch.cuda.is_available()`. This is pure code movement — no test logic was changed. The high LOC count is entirely from moving methods between classes in the same file. OOT backends can skip the entire class via `test_exclusions = {"TestLinalgCUDA": "*"}`. ## Test plan - [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` — 2926 passed - [x] Syntax check passes - [x] AST parse confirms TestLinalg: 262 methods, TestLinalgCUDA: 36 methods Pull Request resolved: pytorch#183586 Approved by: https://github.com/Skylion007
…ch#183587) ## Summary Convert 8 tests verified to have no CUDA-specific code in body from `@onlyCUDA` to `@onlyAccelerator`, making them runnable on XPU, HPU, and PrivateUse1 backends. - 6 clean swaps: `test_norm_fused_type_promotion`, `test_powsum_dtype_kwarg`, `test_foreach_powsum_dtype_kwarg`, `test_triangular_solve_large`, `test_lu_solve_large_matrices`, `test_triu_tril_large_matrix_64bit` - 2 with `.cuda()` → `.to(device)` fix: `test_matmul_45724`, `test_logaddexp_cpu_vs_accelerator_complex` (renamed) ## Test plan - [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` — all passed - [x] Syntax check passes Pull Request resolved: pytorch#183587 Approved by: https://github.com/Skylion007, https://github.com/fffrog ghstack dependencies: pytorch#183586
…linalg (pytorch#183588) ## Summary Add `_get_other_device()` helper to `TestLinalg` and replace 16 hardcoded `torch.cuda.is_available()` + `'cuda'` wrong-device error-path blocks with device-agnostic equivalents using `torch.accelerator`. Also replace `complement_device` helper and convert 6 `device_type == 'cuda'` tolerance branches to `device_type != 'cpu'`. ## Test plan - [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` - all passed - [x] Syntax check passes cC: @fffrog @albanD Pull Request resolved: pytorch#183588 Approved by: https://github.com/Skylion007, https://github.com/fffrog ghstack dependencies: pytorch#183586, pytorch#183587
…ytorch#183586) ## Summary Move 31 CUDA-specific tests (27 TunableOp + 4 backend library) and 3 helper methods into a new `TestLinalgCUDA(TestCase)` class. Guard `TestLinalg.setUp`/`tearDown` tf32 settings behind `torch.cuda.is_available()`. This is pure code movement — no test logic was changed. The high LOC count is entirely from moving methods between classes in the same file. OOT backends can skip the entire class via `test_exclusions = {"TestLinalgCUDA": "*"}`. ## Test plan - [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` — 2926 passed - [x] Syntax check passes - [x] AST parse confirms TestLinalg: 262 methods, TestLinalgCUDA: 36 methods Pull Request resolved: pytorch#183586 Approved by: https://github.com/Skylion007
…ch#183587) ## Summary Convert 8 tests verified to have no CUDA-specific code in body from `@onlyCUDA` to `@onlyAccelerator`, making them runnable on XPU, HPU, and PrivateUse1 backends. - 6 clean swaps: `test_norm_fused_type_promotion`, `test_powsum_dtype_kwarg`, `test_foreach_powsum_dtype_kwarg`, `test_triangular_solve_large`, `test_lu_solve_large_matrices`, `test_triu_tril_large_matrix_64bit` - 2 with `.cuda()` → `.to(device)` fix: `test_matmul_45724`, `test_logaddexp_cpu_vs_accelerator_complex` (renamed) ## Test plan - [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` — all passed - [x] Syntax check passes Pull Request resolved: pytorch#183587 Approved by: https://github.com/Skylion007, https://github.com/fffrog ghstack dependencies: pytorch#183586
…linalg (pytorch#183588) ## Summary Add `_get_other_device()` helper to `TestLinalg` and replace 16 hardcoded `torch.cuda.is_available()` + `'cuda'` wrong-device error-path blocks with device-agnostic equivalents using `torch.accelerator`. Also replace `complement_device` helper and convert 6 `device_type == 'cuda'` tolerance branches to `device_type != 'cpu'`. ## Test plan - [x] `TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg` - all passed - [x] Syntax check passes cC: @fffrog @albanD Pull Request resolved: pytorch#183588 Approved by: https://github.com/Skylion007, https://github.com/fffrog ghstack dependencies: pytorch#183586, pytorch#183587
## Summary `test_tf32_tunableop` and `test_tf32_offline_tunableop` were enabled for all ROCm architectures in #183474, which removed both `@runOnRocmArch(MI300_ARCH)` decorators along with the now-unused import. #183586 re-added them while extracting CUDA-only tests into `TestLinalgCUDA`. `git blame` attributes both current decorators to that refactor rather than to any deliberate re-restriction, so this appears to be an accidental regression. This PR restores the state #183474 landed. While in the same area, this also widens `@runOnRocmArch(MI200_ARCH)` on `test_fp16_backward_preserves_subnormals_rocm`, added for MI200 in #183766. RDNA is excluded there only by omission from the allowlist, and the test passes on RDNA. Part of #196583. ## Validation Repeated runs on gfx1100 (Radeon PRO W7900), gfx1151 and gfx1200, HIP `7.16.26320`, with identical results every time. ``` test/test_linalg.py::TestLinalgCudaOnlyCUDA::test_tf32_tunableop_cuda_float32 PASSED test/test_linalg.py::TestLinalgCudaOnlyCUDA::test_tf32_offline_tunableop_cuda_float32 PASSED test/test_matmul_cuda.py::TestMatmulCudaCUDA::test_fp16_backward_preserves_subnormals_rocm_batched_False_backend_cublas_cuda PASSED test/test_matmul_cuda.py::TestMatmulCudaCUDA::test_fp16_backward_preserves_subnormals_rocm_batched_False_backend_cublaslt_cuda PASSED test/test_matmul_cuda.py::TestMatmulCudaCUDA::test_fp16_backward_preserves_subnormals_rocm_batched_True_backend_cublas_cuda PASSED test/test_matmul_cuda.py::TestMatmulCudaCUDA::test_fp16_backward_preserves_subnormals_rocm_batched_True_backend_cublaslt_cuda PASSED ``` Pull Request resolved: #197361 Approved by: https://github.com/jeffdaily Co-authored-by: Jeff Daily <[email protected]>
Stack from ghstack (oldest at bottom):
Summary
Move 31 CUDA-specific tests (27 TunableOp + 4 backend library) and 3 helper methods into a new
TestLinalgCUDA(TestCase)class. GuardTestLinalg.setUp/tearDowntf32 settings behindtorch.cuda.is_available().This is pure code movement — no test logic was changed. The high LOC count is entirely from moving methods between classes in the same file. OOT backends can skip the entire class via
test_exclusions = {"TestLinalgCUDA": "*"}.Test plan
TEST_CONFIG=cuda python3 test/run_test.py -i test_linalg— 2926 passedcc: @fffrog @albanD
cc @albanD