Skip to content

[OPUS][Config] gfx1250 96cu bf16 GEMM: GPT-OSS TP2 LM head, M 33..256 - #8862

Merged
yifehuan merged 2 commits into
mainfrom
gfx1250-96cu-gptoss-opus-lm-head
Dec 3, 2026
Merged

yifehuan merged 2 commits into
mainfrom
gfx1250-96cu-gptoss-opus-lm-head

Conversation

@xiaohuguo2023

@xiaohuguo2023 xiaohuguo2023 commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds 14 OPUS rows to aiter/configs/model_configs/gptoss_bf16_tuned_gemm.csv for the GPT-OSS TP2 LM head (N=100544, K=2880, bf16, no bias) on the 96-CU gfx1250 partition: M = 64, 80, 96, 112, 128, 144, 160, 168, 176, 192, 208, 224, 240, 256. The lookup pads M, so the rows serve every M from 33 to 256: M = 33 to 63 use the M=64 row. The same 14 shapes are added to gptoss_bf16_untuned_gemm.csv.

Motivation

gpt-oss-120b with TP 2 on two 96-CU partitions runs the LM head as a 100544 x 2880 GEMM once per decode step. The shape has no gfx1250/96 row, so tuned_gemm uses the default triton (gluon) path. For decode batches of 33 to 256, OPUS is 10% to 34% faster than the best gluon config.

Changes

  • gptoss_bf16_tuned_gemm.csv: 14 rows with libtype=opus, as written by csrc/gemm_a16w16/gemm_a16w16_tune.py --libtype opus. No code change.
  • gptoss_bf16_untuned_gemm.csv: the 14 no-bias input shapes of these rows, so a retune from the untuned file covers them.
  • The rows are at steps of 16 because the lookup pads M to the next multiple of 16 first and then to the next power of two. A batch between two rows uses the kernel tuned at the next multiple of 16. There is no M=48 row, so M = 33 to 63 pad to 64 and use the M=64 row; that range is timed below. M=168 has its own row because it is the target decode batch.
  • No rows for the other TP2 shapes. QKV (N=2560, K=2880) and O (N=2880, K=2048) were tuned for M 16 to 256, and OPUS is 29% to 42% slower than gluon there. The LM head at M=16 and M=32 is also slower with OPUS (0.83x and 0.91x).

Performance (if applicable)

Hardware: MI450X, one 96-CU DPX/NPS2 partition (gfx1250). Both sides run through aiter.tuned_gemm.tgemm.mm. Timing is cache-cold: one CUDA graph walks a pool of distinct weight copies, timed with CUDA events, mean without slow outliers. Two runs per side, back to back; the table gives the mean of the two, and the runs agree within 2.2%.

"Before" is the gluon path with the entries of the gluon config PR for the same shape (branch gfx1250-96cu-gptoss-decode-configs: 128x128x64 for M 65 to 128, 256x256x64 for M 129 to 256). "After" is the OPUS row. On plain main the gluon path is slower above M=64 (194 us at M=96 and 479 us at M=168 in the gluon tuning harness), so against main the gain is larger than the table shows.

Hardware Workload/configuration Before After Change
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=64 113.2 us 99.8 us 1.13x
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=80 119.2 us 103.9 us 1.15x
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=96 121.2 us 105.6 us 1.15x
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=112 124.5 us 112.7 us 1.10x
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=128 129.8 us 114.7 us 1.13x
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=144 198.3 us 147.6 us 1.34x
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=160 199.1 us 148.9 us 1.34x
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=168 199.4 us 149.7 us 1.33x
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=176 200.7 us 151.5 us 1.32x
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=192 202.1 us 153.0 us 1.32x
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=208 203.9 us 181.6 us 1.12x
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=224 205.2 us 182.6 us 1.12x
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=240 207.1 us 183.8 us 1.13x
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=256 207.6 us 183.9 us 1.13x

Batches between two rows take the padded row and were timed too: M=65 1.15x, M=129 1.34x, M=150 1.34x, M=200 1.12x.

M = 33 to 63 use the M=64 row through the padding. Same harness, two runs per side back to back, the runs agree within 0.2%. M=32 and below do not reach an OPUS row and stay on gluon (88.1 us at M=32 on both sides).

