Skip to content

[ROCm][release/2.13] Enable linalg tests via hipSOLVER and remove Magma dependency#3455

Open
akashveramd wants to merge 1 commit into
ROCm:release/2.13from
akashveramd:av_replace_magma_rel2.13
Open

[ROCm][release/2.13] Enable linalg tests via hipSOLVER and remove Magma dependency#3455
akashveramd wants to merge 1 commit into
ROCm:release/2.13from
akashveramd:av_replace_magma_rel2.13

Conversation

@akashveramd

Copy link
Copy Markdown

Summary

Backports 6 upstream PyTorch PRs to release/2.13 that enable ROCm linear algebra tests and remove the Magma dependency by routing through hipSOLVER (ROCm >= 7.14):

Key C++ changes

  • BatchLinearAlgebraLib.cpp/h, CUDASolver.cpp/h: extend xgeev, xpotrs, ldl_solve and related 64-bit solver paths to compile and run on ROCm >= 7.14 (USE_ROCM && ROCM_VERSION >= 71400)
  • BatchLinearAlgebra.cpp: route linalg_eig_kernel through hipSOLVER xgeev on ROCm >= 7.14 instead of Magma
  • cuda_to_hip_mappings.py: add hipify mappings for cusolverDnXgeev, cusolverDnCreateParams/DestroyParams, and related symbols

Test changes

  • Replace @skipCUDAIfNoMagma / @skipCUDAIfNoMagmaAndNoCusolver with @skipCUDAIfNoMagmaAndNoLinalgsolver across test_linalg.py, common_methods_invocations.py, and opinfo/definitions/linalg.py
  • Remove ROCm-specific skipIf skips for test_linalg_eig_stride_consistency in inductor tests
  • Add ROCm version guard (ROCM_VERSION < (7, 14)) for linalg.eig / linalg.eigvals OpInfos on older ROCm without hipSOLVER xgeev support

cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @naromero77amd @pragupta @jerrymannil @xinyazhang @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @aditew01 @voznesenskym @penguinwu @EikanWang @Guobing-Chen @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @azahed98

…ependency

Cherry-picked and adapted the following upstream PyTorch PRs onto release/2.13:

- PR pytorch#187703: Re-enable test_preferred_linalg_library test for ROCm
- PR pytorch#185557: Enable linalg tests for eig/ldl_solve (hipSOLVER) and enable
              test_linalg_solve / test_triangular_solve with cuBLAS path
- PR pytorch#187011: Merge test_norm_matrix_degenerate_shapes_old_numpy and
              test_norm_matrix_degenerate_shapes to run for older & newer NumPy versions
- PR pytorch#186122: Enable test_inverse_errors_large & test_lu_solve_batched_many_batches
- PR pytorch#188720: Enable cholesky_ex via hipSOLVER (ROCm >= 7.14) and remove Magma
              dependency for autogenerated tests
- PR pytorch#180303: Add CUDA-to-HIP hipSOLVER mappings, cuSOLVER xgeev support, and
              linalg.eig dispatch via hipSOLVER on ROCm >= 7.14

Additional fixes applied during integration onto release/2.13:
- Remove undefined linalg.matrix_sqrth OpInfo (sample input function absent in 2.13)
- Add missing skipIfRocm import in common_methods_invocations.py
- Fix decorator placement on test_cholesky_ex (split onto separate lines)
- Guard eig-related tests with ROCM_VERSION < (7, 14) to skip on older ROCm without Magma
- Guard inductor eig stride-consistency tests similarly for ROCm < 7.14
- Remove unused skipCUDAIfRocm import from test_linalg.py

Co-authored-by: Cursor <[email protected]>
@rocm-repo-management-api

rocm-repo-management-api Bot commented Jul 20, 2026

Copy link
Copy Markdown

Jenkins build for b7eaae10d15dcfd0b6dfe980e0ec2f151b670ecc commit finished as ABORTED
Links: Pipeline Overview / Build artifacts / Test Results

@akashveramd

Copy link
Copy Markdown
Author

ROCm MAGMA → hipSOLVER cherry-pick test results

Environment: ROCm 7.14.60850 · no MAGMA · PyTorch built without CPU LAPACK
Branch under test: av_replace_magma_rel2.13 @ b7eaae10d15
Baseline: release/2.13 @ 4fc86dafe38


Summary by test file

Test file Baseline release/2.13 PR av_replace_magma_rel2.13 Δ passed Δ skipped
test/test_linalg.py 202 ✅ 85 ⏭ 257 ✅ 26 ⏭ +55 −59
test/test_linalg.py (SLOW) 4 ✅ 4 ✅ 0 0
test/inductor/test_torchinductor.py 0 ✅ 1 ⏭ 1 ✅ 0 ⏭ +1 −1
test/inductor/test_compile_subprocess.py 0 ✅ 1 ⏭ 1 ✅ 0 ⏭ +1 −1
test/inductor/test_torchinductor_opinfo.py 2 ✅ 79 ⏭ 78 ✅ 3 ⏭ +76 −76
test/test_ops.py 132 ✅ 974 ⏭ 956 ✅ 143 ⏭ 7 ⚠️ +824 −831
test/test_ops_gradients.py 4 ✅ 386 ⏭ 127 ✅ 257 ⏭ 6 ⚠️ +123 −129
TOTAL 344 ✅ 1526 ⏭ 0 ❌ 1424 ✅ 429 ⏭ 13 ⚠️ 0 ❌ +1080 −1097

