Repository navigation
CUDA sm_120a: FP8 MMA through the full-rate mxf8f6f4 kind with unit scales, 5% to 8% faster TFQ5 prompt on an RTX 5060 Ti - #5988
Conversation
…it e8m0 scales GeForce Blackwell runs the plain e4m3.f32 MMA at half rate. The block-scaled mxf8f6f4 form with unit scales is bit-identical on the full-rate pipe. Applies to tfq5's mma_e4m3_v and ck_lane's mma_fp8; both kernels are marked arch_specific so their sm_120/121 images build as sm_120a/121a, the same mechanism ck_experts uses for the FP4 mma.
The block-scaled mxf8f6f4 instruction at mma4.cuh:39 is a third asm form with its own operand layout; record its fingerprint with count 1 like the file's other two entries.
|
CI fix at e9c863c: the zig job failed cuda_common_check on the new mxf8f6f4 block — allowlist entry added for its fingerprint with count 1, like the file's other two asm forms. |
Synthena Initial Review — Performance receipt required (
|
…art#5988) The sm_120-only preprocessor branch leaves every other target compiling the unchanged >=890 path, so the serving identity holds by explicit extension (prefix=0). Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Synthena Initial Review — Performance receipt required (
|
|
Thanks, @joshuaswarren. The feature guards and architecture-specific consumers are correct; the earlier generic target warning is closed. The current catalog has both an architecture-specific and a plain The reported primitive comparisons and timings remain credited as reported results. The supplied material does not include their comparison harness, served hashes or a verified performance receipt. Please attach those artifacts if available; exact primitive and served qualification remain required before landing. The existing cosine check cannot substitute for bit equality.
|
The catalog kept the plain tfq5 row next to the new arch-specific one, so an sm_120 or sm_121 build scheduled tfq5 twice into the same fatbin/tfq5.fatbin and registered fatbin_tfq5 twice. The plain row is gone; the arch-specific row stays. A catalog test now asserts each kernel name appears once, and that the actual tfq5 and ck_lane rows build sm_120a and sm_121a and plain sm_89. The two changed catalog comments fit in 120 columns. mma4.cuh's raw identity row now carries its measured bytes; its approved row's note says the new branch is taken on sm_120 and sm_121 (SM120_ALL or SM121_ALL), not sm_120 only.
|
Thank you, @joshuaswarren. This head already removes the duplicate TFQ catalog entry, adds uniqueness/profile coverage and refreshes the source identity. The feature-guard and architecture-target questions remain closed, including the SM121 branch. We'll handle current-main integration and the release note. The primitive comparisons and timings remain credited as reported results. The comparison harness, raw results, served hashes and verified performance receipt are still absent from the supplied material; please attach them if available. Exact primitive and served qualification remains required before landing, and the cosine check cannot substitute for bit equality. No rebase is needed.
|
Refs #5651.
On GeForce Blackwell (consumer sm_120) the plain
e4m3 x e4m3 -> f32MMA runs at half rate. Issuing the same m16n8k32 tile throughkind::mxf8f6f4.block_scale.scale_vec::1Xwith unit e8m0 scales (0x7F) is the same arithmetic on the full-rate pipe: 1.98x raw MMA throughput on a 5060 Ti, and every FP32 output bit-identical, including e4m3 subnormals and NaN bytes, signed zero, subnormal/NaN/Inf accumulators, and chained accumulation.What changes and why it is safe
zig/kernels/cuda/mma4.cuh(mma_fp8, consumed byck_lane) andzig/kernels/cuda/common/tfq5_mma.cuh(mma_e4m3_v): under__CUDA_ARCH_FEAT_SM120_ALL/SM121_ALLemit the block-scaled instruction with unit scales; sm_89-110 keep the plain form. No other operands change; the accumulator contract is unchanged.zig/build/cuda_kernels.zig: marktfq5andck_lanearch_specificso their sm_120/sm_121 images build assm_120a/sm_121aand the feature macro is live. This is the same mechanismck_expertsalready uses for the block-scaled FP4 MMA. sm_80-110 images are unaffected.Measurements (GeForce RTX 5060 Ti, sm_120, CUDA 13.5, -Dsm=120)
Raw MMA loop, alternating arms, median of 3 (interleaved):
e4m3.f32mxf8f6f4unit-scaleRatio 1.983x.
zig build tfq5-bench -Dsm=120pf8(M=512), ABBA (2 interleaved pairs), median:pf16 and decode columns are unchanged (dec and pf16 medians identical to 0.1 TF). The MMA is not the dominant share of this GEMM, so the end gain lands at 5-8% rather than the raw 1.98x.
Exactness: a standalone harness runs both instruction forms on identical operands: 67,108,864 comparisons across random e4m3 patterns, subnormal-only lanes, NaN bytes, +-0/subnormal/NaN/Inf f32 accumulators and up to 4 chained MMAs, with 0 mismatches.
zig build tfq5-contract -Dsm=120: all PASS at this diff (pf8 cosine >= 0.994 vs CPU reference, all 8 rates, MoE and TP=2/4 parity), with cosines identical to main's run.Checks on this head
zig fmt --check zig/build/cuda_kernels.zigclean;tools/pr_check.py0 new lean findings (advisory warnings unchanged from base).cuobjdumpon the built fatbin:tfq5.1.sm_120a.cubinandck_lane.1.sm_120a.cubinimages are emitted, so the gated instruction is the one that ran.Not covered
CHANGELOG.md: left for Ash.