Hardware Workload/configuration Before After Change
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=33 109.0 us 98.2 us 1.11x
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=40 110.4 us 99.1 us 1.11x
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=48 111.5 us 100.1 us 1.11x
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=49 111.8 us 100.0 us 1.12x
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=56 113.0 us 101.0 us 1.12x
MI450X, 96-CU partition bf16 GEMM N=100544 K=2880, M=63 114.0 us 101.7 us 1.12x

Relative max error against fp32 torch.matmul: 2.7e-03 to 3.1e-03 on every row, M = 33 to 63 included.

Tuning command:

python3 csrc/gemm_a16w16/gemm_a16w16_tune.py --input_file <shapes.csv> --tuned_file <out.csv> --libtype opus

Testing

  • Unit tests added or updated
  • Performance benchmarks run
  • Tested on MI250X
  • Tested on MI300X

On the MI450X 96-CU partition:

  • python3 -m unittest op_tests.tuning_tests.test_config_shape_collision: 34 tests OK.
  • pytest op_tests/tuning_tests/test_csv_validation.py op_tests/tuning_tests/test_a16w16_tuned_config_lookup.py: 55 passed, 2 failed. The two failures are TestFlydslRingTunerCandidates (unsupported FlyDSL kernel configuration). They fail the same way without the rows of this PR and do not read these files.
  • Dispatch through the default config merge (AITER_CONFIG_GEMM_BF16 not set): every M from 33 to 256 in the tables selects an OPUS row and passes the error bound.

Documentation

  • No documentation change is needed, with the reason stated below

The change adds config rows only.

Dependencies

  • No new third-party dependencies added

Breaking Changes

None.

PR Self-Review

Reviewed revision

2de75f4

Behavior and intent

On a 96-CU gfx1250 partition, a bf16 GEMM with N=100544, K=2880 and no bias now uses an OPUS kernel when M is 33 to 256 (M = 33 to 63 through the M=64 row). Before, the shape had no row and used the default gluon path, which is 10% to 34% slower for these batches. M = 1 to 32 and M above 256 do not change. Other shapes, other M values and other devices do not change: the rows are keyed on gfx1250 and cu_num 96.

Validation and unverified scope

Commands, hardware and results are in Performance and Testing. No unit test is added: the rows are data, and the existing CSV validation, lookup and collision tests cover them.

Not verified:

  • MI250X, MI300X, MI355X and the 256-CU gfx1250 part. They do not read these rows.
  • op_tests/tuning_tests/test_run_config.py for the merged table.
  • End-to-end serving at this commit.

PR-specific question

0e4c85f

Changed op tests

None.

@xiaohuguo2023
xiaohuguo2023 requested review from a team and a balanced review from Copilot November 27, 2026 16:28

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter standard tests on MI35X
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the Radeon R9700 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 8862 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

@github-actions github-actions Bot changed the title [OPUS] [Config] gfx1250 96cu bf16 GEMM: GPT-OSS TP2 LM head, M 64..256 [Config] gfx1250 96cu bf16 GEMM: GPT-OSS TP2 LM head, M 64..256 Nov 27, 2026
@aiter-bot

aiter-bot commented Nov 27, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 2de75f43ff63 · mode shadow

Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision.

Questions to answer in the PR description

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. Which exact workload keys consume these configuration changes, and what evidence shows that unrelated shapes keep their previous selection?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — PR-specific question is too short to show concrete reasoning (1 units; need 14)
  • FAIL — validation answer must explicitly state what remains unverified (or say none with a reason)

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

@xiaohuguo2023 xiaohuguo2023 changed the title [Config] gfx1250 96cu bf16 GEMM: GPT-OSS TP2 LM head, M 64..256 [OPUS][Config] gfx1250 96cu bf16 GEMM: GPT-OSS TP2 LM head, M 64..256 Nov 27, 2026
@xiaohuguo2023
xiaohuguo2023 force-pushed the gfx1250-96cu-gptoss-opus-lm-head branch from 9390e8d to f13e70d Compare November 28, 2026 13:33
Copilot AI balanced review requested due to automatic review settings November 28, 2026 13:33
@github-actions github-actions Bot changed the title [OPUS][Config] gfx1250 96cu bf16 GEMM: GPT-OSS TP2 LM head, M 64..256 [Config] gfx1250 96cu bf16 GEMM: GPT-OSS TP2 LM head, M 64..256 Nov 28, 2026

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@zufayu
zufayu requested a review from yifehuan December 1, 2026 04:40
@xiaohuguo2023
xiaohuguo2023 force-pushed the gfx1250-96cu-gptoss-opus-lm-head branch from f13e70d to 0e4c85f Compare December 1, 2026 19:28
Copilot AI balanced review requested due to automatic review settings December 1, 2026 19:28

