Fix: compile DeepSeek V4 MoE at EP >= 4, re-anchor dispatch wait - #824
Conversation
Take the gate/up matmul LHS from a flat [E * RECV_MAX, D] view of recv_x instead of slicing the 3-D parent. The 3-D slice emits an nd tensor_view that ptoas infers as nz once RECV_MAX > 16, so every exp_gate_mm / exp_up_mm failed to compile at EP >= 4. Matches the existing flat addressing of recv_y / gate_i32 / up_i32 and the 2-D LHS the w2 matmul already uses.
dispatch_wait spins on the peers' data_arrived counters and needs no result from dispatch_meta, but chaining it behind _meta_tid held its launch until that task's own meta spin and cumsum had retired. Anchor it on an indices read instead -- the same fanin dispatch_push waits on -- so both cross-rank spins start together. - dispatch_gather now takes _meta_tid explicitly: recv_meta_local is manual_dep, so the cumsum -> gather edge was riding entirely on the dropped dispatch_wait chain (combine reads it transitively). - Drop the dependency-only seed_dummy task on dispatch_meta, left over from the scheduling experiments in hw-native-sys#811. It has no predecessors, so it never delayed the task it fed. Numerics unchanged: moe.py x_next PASS at ep2 and ep4 on a2a3.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe routed-expert kernel now loads tiles from a flattened received-input buffer. The MoE dispatch pipeline removes a dummy dependency, anchors waiting through ChangesRouted MoE execution
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant dispatch_push
participant indices
participant dispatch_wait
participant dispatch_meta
participant dispatch_gather
dispatch_push->>indices: produce dispatch indices
indices->>dispatch_wait: tensor read anchors the wait
dispatch_meta->>dispatch_gather: provide metadata dependency
dispatch_wait->>dispatch_gather: provide wait dependency
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
expert_routed: take the gate/up matmul LHS from a flat[E * RECV_MAX, D]view ofrecv_xinstead of slicing the 3-D parent. The 3-D slice emits an ndtensor_viewthat ptoas infers as nz onceRECV_MAX > 16, so everyexp_gate_mm/exp_up_mmfailed to compile at EP >= 4. Matches the flat addressingrecv_y/gate_i32/up_i32already use.dispatch_wait: dropdeps=[_meta_tid]and anchor on anindicesread instead — the same fanindispatch_pushwaits on. The wait only spins on the peers'data_arrivedcounters, so chaining it behinddispatch_metaheld its launch until that task's own meta spin and cumsum retired; now both cross-rank spins start together.dispatch_gather: take_meta_tidexplicitly.recv_meta_localismanual_dep, so the cumsum -> gather edge was riding entirely on thedispatch_waitchain this PR drops (combinereads it transitively).seed_dummytask feedingdispatch_meta, left over from the scheduling experiments in perf(dsv4/moe): tune early task resolution #811 — it has no predecessors and never delayed the task it fed.moe.pyx_nextPASS at ep2 and ep4 on a2a3.