Skip to content

[ROCm] enable decompose k tests for functional coverage - #169948

Closed
jataylo wants to merge 8 commits into
pytorch:mainfrom
jataylo:jack-ut-decomposek
Closed

jataylo wants to merge 8 commits into
pytorch:mainfrom
jataylo:jack-ut-decomposek

Conversation

@jataylo

@jataylo jataylo commented Dec 9, 2025 •

Copy link
Copy Markdown
Collaborator

Fixes #168617
Fixes #168615
Fixes #168614
Fixes #168613
Fixes #168599
Fixes #168600
Fixes #168601
Fixes #168602
Fixes #168603
Fixes #168604
Fixes #168605
Fixes #168606
Fixes #168607

Enables testing for decompose K mode on ROCm. This is still disabled by default pending perf testing but we can get the functional coverage by adding an inductor config for decompose k enablement.

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

@pytorch-bot

pytorch-bot Bot commented Dec 9, 2025 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/169948

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 2 New Failures, 1 Pending, 2 Unrelated Failures

As of commit 3ea4420 with merge base dbba85b (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

BROKEN TRUNK - The following job failed but was present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot Bot added module: inductor module: rocm AMD GPU support for Pytorch labels Dec 9, 2025
@pytorch-bot pytorch-bot Bot added the ciflow/rocm-mi300 Trigger "default" config CI on ROCm MI300 label Dec 17, 2025
@jataylo jataylo added the topic: not user facing topic category label Dec 19, 2025
@jataylo
jataylo marked this pull request as ready for review December 19, 2025 13:58
@zou3519 zou3519 added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Dec 19, 2025

@PaulZhang12 PaulZhang12 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a config that exists to disable decomposeK, setting TORCHINDUCTOR_NUM_DECOMPOSE_K_SPLITS=0. Please use that one instead of adding a new config

@jataylo

jataylo commented Dec 22, 2025

Copy link
Copy Markdown
Collaborator Author

There is already a config that exists to disable decomposeK, setting TORCHINDUCTOR_NUM_DECOMPOSE_K_SPLITS=0. Please use that one instead of adding a new config

Makes sense thanks, will update this

@jataylo

jataylo commented Dec 30, 2025

Copy link
Copy Markdown
Collaborator Author

The ROCm failure seems flaky so disabled will assess this afterwards - #171519

@jataylo

jataylo commented Dec 30, 2025

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge -f "Failing test seems flaky opened up issue to address after"

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

krastogi-in pushed a commit to krastogi-in/pytorch that referenced this pull request Jan 9, 2026
jananisriram added a commit that referenced this pull request Nov 12, 2026
decompose_k was off by default on ROCm pending perf validation (#169948). On MI350X it beats hipBLASLt and the Triton mm template on many large-K GEMMs, so this uses the same default as CUDA (`num_decompose_k_splits=10`).

## Agent details
Drafted with an AI assistant (Claude); pending author review.

Stacked on #195939 and #203681 (the read-flush benchmarker the numbers below were measured with).

MI350X, 172 GEMMs that pass the default `decompose_k_threshold` (K >= 32 * max(M, N)). Ground truth is the median over 8 input allocations of summed device kernel time after a read flush (#203681):
- geomean dk-on / dk-off pick: 0.971; 58 shapes >3% faster
- 7 shapes >3% slower beyond the re-timing noise of aten itself (all autotune misranks between aten and decompose_k)
- fp32 within 4e-6 of aten

These were measured with splits pruned to at least 32 output tiles of 64x64 and at most 64 MiB of workspace; this PR does not add that pruning on ROCm. Other ROCm archs (MI300/gfx942, gfx90a, RDNA) are not measured.

Test Plan:
```
python test/inductor/test_max_autotune.py -k decompose
```
`test_max_autotune_decompose_k_envvars` gains a default-splits case that checks decompose_k is offered.

ghstack-source-id: 71cefa3
Pull-Request: #203875
jananisriram added a commit that referenced this pull request Nov 19, 2026
decompose_k was off by default on ROCm pending perf validation (#169948). On MI350X it beats hipBLASLt and the Triton mm template on many large-K GEMMs, so this uses the same default as CUDA (`num_decompose_k_splits=10`).

## Agent details
Drafted with an AI assistant (Claude); pending author review.

Stacked on #195939 and #203681 (the read-flush benchmarker the numbers below were measured with).

MI350X, 172 GEMMs that pass the default `decompose_k_threshold` (K >= 32 * max(M, N)). Ground truth is the median over 8 input allocations of summed device kernel time after a read flush (#203681):
- geomean dk-on / dk-off pick: 0.971; 58 shapes >3% faster
- 7 shapes >3% slower beyond the re-timing noise of aten itself (all autotune misranks between aten and decompose_k)
- fp32 within 4e-6 of aten

These were measured with splits pruned to at least 32 output tiles of 64x64 and at most 64 MiB of workspace, which #195939's split bound applies on gfx950; other ROCm archs are not pruned. Other ROCm archs (MI300/gfx942, gfx90a, RDNA) are not measured.

Test Plan:
```
python test/inductor/test_max_autotune.py -k decompose
```
`test_max_autotune_decompose_k_envvars` gains a default-splits case that checks decompose_k is offered.

ghstack-source-id: 570fd87
Pull-Request: #203875
jananisriram added a commit that referenced this pull request Nov 19, 2026
decompose_k was off by default on ROCm pending perf validation (#169948). On MI350X it beats hipBLASLt and the Triton mm template on many large-K GEMMs, so this uses the same default as CUDA (`num_decompose_k_splits=10`).

## Agent details
Drafted with an AI assistant (Claude); pending author review.

Stacked on #195939 and #203681 (the read-flush benchmarker the numbers below were measured with).

MI350X, 172 GEMMs that pass the default `decompose_k_threshold` (K >= 32 * max(M, N)). Ground truth is the median over 8 input allocations of summed device kernel time after a read flush (#203681):
- geomean dk-on / dk-off pick: 0.971; 58 shapes >3% faster
- 7 shapes >3% slower beyond the re-timing noise of aten itself (all autotune misranks between aten and decompose_k)
- fp32 within 4e-6 of aten

These were measured with splits pruned to at least 32 output tiles of 64x64 and at most 64 MiB of workspace, which #195939's split bound applies on gfx950; other ROCm archs are not pruned. Other ROCm archs (MI300/gfx942, gfx90a, RDNA) are not measured.

Test Plan:
```
python test/inductor/test_max_autotune.py -k decompose
```
`test_max_autotune_decompose_k_envvars` gains a default-splits case that checks decompose_k is offered.

ghstack-source-id: e11cf66
Pull-Request: #203875
jananisriram added a commit that referenced this pull request Nov 19, 2026
decompose_k was off by default on ROCm pending perf validation (#169948). On MI350X it beats hipBLASLt and the Triton mm template on many large-K GEMMs, so this uses the same default as CUDA (`num_decompose_k_splits=10`).

## Agent details
Drafted with an AI assistant (Claude); pending author review.

Stacked on #195939 and #203681 (the read-flush benchmarker the numbers below were measured with).

MI350X, 172 GEMMs that pass the default `decompose_k_threshold` (K >= 32 * max(M, N)). Ground truth is the median over 8 input allocations of summed device kernel time after a read flush (#203681):
- geomean dk-on / dk-off pick: 0.971; 58 shapes >3% faster
- 7 shapes >3% slower beyond the re-timing noise of aten itself (all autotune misranks between aten and decompose_k)
- fp32 within 4e-6 of aten

These were measured with splits pruned to at least 32 output tiles of 64x64 and at most 64 MiB of workspace, which #195939's split bound applies on gfx950; other ROCm archs are not pruned. Other ROCm archs (MI300/gfx942, gfx90a, RDNA) are not measured.

Test Plan:
```
python test/inductor/test_max_autotune.py -k decompose
```
`test_max_autotune_decompose_k_envvars` gains a default-splits case that checks decompose_k is offered.

ghstack-source-id: f917151
Pull-Request: #203875
jananisriram added a commit that referenced this pull request Dec 1, 2026
decompose_k was off by default on ROCm pending perf validation (#169948). On MI350X it beats hipBLASLt and the Triton mm template on many large-K GEMMs, so this uses the same default as CUDA (`num_decompose_k_splits=10`).

## Agent details
Drafted with an AI assistant (Claude); pending author review.

Stacked on #195939 and #203681 (the read-flush benchmarker the numbers below were measured with).

MI350X, 172 GEMMs that pass the default `decompose_k_threshold` (K >= 32 * max(M, N)). Ground truth is the median over 8 input allocations of summed device kernel time after a read flush (#203681):
- geomean dk-on / dk-off pick: 0.971; 58 shapes >3% faster
- 7 shapes >3% slower beyond the re-timing noise of aten itself (all autotune misranks between aten and decompose_k)
- fp32 within 4e-6 of aten

These were measured with splits pruned to at least 32 output tiles of 64x64 and at most 64 MiB of workspace, which #195939's split bound applies on gfx950; other ROCm archs are not pruned. Other ROCm archs (MI300/gfx942, gfx90a, RDNA) are not measured.

Test Plan:
```
python test/inductor/test_max_autotune.py -k decompose
```
`test_max_autotune_decompose_k_envvars` gains a default-splits case that checks decompose_k is offered.

ghstack-source-id: 60f9963
Pull-Request: #203875
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/b200 ciflow/h100 ciflow/inductor ciflow/rocm-mi300 Trigger "default" config CI on ROCm MI300 Merged module: inductor module: rocm AMD GPU support for Pytorch open source topic: not user facing topic category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

7 participants