Repository navigation
[ROCm][Perf][DSv4.1] TP1 MXFP8 GEMM tiles and a pre-quantized wo_b input for DEP8 on MI355X #63821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1ae3465
621c4e5
825d04d
6392134
98c7dcb
8902eb3
3d2b5cd
fb01225
82daaac
1d99585
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -456,7 +456,7 @@ def _packed(bm, bn, bk, k_pack, warps, stages, nonkdim, waves, fused=1) -> _Conf | |
|
|
||
|
|
||
| # (N, K) -> [(max M, config), ...] for the DeepSeek-V4.1-Flash MXFP8 | ||
| # linears at TP2/TP4, tuned on MI355X under HIP graphs. A tier serves | ||
| # linears at TP1/TP2/TP4, tuned on MI355X under HIP graphs. A tier serves | ||
| # every M up to its bound; larger M reuse the last tier. | ||
| _TUNED: dict[tuple[int, int], list[tuple[int, _Config]]] = { | ||
| # shared expert gate_up, TP4 | ||
|
|
@@ -550,6 +550,20 @@ def _packed(bm, bn, bk, k_pack, warps, stages, nonkdim, waves, fused=1) -> _Conf | |
| (4096, _tiled(128, 128, 128, 1, True, 4, 2, 32, 0)), | ||
| (8192, _tiled(128, 128, 128, 1, True, 4, 2, 16, 0)), | ||
| ], | ||
| # shared expert gate_up, TP1 (DP attention), tuned at the CUDA graph sizes 48-4096 | ||
| (4608, 5120): [ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #62533 adds the same (4608, 5120), (5120, 8192) and (32768, 1280) keys at other positions in _TUNED. The two PRs merge with no git conflict so the second to land leaves repeated keys: ruff F601 then fails pre-commit on main, and at runtime the later literal silently wins. One of the two needs to drop its copies, or fold the tables into #62533 as you offered. cc karverma-amd
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Per the table in the description the two win in different ranges: #64459 up to 2.01x at 1-32 tokens, this PR 1.08-1.19x past 640. Dropping either copy loses one side; could the second to land merge the tiers by M range instead? (Your 1-32 tiers equal main's, so the 1.08x there is noise.)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed: the second to land merges the tiers by M range instead of dropping either copy. We have the per-M merged table from the side-by-side run. And yes, our 1–32 tiers are main's defaults, so the 1.08x there is noise. |
||
| (8, _packed(8, 16, 256, 2, 2, 3, 16, 0)), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. description needs perf and sccuracy check for each kernel you are adding on a microbench level
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a per-kernel table to the description (one MI355X, cold weights). At our decode sizes (224–512 tokens per rank), every new tile is faster than main, up to 2.2x. The only slower point is wo_b at 1024 tokens (1% slower). Accuracy is the same as main: max relative error 1.7e-3 everywhere, and the fused wo_b input is bit-identical. |
||
| (32, _packed(32, 32, 256, 1, 2, 3, 16, 0)), | ||
| (64, _tiled(64, 64, 512, 1, False, 4, 2, 32, 0, 2)), | ||
| (96, _tiled(32, 64, 512, 1, True, 8, 2, 16, 2)), | ||
| (128, _tiled(64, 64, 256, 1, False, 4, 2, 32, 2, 2)), | ||
| (192, _tiled(64, 64, 512, 1, True, 4, 2, 32, 2)), | ||
| (448, _tiled(64, 64, 256, 1, True, 4, 2, 32, 2)), | ||
| (896, _tiled(128, 128, 256, 1, True, 4, 2, 16, 0)), | ||
| (1792, _tiled(128, 128, 128, 1, True, 4, 2, 32, 2)), | ||
| (2560, _tiled(128, 128, 256, 1, True, 8, 2, 32, 0)), | ||
| (8192, _tiled(128, 128, 128, 1, True, 4, 2, 32, 2)), | ||
| ], | ||
| # shared expert down, TP4 | ||
| (5120, 576): [ | ||
| (8, _packed(8, 32, 256, 2, 2, 2, 16, 1)), | ||
|
|
@@ -607,6 +621,20 @@ def _packed(bm, bn, bk, k_pack, warps, stages, nonkdim, waves, fused=1) -> _Conf | |
| (4096, _tiled(128, 128, 128, 1, True, 8, 2, 32, 1)), | ||
| (8192, _tiled(128, 128, 128, 1, True, 2, 2, 32, 1)), | ||
| ], | ||
| # shared expert down, TP1 (DP attention), tuned at the CUDA graph sizes 48-4096 | ||
| (5120, 2304): [ | ||
| (8, _packed(8, 16, 256, 2, 2, 3, 16, 0)), | ||
| (32, _packed(32, 32, 256, 1, 2, 3, 16, 0)), | ||
| (64, _tiled(64, 64, 256, 1, True, 8, 3, 16, 0, 4)), | ||
| (96, _tiled(32, 64, 512, 1, True, 8, 3, 16, 2)), | ||
| (192, _tiled(64, 64, 512, 1, True, 4, 2, 32, 2)), | ||
| (288, _tiled(64, 64, 256, 1, True, 4, 2, 32, 2)), | ||
| (384, _tiled(128, 64, 256, 1, True, 8, 2, 32, 0)), | ||
| (768, _tiled(128, 128, 256, 1, True, 8, 2, 32, 2)), | ||
| (2048, _tiled(128, 128, 128, 1, True, 4, 2, 32, 2)), | ||
| (3072, _tiled(128, 256, 128, 1, True, 8, 3, 32, 2)), | ||
| (8192, _tiled(128, 128, 128, 1, True, 4, 2, 32, 0)), | ||
| ], | ||
| # wo_b, TP2 | ||
| (5120, 4096): [ | ||
| (4, _packed(4, 32, 512, 4, 2, 2, 16, 0)), | ||
|
|
@@ -629,6 +657,34 @@ def _packed(bm, bn, bk, k_pack, warps, stages, nonkdim, waves, fused=1) -> _Conf | |
| (4096, _tiled(128, 128, 128, 1, True, 8, 2, 16, 1)), | ||
| (8192, _tiled(128, 128, 128, 1, True, 4, 2, 32, 0)), | ||
| ], | ||
| # wo_b, TP1 (DP attention), tuned at the CUDA graph sizes 48-4096 | ||
| (5120, 8192): [ | ||
| (8, _packed(8, 16, 256, 2, 2, 3, 16, 0)), | ||
| (32, _packed(32, 32, 256, 1, 2, 3, 16, 0)), | ||
| (48, _tiled(64, 64, 256, 1, True, 4, 2, 16, 2, 4)), | ||
| (64, _tiled(64, 64, 512, 1, True, 4, 2, 32, 2, 2)), | ||
| (96, _tiled(32, 64, 512, 1, True, 8, 2, 16, 0)), | ||
| (128, _tiled(64, 64, 256, 1, True, 4, 2, 32, 0, 2)), | ||
| (192, _tiled(64, 64, 512, 1, True, 4, 2, 16, 0)), | ||
| (384, _tiled(128, 128, 256, 2, True, 4, 2, 16, 0)), | ||
| (768, _tiled(128, 128, 256, 1, True, 4, 2, 16, 0)), | ||
| (1024, _tiled(128, 128, 256, 2, True, 4, 2, 16, 0)), | ||
| (1536, _tiled(128, 128, 256, 1, True, 8, 2, 32, 0)), | ||
| (2048, _tiled(128, 128, 256, 1, True, 8, 2, 32, 2)), | ||
| (3072, _tiled(128, 128, 128, 1, True, 4, 2, 16, 0)), | ||
| (8192, _tiled(128, 128, 256, 1, True, 8, 2, 32, 2)), | ||
| ], | ||
| # DSpark main_proj (15360 -> 5120, replicated): 7 rows a request per step | ||
| (5120, 15360): [ | ||
| (8, _packed(8, 16, 256, 2, 2, 3, 16, 0)), | ||
| (32, _packed(32, 32, 256, 1, 2, 3, 16, 0)), | ||
| (56, _tiled(64, 64, 512, 1, True, 4, 2, 16, 2, 2)), | ||
| (126, _tiled(128, 128, 256, 1, True, 4, 2, 16, 2, 4)), | ||
| (133, _tiled(64, 64, 256, 1, True, 4, 2, 16, 2, 2)), | ||
| (168, _tiled(64, 64, 512, 1, True, 4, 2, 16, 2)), | ||
| (224, _tiled(128, 128, 256, 1, True, 4, 2, 16, 0, 2)), | ||
| (8192, _tiled(128, 128, 256, 1, True, 4, 2, 16, 2, 2)), | ||
| ], | ||
| # wq_b, TP4 | ||
| (8192, 1280): [ | ||
| (1, _packed(8, 32, 256, 2, 4, 3, 16, 1)), | ||
|
|
@@ -663,6 +719,20 @@ def _packed(bm, bn, bk, k_pack, warps, stages, nonkdim, waves, fused=1) -> _Conf | |
| (2048, _tiled(128, 128, 128, 1, True, 4, 2, 32, 0)), | ||
| (8192, _tiled(128, 256, 128, 1, True, 2, 2, 32, 0)), | ||
| ], | ||
| # wq_b, TP1 (DP attention), tuned at the CUDA graph sizes 48-4096 | ||
| (32768, 1280): [ | ||
| (8, _packed(8, 16, 256, 2, 2, 3, 16, 0)), | ||
| (32, _packed(32, 32, 256, 1, 2, 3, 16, 0)), | ||
| (56, _tiled(64, 64, 256, 1, True, 4, 2, 32, 2)), | ||
| (64, _tiled(64, 64, 256, 1, True, 4, 2, 16, 2)), | ||
| (128, _tiled(128, 128, 256, 1, False, 8, 2, 32, 0)), | ||
| (160, _tiled(128, 128, 128, 1, True, 8, 2, 32, 0)), | ||
| (224, _tiled(128, 128, 128, 1, True, 4, 2, 32, 2)), | ||
| (288, _tiled(128, 128, 128, 1, True, 4, 2, 32, 0)), | ||
| (448, _tiled(128, 128, 128, 1, True, 8, 2, 32, 0)), | ||
| (1280, _tiled(128, 128, 128, 1, True, 4, 2, 32, 0)), | ||
| (8192, _tiled(128, 128, 128, 1, True, 4, 2, 32, 2)), | ||
| ], | ||
| } | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description says these tests run in ":amd: (MI355 DPX) MLA Kernels", but that step's AMD mirror (.buildkite/test_areas/kernels.yaml:437) runs only test_dsv41_adaptive_mla_swa_metadata_graph_replay from this file, and the MI300 Attention shards skip them (requires_gfx950). The only gfx950 step that collects test_rocm_mxfp8_wo_a_bmm and this new test is the optional ":amd: (MI355 DPX) Attention Kernels Shard" (test-amd.yaml:4469), so PR CI never runs the epilogue. Could you add pytest -v -s tests/kernels/attention/test_rocm_triton_attn_dsv4.py -k wo_a_bmm to that mirror's commands (its source deps already list both changed files), or correct the description? The existing wo_a test has the same gap on main
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 621c4e5. The MI355 MLA Kernels mirror now runs the wo_a tests and the new gate test from this file.