Skip to content

[Triton/Gluon] [JIT] gfx1250-strict enablment fixes - #7767

Merged
omuhamma merged 50 commits into
mainfrom
a0-enablment-fixes
Nov 23, 2026
Merged

omuhamma merged 50 commits into
mainfrom
a0-enablment-fixes

Conversation

@omuhamma

@omuhamma omuhamma commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Lets aiter's Triton and Gluon kernels and their unit tests run on MI450 gfx1250-strict.
All changes apply only when the GPU is gfx1250-strict, except four bug fixes that also help other archs: MHA decode, MHA spatial swizzle, NVFP4 quant and MXFP8 quant.
Needs a Triton that includes triton-lang/triton#12474. Tested with Triton 46eccb199b.

Changes

Area File(s) Change
HIP reference ops used by Triton tests aiter/jit/core.py Also build for the running GPU when GPU_ARCHS=gfx1250 but the device is gfx1250-strict, so test reference modules load.
Tuned configs aiter/ops/triton/utils/config_utils.py Accept hyphenated arch ids (gfx1250-strict) in _ARCH_OVERRIDE_RE. If configs/gfx1250-strict/<family> is missing, use the gfx1250 table and log a one-time "not tuned" warning.
Configs aiter/ops/triton/configs/gfx1250-strict/ Untuned DEFAULT.json tables with only an any entry, plus a README. Gluon quant tables are left out, so quant uses the gfx1250 tables. The afp4wfp4 preshuffled tables also get the gfx1250 small-M entries, which fixes fused_gemm_afp4wfp4_a16w16 (1,152 / 0) and fused_gemm_afp4wfp4_mul_add (2,048 / 0).
fp8 dtypes aiter/ops/triton/utils/types.py gfx1250-strict uses OCP fp8, not float8_e4m3fnuz.
LDS capacity aiter/ops/triton/utils/_triton/arch_info.py Add gfx1250-strict: 327680.
Kernel arch checks mha_fp8.py, mha_mxfp8.py, chunk_kda.py, unified_attention.py, fused_compress_attn.py, comms/all_reduce.py Accept the gfx1250 family where the code compared against exactly "gfx1250". The unified_attention 3D split rebalance now also runs on gfx1250-strict.
flash_kda _triton_kernels/kimi_delta_attn/flash_kda.py gfx1250-strict takes the gfx1250 Gluon paths instead of silently falling back to Triton.
pa_mqa_logits attention/pa_mqa_logits.py Compile the Gluon kernel for the GPU actually in use, not the arch named in GPU_ARCHS. It used to return garbage logits on gfx1250-strict.
MHA spatial swizzle attention/mha.py Use the spatial workgroup mapping only when it covers every tile. A0 has 6 XCDs, so it often doesn't; 8-XCD parts are unchanged. mha_spatial_swizzle: 22 / 22.
MHA decode _triton_kernels/attention/dao_ai/fwd_decode.py The non-paged decode loop now moves its K/V load bounds with each tile, so it no longer reads past the end of the cache. mha_v3: 586 / 0. Should also fix gfx1250's 2 NaN cases (not yet run on gfx1250).
Matrix instructions A0 can't run _gluon_kernels/common/utils.py, gemm_a8w8_blockscale.py, fp8_mqa_logits.py, mha_fp8.py, unified_attention_2d.py, unified_attention_3d.py, gluon/pa_mqa_logits.py, moe_op_gemm_a4w4.py A0 gives wrong results for the fp8 16x16x128 and fp4 32x16x128 matrix instructions. On gfx1250-strict, use the scaled 16x16x128 instruction instead (with unit scales for fp8). gemm_a8w8_blockscale 233 / 240 → 473 / 0, pa_mqa_logits_2d_context_lens 1 / 0, and every moe_gemm_a4w4 Gluon case now passes.
unified_attention gather unified_attention_2d.py Call tdm.async_gather correctly on newer Triton. Fixes 15 cases in a 240-case sample.
NVFP4 quant _triton_kernels/quant/quant.py Gluon kernels can now call _nvfp4_quant_op. Fixes the 24 fused_kv_cache NVFP4 cases, on gfx1250 too.
MXFP8 quant _gluon_kernels/gfx1250/quant/quant.py Pad the scale buffer only where newer Triton allows it. quant_mxfp8: 161 / 0, same as gfx1250. Fixes compile errors on gfx1250 too.
Test gates op_tests/triton_tests/..., op_tests/multigpu_tests/triton_test/test_all_reduce.py, test_all_reduce_rmsnorm_quant.py Run the gfx1250 tests on gfx1250-strict too. quant_mxfp4 now matches gfx1250 (106 / 13), and pa_prefill_sparse runs all 29 tests.
Triton version none With Triton 46eccb199b, gemm_afp8wfp8 (650 / 0), rope, fused_qkv_split_qk_rope and mla_decode_rope pass with no aiter change.

