flydsl_decode_moe_stage1_blkmap

Fuses paired same-expert sort-blocks into double-height tiles to halve MoE stage-1 weight HBM traffic.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? At decode time, grouped-GEMM MoE stage-1 (gate+up) kernels re-read the same low-precision expert weight from HBM once per sort-block, because token sorting pads each expert to a fixed block granularity. This redundant weight traffic dominates stage-1 latency when many experts hold two or more sort-blocks. ## Core Features & Use Cases - Pair-fusion mechanism: Builds a device-side, CUDA-graph-safe leader-block descriptor that merges two adjacent same-expert sort-blocks into one 2B-row compute tile, so the expert weight is loaded once and reused across both halves. - Validated applicability gates: Requires a tile_m=64 baseline, a substantial pairable-block fraction, and evidence that repeated-weight traffic is latency-relevant, with explicit instructions to report pair_count_fraction and paired_block_fraction. - Correctness and measurement discipline: Mandates odd-tail store masking, a runtime-signature gate (_am2_bmap plus one _blkmap_kernel dispatch), joint config sweeps, and honest segment timing that includes the descriptor producer kernel. - Use Case: On gfx950/MI355X with FlyDSL 0.2.2 running fp8-act/fp4-weight grouped-MoE decode, applying this recipe reduced the honest stage-1 segment median from 192.706 us to 174.498 us (1.104x) while passing parity. ## Quick Start Ask the agent to apply the FlyDSL decode MoE stage-1 block-pairing recipe to the grouped-GEMM gate/up kernel and validate it with a same-session paired versus unpaired A/B benchmark including parity checks.

Frequently Asked Questions about flydsl_decode_moe_stage1_blkmap

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

FAQPage Schema
How do I reduce HBM traffic in a grouped-GEMM MoE decode kernel?▼

Fuse pairs of adjacent same-expert sort-blocks into one double-height compute tile so the expert weight is loaded from HBM once and reused across both block halves. This recipe targets the stage-1 gate/up GEMM and measured 1.104x on the honest stage-1 segment on gfx950 with FlyDSL 0.2.2.

When does MoE sort-block pairing help and when does it not?▼

It helps at decode/small-M when the baseline uses a tile_m=64 compute tile and a substantial fraction of sort-blocks are pairable same-expert pairs. It does not apply when the baseline already uses a 128-row tile, since doubling it exceeds the LDS budget and fails to build.

Does this FlyDSL MoE optimization work on newer FlyDSL versions?▼

The recipe requires FlyDSL 0.2.2 or newer, and the measured numbers come from 0.2.2 on gfx950. On newer versions, map the descriptor, double-height tile, masking, and cache-identity invariants onto current APIs and revalidate with fresh compile, parity, and A/B runs.

Why does my MoE GEMM speedup look bigger than the real stage-1 win?▼

A GEMM-name timing filter silently drops the descriptor-producer kernel, which has an unrelated name. On the validated run that reports 1.124x GEMM-only instead of the honest 1.104x segment, so always time the producer together with the GEMM.

What correctness risks exist when fusing MoE sort-blocks?▼

A solo leader block covering an odd tail must mask the store of its absent upper half, otherwise it double-writes or goes out of bounds. The kernel is numerically equivalent to the unpaired version only when this mask is correct, so parity-gate every build.