Repository navigation
Conversation
ATOM_USE_FLYDSL_FP8_PREFILL_ATTN=1 asked the gfx950-only FP8 FMHA, so on gfx1250 it always fell back to BF16. gfx1250 now uses AITER's a8w8 FMHA, which takes the same per-tensor fp32 Q/K/V descales, writes BF16 and returns natural-log FP32 LSE in [heads, total_q] with bottom-right causal masking, so the quantization, cached-chunk reuse, DCP handoff and fallback policy are unchanged. The a8w8 entry counts as available only when it accepts q/k/v_descale (ROCm/aiter#7214); older builds keep the BF16 path. Its capability check reads shapes and dtypes only, so meta tensors stand in for Q/K/V and the answer stays cached per layer before any FP8 preparation. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
🏷️ CI GuideRuns automatically on every eligible PR before approval:
Heavy model tests:
|
Add ATOM_USE_ASM_FP8_PREFILL_ATTN (default on): on gfx1250 B0, MLA layers with 192/128 QK/V head dims (Kimi-K3) run prefill attention on AITER's ASM FP8 varlen FMHA (fmha_fwd_fp8_varlen_asm, ROCm/aiter#7375), fed by the same fused per-tensor QKV quantization as the FlyDSL backend. The kernel's [total_q, heads, 1] LSE is transposed to the [heads, total_q] layout the merges read. The per-layer check now picks the first enabled backend that serves the layer: ASM, then FlyDSL (ATOM_USE_FLYDSL_FP8_PREFILL_ATTN), then BF16. AITER builds without the kernel, A0, gfx950 and other head dims keep their current path; the default-on flag falls back silently, explicit requests still warn once. Co-authored-by: Cursor <cursoragent@cursor.com>
ATOM_USE_ASM_FP8_PREFILL_ATTN now defaults to 0, like ATOM_USE_FLYDSL_FP8_PREFILL_ATTN: BF16 stays the default and either flag opts in, ASM taking precedence where it applies when both are set. A set flag that no backend can serve logs the BF16 fallback once per process. Co-authored-by: Cursor <cursoragent@cursor.com>
With both ATOM_USE_ASM_FP8_PREFILL_ATTN and ATOM_USE_FLYDSL_FP8_PREFILL_ATTN set, use ASM, ignore the FlyDSL flag and warn once that only one should be set. A layer the selected kernel cannot serve runs BF16 attention rather than falling through to the other FP8 kernel. Co-authored-by: Cursor <cursoragent@cursor.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Runs MLA prefill attention in FP8 on gfx1250 (MI455X) with either of two AITER kernels, each behind its own flag. Both reuse what #2191 built for gfx950: fused QKV/KV per-tensor quantization, Q reuse across cached chunks, the DCP handoff and the cached BF16 fallback.
ATOM_USE_ASM_FP8_PREFILL_ATTN(new)0fmha_fwd_fp8_varlen_asm(ROCm/aiter#7375)ATOM_USE_FLYDSL_FP8_PREFILL_ATTN(#2191)0flash_attn_varlen_a8w8_m32x8(ROCm/aiter#7214)Each layer checks once, before any FP8 preparation, whether the selected kernel serves it; otherwise it runs BF16 attention. Both kernels take per-tensor fp32 Q/K/V descales, write BF16, use bottom-right causal masking and return natural-log FP32 LSE. The ASM kernel writes the LSE as
[total_q, heads, 1]; ATOM transposes it to the[heads, total_q]layout the merges read.Defaults. Both flags default to
0, so BF16 prefill attention stays the default and nothing changes unless a flag is set. Set only one: with both set, ASM is used,ATOM_USE_FLYDSL_FP8_PREFILL_ATTNis ignored, and a warning saying so is logged once per process. Where the selected kernel does not apply (ASM on gfx950, A0gfx1250-strict, other head dims, an AITER without the kernel), the layer falls back to BF16 — not to the other FP8 kernel — before quantization, and the fallback is logged once per process.aiter.ops.mha.fmha_fwd_fp8_varlen_asmandaiter.jit.utils.asm_guard.is_gfx1250_asm_supportedimport. Its check mirrors the FP8 branch of AITER's_select_gfx1250_fmha_fwd_varlen_asm: gfx1250 B0+, 192/192/128 head dims, query heads divisible by KV heads. The per-call conditions (3-D contiguous e4m3 Q/K/V, one-element fp32 descales on the device, BF16 output) hold for what ATOM's quantizers produce.q_descale/k_descale/v_descale(#7214). Its check reads shapes and dtypes only, so meta tensors stand in for Q/K/V.Kernel performance
One MI455X (gfx1250 B0), K3 shapes (12 heads, D192x128), one sequence, kernel time only (quantization excluded); AITER 7061cbd88 with #7214 and #7375 applied.
Causal prefill, Q = K = context:
At 128k that is 1,951 / 3,777 / 4,923 TFLOP/s. With 16k new tokens over a cached context of 1k–128k (non-causal), ASM FP8 is 2.14–2.59× BF16 and 1.27–1.39× FlyDSL FP8. Both FP8 kernels show the same output error against BF16 (relative 0.046–0.054); ASM and FlyDSL differ from each other by 0.017–0.027.
Dependencies
ATOM_USE_ASM_FP8_PREFILL_ATTN=1falls back to BF16.ATOM_USE_FLYDSL_FP8_PREFILL_ATTN=1on gfx1250.Validation
py_compilepass on the changed files.tests/test_mla_flydsl_gather_dispatch.pyandtests/test_envs.py: 135 passed, in a container with this AITER and no GPU attached (a test-only pytest plugin fixes AITER's Triton arch and fp8 dtype, which otherwise need a device at import). New cases: both flags default off; with both set, ASM wins and the warning is logged once across layers; ASM serves K3 on gfx1250 and is asked once; where ASM declines (gfx950, A0, other head dims) the layer runs BF16 without consulting FlyDSL and logs the fallback; the ASM launch gets the quantized Q/K/V and descales, and its LSE comes back as[heads, total_q].