Test results (A0, all 165 Triton test files)

All files in op_tests/triton_tests, branch a0-enablment-fixes rebased onto aiter 75a36b847. The full run used Triton 3.9. Every file that failed was re-run on Triton 46eccb199b, which these results use. Files that passed were not re-run.

  • 121 files fully pass
  • 19 files fail because of Triton bugs for gfx1250-strict:
    • Triton still blocks these matrix instructions on gfx1250-strict, although A0 runs them correctly (checked on A0). [AMD] Enable Remaining GFX1250-strict WMMA Instructions triton-lang/triton#12474 unblocked only the scaled 16x16x128 pair. With the block removed in a local Triton build, all of these failures go away (Triton issue: ):
      • v_wmma_f32_16x16x32_bf16 and v_wmma_f32_16x16x32_f16: gemm_a16w16, ff_a16w16, batched_gemm_bf16, batched_gemm_a16w8, batched a8w8 per-token-group prequant, pa_decode_sparse, pa_prefill_sparse, chunk_kda, mla_v4_triton, mla, unified_attention, flash_kda
      • v_wmma_f32_16x16x64_fp8_fp8 (and the bf8 variants): mla, fp8_mqa_logits, mha_fp8_gfx1250, unified_attention, fused_kv_cache
      • v_wmma_i32_16x16x64_iu8: nothing fails; fav3_sage falls back (see below)
      • Plain Triton tl.dot doesn't fail. It silently falls back to v_wmma_f32_16x16x4_f32, or to v_dot4_i32_iu8 for int8: performance drops a lot and accumulation order changes. gmm's 8 TGMM mismatches come from this; gmm passes 118 / 0 with the block removed.
      • With the block removed, mla is 673 / 2: 2 values are just over tolerance (0.016 vs 0.015), the same as a gfx1250 build.
    • Triton turns on gfx1250's expert scheduling for gfx1250-strict without the scheduler that goes with it, which gives wrong results in mha_mxfp8 (4 of 35), moe_gemm_a8w4 (1 in a 90-case sample) and moe_gemm_a4w4's Triton backend (4 SwiGLU cases). All pass with TRITON_HIP_USE_COEXEC_SCHEDULER=1, and as a gfx1250 build (Triton issue: ).
  • 11 files have other failures, all shared with gfx1250 (same failure on both), except where noted:
    • moe_gemm_a16w4 (373 / 1,404 on Triton 3.9, all 1,777 cases):
      • 1,152 fail on v_wmma_f32_16x16x32_bf16 (gluon and default backends; pass with the block removed)
      • 192 Triton-backend cases with hbm_swizzling=True: the Triton backend reads GFX1250_SCALE-swizzled scales as unswizzled (110 over tolerance, 53 inf/NaN positions differ, 23 crash with an abort, 6 hang). Same failure and abort on gfx1250 at 8c964fa61.
      • 60 Triton-backend cases with apply_swiglu=True and hbm_swizzling=False (larger shapes): about 20–30% of elements over tolerance. All 60 fail the same way on gfx1250.
    • rmsnorm (39): rmsnorm_large_m_small_n config ships for gfx950 only. gfx1250 also has 4 extra numerical mismatches on very large tensors (919 of 537M elements).
    • fused_reduce_add_rmsnorm (120): config ships for gfx950 only
    • mhc (41): mhc_post / mhc_fused_sinkhorn configs ship for gfx950 only
    • fused_bmm_rope_kv_cache (128): gfx950-only config, plus "KV cache dtype must be BF16, FP8 or packed FP4"
    • sonicmoe (23): no BF16 Triton config outside gfx950
    • pa_decode_gluon (18): kernel supports gfx942/gfx950 only, but the test doesn't skip
    • topk (9): TDM needs 16-byte-aligned strides, and N=4097 isn't aligned
    • quant_mxfp4 (13) and fused_mxfp4_quant (72): aiter/utility/fp4_utils.py _dynamic_mxfp4_quant_kernel_asm_layout indexes the scalar bs_offs_n = pid_n as [None, :], which Triton rejects.
    • fav3_sage (571): MXFP4 is not supported on gfx1250-strict. The MXFP4 wrapper is gfx950-only, but the test only checks is_fp4_avail(), which is true on gfx1250.
  • 14 files skip every test on gfx1250 too, by design: their kernels or tests only support other archs (gfx950, gfx942, gfx1100, gfx1200).

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

