…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]>
Summary
Backports 6 upstream PyTorch PRs to
release/2.13that enable ROCm linear algebra tests and remove the Magma dependency by routing through hipSOLVER (ROCm >= 7.14):skipCUDAIfNoMagmaAndNoCusolverwithskipCUDAIfNoMagmaAndNoLinalgsolveracross linalg tests and OpInfo definitions, enabling tests on ROCm via hipSOLVERtest_preferred_linalg_librarytest for ROCmlinalg.eig/ldl_solvevia hipSOLVERxgeev(ROCm >= 7.14); enabletest_linalg_solveandtest_triangular_solvevia cuBLAS pathtest_norm_matrix_degenerate_shapesvariants into a single test that handles both old and new NumPy behaviortest_inverse_errors_largeandtest_lu_solve_batched_many_batcheslinalg tests on ROCmcholesky_exvia hipSOLVER and remove Magma dependency for autogenerated linalg testsKey C++ changes
BatchLinearAlgebraLib.cpp/h,CUDASolver.cpp/h: extendxgeev,xpotrs,ldl_solveand related 64-bit solver paths to compile and run on ROCm >= 7.14 (USE_ROCM && ROCM_VERSION >= 71400)BatchLinearAlgebra.cpp: routelinalg_eig_kernelthrough hipSOLVERxgeevon ROCm >= 7.14 instead of Magmacuda_to_hip_mappings.py: add hipify mappings forcusolverDnXgeev,cusolverDnCreateParams/DestroyParams, and related symbolsTest changes
@skipCUDAIfNoMagma/@skipCUDAIfNoMagmaAndNoCusolverwith@skipCUDAIfNoMagmaAndNoLinalgsolveracrosstest_linalg.py,common_methods_invocations.py, andopinfo/definitions/linalg.pyskipIfskips fortest_linalg_eig_stride_consistencyin inductor testsROCM_VERSION < (7, 14)) forlinalg.eig/linalg.eigvalsOpInfos on older ROCm without hipSOLVERxgeevsupportcc @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