Skip to content

[Triton/Gluon] gfx950: recover three regressions from the LLVM 18f9e623 bump - #7905

Open
yanxuer-999 wants to merge 1 commit into
ROCm:mainfrom
yanxuer-999:triton-gfx950-fix-12236-regressions
Open

yanxuer-999 wants to merge 1 commit into
ROCm:mainfrom
yanxuer-999:triton-gfx950-fix-12236-regressions

Conversation

@yanxuer-999

Copy link
Copy Markdown
Contributor

Summary

This PR adds tuned gfx950 launch configs for the three cases that the AITER perf-daily CI still reports as slower since the LLVM 18f9e623 bump in Triton (triton-lang/triton#12236, tracked in AMD-Triton/triton-tickets#2129). After the change, each case is faster than it was before the bump.

Motivation

The perf-daily CI on MI350X has three open alerts with culprit triton#12236 (gap against the night before the bump, latest night #70):

Alert Case Gap
A2 gemm_a16w16 GLM-5.3 GDN in_proj_ba at decode, M=4 N=32 K=4096 -12.7%
A4 quant_fp8_blockwise axis=1, 5 shapes -5.0% to -6.2%
A13 gemm_a8w8_blockscale 256x1280x8192 -10.4%

Causes, from the compiled kernels:

  • A2: the DEFAULT.json M_LEQ_8 tile (8 warps, waves_per_eu 8) leaves 64 registers per lane and spills. The bump made it spill more (scratch 68 B -> 92 B).
  • A4: the bump changed the bf16 -> fp32 -> fp8 lowering. The kernel has about 6% more VALU instructions (2547 -> 2708). It uses no AGPRs and no scratch.
  • A13: the DEFAULT.json M_LEQ_256 tile (BM256 x BN128) launches only 10 programs for M=256, N=1280. The kernel does not spill. It is latency-bound, so register-allocation changes in the bump moved its time.

Changes

  • configs/gfx950/triton/gemm/gemm_a16w16/GEMM-A16W16-N=32-K=4096.json (new, DEFAULT_FALLBACK): M_LEQ_8 = BM16 BN16 BK256, 2 warps, 3 stages, waves_per_eu 0. any is a copy of the DEFAULT.json any.
  • configs/gfx950/triton/gemm/gemm_a8w8_blockscale/GEMM-A8W8_BLOCKSCALE-N=1280-K=8192.json (new, DEFAULT_FALLBACK): M_LEQ_256 = BM128 BN64 BK128, 4 warps, 3 stages, waves_per_eu 2, NUM_KSPLIT 4. any is a copy of the DEFAULT.json any.
  • configs/gfx950/triton/quant/quant_fp8_blockwise/DEFAULT.json (new): one pinned entry, quant_fp8_blockwise_axis1_block128 = 16 warps, 2 stages, waves_per_eu 2.
  • quant/quant_fp8_blockwise.py: quant_fp8_blockwise() reads its launch parameters through get_tuned_kernel_config(), keyed by axis and block size. When no entry exists (other archs, axis 0, other block sizes), the fallback is the current Python values. The other four entry points (for_weight, for_act_grad, requant_row_to_col, segment_m) do not change. With 16 warps, act_grad, requant and segment_m are 33-80% slower on gfx950.

Performance

MI350X (gfx950), Triton main 4a7b73ca (2026-11-11). GPU kernel time per call from rocprofv3 --kernel-trace: the median of 30 calls, including the split-K reduce kernel. Base is main 37da1db. Two runs; the table shows run 2.

Hardware Workload Before (us) After (us) Change
MI350X gemm_a16w16 bias, 4x32x4096 (A2) 30.60 5.36 -82.4%
MI350X gemm_a16w16 bias, M=1/2/8 x32x4096 30.6-30.7 5.4-5.5 -82%
MI350X gemm_a8w8_blockscale 256x1280x8192 (A13) 142.7 21.1 -83% to -85%
MI350X gemm_a8w8_blockscale 129/192x1280x8192 110.4 / 113.0 19.2 / 19.4 -83%
MI350X quant_fp8_blockwise axis=1, 4096/8192 x 4096/7168/8192 (A4) 31.4-105.3 27.4-92.9 -9.0% to -13.0%

Against Triton 64ccfff9 (the commit before the bump) with the old configs, the new configs are faster on all three cases. A2: 28.7 us -> 5.4 us. A13: 127.1 us -> 21.1 us. A4 8192x7168: 87.9 us -> about 80 us.

Unchanged neighbours (head vs base, two runs): gemm_a16w16 M=16 +0.0%; gemm_a8w8_blockscale M=64 -0.9%/-0.4% and M=512 -0.2%/+0.2%; quant axis=0, weight, act_grad, requant and segment_m are within the run-to-run noise of this machine (mostly within 1%, up to about 10% on single shapes in one run; their launch parameters are identical).

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

The change is config values and the config lookup of one wrapper.

Dependencies

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

Breaking Changes

None.

PR Self-Review

Reviewed revision

4c418cb

Behavior and intent

On gfx950, three cases get new launch configs: gemm_a16w16 with N=32 K=4096 for M <= 8, gemm_a8w8_blockscale with N=1280 K=8192 for 128 < M <= 256, and quant_fp8_blockwise(axis=1, block_size=128). Every other shape, bucket, arch and quant entry point resolves to the same launch parameters as before. The previous configs spill (A2), leave the GPU mostly idle (A13), or do not hide extra VALU work from the LLVM bump (A4).

Validation and unverified scope

  • Search: kernel-trace sweeps on Triton main 4a7b73ca. A2: 361 configs. A13: 577 configs (24 exceeded LDS). A4: 61 launch settings x 5 shapes, with output bit-identical to the current settings.

  • Configs: utils/_triton/tuning/verify_configs.py --expect-tuned serves the new files: gemm_a16w16 M=1/2/4/8 N=32 K=4096, gemm_a8w8_blockscale M=129/192/256 N=1280 K=8192.

  • Unit tests (all pass): op_tests/triton_tests/quant/test_quant_fp8_blockwise.py, plus test_gemm_a16_w16 / test_gemm_a16_w16_layout on M=1/2/4/8 x32x4096 and test_gemm (gemm_a8w8_blockscale, TN/TT/NN/NT, output True/False) on M=129/192/256 x1280x8192. 62 passed.

  • Format: black --check and ruff check pass on the changed Python file.

  • Not verified:

    • gfx942 and other archs (no config is added for them; the code path keeps the current values there);
    • the full Triton test suite;
    • end-to-end model runs.

    The test machine had sporadic multi-millisecond kernel stalls from another workload, so all timings use the median of kernel-trace durations. CUDA-event and CUDA-graph timing were not reliable on it.

PR-specific question

Workload keys that consume the changes:

  • GEMM-A16W16 with N=32, K=4096, M <= 8 (bucket M_LEQ_8);
  • GEMM-A8W8_BLOCKSCALE with N=1280, K=8192, 128 < M <= 256 (bucket M_LEQ_256);
  • QUANT_FP8_BLOCKWISE entry quant_fp8_blockwise_axis1_block128.

Evidence that other selections keep their previous values:

  • Both GEMM files use DEFAULT_FALLBACK with one tuned bucket. Their any is the DEFAULT.json any.
  • The A/B run shows the neighbouring buckets unchanged: a16w16 M=16; blockscale M=64 and M=512.
  • Quant entries other than axis1_block128 have no JSON entry, so get_tuned_kernel_config() returns the fallback, which is the current Python value.

Changed op tests

None.

🤖 Generated with Claude Code

…VM 18f9e623 bump

The LLVM 18f9e623 bump in Triton (triton-lang/triton#12236) slowed three
gfx950 cases that the perf-daily CI still reports. Each one now has a tuned
launch config:

- quant_fp8_blockwise, axis=1, block 128: 16 warps instead of 4, from a new
  gfx950 entry in configs/.../quant/quant_fp8_blockwise/DEFAULT.json. The
  bump added about 6% VALU work to this path. The other entry points keep
  their launch parameters: 16 warps make act_grad, requant and segment_m
  33-80% slower.
- gemm_a16w16 M<=8, N=32, K=4096 (GLM-5.3 GDN in_proj_ba at decode): the
  DEFAULT M_LEQ_8 tile (8 warps, waves_per_eu 8) spills; the tuned tile does
  not.
- gemm_a8w8_blockscale M 129-256, N=1280, K=8192: the DEFAULT M_LEQ_256 tile
  launches only 10 programs; the tuned tile uses split-K 4.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@yanxuer-999
yanxuer-999 requested a review from a team November 13, 2026 02:16
@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 7905 --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 [Triton/Gluon] [Config] gfx950: recover three regressions from the LLVM 18f9e623 bump [Triton/Gluon] gfx950: recover three regressions from the LLVM 18f9e623 bump Nov 13, 2026
@aiter-bot

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 4c418cbf4773 · 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 — 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 launch-config cache ignores USE_LRU_CACHE=False, preventing later JSON edits from taking effect, and the new tuning configurations lack targeted test coverage.

4 open issues
What changed in this PR

This PR targets three gfx950 performance regressions after the LLVM bump by tuning existing AITER Triton kernels without changing public APIs.

Changes:

  • Adds shape-specific GEMM configs for small a16w16 workloads and blockscale split-K execution.
  • Adds a pinned launch config for axis-1 FP8 blockwise quantization.
  • Routes the quantization wrapper through the shared config loader, retaining existing settings when no entry matches.
File Description
aiter/​ops/​triton/​quant/​quant_fp8_blockwise.py Loads quantization launch settings by axis and block size.
aiter/​ops/​triton/​configs/​gfx950/​triton/​quant/​quant_fp8_blockwise/​DEFAULT.json Pins the axis-1, block-128 launch settings.
aiter/​ops/​triton/​configs/​gfx950/​triton/​gemm/​gemm_a8w8_blockscale/​GEMM-A8W8_BLOCKSCALE-N=1280-K=8192.json Tunes the M≤256 bucket with four-way split-K.
aiter/​ops/​triton/​configs/​gfx950/​triton/​gemm/​gemm_a16w16/​GEMM-A16W16-N=32-K=4096.json Tunes the M≤8 bucket with a smaller, two-warp tile.

Review effort: Balanced

)


@functools.cache
"BLOCK_SIZE_N": 16,
"BLOCK_SIZE_K": 256,
"GROUP_SIZE_M": 1,
"num_warps": 2,
"waves_per_eu": 2,
"matrix_instr_nonkdim": 16,
"cache_modifier": ".cg",
"NUM_KSPLIT": 4
# common shapes (4096/8192 × 7168/8192); larger values hurt weight kernel.
num_warps = min(16, max(1, block_size * block_size // 4096))
return {"num_warps": num_warps, "waves_per_eu": 2, "num_stages": 2}
params = {"num_warps": num_warps, "waves_per_eu": 2, "num_stages": 2}

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

Must fix before merge

  1. Resolve the merge conflicts with main in quant_fp8_blockwise.py (wrapper): #8093 changed the same imports, helpers and launch call. If the launch call keeps main's _fnuz_quant_launch_params(), the new gfx950 table is never read, because that helper calls _launch_params(block_size) without a key. Fix: rebase, and pass the table key through that helper.
  2. Measure the quant entry again on top of #8093 (DEFAULT.json): the 16-warp numbers were taken without #8093, which fixes the same slowdown. Also, float8_e4m3fn calls switch to 16 warps, and the PR has no numbers for them. Fix: measure fnuz and e4m3fn again, and keep the entry only where it is faster (or add the dtype to the key). Another option is to move the quant part to its own PR, so that the two GEMM files can merge now.

Nice to fix

  • Reply to the four Copilot comments- they seem to be valid.

This branch has not been deployed

No deployments
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.

4 participants