Repository navigation
[Triton/Gluon] Add arch_info.is_sw_emulated_fp4_avail() and enable gemm_afp4wfp4 on gfx1101 - #7048
Conversation
…4wfp4 on gfx1101 Signed-off-by: Martin Domanský <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
There was a problem hiding this comment.
🟡 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
NOT READY FOR HUMAN REVIEWPR Self-ReviewRevision 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
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
…4wfp4 on gfx1101 (ROCm#7048) Signed-off-by: Martin Domanský <[email protected]>

Motivation
Issue #6685 proposes
arch_info.is_sw_emulated_fp4_avail()for archs without native FP4 instructions, where Triton lowerstl.dot_scaledby 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 enablesgemm_afp4wfp4on 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: addis_sw_emulated_fp4_avail()for gfx1101, gfx1150 and gfx1151, andis_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 ingemm_afp4wfp4_()is replaced byis_sw_emulated_fp4_avail(), still for the Triton backend only.gemm_afp4wfp4_preshuffled_scales()andgemm_afp4wfp4_preshuffle()keepis_fp4_avail().aiter/ops/triton/configs/gfx1101/triton/gemm/gemm_afp4wfp4/DEFAULT.json(new):M_LEQ_16andanytuned on gfx1101.M_LEQ_128is 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 isis_any_fp4_avail(); on the emulated archs it runs the unshuffled Triton path only, the same scope as the kernel gate. On these archsassert_closeusesatol=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]: Addarch_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:
gemm_afp4wfp4_()Tritongemm_afp4wfp4_()GluonOnly 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, aitermain@26f4f1fbwith 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.enumwith an empty module, somodule_aiter_coreis not JIT-built, which needs Ninja and hipcc;makes
chip_info._detect_native()return the arch fromtorch.cuda.get_device_properties(0).gcnArchName;binds
aiter.dtypes, whichaiter/__init__.pyleaves unbound underAITER_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 theM_LEQ_16,M_LEQ_128andanyentries 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 theint64split-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 oldermain; the difference is the shapes added to the module since.M_LEQ_16M_LEQ_128anyNo 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
arch_info.is_sw_emulated_fp4_avail()for Triton MXFP4 on gfx11 GPUs without native FP4 #6685 proposes the helper and the per-family split.is_sw_emulated_fp8_avail(),is_any_fp8_avail()).