Skip to content

[Triton/Gluon] [Config] Add gfx1151 gemm_a16w16 DEFAULT.json - #6671

Merged
azaidy merged 2 commits into
mainfrom
amd/dev/klin/triton-gfx1151-gemm-a16w16-config
Oct 21, 2026
Merged

azaidy merged 2 commits into
mainfrom
amd/dev/klin/triton-gfx1151-gemm-a16w16-config

Conversation

@klin-amd

@klin-amd klin-amd commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

gemm_a16w16 is broken on AMD Ryzen AI Max+ 395 (gfx1151). It raises an AssertionError:

AssertionError: Required config file doesn't exist:
.../configs/gfx1151/triton/gemm/gemm_a16w16/DEFAULT.json

All 180 Triton tests fail. The kernel is correct. Only the tuned config file is absent. gfx1150 has this file. gfx1151 does not.

#4814 did similar work for gfx1151. That PR is closed. This PR adds the file with values tuned on gfx1151 hardware.

Technical Details

This PR adds one file. It changes no code.

aiter/ops/triton/configs/gfx1151/triton/gemm/gemm_a16w16/DEFAULT.json
Bucket Tile (M x N x K) Warps
M_LEQ_64 32 x 16 x 256 2
M_LEQ_256 64 x 64 x 128 4
M_LEQ_1024 128 x 64 x 64 4
any 128 x 128 x 64 4

All buckets use GROUP_SIZE_M 1, num_stages 2, waves_per_eu 1, matrix_instr_nonkdim 16, cache_modifier null and NUM_KSPLIT 1. These are the keys of the family, as configs/AGENTS.md requires.

A tile sweep on gfx1151 selected these values. For M of 64 and below, a small tile is faster. Thus the file gives that
range its own bucket.

These values are measured on gfx1151, not copied from another architecture.

Not in this PR

  • The persistent (108 tests) and atomic (84 tests) variants still fail on gfx1151. They read their own config families (GEMM-A16W16-PERSISTENT, GEMM-A16W16-ATOMIC), which have no gfx1151 file. A follow-up PR can add them.
  • gfx1150 keeps its current file. I did not measure on gfx1150.
  • With activation="gelu" or "gelu_tanh", the kernel is slow on gfx1151. [Triton/Gluon] gfx1151 gemm_a16w16: round before the activation to avoid spills #6676 corrects most of this in the kernel. A config change cannot correct it.

Test Plan

Run the Triton tests on a gfx1151 host. Run them first on main, then with this PR.

pytest op_tests/triton_tests/gemm/basic/test_gemm_a16w16.py \
  -k "triton and not persistent and not atomic"

This command covers the plain, activation and layout tests.

Reproduce

import torch
from aiter.ops.triton.gemm.basic.gemm_a16w16 import gemm_a16w16
from aiter.ops.triton.utils.gemm_config_utils import get_gemm_config

for M in (32, 128, 666, 4096):
    cfg, tuned = get_gemm_config("GEMM-A16W16", M, 4608, 1152, backend="triton")
    x = torch.randn(M, 1152, device="cuda", dtype=torch.bfloat16)
    w = torch.randn(4608, 1152, device="cuda", dtype=torch.bfloat16)
    y = gemm_a16w16(x, w)
    print(M, cfg["BLOCK_SIZE_M"], cfg["BLOCK_SIZE_N"], cfg["BLOCK_SIZE_K"], tuned)

On main, this raises the AssertionError above. With this PR, it prints the tile for each bucket. tuned is False for every M, because this PR adds the default file only.

Test Result

On AMD Ryzen AI Max+ 395 (gfx1151) + torch 2.13.0+rocm7.15.0a20260728 + Triton 3.8.0+git4cff872c :

Tree Result
main (727439c) 180 failed (missing config), 540 skipped, 300 deselected
this PR 180 passed, 540 skipped, 300 deselected

Both runs skip 540 Gluon tests and deselect 300. Gluon does not support gfx1151.

Submission Checklist

On gfx1151, gemm_a16w16 stops before it compiles a kernel, because there
is no configs/gfx1151/triton/gemm/gemm_a16w16/DEFAULT.json.

The M_LEQ_256 and M_LEQ_1024 buckets are the gfx1151 table from #4814
(@tangzzycc), the same values that #5997 seeded into gfx1150. The "any"
bucket (M > 1024) changes from 64x64x256 to 128x128x64: over 12 large-M
shapes on gfx1151 it measured 32.4 TFLOPS geomean against 25.3.

