Skip to content

[CPU] Merge MoE ±bias tests via bias=[False, True] - #94

Draft
mingfeima wants to merge 5 commits into
mainfrom
cursor/merge-moe-bias-param-7180
Draft

[CPU] Merge MoE ±bias tests via bias=[False, True]#94
mingfeima wants to merge 5 commits into
mainfrom
cursor/merge-moe-bias-param-7180

Conversation

@mingfeima

@mingfeima mingfeima commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • Merge test_*_moe / test_*_moe_bias into single parametrized cases with bias=[False, True].
  • Add small helpers (run_fused_experts, make_routing) to cut boilerplate in CPU MoE tests.

Bug fixes

  1. test_int4_moe: must keep the same routing for ref and kernel. Replacing softmax/topk of the shared score with make_routing(...) drew a fresh score and broke the comparison.
  2. test_fp8_moe / test_fp8_moe_bias: do not cast scaled_weight() to bf16 before the reference. That truncates vs the FP8 kernel’s float accumulate and fails at larger shapes such as m=32, n=k=128 (test_fp8_moe_bias[False-2-4-128-128-32]). Keep float32 dequant weights for the ref (same as main’s test_fp8_moe).

Test plan

  • Xeon CI: test/registered/cpu/test_moe.py (int4 + fp8 ± bias)
Open in Web Open in Cursor 

CI States

Latest PR Test (Base): ❌ Run #29483941434
Latest PR Test (Extra): ❌ Run #29483941266

mingfeima and others added 2 commits July 15, 2026 16:40
make_routing draws a fresh score, so ref (from the original score)
and the kernel no longer selected the same experts.

Co-authored-by: Ma Mingfei <mingfei.ma@intel.com>
cursoragent and others added 3 commits July 16, 2026 08:34
Casting scaled_weight() to bf16 truncates relative to the FP8
kernel's float accumulation and breaks test_fp8_moe_bias at larger
shapes (e.g. m=32, n=k=128). Match main's test_fp8_moe and keep
float32 dequant weights in the reference path.

Co-authored-by: Ma Mingfei <mingfei.ma@intel.com>
- Add run_fused_experts / make_routing helpers to drop None arg walls
- Merge bf16/fp8/mxfp4 non-bias and bias tests into one parametrized case
- bias=True also covers clamped SwiGLU (alpha/limit); bias=False keeps silu

Co-authored-by: Ma Mingfei <mingfei.ma@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants