Repository navigation
[Inductor] Filter decompose-K splits by output tiles and workspace - #195939
jananisriram wants to merge 34 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/195939
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 39eba0c with merge base ed2f237 ( 🟡 GREEN LIGHT - OUTDATED (earlier commit) - PR requires human review:
reason: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
…ounds; #203875 restacked, wording only [ghstack-poisoned]
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 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
1 similar comment
|
@jananisriram has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
[ghstack-poisoned]
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 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
[ghstack-poisoned]
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 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@jananisriram has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
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
|
@jananisriram has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Stack from ghstack (oldest at bottom):
Decompose-K autotunes up to 10 split choices for each large-K mm, and most of them never win. This filters out splits that launch too few output tiles (
split * ceil(M/64) * ceil(N/64)) or need a large FP32 workspace (split * M * N * 4bytes).The bounds depend on the device:
The filter only removes candidates and never removes all of them. It is skipped for symbolic shapes and the EXHAUSTIVE search space.
TORCHINDUCTOR_DECOMPOSE_K_MIN_OUTPUT_TILE_SIZEsets the tile size used for the estimate (default 64; 0 turns the filter off).On H100, across 64 decompose-K shapes, it removes 27% of split choices without losing any split that beats ATen, and cuts autotune time by 31% on 10 held-out shapes.
Test plan:
python test/inductor/test_max_autotune.py -k decompose(54 tests, H100)Agent details
Drafted with an AI assistant (Claude); pending author review.
gfx950 (MI350X) also gets a bound: at least 32 output tiles and at most 64 MiB of FP32 workspace, gated on
rocm_gfx_arch() == "gfx950". Other ROCm targets stay unfiltered. Across 241 MI350X decompose-K shapes it keeps 77% of split choices, and no shape gets more than 2% slower than with every split.Differential Revision: D121710493