@vgokhale vgokhale changed the title A0 enablment fixes gfx1250-strict enablment fixes Nov 11, 2026
@omuhamma omuhamma self-assigned this Nov 11, 2026
omuhamma and others added 27 commits November 11, 2026 22:22
On an MI450 A0, ROCr reports gfx1250-strict while images commonly set
GPU_ARCHS=gfx1250. _needs_arch_rebuild() then rebuilds the prebuilt module
"for gfx1250-strict", but build_module() took --offload-arch only from
GPU_ARCHS, so the rebuilt .so again held only gfx1250 code and loading it
raised ModuleNotFoundError. Every HIP JIT op failed this way on A0.

Append get_gfx_runtime() to the offload-arch list when it is not already
covered (and GPU_ARCHS is not "native"). The target stays the exact arch
identity, as build_targets.base_gfx_arch() requires for build targets.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tables

Two problems kept every config-driven Triton/Gluon kernel off MI450 A0,
which reports gfx1250-strict:

* _ARCH_OVERRIDE_RE rejected the hyphen, so callers that pass
  arch=<device arch> (unified attention, mHC, MLA, sparse MLA) asserted
  before any kernel ran. Allow hyphen-separated suffixes.

* resolve_config_dir() built configs/<exact arch>/... and only
  configs/gfx1250/ ships, so DEFAULT.json lookups failed. When the running
  arch has no tree of its own, read the base family tree
  (build_targets.base_gfx_arch()) with a one-time warning. Exact-arch
  trees still win when present, and explicit tuning scopes (a cu_num
  argument) never take the fallback, so tuners creating
  configs/gfx1250-strict/ are not redirected onto the gfx1250 tables.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
get_fp8_dtypes() listed gfx1250 but not its MI450 A0 variant
gfx1250-strict, so A0 fell through to float8_e4m3fnuz / e5m2fnuz (the
gfx942 formats). gfx1250 has no fnuz WMMA, so fp8 kernels failed to compile
("no matching matrix core intrinsic ... f8E4M3FNUZ") or rejected OCP fp8
inputs. aiter/utility/dtypes.py already maps gfx1250-strict to e4m3fn.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
_LDS_CAP_BYTES had no gfx1250-strict entry, so pa_decode_sparse computed
None // int on MI450 A0. A0 has the same 320 KiB LDS as gfx1250
(chip_info already lists it).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Kernels that are gfx1250-family code asserted or branched on the exact
string "gfx1250" and so rejected MI450 A0 (gfx1250-strict) or silently took
a non-gfx1250 path: Gluon mha_fp8 / mha_mxfp8, fused_compress_attn_fp4, the
4-rank Gluon all_reduce, mega_mhc (C++), FlyDSL fmha / conv dispatch and
FlashKDA (whose TDM path is already gated by is_tdm_avail(), which includes
strict). Accept both ids at those sites.