Co-authored-by: tangzzycc <[email protected]>
Co-authored-by: Claude <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

Label Tests
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 gfx1201 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 6671 --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.

…kets

The M_LEQ_1024 tile from #4814 (32x32x256) is slow for large N and K on
gfx1151. For example, 666 x 9728 x 2432 ran at 7.2 TFLOPS.

- M_LEQ_64: the #4814 M_LEQ_256 tile (32x16x256, 2 warps). It is the best
  or near the best for M <= 64.
- M_LEQ_256: 64x64x128, 4 warps (new).
- M_LEQ_1024: 128x64x64, 4 warps (new).

Over 10 shapes for each bucket, which include the LLM shapes of #4814, the
geomean goes from 17.0 to 27.1 TFLOPS for 256 < M <= 1024. No shape is
slower than with the #4814 tile.

Co-authored-by: tangzzycc <[email protected]>
Co-Authored-By: Claude <[email protected]>
@menglcai-amd
menglcai-amd marked this pull request as ready for review October 20, 2026 07:28
@menglcai-amd
menglcai-amd requested a review from a team October 20, 2026 07:28
@Boss2002n
Boss2002n requested a balanced review from Copilot October 20, 2026 09:33

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 hardware-specific settings need human review of the reported gfx1151 correctness and performance evidence.

No open issues 🎉

What changed in this PR

Adds the missing gfx1151 default configuration for the existing Triton gemm_a16w16 path.

Changes:

  • Adds three M-size buckets and an any fallback with hardware-tuned launch settings.
  • Leaves kernels, public APIs, and other architectures unchanged.
File Description
aiter/​ops/​triton/​configs/​gfx1151/​triton/​gemm/​gemm_a16w16/​DEFAULT.json Supplies four default configurations for gfx1151 GEMM.

Review effort: Balanced

@azaidy
azaidy self-requested a review October 20, 2026 22:29
@azaidy azaidy self-assigned this Oct 20, 2026

@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 3e20e23 into main Oct 21, 2026
@azaidy
azaidy deleted the amd/dev/klin/triton-gfx1151-gemm-a16w16-config branch October 21, 2026 17:50
menglcai-amd pushed a commit that referenced this pull request Nov 8, 2026
…fx1150

The gfx1150 file has the values that #5997 copied from gfx1151. #6671
then replaced the gfx1151 values for M > 64, but not the gfx1150 values.
This copies the current gfx1151 file to gfx1150.

On gfx1150 (Radeon 890M), bf16 + bias, 37 shapes: geomean 1.59x faster
than main; 36 of 37 shapes are the same or faster.

Co-Authored-By: Claude <[email protected]>
Boss2002n pushed a commit that referenced this pull request Nov 27, 2026
)

* [Triton/Gluon] [Config] Use the gfx1151 gemm_a16w16 DEFAULT.json on gfx1150

The gfx1150 file has the values that #5997 copied from gfx1151. #6671
then replaced the gfx1151 values for M > 64, but not the gfx1150 values.
This copies the current gfx1151 file to gfx1150.

On gfx1150 (Radeon 890M), bf16 + bias, 37 shapes: geomean 1.59x faster
than main; 36 of 37 shapes are the same or faster.

* [Triton/Gluon] [Config] gfx1150 gemm_a16w16: use values from a gfx1150 search

A tile search on gfx1150 (Radeon 890M) replaced the copied gfx1151 values:
- M_LEQ_256: 64x64x64, 2 warps (was 64x64x128, 4 warps).
- Split M_LEQ_1024 at 512: M_LEQ_512 keeps 128x64x64; 512 < M <= 1024
  uses the any tile, 128x128x64.

Against main, 45 shapes: geomean 1.62x; 2 shapes are slower
(768x1536x1536 0.88x, 640x3072x768 0.98x).

Co-authored-by: menglcai <[email protected]>
klin-amd added a commit that referenced this pull request Nov 30, 2026
…AULT.json re-pick


18 GEMM-A16W16-N=<N>-K=<K>.json files from the official tuner on gfx1151,
with the large-M buckets re-timed with and without fused activations,
and the DEFAULT.json buckets above M = 64 re-picked: #6671 was tuned
before #5505 changed the tile remap, and its GROUP_SIZE_M 1 entries are
now much slower on wide N.

Signed-off-by: Lin, KuanTing <[email protected]>
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.

3 participants