Skip to content

[Triton/Gluon] Add arch_info.is_sw_emulated_fp4_avail() and enable gemm_afp4wfp4 on gfx1101 - #7048

Merged
azaidy merged 1 commit into
ROCm:mainfrom
Ragua1:fp4-emulated-gemm-afp4wfp4-gfx1101
Nov 3, 2026
Merged

azaidy merged 1 commit into
ROCm:mainfrom
Ragua1:fp4-emulated-gemm-afp4wfp4-gfx1101

Conversation

@Ragua1

@Ragua1 Ragua1 commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Motivation

Issue #6685 proposes arch_info.is_sw_emulated_fp4_avail() for archs without native FP4 instructions, where Triton lowers tl.dot_scaled by upcasting the operands to bf16, and opening the FP4 entry points one family at a time. This PR is the first step. It adds the helper and enables gemm_afp4wfp4 on gfx1101, the entry point that already runs on gfx1151 since #5470 and on gfx1150 since #5997 through an arch-name exception.

Technical Details

  • aiter/ops/triton/utils/_triton/arch_info.py: add is_sw_emulated_fp4_avail() for gfx1101, gfx1150 and gfx1151, and is_any_fp4_avail() for native or emulated FP4, the pair [Triton/Gluon] Add arch_info.is_sw_emulated_fp8_avail() for gfx11 and enable the Triton MHA fp8 path and the MXFP8 quant tests on it #6782 added for fp8. is_fp4_avail() is unchanged.
  • aiter/ops/triton/gemm/basic/gemm_afp4wfp4.py: the gfx1150/gfx1151 exception in gemm_afp4wfp4_() is replaced by is_sw_emulated_fp4_avail(), still for the Triton backend only. gemm_afp4wfp4_preshuffled_scales() and gemm_afp4wfp4_preshuffle() keep is_fp4_avail().
  • aiter/ops/triton/configs/gfx1101/triton/gemm/gemm_afp4wfp4/DEFAULT.json (new): M_LEQ_16 and any tuned on gfx1101. M_LEQ_128 is the gfx1151 entry, because the gfx1101 candidate did not beat it on held-out shapes (see below).
  • op_tests/triton_tests/gemm/basic/test_gemm_afp4wfp4.py: the module gate is is_any_fp4_avail(); on the emulated archs it runs the unshuffled Triton path only, the same scope as the kernel gate. On these archs assert_close uses atol=1e-2, rtol=torch.finfo(dtype).eps: the emulated result can differ from the reference by one ULP of the output dtype after rounding; the largest relative difference on gfx1101 was 0.00775 ([Feature]: Add arch_info.is_sw_emulated_fp4_avail() for Triton MXFP4 on gfx11 GPUs without native FP4 #6685).

Gate result per arch, before and after this change, evaluated from the source of both trees:

Arch gemm_afp4wfp4_() Triton gemm_afp4wfp4_() Gluon Test module
gfx950, gfx1250 allowed, unchanged allowed, unchanged runs, unchanged
gfx942, gfx1100, gfx1200, gfx1201 rejected, unchanged rejected, unchanged skipped, unchanged
gfx1101 rejected → allowed rejected, unchanged skipped → runs, unshuffled Triton only
gfx1150, gfx1151 allowed, unchanged rejected, unchanged skipped → runs, unshuffled Triton only

Only gfx1101 was tested. On gfx1150 and gfx1151 the kernel gate does not change, but the test module now runs there. On gfx1150 the test failed by one ULP with the default tolerance (#6685); it has not been run there with the tolerance above.

Test Plan

gfx1101 (Radeon RX 7800 XT), Windows 11, TheRock ROCm 10.2 (torch 2.15.0a0+rocm10.2.0a20260926), Triton 3.8.0, AITER_TRITON_ONLY=1, aiter main @ 26f4f1fb with this change.

On Windows the test modules ran through a local pytest wrapper. It does not modify kernels, configs or test code. It:

  • replaces aiter.ops.enum with an empty module, so module_aiter_core is not JIT-built, which needs Ninja and hipcc;

  • makes chip_info._detect_native() return the arch from torch.cuda.get_device_properties(0).gcnArchName;

  • binds aiter.dtypes, which aiter/__init__.py leaves unbound under AITER_TRITON_ONLY;

  • caps the PyTorch allocator at 90 % of the 16 GiB card.

  • test_gemm_afp4wfp4.py -k "not 106496". Of the 72 deselected cases with N = 106496, 16 would run on gfx1101; each needs one allocation of about 13 GiB and runs out of memory, since the runner caps the PyTorch allocator at 90 % of the 16 GiB card.

  • get_gemm_config("GEMM-AFP4WFP4", M, 4096, 4096) for M = 8, 64 and 512 returns the M_LEQ_16, M_LEQ_128 and any entries of the new file.

Performance of the new table against the gfx1151 table, which is what gfx1101 would get as a seed. Kernel time on the GPU, 10 calls per timed window, both configs in the same process in rotated order, output checked against the test's reference in the same process. Ratio = gfx1151 time / gfx1101 time, geometric mean over the shapes of a bucket, median and range over fresh processes; with 10 processes the best and the worst are dropped first. Held-out shapes: 8 per bucket, M log-uniform within the bucket, N 32–65536, K 256–32768, none used in tuning. Measured on aiter @ 16979d75; the only kernel change since then is the int64 split-K store offset in _gemm_afp4wfp4_kernel.

Test Result

test_gemm_afp4wfp4.py: before, the whole module is skipped on gfx1101. After: 124 passed, 436 skipped, 72 deselected. #6685 reports 104 passed on an older main; the difference is the shapes added to the module since.

Bucket Tuning shapes, 10 processes Held-out shapes, 5 processes Entry in the new file
M_LEQ_16 1.398 (1.389–1.406) 1.817 (1.812–1.828) tuned
M_LEQ_128 1.239 (1.237–1.242) 0.953 (0.948–0.977) gfx1151; the ratios are of the tuned candidate that was not taken
any 1.292 (1.291–1.293) 1.072 (1.067–1.072) tuned

No correctness failure in any process.

Not included

The other FP4 entry points (gemm_a16wfp4, gemm_a8wfp4, the batched and fused FP4 GEMMs) follow in separate PRs, as proposed in #6685, each with its own gfx1101 configs and test results.

Related

@Ragua1
Ragua1 requested a review from a team October 27, 2026 22:43
@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 7048 --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 [Triton] Add arch_info.is_sw_emulated_fp4_avail() and enable gemm_afp4wfp4 on gfx1101 [Triton/Gluon] Add arch_info.is_sw_emulated_fp4_avail() and enable gemm_afp4wfp4 on gfx1101 Oct 27, 2026
@Boss2002n
Boss2002n requested a balanced review from Copilot October 28, 2026 01: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.

🟡 Changes recommended

The benchmark’s is_fp4_avail() gate still rejects gfx1101, preventing measurement of the new configurations; it must allow the unshuffled Triton path while keeping unsupported preshuffle and Gluon options blocked.

1 open issue
What changed in this PR

This PR adds shared FP4 capability checks and enables unshuffled Triton gemm_afp4wfp4 on gfx1101, following the per-family rollout proposed in #6685.

Changes:

  • Add helpers for software-emulated FP4 and combined native/emulated support.
  • Replace the local architecture exception and add gfx1101 default configs.
  • Enable unshuffled Triton tests on emulated architectures with dtype-based tolerance, while keeping Gluon and preshuffled paths restricted.
File Description
op_tests/​triton_tests/​gemm/​basic/​test_gemm_afp4wfp4.py Extend test gates and adjust tolerance for emulated FP4.
aiter/​ops/​triton/​utils/​_triton/​arch_info.py Add emulated and combined FP4 capability helpers.
aiter/​ops/​triton/​gemm/​basic/​gemm_afp4wfp4.py Use the emulation helper to admit gfx1101 on Triton.
aiter/​ops/​triton/​configs/​gfx1101/​triton/​gemm/​gemm_afp4wfp4/​DEFAULT.json Add gfx1101 launch configs for three M buckets.

Review effort: Balanced

@zufayu
zufayu requested review from a team and k50112113 October 28, 2026 02:31

@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

@aiter-bot

Copy link
Copy Markdown

NOT READY FOR HUMAN REVIEW

PR Self-Review

Revision 296c42e0c2a4 · 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 — missing ### Reviewed revision in the PR description
  • FAIL — missing ### Behavior and intent in the PR description
  • FAIL — missing ### Validation and unverified scope in the PR description
  • FAIL — missing ### PR-specific question in the PR description
  • FAIL — missing ### Changed op tests in the PR description
  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — Behavior and intent has no substantive answer
  • FAIL — Validation and unverified scope has no substantive answer
  • FAIL — PR-specific question has no substantive answer
  • FAIL — changed op test not explained in Changed op tests: op_tests/triton_tests/gemm/basic/test_gemm_afp4wfp4.py
  • FAIL — Changed op tests must explain why each changed op test is necessary and non-redundant

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

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.

5 participants