Opus MXFP4 MQA logits is deliberately left alone: it relies on F4 WMMA,
which A0 cannot use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Test gates compared the arch to the exact string "gfx1250", so on MI450 A0
(gfx1250-strict) these suites skipped every case and the kernels were never
exercised. Accept the strict id in those gates.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
mori.jit detects the arch with rocm_agent_enumerator without -name, which
reports the base ISA (gfx1250) on MI450 A0. The EP dispatch kernel was built
for gfx1250 and hipModuleLoad rejected it on A0 ("device kernel image is
invalid"). Set MORI_GPU_ARCHS from gcnArchName when the user has not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
flydsl.runtime.device.get_rocm_arch() prefers HSA_OVERRIDE_GFX_VERSION over
the hardware, so images exporting HSA_OVERRIDE_GFX_VERSION=12.5.0 made FlyDSL
emit gfx1250 (B0) code objects on MI450 A0. Set FLYDSL_GPU_ARCH (which takes
priority) from gcnArchName when the user has not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Completes the previous commit (only mha_fp8.py was staged there). Same
change at the other sites that asserted or branched on the exact string
"gfx1250" and so rejected MI450 A0 (gfx1250-strict) or silently took a
non-gfx1250 path: Gluon mha_mxfp8, fused_compress_attn_fp4, the 4-rank
Gluon all_reduce, mega_mhc (C++), FlyDSL fmha / conv dispatch and FlashKDA
(whose TDM path is already gated by is_tdm_avail(), which includes strict).

Opus MXFP4 MQA logits is deliberately left alone: it relies on F4 WMMA,
which A0 cannot use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two more gfx1250-family sites rejected MI450 A0 (gfx1250-strict):
chunk_kda's Gluon prepare/walk asserted the exact arch, and mega_mhc
compared get_gfx_runtime() against "gfx1250" both in its support check and
in its gfx1250 dispatch branches. Accept strict in chunk_kda and map the
runtime arch through base_gfx_arch() in mega_mhc (its C++ side already
accepts gfx1250-strict).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The worker initialised mori's Communicator before importing anything from
aiter, so the package's MORI_GPU_ARCHS pin ran after mori had already JIT-
compiled for the base ISA, and on MI450 A0 hipModuleLoad still rejected the
gfx1250 kernel ("device kernel image is invalid"). Import the package first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replace the whole-tree fallback to configs/gfx1250 with an explicit
configs/gfx1250-strict/ tree. Each M-bucketed family's DEFAULT.json holds
only a generic "any" entry (copied from the gfx1250 table's "any"), with no
per-M buckets and no N/K-specialized files, so loaders report the config as
untuned and nobody mistakes it for A0 tuning. A README in the directory
says so.

Families keyed by kernel variant or shape (attention, KDA, grouped GEMM,
block_cat, MoE a8w4/a4w4) have no generic entry; resolve_config_dir() now
falls back per family, only where configs/gfx1250-strict lacks one, and warns
that the gfx1250 table is NOT tuned for gfx1250-strict.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
get_quant_config() derives the bucket axes from composite keys such as
M_LEQ_1.K_LEQ_1024 and raised "bucket keys must share one axis order,
found []" for a table with only a generic "any" entry, as the untuned
configs/gfx1250-strict tables are. Return a copy of "any" when the table
has no composite bucket keys.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Tighten three earlier changes so they cannot alter behaviour on any GPU
other than MI450 A0:

* jit: only add the running arch to --offload-arch when GPU_ARCHS names its
  base family (gfx1250 on gfx1250-strict). Previously any arch missing from
  GPU_ARCHS was added, which changed deliberate cross-builds on other GPUs.
* flydsl / mega_moe: only pin FLYDSL_GPU_ARCH / MORI_GPU_ARCHS when the GPU
  is gfx1250-strict, so other GPUs (and deliberate HSA_OVERRIDE_GFX_VERSION
  use) keep the libraries' own detection. Detect the arch with
  chip_info.get_gfx_runtime() (rocminfo) instead of torch.cuda, so importing
  these packages no longer initialises HIP in the importing process.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
black (26.10.1) and ruff 0.16.0 (the version pinned in pre-checks.yaml) over
the Python files this branch touches. Formatting and ruff autofixes only;
no behaviour change.
Scope this branch to Triton / Gluon. Restore to d67fc6d the FlyDSL arch
pin and FlyDSL fmha / conv arch checks, the MegaMoE mori arch pin and its
test import-order change, the mega_mhc Python and C++ arch handling, and
the arch gates in the non-Triton op_tests (mega_mhc, mla_decode_pagesize64,
opus a16w16 GEMM, mla_sparse_prefill, a8w8 mxfp8 bpreshuffle).

The JIT change in aiter/jit/core.py stays: Triton tests check results
against aiter HIP ops whose modules must load on gfx1250-strict.
The quant config loader requires two bucket axes, so the any-only
mxfp4/mxfp8 tables broke op_tests/triton_tests/quant/test_quant_configs.py.
Restore quant_config_utils.py and let quant fall back to the gfx1250 tables.
fused_sigmoid_mul looks up a "strided" config for strided inputs; the
any-only strict table dropped it, so 60 cases of
op_tests/triton_tests/fusions/test_fused_sigmoid_mul.py raised KeyError on A0.
Copy the gfx1250 strided entry.
…uant tests on gfx1250-strict

These gates listed gfx1250 but not gfx1250-strict, so the files skipped every
test on A0. conv2d and conv3d now pass on A0 (86/86, 152/152).
The NVFP4 skip listed only gfx1250, so A0 skipped the 24 cases that B0 runs.
On A0 they now fail the same way as on B0 (GluonSemantic.full() missing
layout).
…ache gates

The no-rope skip and the FP4/FP8 cache-dtype skips listed only gfx1250, so A0
ran 288 cases the gfx1250 kernel rejects and skipped 240 FP4/FP8 cases B0 runs.
A0 now matches B0: 512 passed, 24 failed (NVFP4), 288 skipped.
kT_mask and v_mask compare offs_n (0..BLOCK_N) against the cache length, so
they only bound the first tile. Tiles past the split end read keys and values
out of range; the masked scores are -inf, but garbage V still reaches p @ v,
giving NaN or an illegal memory access depending on memory contents. Seen in
test_mha_v3 test_flash_attn_kvcache_sliding_window on MI450 A0 and B0.
Mask the loads with (start_n + offs_n) < hi, as the paged path already does.
remap_workgroup_spatial assumes the heads (and, for GQA with fewer KV heads
than XCDs, the per-KV-head work) split evenly across XCDs. On a 6-XCD part
(MI450 A0) the test shapes do not, so some tiles were computed twice and others
never (test_mha_spatial_swizzle, 22 failures). Fall back to the default mapping
for such shapes; 8-XCD parts keep the spatial mapping for every tested shape.
The compile target and options["arch"] came from get_gfx(), which follows
GPU_ARCHS. With GPU_ARCHS=gfx1250 on a gfx1250-strict (MI450 A0) device the
kernel was built for gfx1250, emitted v_wmma_f32_16x16x128_fp8_fp8 (not
supported on gfx1250-strict) and returned wrong logits. Use the runtime arch
when it is the strict variant of get_gfx(); other devices are unchanged.
…d quant_mxfp4 gates

pa_prefill_sparse ran its Triton-only single-source tests on A0 (the gfx1250
dispatch then dereferenced kv=None) and skipped the gfx1250 ones; quant_mxfp4
backend_validation expected A0 to reject fp16 Gluon, and the Gluon-vs-Triton
cases skipped. A0 now selects the same tests as B0.
…eshuffled tables

The preshuffled afp4wfp4 kernels assert BLOCK_SIZE_M <= 16 for M < 32
(x_scale is un-shuffled there). The gfx1250-strict GEMM-AFP4WFP4_PRESHUFFLED
and FUSED-GEMM-AFP4WFP4_PRESHUFFLED-A16W16 tables had only an "any" entry
(BLOCK_SIZE_M 128 / 32), so every small-M call failed the assertion.

Copy the gfx1250 small-M buckets (M_LEQ_8 + M_LEQ_31, and M_LEQ_8 +
M_LEQ_16) into the strict tables; the untuned "any" entry is unchanged.

test_fused_gemm_afp4wfp4_mul_add: 2048 passed, test_fused_gemm_afp4wfp4_a16w16:
1152 passed on gfx1250-strict.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
_GLUON_ARCH_OK and _GLUON_K2C_ARCH_OK still listed only gfx950 and
gfx1250, so on MI450 A0 (gfx1250-strict) flash_kda_fwd never routed K1/K2
to Gluon and silently fell back to Triton, while the TDM and scan-prefetch
flags (3303bd3) already treat gfx1250-strict as gfx1250. Add
gfx1250-strict to both flags so the strict part runs the same kernels.

On gfx1250-strict the Gluon K2 now fails to compile on
v_wmma_f32_16x16x32_bf16, which Triton 3.9 rejects for gfx1250-strict;
that is a compiler issue and is not worked around here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zufayu

zufayu commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Current-head CI has a real MI300X Triton shard-1 failure: test_triton_unified_attn_prefill_head_sizes (BF16, head_size=320) raises OutOfResources because the kernel requests 131072 bytes of shared memory on a 65536-byte device. Job: https://github.com/ROCm/aiter/actions/runs/44778210409/job/136434768434. This test was added to main by #5409 (9e1d318); this PR only broadens the gfx1250-family branch in unified_attention.py and does not change the gfx942 kernel/config. Could you coordinate a base fix for this MI300X case, then sync main and rerun the shard? I will keep the A0 patch PRs separate.

@omuhamma

Copy link
Copy Markdown
Contributor Author

I pushed a fix here: #8400 , will merge if CI passes there then sync with main here

@zufayu

zufayu commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Current-head MI35X Triton shard 7 hit the 60-minute Triton Tests step timeout while tests were still passing (the last logged GEMM case passed); the job log shows no pytest assertion failure. Job: https://github.com/ROCm/aiter/actions/runs/44962740542/job/137025412234. Please split/shorten this shard or adjust its step timeout when addressing the WMMA review, then rerun CI on the updated head.

…allback

Replace gl.amd.gfx1250.wmma and gl.amd.cdna5.wmma in common/utils.py with the
gfx1250-strict fp8 fallback, so the kernels keep their original wmma calls.
Remove wmma_compat from the kernels. mha_fp8, gemm_a8w8_blockscale and
pa_mqa_logits import utils so the patch is applied before they compile.
@omuhamma

Copy link
Copy Markdown
Contributor Author

@vgokhale can you review again please

@zufayu shard 7 typically does not time out, I will let CI run once more. Should be passing but will check again today and make necessary updates if the problem persists

@omuhamma
omuhamma requested review from vgokhale and zufayu November 22, 2026 01:36
@zufayu

zufayu commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

The new WMMA patch takes effect only after common/utils.py is imported. On a fresh import, attention/unified_attention.py and attention/fp8_mqa_logits.py load their gfx1250 Gluon kernels without importing that module, while the kernels now call gl.amd.gfx1250.wmma directly. Strict FP8 16x16x128 can therefore reach the unsupported native WMMA depending on import order. Please import the patch module from these entry points (or otherwise guarantee initialization before compilation) and add a fresh-process strict FP8 compile smoke for both paths. I am holding re-approval of head bd75de9 until this is addressed.

…ogits

unified_attention_2d, unified_attention_3d and fp8_mqa_logits call
gl.amd.gfx1250.wmma with fp8 operands, but did not import common/utils.py.
On a fresh import the gfx1250-strict fp8 patch was not applied, so strict
fp8 16x16x128 could reach the native WMMA. Import utils in these kernels
so the patch is applied before they compile.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zufayu

zufayu commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Head 051544a is now one commit behind main (cd78917, #7868). GitHub reports no merge conflict, but maintainer branch updates are disabled. Please sync main into your branch and rerun CI on the resulting head when ready.

zufayu
zufayu previously approved these changes Nov 22, 2026

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

Reviewed the changes since my previous approval at 5249225. The WMMA compatibility wrapper selects scaled FP8 only for gfx1250-strict 16x16x128 and otherwise calls the captured native function; gfx1250 and cdna5 originally export the same native implementation. The updated attention entry points import common/utils before compilation, addressing the fresh-import concern. No unresolved review thread remains. Approving this head; the separate CI failures and main sync still need attention.

@zufayu

zufayu commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Latest CI has a separate MI35X Standard shard-1 failure in op_tests/test_flydsl_hgemm.py: changed-input graph replay differs by one BF16 ULP in 1/2,280 outputs (max delta 0.015625), then raises graph replay mismatch. Job: https://github.com/ROCm/aiter/actions/runs/44990449408/job/137134217015. This is the pre-existing atomic split-K test issue tracked by #8351; this PR does not change that file. Please rerun the failed job once, or sync main after #8351 merges and rerun CI. Maintainer branch updates remain disabled.

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

1. Move the patch to a guaranteed-early init

Comment on aiter/ops/triton/_gluon_kernels/common/utils.py:49.

Now: the rebind runs only when common/utils.py is imported. Each fp8 kernel
imports it for the side effect, for example
fp8_mqa_logits.py:7: from ...common import utils # noqa: F401.

Not covered: a kernel that calls gl.amd.gfx1250.wmma with fp8 operands and
forgets this import compiles against the native WMMA and fails on
gfx1250-strict. Commit 051544a already fixed three kernels that forgot it, so
the trap is live.

Fix: run the rebind from a package __init__.py that always loads before any
gfx1250 kernel compiles (for example _gluon_kernels/common/__init__.py). Then
delete the per-kernel # noqa: F401 imports. A new fp8 kernel then cannot miss
the patch.

2. Confirm the unit-scale numerics

Comment on aiter/ops/triton/_gluon_kernels/common/utils.py:43.

Now: the fallback calls wmma_scaled(a, None, ..., b, None, ..., acc) with
None scales.

Not covered: the result must equal the unscaled wmma, or gfx1250-strict
gives different numbers than gfx1250.

Fix: confirm None is exactly a scale of 1 and the scaled path is
bit-identical to unscaled wmma. State it in the PR.

…nits

Import common/utils.py in _gluon_kernels/__init__.py and gluon/__init__.py,
so the gfx1250-strict fp8 wmma patch is applied before any Gluon kernel
module loads. Remove the per-kernel utils imports.
@omuhamma

Copy link
Copy Markdown
Contributor Author

@vgokhale Updated the PR, tested the scale vs non scale. The results are bit identical

@omuhamma
omuhamma merged commit b4f12e2 into main Nov 23, 2026
81 of 85 checks passed
@omuhamma
omuhamma deleted the a0-enablment-fixes branch November 23, 2026 21:27
lburzawa added a commit that referenced this pull request Dec 3, 2026
Resolve the conflict in unified_attention_2d.py by taking main's
_GATHER_TAKES_COL check (b4f12e2, #7767), which fixes the same
tdm.async_gather signature change as c4af91f.

Co-Authored-By: Claude Opus 5.5 <[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.

7 participants