You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FlyDSL] mxfp8 activation quantizer for the decode GEMM tiers: (16, 16) code layout + shuffled E8M0 scales - #8606
gfx950 FlyDSL MXFP8 activation quantizer for the decode MXFP8 GEMM tiers: bf16 [M, K] -> fp8 e4m3 codes in the weight's (16, 16) preshuffled layout (rows padded to the row tile, padding rows zero) + E8M0 scales in AITER's shuffled layout (shuffle_scale_a16w4), or row-major codes (shuffled=False). One launch, a workgroup per 32-row x 256-K tile. Prerequisite of the one-launch QKV front chain in the next PR (stacked on this one), which reads exactly these codes.
Stacked on #8576 (only the top commit is this PR). Technique source: amd-kernels gemm/mxfp8_common/mxfp8_quant.py and the scale/convert helpers of mxfp8_gemm_decode.py (ported, credited in the file header, no import).
Why a quantizer PR on its own
It has no end-to-end effect by itself: it is the producer of the layout the chain kernel needs (a row-major quantizer cannot feed it). Cost vs the quantizer the public path uses today, graph replay with 8 rotated activations, MI355X, K=6144, us per call (aiter per_group_quant_hip / this kernel): M16 3.94 / 3.68, M24 3.75 / 3.67, M32 3.83 / 3.66, M48 3.85 / 3.94, M64 3.81 / 3.92, M96 3.81 / 4.00, M128 3.89 / 4.05 (parity, +-0.2 us). The gain is measured on the stack in the next PR.
Test
op_tests/test_flydsl_mxfp8_quant_shuffled.py (pytest, gfx950): codes and scales compared byte for byte against a torch reference of the Triton MXFP8 rule (scale byte clamp(ceil(log2(amax/448))+127) from the bf16 pattern of the group max, RNE e4m3, permutation into the (16, 16) layout, shuffle_scale_a16w4), M in {1,5,8,16,17,24,33,48,64,96,100,128}, K in {6144, 2048}, four magnitudes (0.01 .. 3000), zero rows/blocks. Also compared against the amd-kernels quantizer on 15 row counts x 4 magnitudes during development: bit-identical.
Review
By-hand pass over the repo's review-pr rules (triage of A1/A4, B2, C1/C2, D1/D8, P1-P6, HK6/HK12, siblings, guards, FlyDSL bounds): no runtime-surface change to existing ops (new module only), buffer resources are sized from the runtime row counts, pytest-collectable test in op_tests/, no env knobs, no print. P6: base-vs-head timing is the table above; the end-to-end measurement is in the stacked PR.
…Max-M3 TP4 prefill
Same bytes as the HIP kernel, 1.6-3.0x faster on device and 3.5x less host time per
call for calls of at least 1024 tokens (nvfp4 K/V/index-K, 16/1/1 heads, rotary 64,
gfx950). Ported from amd-kernels. AITER_FUSED_QKNORM_NVFP4_FLYDSL=0 keeps the HIP kernel.
Co-Authored-By: Claude <[email protected]>
…6) code layout + shuffled E8M0 scales
gfx950 FlyDSL quantizer: bf16 [M, K] -> fp8 e4m3 codes in the weight's (16, 16) preshuffled layout (rows padded to the row
tile, padding rows zero) plus E8M0 scales in AITER's shuffled layout, or row-major codes. One launch, a workgroup per
32-row x 256-K tile. Prerequisite of the one-launch QKV front chain (next PR): that kernel reads exactly these codes.
Technique source: amd-kernels gemm/mxfp8_common/mxfp8_quant.py and the scale/convert helpers of mxfp8_gemm_decode.py
(ported, no import). op_tests/test_flydsl_mxfp8_quant_shuffled.py compares codes and scales byte for byte against a torch
reference of the Triton MXFP8 rule (60 shape/magnitude cases).
Co-Authored-By: Claude <[email protected]>
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 8606 --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.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The quantizer can read out of bounds for rpw=4 and reuse device-bound handles across GPUs, risking incorrect outputs, while CI skips all 24 regression test cases.
Adds a gfx950 FlyDSL MXFP8 activation quantizer that produces the layouts needed by the upcoming decode QKV chain. This PR is stacked on #8576; the supplied diff also includes that prerequisite’s NVFP4 insert work.
Changes:
Quantizes BF16 activations into FP8 codes with either row-major or (16, 16) preshuffled layout, plus shuffled E8M0 scales.
Adds byte-exact reference tests across row counts, widths, magnitudes, and padding cases.
Includes the stacked NVFP4 insert kernels, public dispatch, and comparison tests.
bf16/contiguity (real): quantize() rejects non-bf16 or non-contiguous input before the byte views.
Device handles (real): the compiled handle is keyed per device (specialization_key) and launched under x.device with its current stream.
rpw=4 scalar-offset read (real only off the default path): mxfp8_quantize_shuffled always uses rpw=2, whose j loop is a single iteration; the rpw>2 paths now require M padded to whole 32-row tiles (ValueError otherwise) instead of reading past X.
CI entry point (real): the op test file now runs under pytest from python3 <file>, plus a test for the new rejections. Tests: 24 + new cases pass on gfx950.
@benchmark/run_perftest harness: not done in this PR (kernel timing is in the description); will follow if wanted.
The claimed byte equivalence with AITER's Triton MXFP8 scale rule fails at the mantissa boundary: bf16 amax=448 produces scale byte 127 here, but _mxfp8_quant_op in aiter/ops/triton/_triton_kernels/quant/quant.py:851-858 produces 128. Document this different rounding contract in the kernel and test descriptions, or align the implementation with the existing rule and add a boundary comparison.
Reject unsupported architectures before compilation or launch
Could you reject unsupported architectures at this entry point? A contiguous bf16 [16, 256] input on gfx942 passes the current validation and reaches the gfx950-only cvt_scalef32_pk_fp8_bf16 path. Neither this function nor its allocating wrapper has a runtime architecture gate; skipping the numerical test on other cards does not protect callers. Use get_gfx_runtime() to reject non-gfx950 calls before compiling or launching.
This new kernel introduces the legacy buffer_ops memory path, including raw LLVM LDS pointer handling below. aiter/ops/flydsl/AGENTS.md:30-35 explicitly reserves buffer_ops for older kernels and requires new code to use FlyDSL buffer tensors and fx.copy; raw operations need a documented missing/slower stable API backed by evidence. Please migrate the buffer/LDS path to those APIs, retaining only instruction-specific boundaries with the required justification, so this module does not add another legacy implementation to maintain.
Withdrawn: the QKV front now reads plain row-major activation codes from the existing per_group_quant_hip quantizer, so this (16,16)-layout quantizer has no consumer (measured: the layout gained only 0.1-1.4 us per front and needed separate A-shuffle support). Closing.
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
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.
Summary
gfx950 FlyDSL MXFP8 activation quantizer for the decode MXFP8 GEMM tiers: bf16
[M, K]-> fp8 e4m3 codes in the weight's (16, 16) preshuffled layout (rows padded to the row tile, padding rows zero) + E8M0 scales in AITER's shuffled layout (shuffle_scale_a16w4), or row-major codes (shuffled=False). One launch, a workgroup per 32-row x 256-K tile. Prerequisite of the one-launch QKV front chain in the next PR (stacked on this one), which reads exactly these codes.Stacked on #8576 (only the top commit is this PR). Technique source: amd-kernels
gemm/mxfp8_common/mxfp8_quant.pyand the scale/convert helpers ofmxfp8_gemm_decode.py(ported, credited in the file header, no import).Why a quantizer PR on its own
It has no end-to-end effect by itself: it is the producer of the layout the chain kernel needs (a row-major quantizer cannot feed it). Cost vs the quantizer the public path uses today, graph replay with 8 rotated activations, MI355X, K=6144, us per call (
aiter per_group_quant_hip/ this kernel): M16 3.94 / 3.68, M24 3.75 / 3.67, M32 3.83 / 3.66, M48 3.85 / 3.94, M64 3.81 / 3.92, M96 3.81 / 4.00, M128 3.89 / 4.05 (parity, +-0.2 us). The gain is measured on the stack in the next PR.Test
op_tests/test_flydsl_mxfp8_quant_shuffled.py(pytest, gfx950): codes and scales compared byte for byte against a torch reference of the Triton MXFP8 rule (scale byteclamp(ceil(log2(amax/448))+127)from the bf16 pattern of the group max, RNE e4m3, permutation into the (16, 16) layout,shuffle_scale_a16w4), M in {1,5,8,16,17,24,33,48,64,96,100,128}, K in {6144, 2048}, four magnitudes (0.01 .. 3000), zero rows/blocks. Also compared against the amd-kernels quantizer on 15 row counts x 4 magnitudes during development: bit-identical.Review
By-hand pass over the repo's review-pr rules (triage of A1/A4, B2, C1/C2, D1/D8, P1-P6, HK6/HK12, siblings, guards, FlyDSL bounds): no runtime-surface change to existing ops (new module only), buffer resources are sized from the runtime row counts, pytest-collectable test in
op_tests/, no env knobs, noprint. P6: base-vs-head timing is the table above; the end-to-end measurement is in the stacked PR.Co-authored with Claude Code.
🤖 Generated with Claude Code