Skip to content

perf(flydsl-moe): reduce a8w4 GEMM2 VGPR pressure for DSV4 - #4135

Merged
coderfeli merged 3 commits into
feat/dsv4-a8w4-mxmoe-v2-gemmfrom
cguo/v2-moe
Jul 8, 2026
Merged

coderfeli merged 3 commits into
feat/dsv4-a8w4-mxmoe-v2-gemmfrom
cguo/v2-moe

Conversation

@charlieguo1106

Copy link
Copy Markdown
Contributor

Summary

This PR optimizes the FlyDSL MXFP4/MXFP8 MoE v2 GEMM2 down-projection path for DSV4 a8w4 reduce-mode shapes.

  • Adds a bf16 LDS cshuffle path for a8w4 GEMM2 reduce output, cutting C-tile LDS footprint from f32 to bf16 while preserving the existing atomic path.
  • Adds MXFP4_G2_INTER_MAX so small-intermediate shapes such as DSV4 inter_dim=512 can compile with a tighter K cap and hit a straight-line K=2 GEMM2 mainloop.
  • Splits GEMM2 B consumption by N-half in the straight-line K2 path, reducing peak live B fragments and lowering final ISA VGPR usage from 219 -> 184 -> 168 for the target shape.
  • Adds bench_gemm12_v2_vs_baseline.py to compare v2 GEMM1/GEMM2 launch latency and correctness against the tuned DSV4 baseline kernels.

MXFP4_G2_INTER_MAX=512 python bench_gemm12_v2_vs_baseline.py --stage gemm2 --csv aiter/configs/model_configs/dsv4_fp8fp4_tuned_fmoe.csv --model-dim 7168 --inter-dim 512 -E 384 -k 6

Test Plan

  • Verified target GEMM2 kernel via FLYDSL_DUMP_IR=1 MXFP4_G2_INTER_MAX=512 on DSV4 a8w4 shape:
    model_dim=7168, inter_dim=512, E=384, topk=6.
  • Checked final ISA VGPR progression for the target reduce kernel:
    baseline v2 219 VGPR, straight-line K2 184 VGPR, N-half B split 168 VGPR, with no spill.
  • Ran/used the new launch-only benchmark flow to validate v2 output correctness against the torch/reference-backed baseline path.

@coderfeli
coderfeli merged commit fab7d2f into feat/dsv4-a8w4-mxmoe-v2-gemm Jul 8, 2026
2 checks passed
@coderfeli
coderfeli deleted the cguo/v2-moe branch July 8, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants