Repository navigation
gfx942: add flat + 16x FMoE kernels for GLM5.2-FP8 decode - #4040
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
151d85b to
aa5bc4d
Compare
7cd76e4 to
d5d26ed
Compare
|
Tested with Conclusions:
|
7b19a24 to
b9cf771
Compare
Performance results vs main (post PR #3422)After #3422 ("GLM-5.1 tunings") merged, the CK 2-stage kernels for this workload were replaced by ASM 1-stage kernels on main. We repeated the comparison against the new baseline.
Kernels used
Full MOE pipeline (profiler avg us/iter, gfx942 304 CUs)
Breakdown of gains
Accuracy (logits_diff vs BF16 reference)
Workload: GLM-5, E=257, topk=9, D=6144, D_FF=256, blockscale FP8, gfx942. |
b9cf771 to
bfcc551
Compare
Updated performance results (50 profiler iterations, clean GPU)Previous measurements used only 5 profiler iterations, which caused noisy/bimodal results. Re-ran both ASM flat and main with 50 profiler iterations on a clean GPU (no other workloads), 5 independent runs each. Workload: GLM-5 FMoE decode, E=257, topk=9, dim=6144x256, A8W8 blockscale FP8, SiLU, gfx942 Device time (profiler, ROCTracer HW timestamps)
cuda.Event time (end-to-end GPU including host dispatch overhead)
Summary
Both main and ASM flat use 1-stage kernels (full MOE pipeline: GEMM0 gate + GEMM1 up + SiLU + GEMM2 down in a single kernel launch). The ASM flat kernel uses FLAT instructions for global memory access and reads activations in BF16 (X_BF16) instead of FP8, with a 16x128 tile size vs main's 32x128. |
14cb5d2 to
1e8b140
Compare
Add vmcnt-optimized flat_pf3 1-stage FMoE kernel (16x128) for gfx942. Reduces MOE latency by ~37% at t=4 and ~20% at t=8 vs main's 32x128 kernel on GLM-5 decode workload (E=257, K=9, dim=6144x256). - Enable flat dispatch path for 80-CU (MI308) GPUs - Fix DQ/GQ/UQ scale buffer_load OOB with vmcnt optimize - Update GLM-5 tuned CSV configs with flat_pf3 entries
1e8b140 to
d7f53ac
Compare
Add gfx942 FP8 blockscale flat FMoE kernel for low-token decode (4-8 tokens per expert).
The flat kernel (a16_16x128_flat_pf3) eliminates external sorting by having each workgroup scan topk_ids internally, and fuses output zeroing (fill) into the kernel via global_atomic_pk_add_bf16. This removes the sort + fill kernel launches from the pipeline, reducing end-to-end latency at low token counts.
Changes:
Test:
Motivation
GLM5.2-FP8 decode workloads on gfx942 (MI300/MI325) have very few tokens per expert (typically 4-8). At these token counts, the external sort kernel overhead is disproportionate. The flat kernel avoids this by fusing sort + fill into the GEMM kernel, giving ~15-20% kernel-level speedup over CK at t=4-8.
Test Result
Verified on 304 CU MI325 with e=256/k=8 and e=257/k=9 (shared expert). logits_diff ~2e-4 (within FP8 quantization noise).