Skip to content

[Triton/Gluon] [Bugfix] gfx1250 unified attention 2D: store decode outputs from registers - #7203

Merged
k50112113 merged 9 commits into
ROCm:mainfrom
akao-amd:pr-gfx1250-ua2d-decode-register-store
Nov 11, 2026
Merged

k50112113 merged 9 commits into
ROCm:mainfrom
akao-amd:pr-gfx1250-ua2d-decode-register-store

Conversation

@akao-amd

@akao-amd akao-amd commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

For all-decode calls with gpt-oss's shapes, _unified_attention_2d_gfx1250 launches the 2D Gluon kernel with USE_TDM_STORE=False and plain gl.store (not the CDNA4 buffer_store). The LDS-staged TDM store of the output can write stale LDS on gfx1250, which silently corrupts served attention rows.

Motivation

The kernel stages its output tile in LDS (ds_store_b128), waits s_wait_dscnt 0 and writes it with tensor_store_from_lds. Under load the TDM store sometimes writes what that LDS held before. The same defect, with the same epilogue, is fixed for the a8w4 MoE decode kernel in a companion PR (gfx1250 a8w4 MoE decode: store the output tile from registers). Here the wrong values are plausible (about 32 elements of one token's output off by up to 68, never NaN/Inf), so nothing downstream flags them.

  • Offline, sliding-window decode (window 127, the same inputs 64x per CUDA graph, bitwise vs eager): 28,020 differing elements per million calls with 64 q / 8 kv heads at 64 requests, 22,700 at 128; 488-6,300 with 32 / 4 heads.
  • Serving (gpt-oss-120b, SGLang, every attention call recomputed in the graph and compared with the served output; 8k/1k and 1k/1k at c16 and c64): 472-535 corrupted rows per run at TP1, 4-7 at TP2, in sliding-window decode. GSM8K is unaffected, which is why this goes unnoticed.

Context (the same paragraph in the three companion gfx1250 PRs). Three defects and a compiler bug hit gpt-oss-120b on gfx1250 together and hid one another. (1) The TDM store of an LDS-staged output tile can ship stale LDS: the a8w4 MoE decode and unified attention 2D register-store PRs. The rule for when a TDM store may read LDS written by ds_store needs an answer from the LLVM AMDGPU / hardware side. (2) The Gluon 2D attention turns one NaN in a KV page tail into NaN for every query that reads the page: the V-masking PR. (3) LLVM placed the workgroup release's s_wait_dscnt 0 after s_barrier_signal at the top of a loop. That made attention extend non-deterministic and looked like (1). It is fixed by llvm/llvm-project#220357, which is in Triton main's LLVM and known to the compiler team (ROCm/rocm-libraries#10893). In serving, (1) in the MoE made one token's row NaN and (2) spread it to the whole batch. GSM8K failed only at TP2 and only after load. At TP1 the same race stayed finite and passed every gate. Related gfx1250 TDM/LDS ordering reports: #5712 (a TDM load racing a ds_read of the slot it overwrites), #4537 (TDM ring wait counts), the note in #4894's gfx1250 quant kernel ("fp8 TDM async_store corrupted data in tiles wider than 1024"), and LLVM 941a04e69ee8 (keep the TDM counter low), which lowers (1)'s rate to ~0.6x but not to 0. Other gfx1250 users of the Gluon MoE decode kernel may be exposed to (1): vLLM's gpt-oss Gluon MoE path (ROCm/vllm#1327) and ATOM's FlyDSL-prefill + Gluon-decode split.

Changes

  • _unified_attention_2d_gfx1250: REGISTER_STORE when head size 64 (q and v), 8 queries per kv head, page 64, bf16 output and the call is all-decode; then USE_TDM_STORE=False and USE_STORE_BUFFER_OP=False. The kernel's existing register-store path is used; no kernel change.
  • Narrow on purpose:
    • Other shapes keep the TDM store until the register path is validated for them.
    • Extend keeps it for now. With the register path, extend at 64 / 8 heads became non-deterministic because of the compiler bug (3) above. Extend can follow once the Triton in use has that fix.
    • buffer_store is not used: a gfx1250 GPU hung while AITER's attention tests ran on a variant that used it (cause not established).

Performance

Hardware Workload/configuration Before After Change
gfx1250 (MI450X, DPX partition) 2D kernel, gpt-oss decode shapes, same-minute alternating runs TDM store register store 0.981-1.000x time

Test

gfx1250 only (the launcher path is gfx1250-only).

  • Offline repro after the change: 0 in 640k calls at 64 requests (both head layouts), 0 in 320k at 128. One call is bitwise equal to the TDM-store path.
  • Serving, the same counters and load as above, 3 runs:
run corrupted sliding-decode rows (before -> after) GSM8K after load
TP2 4-7 -> 0 of 1.74M calls 0.9583
TP1, GPU 6 472-535 -> 0 of 0.84M 0.9613
TP1, GPU 7 472-535 -> 0 of 0.83M 0.9568

Extend rows remained (unchanged path, see above). Full-attention decode runs the 3D kernel (no TDM store): 0 in ~5.3M calls before and after.

Validated on the AITER tree of a gpt-oss gfx1250 recipe (base 2bb5491, with #6999) and the image's Triton (76940ad + revert); this commit is the same change on main. Not run: AITER's attention op tests on gfx1250, shapes other than gpt-oss's, end-to-end speed. The code comment says extend's register path "is not deterministic"; the cause was found later (compiler bug (3)).

MI355X (gfx950), 2026-11-05, image rocm/sgl-dev:v0.5.23-rocm10-mi35x-20261102, ROCm 10.0.0. pytest op_tests/triton_tests/attention/test_unified_attention.py at this head against merge-base ddb5085d31e2: 2500 passed, 0 failed. The 2 new test_gfx1250_gluon_ua2d_decode_register_store cases skip with "gfx1250 Gluon 2D kernel only, not gfx950". No outcome change on the other cases. The launcher edit is inside _unified_attention_2d_gfx1250, which runs only when DEVICE_ARCH == "gfx1250". CI shard 4 is the same 26 files as the green #7202 run (79.4 min against a 90 min cap). The cap fired in test_mha_varlen_large_kv.py and test_gemm_a8w8_blockscale_cktile_aq_rowmajor.py. On this box, after their one-time JIT, those two files take 42 s and 4 s on this head and on main.

PR Self-Review

Reviewed revision

db9c253a72d89184525afdc81d670b043d08e0b9

Behavior and intent

_unified_attention_2d_gfx1250 stages the output tile in LDS (ds_store_b128), waits s_wait_dscnt 0, and writes it with tensor_store_from_lds. On gfx1250 that store sometimes writes what the LDS held before. The values are plausible, about 32 elements of one token off by up to 68, never NaN or Inf, so GSM8K does not see them. The same epilogue on the a8w4 MoE decode kernel is #7202.

For gpt-oss decode the launcher now takes the kernel's existing register-store path: USE_TDM_STORE=False and USE_STORE_BUFFER_OP=False (plain gl.store, not the CDNA4 buffer_store). The register-store row offset is int64, matching the TDM store, so a large output stride does not wrap. The gate is head size 64 for Q and V, 8 queries per KV head, page 64, bf16 output, and all_decode.

Validation and unverified scope

gfx1250 only (MI450X, DPX partition). The launcher path is gfx1250-only. Recipe AITER 2bb549102 plus #6999, Triton 76940ad plus its revert. This commit is that change on main.

Offline, sliding window 127, the same inputs 64 times per CUDA graph, bitwise against eager. Before: 28,020 differing elements per million calls at 64 q / 8 kv heads and 64 requests, 22,700 at 128 requests; 488–6,300 per million with 32 / 4 heads. After: 0 in 640k calls at 64 requests (both head layouts), 0 in 320k at 128. One call is bitwise equal to the TDM-store path. Same-minute alternating kernel times: 0.981–1.000× the TDM store.

Serving, gpt-oss-120b, SGLang, every attention call recomputed in the graph and compared with the served output, 8k/1k and 1k/1k at c16 and c64. Corrupted sliding-window decode rows: TP2 4–7 per run to 0 of 1.74M calls (GSM8K 0.9583); TP1 GPU 6, 472–535 to 0 of 0.84M (GSM8K 0.9613); TP1 GPU 7, 472–535 to 0 of 0.83M (GSM8K 0.9568). Extend rows remained, on the unchanged path. Full-attention decode runs the 3D kernel, which has no TDM store: 0 in about 5.3M calls before and after.

Not run: AITER's attention op tests on gfx1250, shapes outside the gate, an end-to-end speed bracket.

PR-specific question

The boundary is the host predicate. A call that misses one conjunct keeps USE_TDM_STORE=True and can still ship stale LDS. Extend is excluded on purpose, not because the race is absent there. With the register path, extend at 64 / 8 heads was non-deterministic: LLVM placed the workgroup release's s_wait_dscnt 0 after s_barrier_signal at the top of the loop (llvm/llvm-project#220357). Letting extend through before the Triton in use has that fix reintroduces that failure, which looks like this store race and is not. The serving counters are the check that the gate holds: sliding-window decode rows go to 0, and extend rows stay on the old path.

USE_STORE_BUFFER_OP is forced false inside the gate. A gfx1250 GPU hung while AITER's attention tests ran on a variant that used the CDNA4 buffer_store. The cause was not established, so the gated path uses plain gl.store.

One eager call matching the TDM-store path bitwise is the check that the register path writes the same tile when the race does not fire. The replay counts (640k / 320k offline, and the serving counters above) are the check that it no longer fires under load. Full-attention decode never enters this kernel.

Changed op tests

op_tests/triton_tests/attention/test_unified_attention.py — test_gfx1250_gluon_ua2d_decode_register_store. gpt-oss all-decode shapes (head 64, 8 query heads per KV head, page 64, bf16 out) take the register-store epilogue. The test checks the output against the paged reference and compares CUDA-graph replays bitwise with the eager call. It does not run off gfx1250.

🤖 Generated with Claude Code

…rs (gpt-oss shapes)

For all-decode calls with gpt-oss's shapes (head 64, 8 queries per kv head, page 64, bf16
out) the 2D kernel stores its output with plain global stores from registers instead of
staging it in LDS for tensor_store_from_lds, whose LDS read can miss the wave's ds_stores
on gfx1250. Extend keeps the TDM store: the register path is not deterministic there at
TP1 heads (open). CDNA4 buffer_store is not used on gfx1250.

Serving (gpt-oss-120b base1028, in-graph attention pair counters, 8k/1k and 1k/1k at c16
and c64): sliding-window decode corrupted served rows TP1 472-535 per run before, 0 after
(2 runs); TP2 4-7 before, 0 after. Extend unchanged (rare). GSM8K TP2 0.9583, TP1 see report.

Co-Authored-By: Claude <[email protected]>
@akao-amd
akao-amd requested a review from a team October 30, 2026 07:07
@akao-amd akao-amd closed this Oct 30, 2026
@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 7203 --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.

@aiter-bot

aiter-bot commented Oct 30, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 7975f02119f2 · 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 — Reviewed revision must contain at least the first 7 characters of the current head SHA

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

@akao-amd akao-amd reopened this Oct 30, 2026
@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 7203 --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.

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 newly selected register path can overflow output offsets and write out of bounds for large-stride bf16 outputs, and the affected all-decode sliding-window branch lacks test coverage.

2 open issues
What changed in this PR

This PR updates gfx1250 unified attention dispatch to avoid stale output from LDS-staged TDM stores for specific gpt-oss decode shapes.

Changes:

  • Enables the existing register-store path for all-decode calls with 64-element query/value heads, eight queries per KV head, 64-token pages, and bf16 output.
  • Uses plain global stores rather than buffer stores for those calls.
  • Leaves extend calls and other shapes on the existing TDM-store path.
File Description
aiter/​ops/​triton/​attention/​unified_attention.py Adds the decode-shape gate and selects the existing register-store path.

Review effort: Balanced

@k50112113

Copy link
Copy Markdown
Contributor

@akao-amd What is the Triton compiler version you are using? Can you provide a repro? I think this is more like a bug issue report rather than a PR simply to bypass it.

akao-amd and others added 2 commits November 3, 2026 14:44
…store epilogue

The register store computed token index * output_stride_0 in int32. With a
strided output (3 x 64 x 64 bf16, strides 2**30, 64, 1) row 2 wrapped and the
store faulted (illegal memory access). Use an int64 row start, as the TDM
store already does.

Co-Authored-By: Claude <[email protected]>
…inst the reference and graph replays

gpt-oss decode shapes (head 64, 8 query heads per KV head, page 64, bf16 out,
sliding window 128) take the register-store epilogue. Check the output against
ref_paged_attn and 32 CUDA graph replays bitwise against the eager call.

Co-Authored-By: Claude <[email protected]>
@akao-amd

akao-amd commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@k50112113 Thanks for the review. Versions: validated with Triton 76940ad + a revert of 9debefe, LLVM b010a18d, ROCm 10.1, AITER 2bb549102 + #6999 (the rocm/sgl-dev:v0.5.23-rocm101-mi45x images).

Repro: repro_7203_tdm_store.py: gpt-oss decode shape, 64 calls per CUDA graph, every replay compared bitwise with an eager call. On 10-30 it gave 28,020 differing elements per million calls with the TDM-store epilogue (0 with the register store). Today, on another MI450X box (ROCm 10.1, image of 11-02), the same repro gives 0 on main, 0 on the original tree and 0 with the register store (512k calls). So the race depends on something outside this kernel, for example the device or its firmware. I agree that it belongs in a bug report, and I will file one with the 10-30 data. Until it is understood I would keep this PR open as the mitigation, or close it if you prefer to wait for the report.

@akao-amd

akao-amd commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

The 10-30 Aiter Test Gate failure was an MI35X shard ("Standard Tests (1 GPU)") that timed out at 90 min; it does not run the changed gfx1250 path. The new head will run CI again. Could a maintainer add ci:gfx1250-ffm-triton so that the new gfx1250 test runs?

@akao-amd

akao-amd commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@k50112113 Following up on your question. Versions and the repro are in the comment above. The script is https://gist.github.com/akao-amd/bae984dabc2c1a38d756318ef784abcf (repro_7203_tdm_store.py). It reproduced on 2026-10-30. On 2026-11-03, on another MI450X with the 11-02 image, the same script was clean on main, on the original tree, and with the register store (512k calls). I am filing that as a bug and would keep this PR open as the mitigation until the race is understood. Close it if you would rather wait on the bug.

@ROCm/team_aiter @ROCm/triton_kernels_team Could a maintainer add ci:gfx1250-ffm-triton so the new gfx1250 test runs? The label exists; this PR only has Triton/Gluon.

The red Aiter Test is shard 4 hitting the 90-minute limit in op_tests/test_gemm_a8w8_blockscale_cktile_aq_rowmajor.py, the same pattern as #7201. https://github.com/ROCm/aiter/actions/runs/41592123755

@akao-amd

akao-amd commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@azaidy Tagging you as a Gluon owner for the gfx1250 Gluon unified attention 2D decode register-store change in this PR. The open question from k50112113 is in the thread above.

@akao-amd

akao-amd commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@k50112113 Filed as #7512.

Re-ran the gist today, unedited (sliding_window=128), on ctmocha-aris-e21-13 GPU 6 (ASIC 0xC6181ECF560C08D6, VBIOS 00206807 built 2026/10/09). AITER main fe86c6e versus this PR at db9c253. 512,000 calls. Eager warm-up was 0 in every run. The mismatches are graph replays.

image main this PR
rocm/sgl-dev:v0.5.23-rocm101-mi45x-20261031 8,663 bad elements (16,920 per million), max abs diff 3.78 0
rocm/sgl-dev:v0.5.23-rocm101-mi45x-20261102 6,808 bad elements (13,297 per million), max abs diff 3.71 0

The 11-03 clean run was a different MI450X. On this GPU the 20261102 image still shows the race on main, and the register store is clean. I would keep this PR open as the mitigation. The issue has the firmware block and the 10-30 numbers. The 10-30 writeup says window 127. Today's runs, the gist, and test_gfx1250_gluon_ua2d_decode_register_store use 128.

@k50112113

k50112113 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Latest upstream triton (commit f254bd63d5ee162347da8f79ff0a3ed3b0936fe9) fixes the bug:

image

I pulled AITER main to test your repro_7203_tdm_store.py

@akao-amd

akao-amd commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@k50112113 I reran the gist with Triton f254bd63 on a GPU where the race shows. It lowers the rate by about 50x but does not remove it.

Setup: the gist repro_7203_tdm_store.py, unedited (sliding_window=128), with --replays 8000 --calls 64 --seqs 64, which is 512,000 calls per run. AITER main fe86c6e, whose decode epilogue is still LDS plus tensor_store_from_lds. MI450X (gfx1250), HIP device 2 on ctheliosp-zuse-f19-14 (ASIC 0xCA22C88B3D8CAE28, IFWI 00210788). Image rocm/sgl-dev:v0.5.23-rocm10-mi45x-20261108 (ROCm 10.0.0). Same GPU, same AITER, same inputs. Only the Triton changes between rows, and the runs alternated control, candidate, control, candidate.

Triton run 1 run 2
image 76940ad348 (control) 26,304 bad elements (51,375 per million calls), max abs diff 3.92 26,456 (51,672 per million), max abs diff 3.92
f254bd63d5ee (built from source, nothing else changed) 392 bad elements (766 per million), max abs diff 3.19 544 (1,062 per million), max abs diff 3.19

Eager warm-up was 0 in every run, so all the mismatches are CUDA-graph replays. This PR's head (db9c253, register store) on the same GPU with the image Triton: 0 in 512,000 calls.

So f254bd63 does not fix the race on this GPU, and this PR is still needed as the mitigation. At the lower rate a short run can come back clean: the 12,800-call run (--replays 200) with f254bd63 was 0 here. Your run may also have been on a GPU where the race does not show: on 11-03 a different MI450X was clean even with the image Triton. Something between 76940ad and f254bd63 reduces the rate. I have not bisected which commit does that.

Prior point, 2026-11-05, ctmocha-aris-e21-13 GPU 6, AITER main fe86c6e against this PR at db9c253, 512,000 calls, image Triton:

image main this PR
rocm/sgl-dev:v0.5.23-rocm101-mi45x-20261031 8,663 bad elements (16,920 per million), max abs diff 3.78 0
rocm/sgl-dev:v0.5.23-rocm101-mi45x-20261102 6,808 bad elements (13,297 per million), max abs diff 3.71 0

Today's image differs from 11-05. Its Triton is plain 76940ad348. On 11-05 the image Triton was 60bc362eed, which is 76940ad plus the revert of 9debefe, and the ROCm was 10.1 instead of 10.0. The control races on both.

The internal Triton ticket on this TDM-store behavior (triton-tickets#2164) measured the register-store fix on _moe_gemm_a8w4_decode (#7202). This kernel is unified attention 2D (#7512, this PR), so that ticket does not verify this PR.

Drop the decode-shape gate that rejected configs without USE_TDM_STORE=false. The gpt-oss entries already set the flag, so the config alone selects the register-store epilogue. Other shapes keep TDM stores unless their config says otherwise.

Update the gate test to check the flag per config entry, and remove the unflagged-leaf rejection test.

@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, please resolve conflicts and we'll let CI run

# Conflicts:
#	aiter/ops/triton/attention/unified_attention.py
#	aiter/ops/triton/utils/unified_attention_utils.py
#	op_tests/triton_tests/attention/test_unified_attention.py
@k50112113

Copy link
Copy Markdown
Contributor

Please fix the black and ruff formatting required by the CI thanks

# Conflicts:
#	aiter/ops/triton/attention/unified_attention.py
#	op_tests/triton_tests/attention/test_unified_attention.py
@k50112113
k50112113 merged commit 61b4e7b into ROCm:main Nov 11, 2026
vpietila-amd pushed a commit that referenced this pull request Nov 12, 2026
…tputs from registers (#7203)

* gfx1250 gluon unified attention 2D: store decode outputs from registers (gpt-oss shapes)

For all-decode calls with gpt-oss's shapes (head 64, 8 queries per kv head, page 64, bf16
out) the 2D kernel stores its output with plain global stores from registers instead of
staging it in LDS for tensor_store_from_lds, whose LDS read can miss the wave's ds_stores
on gfx1250. Extend keeps the TDM store: the register path is not deterministic there at
TP1 heads (open). CDNA4 buffer_store is not used on gfx1250.

Serving (gpt-oss-120b base1028, in-graph attention pair counters, 8k/1k and 1k/1k at c16
and c64): sliding-window decode corrupted served rows TP1 472-535 per run before, 0 after
(2 runs); TP2 4-7 before, 0 after. Extend unchanged (rare). GSM8K TP2 0.9583, TP1 see report.

* gfx1250 gluon unified attention 2D: int64 row offset in the register-store epilogue

The register store computed token index * output_stride_0 in int32. With a
strided output (3 x 64 x 64 bf16, strides 2**30, 64, 1) row 2 wrapped and the
store faulted (illegal memory access). Use an int64 row start, as the TDM
store already does.

* op_tests: gfx1250 unified attention 2D: all-decode register store against the reference and graph replays

gpt-oss decode shapes (head 64, 8 query heads per KV head, page 64, bf16 out,
sliding window 128) take the register-store epilogue. Check the output against
ref_paged_attn and 32 CUDA graph replays bitwise against the eager call.

* gfx1250 UA2D: enforce safe register-store gate

* gfx1250 UA2D: use the USE_TDM_STORE config flag as the only switch

Drop the decode-shape gate that rejected configs without USE_TDM_STORE=false. The gpt-oss entries already set the flag, so the config alone selects the register-store epilogue. Other shapes keep TDM stores unless their config says otherwise.

Update the gate test to check the flag per config entry, and remove the unflagged-leaf rejection test.

* op_tests: fix black and ruff formatting in unified attention tests

---------
Co-authored-by: akao-amd <[email protected]>
Co-authored-by: Shao-Chun Lee <[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