Copilot AI 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.

🟡 Changes recommended

The M=64 configuration also affects unbenchmarked M=33–63 inputs, extending the change beyond its documented scope.

2 open issues

Review effort: Balanced

Add OPUS rows for the gpt-oss TP2 LM head (N=100544, K=2880, bf16, no bias)
on the 96-CU gfx1250 partition, for M = 64, 80, ..., 256 and 168. The shape
had no row, so it ran the default triton (gluon) kernel.

Rows are from csrc/gemm_a16w16/gemm_a16w16_tune.py --libtype opus. Timed
cache-cold through tgemm.mm against the gluon path, two runs. The gluon side
uses the entries of the gluon config PR (128x128x64 for M 65..128, 256x256x64
for M 129..256); main is slower than that above M=64:

    M        gluon       OPUS        ratio
    64       113 us      100 us      1.12x
    65..128  118-130 us  103-115 us  1.09-1.14x
    129..192 196-202 us  147-153 us  1.32-1.34x
    200..256 203-208 us  181-184 us  1.12x

The QKV (2560x2880) and O (2880x2048) shapes were tuned too; OPUS is 29% to
42% slower than gluon there, so they get no row.

Signed-off-by: Xiaohu Guo <[email protected]>
@xiaohuguo2023
xiaohuguo2023 force-pushed the gfx1250-96cu-gptoss-opus-lm-head branch from 0e4c85f to 8d4ebc9 Compare December 2, 2026 11:50
Add the 14 no-bias inputs for N=100544, K=2880 (M = 64 to 256 in steps of
16, and M=168) to gptoss_bf16_untuned_gemm.csv. They are the inputs of the
gfx1250 96cu OPUS rows in gptoss_bf16_tuned_gemm.csv, so a retune from the
untuned file covers them.

Signed-off-by: Xiaohu Guo <[email protected]>
Copilot AI balanced review requested due to automatic review settings December 2, 2026 12:24
@xiaohuguo2023 xiaohuguo2023 changed the title [Config] gfx1250 96cu bf16 GEMM: GPT-OSS TP2 LM head, M 64..256 [Config] gfx1250 96cu bf16 GEMM: GPT-OSS TP2 LM head, M 33..256 Dec 2, 2026

Copilot AI 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.

🔵 Needs a closer look

The M=64 row also switches backend dispatch for M=33–63, outside the claimed scope and reported validation range, so those batches need their prior dispatch preserved or benchmarked and validated.

2 open issues

Review effort: Balanced

@xiaohuguo2023 xiaohuguo2023 changed the title [Config] gfx1250 96cu bf16 GEMM: GPT-OSS TP2 LM head, M 33..256 [OPUS][Config] gfx1250 96cu bf16 GEMM: GPT-OSS TP2 LM head, M 33..256 Dec 2, 2026

@yifehuan yifehuan 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.

LGTM

@yifehuan
yifehuan merged commit ecfa616 into main Dec 3, 2026
73 of 74 checks passed
@yifehuan
yifehuan deleted the gfx1250-96cu-gptoss-opus-lm-head branch December 3, 2026 02:40
AndreasKaratzas added a commit to AndreasKaratzas/aiter that referenced this pull request Dec 3, 2026
Conflict in gemm_a16w16_gfx950_utils.py vs ROCm#8460: main adds an s_nop 1
after the inline-asm global_store_dwordx4 in store_global_f32_vec and in
SplitKProtocol.zero_c. This branch removes both (no zero-init of C, no
atomic split-K store); its workspace and C stores go through BufferCopy128b
and write_cshuffle_vec_to_global, which LLVM emits and pads itself. No
inline-asm store is left in the A16W16 kernel, so the branch side is kept.

gptoss_bf16_tuned_gemm.csv merges cleanly: the branch's gfx950 rows plus
main's 14 gfx1250 rows from ROCm#8862, no duplicate keys.

Co-authored-by: Claude <[email protected]>
Signed-off-by: Andreas Karatzas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants