feat(dispatch): seal collective-aware MoE step execution - #677
Draft
fivetide wants to merge 25 commits into
Draft
Conversation
added 25 commits
September 1, 2026 13:37
This was referenced Sep 1, 2026
Kaden-Schutt
requested changes
Sep 1, 2026
Kaden-Schutt
left a comment
Collaborator
There was a problem hiding this comment.
Blocking architectural issues remain in the G5 execution path:
- EP ownership is metadata-only: every rank still computes every expert.
- TP shards retain full dimensions rather than shard-local shapes.
- Grouped scatter capacity is not proven and can overrun its allocation.
- Activation-basis selection is not sealed to dtype/signature identity.
- Combine uses additive output without a proven zero/local contribution, and the all-reduce/residual contract is wrong.
- Mesh logical ranks are not bound to physical GPU identity.
- Alias validation is incomplete.
- Unload/rollback does not own all published storage and can leave stale tables.
- The legacy execute_pipeline entry point bypasses sealing.
These are correctness and ownership blockers, not polish. Keep this draft until the execution/storage model is made fail-closed and validated end to end.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Status — incomplete historical draft; changes requested
Head
26fe251394499721679ae6a05a221d8f4997e3abis an incomplete G5 attempt against superseded base0f1628241f75. Currentmasteris344e17a2edd893d6e323bd69189844e95bd73a9e; the G1/G2/G4 partials included by this stack were merged and then backed out bya0fca0d6d, and #675 remains an open stale-stack draft.This head is superseded by the G5 consistent-deliverable contract in #666. The replacement must follow accepted G1, G2, and G3, close every listed blocker, and route production registry qwen3.6:35b-a3b through the sealed executor with per-position numerical/state evidence, lifecycle coverage, and maintained physical validation for every multi-device claim. Substrate-only completion is not accepted.
This head is dirty/non-rebaseable and is not mergeable or review-ready. Do not push or rebase it. Keep this PR open and draft with
CHANGES_REQUESTED. Do not close until a replacement G5 PR is published.Summary
Relative to the historical G3 baseline, this PR proposes the G5 collective-aware MoE Step changeset tracked by #666; it does not complete G5 or establish current-tree acceptance. It turns the G3 expert manifest and G1 named
DeviceMeshinto a sealed, manifest-derived expert ownership plan, then executes only an explicitly typed route-to-combine program. The plan owns placement, rank views, source metadata, and the one collective row; the dispatch layer owns the generic route, indexed/grouped projection, activation, combine, and mesh execution protocol.What changed
hipfire_runtime::moe_plan::ExpertPlanas the sole resolver for a declared expert group. Construction validates the manifest source entries, fused projection layout, logical shapes and dtypes, resource requirements, parallelism, assignment, named mesh group, and the ordered G3 collective schedule. It deterministically derives(global expert, owner rank, local slot)placements, rank-local owner views, mesh epoch, and the manifest-authorized post-combine collective.MoeExpertRefproduced by the validated plan binding—no allocator, source path,WeightStorerepresentation, or family-side teardown authority crosses that boundary.hipfire-dispatch:RouterPlanmakes softmax-top-k versus precomputed routing explicit, whileMoeRoute,IndexedMoeGemv,MoeScatter,GroupedMoeGemm,MoeGateUpUnscatter,MoeActivation, andMoeCombinecarry the operands and geometry needed by each operation. The only accepted executable grammars are:route → gate/up → activation → down (expanded) → combineroute → scatter → gate/up → unscatter → activation → down (expanded) → combineMoeCombineis the sole weighted reduction step; there is no fallback grammar that can bypass ownership or collective checks. Unsealed MoE steps are rejected by the ordinary pipeline entry point.RouterPlan::validate_againstchecks normalized route metadata and score/indices/weights storage; schedule validation checks all step tensors and raw grouped metadata;MoeExecutionSignaturecompares protocol, execution identity, router identity/selection, top-k, dtype, dimensions, batch/hidden geometry, and the canonical ownership partition across ranks. Mesh preflight additionally checks rank ordering, owner rank, named group membership, collective axis/dimension, device uniqueness, and mesh epoch entirely on the host before any device method is called.None); parallel plans require one manifest-owned all-reduce attached toMoeCombine, with dimensionbatch_size × hidden.execute_sealed_steps_meshruns each rank schedule in the manifest group order and performs that one reduction after all rank-local schedules complete.MoeFamily: the typed steps dispatch through the existing route, indexed GEMV, scatter, grouped GEMM, unscatter, activation, and combine kernels for the sealed single-device and mesh protocols. The new planner-to-executor boundary is exposed throughseal_steps,execute_sealed, andexecute_sealed_mesh; family code no longer reconstructs ownership or collective membership.Goals
Short term
Long term
Benefits
Dependency and landing order
masterafter the rollback.hipfire_runtime::multi_gpu::Gpus; do not add the revertedhipfire-hardwarecrate.Remaining blockers before ready
execute_pipelineentry point through sealing, or remove the bypass; no execution path may bypass sealing.Verification
Historical head-only evidence; none of these results establishes current-master acceptance:
26fe251394499721679ae6a05a221d8f4997e3ab.cargo buildpassed on the displaced G1 → G3 → G5 stack.cargo testpassed on that historical stack (3,509 passed, 12 ignored).gates (ratchets, layering, registers)check failed on the historical head.hipfire run qwen3.6:27band one A3B, with decoded text inspected and recorded.python3 -m tools.change_gate run --base betawas not run; fork tracker output is not upstream acceptance evidence.Architecturetrait surface change on the historical head; re-confirm on the re-land.Nonclaims / follow-up
Wall time: 0.70 seconds
No production multi-device enablement, physical collective, model-family/axis integration, or G5 completion claim is made by this historical head.