Skip to content

[ASM] [HIP] gfx1250 mha bwd d192 d128 kernel integration - #6996

Merged
JaxChen29 merged 3 commits into
ROCm:mainfrom
JaxChen29:hd192_128_gfx1250_bwd
Oct 30, 2026
Merged

JaxChen29 merged 3 commits into
ROCm:mainfrom
JaxChen29:hd192_128_gfx1250_bwd

Conversation

@JaxChen29

@JaxChen29 JaxChen29 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

gfx1250 has an assembly FMHA backward path for hdim_q == hdim_v == 128, added in
#6454, but nothing registered for the
192/128 head-dim pair. This adds the bf16 hd192_128 backward objects for gfx1250 —
batch and group mode, causal and non-causal, non-deterministic and deterministic —
so the asm path covers a second head dim on that arch.

Technical Details

Fourteen files: twelve kernel objects, two manifests, one README line. No host-side
C++ change is required
.
Objects go flat under hsa/gfx1250/fmha_v3_bwd/, following the existing naming
(bwd_<hdim>_<dtype>[_causal_br]_a32_pssk[_group][_det].co, _group before _det).
Nothing enumerates them — setup.py copies the whole hsa tree and hsa/codegen.py
globs the manifests.
Registration adds 8 rows to fmha_bwd_dqdkdv.csv ({default, det, group, group_det} × {non-mask, causal_br}, with hdim_q=192 hdim_v=128 pssk=1 pddv=0 ts_qo=32 ts=128) and 4 rows to fmha_bwd_dq_convert.csv. The det column is
already upstream from #6454; these rows only populate it for a second head dim, so
no schema change. Each hd192_128 dqdkdv pair sits directly after the hd128 pair in
the same (det, mode) block, preserving the existing block order.
The dq_convert rows carry hdim_v=192 deliberately: that matches the gfx950
convention, where the dq_convert object is shared between hd192_192 and hd192_128,
and the dq_convert lookup keys on hdim_q/mode/det/bf16_cvt without consulting
hdim_v.

Test Plan

Tested on a07-3 (gfx1250), docker image rocm/fw-bringup:gfx1250-atom-dev-20260707 (ROCm 7.14.0), amdgpu-dkms 1:7.1.0.31300009-2410483.24.04.

Test all features supported and evaluate perf of each kernel.

Test Result

Results

Head dim dqdkdv objects Pass Deterministic bit-exact
hd128 unchanged (device scope) 48/48 25/25
hd192/128 this PR (CU-scope dQ atomics) 48/48 25/25
hd192/128 device-scope build, for comparison 48/48 25/25

gfx1250 function test pass.

Performance: hd192/128 backward (gfx1250)

Shape: b=4, h=64, h_k=4, s=s_k=8192, d=192, d_v=128, bf16, atomic_fp32, batch mode.

Mode Mask Deterministic Constant 0.1 (-init=3) Random (-init=1, default)
batch none off 10.404 ms, 2748 TFLOPS 13.600 ms, 2102 TFLOPS
batch none on 18.440 ms, 1550 TFLOPS 23.886 ms, 1197 TFLOPS
batch causal off 6.788 ms, 2106 TFLOPS 8.763 ms, 1631 TFLOPS
batch causal on 9.748 ms, 1466 TFLOPS 12.269 ms, 1165 TFLOPS

Command: ./bwd.exe -prec=bf16 -b=4 -h=64 -h_k=4 -s=8192 -s_k=8192 -d=192 -d_v=128 -bwd_v3=1 -kname=1 -v3_atomic_fp32=1 -mode=0 -v=0 -warmup=20 -repeat=10 -mask={0|b} -deterministic={0|1} -init={3|1}

Submission Checklist

@JaxChen29
JaxChen29 requested a review from a team October 27, 2026 06:41
@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 6996 --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.

@github-actions github-actions Bot changed the title gfx1250 mha bwd d192 d128 kernel integration [ASM] gfx1250 mha bwd d192 d128 kernel integration Oct 27, 2026
@github-actions github-actions Bot added the ASM label Oct 27, 2026
@zufayu
zufayu requested a review from shay-li77 October 28, 2026 02:33
@github-actions github-actions Bot changed the title [ASM] gfx1250 mha bwd d192 d128 kernel integration [ASM] [HIP] gfx1250 mha bwd d192 d128 kernel integration Oct 29, 2026
@github-actions github-actions Bot added the HIP label Oct 29, 2026
@JaxChen29
JaxChen29 requested a review from slippedJim October 29, 2026 03:39
slippedJim
slippedJim previously approved these changes Oct 29, 2026

@slippedJim slippedJim 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

@slippedJim slippedJim 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

@shay-li77 shay-li77 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

@JaxChen29
JaxChen29 merged commit 5826f22 into ROCm:main Oct 30, 2026
58 checks passed
solinzby1 pushed a commit that referenced this pull request Nov 2, 2026
* register gfx1250 hd192_128 bwd objects, including deterministic

* add perf co

* remove unused perf co
shantipriya-amd pushed a commit to shantipriya-amd/aiter that referenced this pull request Nov 18, 2026
* register gfx1250 hd192_128 bwd objects, including deterministic

* add perf co

* remove unused perf co
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