✅ passed · ⏭ skipped · ⚠️ xfailed (expected failure) · ❌ failed


Why skips decreased

The bulk of the 1097 newly-passing tests were previously skipped in the baseline for these reasons — all resolved by the cherry-picks:

Skip reason (baseline only) Root cause Resolved by
no MAGMA library detected MAGMA absent on ROCm PRs pytorch#185557, pytorch#188720 — hipSOLVER replaces MAGMA
MAGMA required for ROCm Hard MAGMA guard on eig/eigvals/etc. PR pytorch#185557 — removes @skipCUDAIfNoMagma guards
ROCm hipsolver backend does not currently support eig Missing xgeev in old hipsolver PR pytorch#188720 — adds @skipIfRocmVersionLessThan([7,14]) and enables path
skipCUDAIfRocm: test doesn't currently work on the ROCm stack Blanket ROCm skip PRs pytorch#180303, pytorch#185557 — replaces with targeted skips

Remaining skips in PR branch (all pre-existing / expected)

Skip reason Count Notes
no MAGMA library detected 0 ✅ fully resolved
test is slow; run with PYTORCH_TEST_WITH_SLOW ~30 Pre-existing; run with PYTORCH_TEST_WITH_SLOW=1
Only runs on cpu ~40 CPU-only tests; not applicable to CUDA suite
https://github.com/pytorch/pytorch/issues/150959 4 Known open issue, pre-existing
Skipped! Op doesn't support autograd for this dtype ~12 Op limitation, not our change
Skipped! Op has no inplace variant / Op does support gradgrad ~10 Op limitation, not our change
xfailed (⚠️) 13 Explicitly marked expected failures in PR code

No regressions

Zero tests moved from passing → failing across all 6 test files.
All failures present in the baseline are also present in the PR branch.

@akashveramd

akashveramd commented Jul 24, 2026

Copy link
Copy Markdown
Author

ROCm MAGMA → hipSOLVER cherry-pick: autogenerated test results (upstream-style counting)

Counting methodology: one row per unique test function (dtype variants collapsed).
A test is "✅ Passed (some skipped)" if at least one dtype variant passed and at least one was skipped.

Environment: ROCm 7.14.60850 · no MAGMA · av_replace_magma_rel2.13 @ b7eaae10d15
Baseline: release/2.13 @ 4fc86dafe38


Overall summary

Status Baseline release/2.13 PR av_replace_magma_rel2.13 Upstream PR pytorch#188720 (reference)
✅ Passed 217 1,883 1,525
✅ Passed (some skipped) 1 6 7
⏭ Skipped 2,470 781 585
⚠️ XFAIL 3 21 17
❌ Failed 0 0 0
Total 2,691 2,691 2,156 (+22 not generated)

Our total (2,691) is higher than upstream (2,156) because we run 4 additional test files
(test_ops_jit.py, test_overrides.py, test_testing.py, functorch/test_ops.py) that
upstream did not include in their count. The pattern is identical: 0 failures, same xfail categories.


Per test file

Test file Baseline ✅ Baseline ⏭ PR ✅ PR ⏭ Δ passed Δ skipped
test/inductor/test_torchinductor_opinfo.py 4 42 43 2 +39 −40
test/test_decomp.py 6 44 45 4 +39 −40
test/test_jit_fuser_te.py 0 93 0 93 0 0
test/test_meta.py 25 352 185 192 +160 −160
test/test_ops.py 136 961 911 179 +775 −782
test/test_ops_gradients.py 4 231 72 160 +68 −71
test/test_ops_jit.py 5 45 44 4 +39 −41
test/test_testing.py 6 44 48 2 +42 −42
test/test_overrides.py 5 42 45 2 +40 −40
test/functorch/test_ops.py 27 572 495 100 +468 −472
test/test_fx_experimental.py 0 43 0 43 0 0
test/inductor/test_torchinductor.py 0 1 1 0 +1 −1
TOTAL 218 2,470 1,889 781 +1,671 −1,689

Notes on remaining skips (781)

Category Count Notes
test_jit_fuser_te.py (NNC doesn't fuse linalg ops) 93 Pre-existing — NNC/TensorExprKernel does not support linalg ops
test_fx_experimental.py (@onlyCPU decorator) 43 Pre-existing — these tests only run on CPU by design
test_meta.py inplace variants ~80 Pre-existing — linalg ops have no in-place variants
test_ops.py (no tags, multi-device, slow) ~100 Pre-existing structural skips
test_ops_gradients.py inplace / gradgrad ~60 Pre-existing — no in-place grad for linalg ops
functorch/test_ops.py 100 Reduced from 572; remaining are op-limitation skips
Other (slow, cpu-only, dtype limitations) remainder All pre-existing

0 tests failed. All skips are pre-existing and structurally equivalent to upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant