Repository navigation
[Config] [Perf] Retune Llama-3.1-405B BF16 GEMM config for gfx950 - #7479
Conversation
Retune all rows of model_configs/llama405B_bf16_tuned_gemm.csv on gfx950/256 CU (155 of 156 rows change; the TP1 row (16384, 53248, 16384) keeps its current entry because no candidate passed in the retune). Many current rows select kernels that measure 10-20% slower than their recorded us. With this table, vLLM Llama-3.1-405B BF16 TP8 serving at concurrency 32 goes from 902 to 999 output tok/s on aiter main (MI350X). gsm8k accuracy is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017JGuDSsfinKAQhqUaGzpK7 Signed-off-by: Andy Friedrich <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
READY FOR HUMAN REVIEWPR Self-ReviewRevision Author self-review accepted. Readiness report: Author answers
Show the author's self-review answersBehavior and intentValidation and unverified scopePR-specific questionChanged op testsPR state
Copilot findings
Code and op-test hygiene
Required CI
Shadow mode reports what would block but keeps the status successful. Set |
… row ROCm#6937 moved OPUS to local kernel ids. The retuned row still carried the old global id 6401, which no longer resolves, so the runtime loader dropped the row and test_opus_a16w16_policy_parity failed. Same kernel (opus_gemm_mono_tile_512x128x256x64_2x4_16x16x32_0x0x0_nooob_4g_safe) is local kid 136 on gfx950/256 CU. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
This PR retunes
aiter/configs/model_configs/llama405B_bf16_tuned_gemm.csvfor gfx950 (256 CU). 155 of 156 rows change. No code changes.On upstream main, vLLM Llama-3.1-405B BF16 TP8 serving at concurrency 32 goes from 904.6 to 994.6 output tok/s (+10.0%). gsm8k accuracy does not change.
Motivation
#5145 regenerated this table, together with 12 other model tables. Many of its rows select kernels that are slower than the
uscolumn records.For example, gate_up
(M=32, N=13312, K=16384)records 78.5 µs for its FlyDSL kernel. That kernel measures 96–108 µs, and the best available kernel measures 78–81 µs.As a result, vLLM Llama-3.1-405B BF16 serving lost about 7% throughput compared with vLLM v0.29, which used the table from before #5145.
Changes
us,err_ratio,tflopsandbw.(M=128, N=53248, K=16384), uses local kid136. The tuner wrote the old global kid6401, which stopped resolving after [HIP] [CK] [OPUS] OPUS global kid to local kid #6937 moved OPUS to local ids. The runtime loader would drop the row, andtest_opus_a16w16_policy_parityfailed in CI. It is the same kernel,opus_gemm_mono_tile_512x128x256x64_2x4_16x16x32_0x0x0_nooob_4g_safe, sousand the other columns are unchanged.(M=16384, N=53248, K=16384). That is a TP1 shape, and no candidate passed in the retune.Performance (if applicable)
vLLM
0.33.0rc1.dev484, Llama-3.1-405B-Instruct BF16, TP8,--gpu-memory-utilization 0.85.vllm bench serverandom dataset: 1024 input and 1024 output tokens,--ignore-eos, concurrency 32, 320 prompts.a2ea45340+ this PR, FlyDSL 0.4.1: output tok/sFor reference, vLLM v0.29, which predates #5145, gives 966.1 tok/s on MI350X and 998.6 tok/s on MI355X.
GEMM time per decoder layer (qkv + o + gate_up + down), in µs. Single MI350X, upstream main
a2ea45340, CUDA graph of 40 calls over 4 rotating weight sets, CUDA events, median of 5:Testing
No unit tests changed, because this PR only changes data. The existing config tests pass (see Validation).
MI250X and MI300X are not affected: every row is keyed
gfx950,256, so gfx90a and gfx942 never read these rows. Tested on MI350X and MI355X.Documentation
The change is tuned data only. Behavior and interfaces do not change.
Dependencies
Breaking Changes
None.
PR Self-Review
Reviewed revision
f17298b
Behavior and intent
The BF16 GEMM dispatch (
aiter.tuned_gemm→get_GEMM_A16W16_config) now selects a different kernel for 112 Llama-3.1-405B shapes on gfx950/256 CU.The current rows from #5145 select kernels that are 10–20% slower than their recorded
us, and slower than other available kernels. That causes a 7–10% end-to-end throughput loss for Llama-3.1-405B BF16 serving.The retune uses the same tuner (
csrc/gemm_a16w16/gemm_a16w16_tune.py) and the same candidate set and correctness check. The only difference is how it measures time; see "Validation and unverified scope".Validation and unverified scope
All on commit
77bb03492over upstreama2ea45340, FlyDSL 0.4.1, MI350X, unless stated otherwise. The later commits mergemaininto the branch, andf17298b4achanges the OPUS row'ssolidxfrom 6401 to 136 (see Changes). With 6401 the runtime dropped that row. It is a TP1 gate_up shape, so the TP8 measurements below never used it. The PR diff is still this one file:python3 -m unittest op_tests.tuning_tests.test_csv_validation op_tests.tuning_tests.test_config_shape_collision op_tests.tuning_tests.test_a16w16_tuned_config_lookup: 54 tests passed.TUNE_TEST_FAMILY=csrc_bf16 TUNE_TEST_CONFIG=aiter/configs/model_configs/llama405B_bf16_tuned_gemm.csv python3 -m unittest op_tests.tuning_tests.test_run_config.TestRunConfigCustom: passed, 156 of 156 shapes OK.Merged runtime config, diffed with
AITER_CONFIGS.get_config_file("AITER_CONFIG_GEMM_BF16", ...)on upstream main and on this branch:At
f17298b4a: every OPUS row in the shipped*bf16_tuned_gemm.csvfiles (1224 rows) resolves throughget_kernel_instance(gfx, "a16w16", solidx, cu_num)to an instance whose name matcheskernelName. That is the checktest_opus_a16w16_policy_paritymakes.No "not recognized … falling back" message for any FlyDSL kernel name, in the microbenchmark or in the vLLM server logs.
Microbenchmark of the four TP8 shapes at 26 values of M (1–8192): results in the Performance table. Two single-op rows are more than 5% slower, both at M=96 (padded to the M=128 row): qkv 24.3 → 26.8 µs and o 17.2 → 19.9 µs.
vLLM end to end at concurrency 32: results in the Performance table. Each arm ran in a fresh container, with no other GPU processes during the measured run.
gsm8k (lm-eval 0.4.13, 5-shot, 1319 questions), MI350X with real weights, aiter 0.1.27 stack:
No change within noise. The largest
err_ratioin the new table is 0.032.Tuning method:
no valida data after post processfor most candidates, and later failed withHSA_STATUS_ERROR_OUT_OF_RESOURCES;--mp 8filled all GPUs, after which candidates failed silently.aiter.test_common.run_perftestwas replaced with CUDA-graph replay of 40 calls over at least 1 GiB of rotated argument copies, timed by CUDA events (median of 5). The tuner ran as 8 single-GPU--mp 1processes.Unverified or not covered:
run_config, not end to end.PR-specific question
Which workload keys use these changes: only the BF16 GEMM keys
(gfx=gfx950, cu_num=256, M, N, K, bias=False, dtype=torch.bfloat16, outdtype=torch.bfloat16, scaleAB=False, bpreshuffle=False), with:Runtime M values round up to those rows. These are the qkv, o, gate_up and down projections at TP1, TP2, TP4 and TP8.
Why other shapes keep their previous selection:
*bf16_tuned_gemm*.csv, and the shape-collision test passes.AITER_CONFIGS.get_config_fileon upstream main and on this branch. The key sets are identical (5541 rows each). Only 112 selections change, all keyed in this file, and the other 5385 keys keep the samelibtype,solidx,splitKandkernelName.cu_numvalues have no rows here, so they are not affected.Changed op tests
None.
🤖 Generated with Claude Code
https://claude.ai/code/session_017JGuDSsfinKAQhqUaGzpK7