flydsl_prefill_moe_stage2_fp8partial

Stores grouped-MoE stage-2 down-proj partials in fp8 to halve HBM traffic on gfx950.

178|52|Updated Jul 30, 2025
One-click install
npx skills add https://github.com/AMD-AGI/GEAK --skill flydsl-prefill-moe-stage2-fp8partial-amd-agi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: flydsl_prefill_moe_stage2_fp8partial
Source: https://github.com/AMD-AGI/GEAK/tree/main/perf_knowledge/expert_skills/skills/flydsl_prefill_moe_stage2_fp8partial
Command: npx skills add https://github.com/AMD-AGI/GEAK --skill flydsl-prefill-moe-stage2-fp8partial-amd-agi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Grouped-GEMM MoE stage-2 (down-proj plus top-k reduce) at prefill on AMD gfx950 GPUs is bottlenecked by HBM traffic on the per-token, per-slot partial tensor, which is written once by the GEMM and read once by the reduce kernel at full bf16 width. ## Core Features & Use Cases - fp8 partial store/load: Keeps MFMA compute and accumulation at bf16/f32 while storing only the global partial tensor as fp8 e4m3, halving both the write and read traffic. - Symmetric scale mechanism: Applies a calibrated scale s before the fp8 store and 1/s after the fp8-to-f32 unpack in the reducer, so the scale cancels exactly in the f32 sum. - Validation guidance: Defines runtime signature gates (cshuffle_pf8 store, infp8 reducer), relaxed full-logits parity checks, and segment-level A/B scoring of GEMM plus reduce kernels summed. - Use Case: When profiling a FlyDSL grouped-MoE prefill workload on MI355X shows the stage-2 down/reduce segment is bandwidth-bound, apply this recipe to achieve a measured 1.21x segment speedup with the reduce kernel alone improving 2.05x. ## Quick Start Ask the agent to apply the fp8-partial store and load recipe to the FlyDSL grouped-MoE stage-2 down-proj and reduce kernels, then validate parity and time both kernels together.

Frequently Asked Questions about flydsl_prefill_moe_stage2_fp8partial

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce HBM traffic in grouped-MoE stage-2 kernels?

Store the per-token top-k partial tensor as fp8 e4m3 instead of bf16, keeping compute in bf16 with f32 accumulation. Apply a symmetric scale before the store and unscale after the load in the reduce kernel, halving both write and read traffic.

How to optimize FlyDSL MoE prefill kernels on gfx950?

For the stage-2 down-proj plus reduce segment, convert the partial buffer to fp8 with a calibrated scale derived from the partial magnitude histogram. Measured on FlyDSL 0.2.2 and MI355X, this gives about 1.21x on the segment and 2.05x on the reduce kernel.

Does this fp8 partial optimization work on the accumulating down path?

No. The recipe is only valid on the non-accumulating down path with a full-width output and tile-N aligned to the fp8 store width. The accumulating or split-K path must remain in bf16.

Why does my measured speedup only show 1.05x after applying fp8 partials?

A GEMM-only measurement captures just the write-side saving, about 1.053x. The larger read-side saving lands in the separate reduce kernel, so you must time the down GEMM and reduce kernels summed as one segment.

Is the fp8 partial store bit-exact with the bf16 baseline?

No, it is lossy by construction and gated on relaxed parity. Validation showed cosine similarity around 0.9986 and logits_diff around 0.0014, within the accepted tolerance, but it requires a model-calibrated scale to avoid silent precision loss.