feat(rocm): MoE combine/gate ops — SharedExpertGate, MoeCombine, MoeCombineGate (issue #41) - #509
feat(rocm): MoE combine/gate ops — SharedExpertGate, MoeCombine, MoeCombineGate (issue #41)#509VikashLoomba wants to merge 1 commit into
Conversation
…mbineGate) (mudler#41) The next links in the generic MoE path after the router/silu-mul. Hand- translated from cuda_moe.cu (MoeCombineKernel :473, MoeCombineGateKernel :555) and the SharedExpertGate CPU oracle (cpu_ops.cpp:2387). Grid-stride, f32 math, bf16/f32 dtype arms via boundary conversions; the combine-gate folds the shared-expert sigmoid gate rounded through bf16 exactly as the donor. Evidence (4x gfx1100, ROCm 7.14, Release): - new MoE combine/gate cross-device case: 9/9 assertions (MoeCombineGate's oracle is the host-computed composite — no CPU op registration exists) - ctest -R 'rocm|cross_device': 4/4 - full ctest: pre-existing failure set shrinks 7 -> 5; test_bench and test_capi now PASS (they failed at op 77 / the router dtype before the chain). test_loaded_engine_dense now fails only on the async-scheduling assertion (a lane capability gap, not a kernel throw). - Named remaining blocker: the grouped quant expert GEMM (kMatmulBTQuantGrouped), the DeepSeek-V4 keep-quant family. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: pi:kimi-k3 [pi]
|
Reviewed as part of a sweep over the open external PRs. The translations are faithful — I checked all three donor anchors at your base SHA and they resolve exactly ( Two things to fix. Both are the same shape as findings on #506 and #523 — the calculation ported cleanly, the guards around it did not — so it is probably worth reading the three together. 1. The donor's dtype refusals were dropped, and f16 is reachable.
f16 gets through: 2. The new test exercises the dtype arm the model never runs. On the live path Consequence: an inverted predicate in Smaller ones: Credit where due: recomputing the No AMD hardware here, so your 9/9 and the ctest results could not be reproduced and I am not disputing them; both findings are static, read from the seam and the model path. |
Row
BACKEND-ROCM— the next links in the generic MoE path, after the router/silu-mul (#348). Issue #41. ClaimCLAIM-ROCM-GDN-KERNELScontinues.What changed
NEW
src/vt/rocm/rocm_moe_chain.hipwith three ops, hand-translated fromcuda_moe.cu(MoeCombineKernel:473,MoeCombineGateKernel:555) + theSharedExpertGateCPU oracle (cpu_ops.cpp:2387):kSharedExpertGate—out[t,c] = sigmoid(gl[t]) * sd[t,c](bf16 out, f32/bf16 sd)kMoeCombine— weighted top-k expert sum + optional shared termkMoeCombineGate— combine with the shared-expert sigmoid gate folded in, the shared term rounded through bf16 exactly as the donorAll grid-stride, f32 math, bf16/f32 dtype arms via boundary conversions. New cross-device case gates all three (MoeCombineGate's oracle is the host-computed composite — no CPU op registration exists for it).
Evidence (4× gfx1100, ROCm 7.14, Release)
ctest -R 'rocm|cross_device': 4/4test_benchandtest_capinow PASS (they failed at op 77 / the router dtype before the chain).test_loaded_engine_densenow fails only on the async-scheduling assertion (runner_supports_async()=falseon ROCm), a lane capability gap, not a kernel throw.Speed claims
Honest gaps
kMatmulBTQuantGrouped, the DeepSeek-V4 keep-quant family) — the heavy lift for Qwen3.5-27B-class GDN-MoE models, a proper kernel project of its own.