Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/183474
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 1 Unclassified FailureAs of commit 1e62d8d with merge base 5eacd08 ( UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
jeffdaily
left a comment
There was a problem hiding this comment.
I'm hoping we can just remove @runOnRocmArch(MI300_ARCH) entirely without changing the gated skip. I believe hipblaslt on MI200 just ignores the request for TF32 dtypes and defaults to full fp32 precision. It's only on MI300 that actual HW is used for TF32. MI350 also doesn't have TF32 HW. There's no real point in gating this at all. The test should run on all ROCm platforms. You'd need to verify that by running these tests on more platforms.
As for the CDNA2OrLater() change, adding gfx950 makes complete sense, but it seems orthogonal to this PR's intent. There are a number of places where CDNA2OrLater is used on other tests that would need their own CI signal for. But definitely worth doing because it means we have a test gap here on MI350 not being part of CDNA2OrLater. I think these ones:
- test/test_linalg.py:8084 (test__int4_mm)
- test/test_linalg.py:8153 (test_compile_int4_mm)
- test/inductor/test_aot_inductor.py:7664 (test__weight_int4pack_mm)
- test/inductor/test_aot_inductor.py:7701 (test__weight_int4pack_mm_with_scales_and_zeros)
I'd like 2 separate PRs, one for the CDNA2OrLater change and one for the test skip decorator removal. You can repurpose this current PR for the test skip removal, then create a new PR for the CDNA2OrLater change.
206dc72 to
eb45f5c
Compare
eb45f5c to
1e62d8d
Compare
Thanks for the suggestions @jeffdaily . I have actioned them, the new PR for adding gfx950 to CDNA2OrLater() is here: #183599 |
|
@pytorchbot merge -i |
Merge startedYour change will be merged while ignoring the following 1 checks: pull / linux-jammy-py3.10-clang18 / test (crossref, 2, 2, linux.2xlarge) Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
See [this comment in this PR](#183474 (review)) for detailed info. gfx950, or the MI350 series GPUs, belongs to CDNA4: https://www.amd.com/en/products/accelerators/instinct/mi350/mi350x.html The function CDNA2OrLater() in `torch/testing/_internal/common_cuda.py` was missing it, added in this PR. ### ADDITIONAL Investigative Summary The following 2 tickets are about `int4_mm` that was previously gated on MI355X due to the aforementioned issue: FIXES #168764 FIXES #168765 ``` $ grep -rn "CDNA2\|gfx90a\|gfx942" aten/src/ATen/native/cuda/int4mm.cu 2>/dev/null | head -10 143:static bool isCDNA2orLater(int index) { 144: return at::detail::getCUDAHooks().isGPUArch({"gfx90a", "gfx942", "gfx950"}, index); 629: printf("__builtin_amdgcn_mfma_f32_16x16x16bf16_1k is only supported on AMD gpu arch greater than or equal to CDNA2\n"); 1112: if (!isCDNA2orLater(A.device().index())) { 1113: TORCH_CHECK(false, "_weight_int4pack_mm_cuda is only supported on AMD gpu arch greater than or equal to CDNA2"); 1307: if (!isCDNA2orLater(in.device().index())) { 1308: TORCH_CHECK(false, "_convert_weight_to_int4pack_cuda is only supported on AMD gpu arch greater than or equal to CDNA2"); ``` This indicates int4mm is already supported on gfx950. ### Testing BEFORE fix on an MI355X / gfx950 machine, ``` $ PYTORCH_TEST_WITH_ROCM=1 pytest test/test_linalg.py -k "test__int4_mm or test_compile_int4_mm" -v -s 2>/dev/null =================================================================================== test session starts ==================================================================================== platform linux -- Python 3.12.13, pytest-7.3.2, pluggy-1.6.0 -- /opt/conda/envs/py_3.12/bin/python3.12 cachedir: .pytest_cache hypothesis profile 'dev' -> database=None, max_examples=10, suppress_health_check= [HealthCheck.too_slow] rootdir: /var/lib/jenkins/pytorch configfile: pytest.ini plugins: xdoctest-1.3.0, hypothesis-6.56.4, subtests-0.13.1, flakefinder-1.1.0, rerunfailures-14.0, cpp-2.3.0, xdist-3.3.1 collected 3018 items / 2986 deselected / 32 selected Running 32 items in this shard ... test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_32_n_48_cuda SKIPPED [0.0007s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_32_n_64_cuda SKIPPED [0.0005s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_64_n_48_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_64_n_64_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_32_n_48_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_32_n_64_cuda SKIPPED [0.0005s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_64_n_48_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_64_n_64_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_32_n_48_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_32_n_64_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_64_n_48_cuda SKIPPED [0.0003s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_64_n_64_cuda SKIPPED [0.0005s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_32_n_48_cuda SKIPPED [0.0003s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_32_n_64_cuda SKIPPED [0.0003s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_64_n_48_cuda SKIPPED [0.0003s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_64_n_64_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) ===================================================================== 16 passed, 16 skipped, 2986 deselected in 2.47s ====================================================================== ``` ### Testing AFTER fix and re-compiling: on an MI355X / gfx950 machine, ``` $ PYTORCH_TEST_WITH_ROCM=1 pytest test/test_linalg.py -k "test__int4_mm or test_compile_int4_mm" -v -s 2>/dev/null ============================================================================================= test session starts ============================================================================================== platform linux -- Python 3.12.13, pytest-7.3.2, pluggy-1.6.0 -- /opt/conda/envs/py_3.12/bin/python3.12 cachedir: .pytest_cache hypothesis profile 'dev' -> database=None, max_examples=10, suppress_health_check=[HealthCheck.too_slow] rootdir: /var/lib/jenkins/pytorch configfile: pytest.ini plugins: xdoctest-1.3.0, hypothesis-6.56.4, subtests-0.13.1, flakefinder-1.1.0, rerunfailures-14.0, cpp-2.3.0, xdist-3.3.1 collected 3018 items / 2986 deselected / 32 selected Running 32 items in this shard ... test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_32_n_48_cuda PASSED [3.1637s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_32_n_64_cuda PASSED [0.0160s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_64_n_48_cuda PASSED [0.0136s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_64_n_64_cuda PASSED [0.0031s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_32_n_48_cuda PASSED [0.0029s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_32_n_64_cuda PASSED [0.0028s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_64_n_48_cuda PASSED [0.0028s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_64_n_64_cuda PASSED [0.0027s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_32_n_48_cuda PASSED [0.1767s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_32_n_64_cuda PASSED [0.0508s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_64_n_48_cuda PASSED [0.1332s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_64_n_64_cuda PASSED [0.0040s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_32_n_48_cuda PASSED [0.0544s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_32_n_64_cuda PASSED [0.0041s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_64_n_48_cuda PASSED [0.0565s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_64_n_64_cuda PASSED [0.0042s] ===================================================================================== 32 passed, 2986 deselected in 6.53s ====================================================================================== ``` Pull Request resolved: #183599 Approved by: https://github.com/jeffdaily
Merge failedReason: 1 jobs have failed, first few of them are: trunk / macos-py3-arm64 / test (mps, 1, 1, macos-m2-15) Details for Dev Infra teamRaised by workflow job |
|
@pytorchbot merge -f "unrelated mac failure" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Conflict resolution: - docs/source/notes/numerical_accuracy.rst was deleted by upstream (#183341) and replaced with numerical_accuracy.md (MyST conversion). Reapplied the TF32-on-MI300 section as MyST and appended it to the .md file. Kept the tf32_on_mi300 anchor name so :ref: from hip.rst still resolves. - test/test_linalg.py: kept with_ieee_matmul_precision (used at line 797); dropped runOnRocmArch (upstream PR #183474 removed both @runOnRocmArch(MI300_ARCH) decorators). lintrunner -a then removed the newly-unused MI300_ARCH import. Authored by Claude.
See [this comment in this PR](pytorch#183474 (review)) for detailed info. gfx950, or the MI350 series GPUs, belongs to CDNA4: https://www.amd.com/en/products/accelerators/instinct/mi350/mi350x.html The function CDNA2OrLater() in `torch/testing/_internal/common_cuda.py` was missing it, added in this PR. ### ADDITIONAL Investigative Summary The following 2 tickets are about `int4_mm` that was previously gated on MI355X due to the aforementioned issue: FIXES pytorch#168764 FIXES pytorch#168765 ``` $ grep -rn "CDNA2\|gfx90a\|gfx942" aten/src/ATen/native/cuda/int4mm.cu 2>/dev/null | head -10 143:static bool isCDNA2orLater(int index) { 144: return at::detail::getCUDAHooks().isGPUArch({"gfx90a", "gfx942", "gfx950"}, index); 629: printf("__builtin_amdgcn_mfma_f32_16x16x16bf16_1k is only supported on AMD gpu arch greater than or equal to CDNA2\n"); 1112: if (!isCDNA2orLater(A.device().index())) { 1113: TORCH_CHECK(false, "_weight_int4pack_mm_cuda is only supported on AMD gpu arch greater than or equal to CDNA2"); 1307: if (!isCDNA2orLater(in.device().index())) { 1308: TORCH_CHECK(false, "_convert_weight_to_int4pack_cuda is only supported on AMD gpu arch greater than or equal to CDNA2"); ``` This indicates int4mm is already supported on gfx950. ### Testing BEFORE fix on an MI355X / gfx950 machine, ``` $ PYTORCH_TEST_WITH_ROCM=1 pytest test/test_linalg.py -k "test__int4_mm or test_compile_int4_mm" -v -s 2>/dev/null =================================================================================== test session starts ==================================================================================== platform linux -- Python 3.12.13, pytest-7.3.2, pluggy-1.6.0 -- /opt/conda/envs/py_3.12/bin/python3.12 cachedir: .pytest_cache hypothesis profile 'dev' -> database=None, max_examples=10, suppress_health_check= [HealthCheck.too_slow] rootdir: /var/lib/jenkins/pytorch configfile: pytest.ini plugins: xdoctest-1.3.0, hypothesis-6.56.4, subtests-0.13.1, flakefinder-1.1.0, rerunfailures-14.0, cpp-2.3.0, xdist-3.3.1 collected 3018 items / 2986 deselected / 32 selected Running 32 items in this shard ... test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_32_n_48_cuda SKIPPED [0.0007s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_32_n_64_cuda SKIPPED [0.0005s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_64_n_48_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_64_n_64_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_32_n_48_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_32_n_64_cuda SKIPPED [0.0005s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_64_n_48_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_64_n_64_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_32_n_48_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_32_n_64_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_64_n_48_cuda SKIPPED [0.0003s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_64_n_64_cuda SKIPPED [0.0005s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_32_n_48_cuda SKIPPED [0.0003s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_32_n_64_cuda SKIPPED [0.0003s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_64_n_48_cuda SKIPPED [0.0003s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_64_n_64_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) ===================================================================== 16 passed, 16 skipped, 2986 deselected in 2.47s ====================================================================== ``` ### Testing AFTER fix and re-compiling: on an MI355X / gfx950 machine, ``` $ PYTORCH_TEST_WITH_ROCM=1 pytest test/test_linalg.py -k "test__int4_mm or test_compile_int4_mm" -v -s 2>/dev/null ============================================================================================= test session starts ============================================================================================== platform linux -- Python 3.12.13, pytest-7.3.2, pluggy-1.6.0 -- /opt/conda/envs/py_3.12/bin/python3.12 cachedir: .pytest_cache hypothesis profile 'dev' -> database=None, max_examples=10, suppress_health_check=[HealthCheck.too_slow] rootdir: /var/lib/jenkins/pytorch configfile: pytest.ini plugins: xdoctest-1.3.0, hypothesis-6.56.4, subtests-0.13.1, flakefinder-1.1.0, rerunfailures-14.0, cpp-2.3.0, xdist-3.3.1 collected 3018 items / 2986 deselected / 32 selected Running 32 items in this shard ... test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_32_n_48_cuda PASSED [3.1637s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_32_n_64_cuda PASSED [0.0160s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_64_n_48_cuda PASSED [0.0136s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_64_n_64_cuda PASSED [0.0031s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_32_n_48_cuda PASSED [0.0029s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_32_n_64_cuda PASSED [0.0028s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_64_n_48_cuda PASSED [0.0028s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_64_n_64_cuda PASSED [0.0027s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_32_n_48_cuda PASSED [0.1767s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_32_n_64_cuda PASSED [0.0508s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_64_n_48_cuda PASSED [0.1332s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_64_n_64_cuda PASSED [0.0040s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_32_n_48_cuda PASSED [0.0544s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_32_n_64_cuda PASSED [0.0041s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_64_n_48_cuda PASSED [0.0565s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_64_n_64_cuda PASSED [0.0042s] ===================================================================================== 32 passed, 2986 deselected in 6.53s ====================================================================================== ``` Pull Request resolved: pytorch#183599 Approved by: https://github.com/jeffdaily
…h#183474) FIXES pytorch#168760 FIXES pytorch#168761 ### Investigation summary ### Command to reproduce As seen an on MI300X machine, ``` $ PYTORCH_TEST_WITH_ROCM=1 pytest test/test_linalg.py -k "test_tf32_tunableop or test_tf32_offline_tunableop" -v -s 2>/dev/null ========================================================================== test session starts =========================================================================== platform linux -- Python 3.12.13, pytest-7.3.2, pluggy-1.6.0 -- /opt/conda/envs/py_3.12/bin/python3.12 cachedir: .pytest_cache hypothesis profile 'dev' -> database=None, max_examples=10, suppress_health_check=[HealthCheck.too_slow] rootdir: /var/lib/jenkins/pytorch configfile: pytest.ini plugins: rerunfailures-14.0, cpp-2.3.0, xdoctest-1.3.0, flakefinder-1.1.0, hypothesis-6.56.4, xdist-3.3.1, subtests-0.13.1 collected 3018 items / 3014 deselected / 4 selected Running 4 items in this shard test/test_linalg.py::TestLinalgCPU::test_tf32_offline_tunableop_cpu_float32 SKIPPED [0.0043s] (Only runs on cuda) test/test_linalg.py::TestLinalgCPU::test_tf32_tunableop_cpu_float32 SKIPPED [0.0007s] (Only runs on cuda) test/test_linalg.py::TestLinalgCUDA::test_tf32_offline_tunableop_cuda_float32 PASSED [7.7702s] test/test_linalg.py::TestLinalgCUDA::test_tf32_tunableop_cuda_float32 PASSED [1.2038s] ============================================================= 2 passed, 2 skipped, 3014 deselected in 10.02s ============================================================= ``` ### The fix -- In `test/test_linalg.py`, remove `@runOnRocmArch(MI300_ARCH)` decorator, enable TF32 TunableOp tests to run on all ROCm architectures -- Remove unused `runOnRocmArch` import from `test_linalg.py`. ### Behaviour BEFORE fix The `test_tf32_offline_tunableop` and `test_tf32_tunableop` tests pass on MI300 series GPUs, but is skipped for MI200 and MI350 series GPUs. ### Behaviour AFTER fix The `test_tf32_offline_tunableop` and `test_tf32_tunableop` tests pass on MI200, MI300 and MI350 series GPUs. Pull Request resolved: pytorch#183474 Approved by: https://github.com/jeffdaily
See [this comment in this PR](pytorch#183474 (review)) for detailed info. gfx950, or the MI350 series GPUs, belongs to CDNA4: https://www.amd.com/en/products/accelerators/instinct/mi350/mi350x.html The function CDNA2OrLater() in `torch/testing/_internal/common_cuda.py` was missing it, added in this PR. ### ADDITIONAL Investigative Summary The following 2 tickets are about `int4_mm` that was previously gated on MI355X due to the aforementioned issue: FIXES pytorch#168764 FIXES pytorch#168765 ``` $ grep -rn "CDNA2\|gfx90a\|gfx942" aten/src/ATen/native/cuda/int4mm.cu 2>/dev/null | head -10 143:static bool isCDNA2orLater(int index) { 144: return at::detail::getCUDAHooks().isGPUArch({"gfx90a", "gfx942", "gfx950"}, index); 629: printf("__builtin_amdgcn_mfma_f32_16x16x16bf16_1k is only supported on AMD gpu arch greater than or equal to CDNA2\n"); 1112: if (!isCDNA2orLater(A.device().index())) { 1113: TORCH_CHECK(false, "_weight_int4pack_mm_cuda is only supported on AMD gpu arch greater than or equal to CDNA2"); 1307: if (!isCDNA2orLater(in.device().index())) { 1308: TORCH_CHECK(false, "_convert_weight_to_int4pack_cuda is only supported on AMD gpu arch greater than or equal to CDNA2"); ``` This indicates int4mm is already supported on gfx950. ### Testing BEFORE fix on an MI355X / gfx950 machine, ``` $ PYTORCH_TEST_WITH_ROCM=1 pytest test/test_linalg.py -k "test__int4_mm or test_compile_int4_mm" -v -s 2>/dev/null =================================================================================== test session starts ==================================================================================== platform linux -- Python 3.12.13, pytest-7.3.2, pluggy-1.6.0 -- /opt/conda/envs/py_3.12/bin/python3.12 cachedir: .pytest_cache hypothesis profile 'dev' -> database=None, max_examples=10, suppress_health_check= [HealthCheck.too_slow] rootdir: /var/lib/jenkins/pytorch configfile: pytest.ini plugins: xdoctest-1.3.0, hypothesis-6.56.4, subtests-0.13.1, flakefinder-1.1.0, rerunfailures-14.0, cpp-2.3.0, xdist-3.3.1 collected 3018 items / 2986 deselected / 32 selected Running 32 items in this shard ... test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_32_n_48_cuda SKIPPED [0.0007s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_32_n_64_cuda SKIPPED [0.0005s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_64_n_48_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_64_n_64_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_32_n_48_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_32_n_64_cuda SKIPPED [0.0005s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_64_n_48_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_64_n_64_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda is supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_32_n_48_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_32_n_64_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_64_n_48_cuda SKIPPED [0.0003s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_64_n_64_cuda SKIPPED [0.0005s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_32_n_48_cuda SKIPPED [0.0003s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_32_n_64_cuda SKIPPED [0.0003s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_64_n_48_cuda SKIPPED [0.0003s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_64_n_64_cuda SKIPPED [0.0004s] (_convert_weight_to_int4pack_cuda supported only for CDNA2 or later) ===================================================================== 16 passed, 16 skipped, 2986 deselected in 2.47s ====================================================================== ``` ### Testing AFTER fix and re-compiling: on an MI355X / gfx950 machine, ``` $ PYTORCH_TEST_WITH_ROCM=1 pytest test/test_linalg.py -k "test__int4_mm or test_compile_int4_mm" -v -s 2>/dev/null ============================================================================================= test session starts ============================================================================================== platform linux -- Python 3.12.13, pytest-7.3.2, pluggy-1.6.0 -- /opt/conda/envs/py_3.12/bin/python3.12 cachedir: .pytest_cache hypothesis profile 'dev' -> database=None, max_examples=10, suppress_health_check=[HealthCheck.too_slow] rootdir: /var/lib/jenkins/pytorch configfile: pytest.ini plugins: xdoctest-1.3.0, hypothesis-6.56.4, subtests-0.13.1, flakefinder-1.1.0, rerunfailures-14.0, cpp-2.3.0, xdist-3.3.1 collected 3018 items / 2986 deselected / 32 selected Running 32 items in this shard ... test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_32_n_48_cuda PASSED [3.1637s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_32_n_64_cuda PASSED [0.0160s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_64_n_48_cuda PASSED [0.0136s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_32_k_64_n_64_cuda PASSED [0.0031s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_32_n_48_cuda PASSED [0.0029s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_32_n_64_cuda PASSED [0.0028s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_64_n_48_cuda PASSED [0.0028s] test/test_linalg.py::TestLinalgCUDA::test__int4_mm_m_64_k_64_n_64_cuda PASSED [0.0027s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_32_n_48_cuda PASSED [0.1767s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_32_n_64_cuda PASSED [0.0508s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_64_n_48_cuda PASSED [0.1332s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_32_k_64_n_64_cuda PASSED [0.0040s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_32_n_48_cuda PASSED [0.0544s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_32_n_64_cuda PASSED [0.0041s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_64_n_48_cuda PASSED [0.0565s] test/test_linalg.py::TestLinalgCUDA::test_compile_int4_mm_m_64_k_64_n_64_cuda PASSED [0.0042s] ===================================================================================== 32 passed, 2986 deselected in 6.53s ====================================================================================== ``` Pull Request resolved: pytorch#183599 Approved by: https://github.com/jeffdaily
…h#183474) FIXES pytorch#168760 FIXES pytorch#168761 ### Investigation summary ### Command to reproduce As seen an on MI300X machine, ``` $ PYTORCH_TEST_WITH_ROCM=1 pytest test/test_linalg.py -k "test_tf32_tunableop or test_tf32_offline_tunableop" -v -s 2>/dev/null ========================================================================== test session starts =========================================================================== platform linux -- Python 3.12.13, pytest-7.3.2, pluggy-1.6.0 -- /opt/conda/envs/py_3.12/bin/python3.12 cachedir: .pytest_cache hypothesis profile 'dev' -> database=None, max_examples=10, suppress_health_check=[HealthCheck.too_slow] rootdir: /var/lib/jenkins/pytorch configfile: pytest.ini plugins: rerunfailures-14.0, cpp-2.3.0, xdoctest-1.3.0, flakefinder-1.1.0, hypothesis-6.56.4, xdist-3.3.1, subtests-0.13.1 collected 3018 items / 3014 deselected / 4 selected Running 4 items in this shard test/test_linalg.py::TestLinalgCPU::test_tf32_offline_tunableop_cpu_float32 SKIPPED [0.0043s] (Only runs on cuda) test/test_linalg.py::TestLinalgCPU::test_tf32_tunableop_cpu_float32 SKIPPED [0.0007s] (Only runs on cuda) test/test_linalg.py::TestLinalgCUDA::test_tf32_offline_tunableop_cuda_float32 PASSED [7.7702s] test/test_linalg.py::TestLinalgCUDA::test_tf32_tunableop_cuda_float32 PASSED [1.2038s] ============================================================= 2 passed, 2 skipped, 3014 deselected in 10.02s ============================================================= ``` ### The fix -- In `test/test_linalg.py`, remove `@runOnRocmArch(MI300_ARCH)` decorator, enable TF32 TunableOp tests to run on all ROCm architectures -- Remove unused `runOnRocmArch` import from `test_linalg.py`. ### Behaviour BEFORE fix The `test_tf32_offline_tunableop` and `test_tf32_tunableop` tests pass on MI300 series GPUs, but is skipped for MI200 and MI350 series GPUs. ### Behaviour AFTER fix The `test_tf32_offline_tunableop` and `test_tf32_tunableop` tests pass on MI200, MI300 and MI350 series GPUs. Pull Request resolved: pytorch#183474 Approved by: https://github.com/jeffdaily
…l tests runOnRocmArch is an allowlist: on ROCm the test runs only on the listed gfx archs. Widening it to NAVI still leaves gfx90a/gfx950 (TF32 TunableOp) and gfx942/gfx950 (subnormals) skipped, although nothing in these tests is arch-specific: the TunableOp tests check that a TF32 GEMM entry is recorded and rocBLAS did not win, and the subnormal test checks a numerical property that should hold on every arch. pytorch#183474 removed the TunableOp decorators outright for the same reason, which is what this PR's description says it restores. Remove all three decorators so the tests run on every ROCm arch (CUDA is unaffected; runOnRocmArch was a no-op there), and drop the runOnRocmArch and MI300_ARCH imports that are now unused in test_linalg.py. Test Plan: On MI355X (gfx950, ROCm 10.0), an arch these tests previously skipped: ``` python -m pytest test/test_linalg.py test/test_matmul_cuda.py -k "test_tf32_tunableop or test_tf32_offline_tunableop or test_fp16_backward_preserves_subnormals_rocm" lintrunner --take RUFF,FLAKE8,PYFMT test/test_linalg.py test/test_matmul_cuda.py ``` 6 passed. Authored with Claude.
## 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]>
FIXES #168760
FIXES #168761
Investigation summary
Command to reproduce
As seen an on MI300X machine,
The fix
-- In
test/test_linalg.py, remove@runOnRocmArch(MI300_ARCH)decorator, enable TF32 TunableOp tests to run on all ROCm architectures-- Remove unused
runOnRocmArchimport fromtest_linalg.py.Behaviour BEFORE fix
The
test_tf32_offline_tunableopandtest_tf32_tunableoptests pass on MI300 series GPUs, but is skipped for MI200 and MI350 series GPUs.Behaviour AFTER fix
The
test_tf32_offline_tunableopandtest_tf32_tunableoptests pass on MI200, MI300 and MI350 series GPUs.cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @naromero77amd @pragupta @jerrymannil @xinyazhang