Skip to content

[Triton/Gluon] [Tune] gfx950 gemm_a16w8_blockscale: add N=1280 K=8192 config - #8106

Merged
azaidy merged 2 commits into
ROCm:mainfrom
mengfei-jiang:a16w8-blockscale-retune-n1280-k8192
Nov 30, 2026
Merged

azaidy merged 2 commits into
ROCm:mainfrom
mengfei-jiang:a16w8-blockscale-retune-n1280-k8192

Conversation

@mengfei-jiang

@mengfei-jiang mengfei-jiang commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

For Triton 3.9.0 perf regression, add a shape-specific config for N=1280 K=8192 on gfx950. With the explicit tl.fma change (PR #7544), M=32/64 at this shape regressed 4-6% with DEFAULT. The new config uses NUM_KSPLIT=8, num_warps=4 for small M buckets, recovering performance to match Triton 3.8.

Summary

Add a tuned gfx950 config for gemm_a16w8_blockscale at N=1280 K=8192, and add test coverage for M=32/64 at this shape to verify the split-K results.

Motivation

After the explicit tl.fma change in PR #7544, the DEFAULT config regresses 4-6% at M=32/64 for N=1280 K=8192 on gfx950. A shape-specific config with NUM_KSPLIT=8 and num_warps=4 recovers performance and is faster than Triton 3.8 at small M.

Changes

  • Add configs/gfx950/triton/gemm/gemm_a16w8_blockscale/GEMM-A16W8_BLOCKSCALE-N=1280-K=8192.json with tuned tile sizes and split-K values for each M bucket.
  • Add M=32 and M=64 test shapes at N=1280 K=8192 in test_gemm_a16w8_blockscale.py.

Performance (if applicable)

Hardware Workload/configuration Before (3.8) After (3.9+fma+tune) Change
gfx950 N=1280 K=8192 M=32 19.7 us 8.5 us +57% faster
gfx950 N=1280 K=8192 M=64 19.7 us 10.7 us +46% faster
gfx950 N=1280 K=8192 M=1024 79.8 us 78.8 us neutral
gfx950 N=1280 K=8192 M=16384 489.3 us 487.9 us neutral

Testing

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

Documentation

  • Docstrings updated
  • User guide updated
  • Performance guide updated
  • No documentation change is needed, with the reason stated below

Dependencies

  • No new third-party dependencies added
  • New dependencies are listed and justified below

Breaking Changes

None

PR Self-Review

Reviewed revision

d802633

Behavior and intent

Small-M performance at N=1280 K=8192 regressed after the explicit tl.fma change because the DEFAULT config does not split K enough for this shape. The tuned config uses NUM_KSPLIT=8 to distribute the K dimension across 8 partitions, recovering small-M throughput.

Validation and unverified scope

Benchmarked on gfx950 with bench_gemm_a16w8_blockscale.py at N=1280 K=8192 for M in {32, 64, 1024, 2048, 16384}. Large-M performance is neutral.

PR-specific question

N/A

Changed op tests

Added (64, 1280, 8192) to gemm_shapes.py DECODE shapes to cover the split-K path at the newly tuned shape. (32, 1280, 8192) was already added by #8214.

@mengfei-jiang
mengfei-jiang requested a review from a team November 17, 2026 12:37
@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 8106 --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 [Tune] gfx950 gemm_a16w8_blockscale: add N=1280 K=8192 config [Triton/Gluon] [Config] [Tune] gfx950 gemm_a16w8_blockscale: add N=1280 K=8192 config Nov 17, 2026
@aiter-bot

aiter-bot commented Nov 17, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision d80263304917 · 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 has no substantive answer
  • 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.

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 retuned configuration lacks tests at N=1280, K=8192 for M=32 and M=64, leaving its split-K results unverified on gfx950.

1 open issue
What changed in this PR

Adds a shape-specific gfx950 tuning config for gemm_a16w8_blockscale at N=1280, K=8192, targeting the small-M performance regression reported after the explicit FMA changes in #7544.

Changes:

  • Uses eight split-K partitions and four warps for the M=32 and M=64 buckets.
  • Defines additional M buckets and an any entry for larger inputs.
File Description
aiter/​ops/​triton/​configs/​gfx950/​triton/​gemm/​gemm_a16w8_blockscale/​GEMM-A16W8_BLOCKSCALE-N=1280-K=8192.json Adds shape-specific tile sizes, launch settings, and split-K values for gfx950.

Review effort: Balanced

@zufayu
zufayu requested review from a team and k50112113 November 18, 2026 01:24
@github-actions github-actions Bot changed the title [Triton/Gluon] [Config] [Tune] gfx950 gemm_a16w8_blockscale: add N=1280 K=8192 config [Triton/Gluon] [Tune] gfx950 gemm_a16w8_blockscale: add N=1280 K=8192 config Nov 18, 2026
@github-actions github-actions Bot removed the Config label Nov 18, 2026

@k50112113 k50112113 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, but please resolve conflicts thanks

Add a shape-specific config for N=1280 K=8192 on gfx950. With the
explicit tl.fma change (PR ROCm#7544), M=32/64 at this shape regressed
4-6% with DEFAULT. The new config uses NUM_KSPLIT=8, num_warps=4 for
small M buckets, recovering performance to match Triton 3.8.

gfx950, N=1280 K=8192, kernel time (us):

  M        3.8     3.9+fma+retune
  32       19.7    8.5
  64       19.7    10.7
  1024     79.8    78.8
  2048     87.4    88.8
  16384    489.3   487.9

Co-Authored-By: Claude <[email protected]>
@mengfei-jiang
mengfei-jiang force-pushed the a16w8-blockscale-retune-n1280-k8192 branch from 27c156c to eb71cf5 Compare November 21, 2026 03:09
@github-actions github-actions Bot changed the title [Triton/Gluon] [Tune] gfx950 gemm_a16w8_blockscale: add N=1280 K=8192 config [Triton/Gluon] [Config] [Tune] gfx950 gemm_a16w8_blockscale: add N=1280 K=8192 config Nov 21, 2026
@github-actions github-actions Bot changed the title [Triton/Gluon] [Config] [Tune] gfx950 gemm_a16w8_blockscale: add N=1280 K=8192 config [Triton/Gluon] [Tune] gfx950 gemm_a16w8_blockscale: add N=1280 K=8192 config Nov 21, 2026
@github-actions github-actions Bot removed the Config label Nov 21, 2026

@Dewei-Wang-sh Dewei-Wang-sh 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

mengfei-jiang pushed a commit that referenced this pull request Nov 23, 2026
…3.9 (#7544)

Triton 3.8 enables implicit FP contraction by default, but Triton 3.9 disables implicit FP contraction by default.
Expressions like accumulator += tl.dot(a, b) * scale are no longer lowered to a single FMA instruction — the compiler emits separate mul and add instead, causing performance regression.

Two changes in the fp8 K loop:

Use tl.range(num_stages=2) for the loop. With num_stages on the loop, the Triton pipeliner also pipelines loads that do not feed tl.dot. The a_scale and b_scale loads are then issued one iteration ahead. Before, the wait for the scales also waited for the A/B prefetch.
Compute the scale outer product first and use tl.fma for the accumulation. Triton 3.9 does not fuse mul and add by default, so the old expression gave separate mul and add instructions.
gfx950, M=4096 N8=512 N16=256 K=7168, median of 5 (us):

           3.9 fp8  3.9 both  3.8 fp8  3.8 both
before 129.9 141.5 122.8 131.6
after 77.8 120.3 76.9 119.7

The same explicit tl.fma fix is applied to four more kernels that had
the same Triton 3.9 regression:
gemm_a8w8_blockscale (and preshuffle variant): ~7% regression recovered.
gather_kv_b_proj: 12-15% regression recovered.
gemm_a16w8_blockscale (PREQUANT and plain branches).
batched_gemm_a8w8_a_per_token_group_prequant: explicit FMA + skip
split-K range math when NUM_KSPLIT==1 to keep the K loop aligned.
Test: test_gemm_a16w8_blockscale.py now parametrizes prequant={False, True}.
The N=1280 K=8192 gfx950 retune config is in PR #8106
@mengfei-jiang
mengfei-jiang requested a review from azaidy November 25, 2026 02:05

@azaidy azaidy 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!

@azaidy
azaidy merged commit 48efdf9 into ROCm:main Nov 30, 2026
74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants