Add owner-sharded activation objects and direct publication - #20
Open
foraxe wants to merge 5 commits into
Open
Conversation
foraxe
marked this pull request as ready for review
July 31, 2026 11:43
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.
Draft PR: Add owner-sharded activation objects and direct publication
Summary
This change adds opt-in object-centric activation paths to MoonEP while preserving ordinary dispatch as the default and universal fallback.
prepare_dispatchexposes a planned final-owner target for a compatible producer epilogue.prepare_dispatch_publicationoverlaps route metadata, padding, and duplicate-map preparation with that producer.publish_dispatchpublishes producer writes and expands same-rank duplicates without recopying representative hidden payloads.source_storageandprepare_source_dispatchexpose one physical source-activation shard per rank.materialize_source_dispatchis the contiguous-consumer fallback: each rank explicitly pulls representative peer rows and fans the loaded vector directly into repeated final slots.No existing call changes behavior unless the new APIs or
enable_source_object=Trueare selected.Motivation
The ordinary path materializes routed payloads through a rank-to-rank dispatch even when the producer or consumer can operate on a shared logical activation object. The new contracts move placement, peer addressing, publication, and duplicate handling behind MoonEP APIs:
Physical movement remains available when a contiguous local view is faster. The runtime does not require generic CUDA operations to dereference peer VMM mappings.
Public contracts
Producer direct-out
prepare_dispatchreturns aMoonEPDispatchTargetwhoseplan.dstmaps each source token/top-k position to a representative final-owner row. A compatible producer writes non-negative destinations totarget.mapped_hidden.publish_dispatchcompletes MoonEP-owned metadata, cross-rank visibility, padding, and duplicate expansion.The optional two-phase path starts metadata work with
prepare_dispatch_publication, runs the producer on the caller stream, then consumes the one-shot prepared object inpublish_dispatch.Owner-sharded source
Buffer(enable_source_object=True)allocates one[S, H]source shard and one[S, K]route-weight shard per rank.prepare_source_dispatchpublishes peer-indexed provenance without routed hidden copies.materialize_source_dispatchpulls only representative rows from their physical owners and produces the ordinary contiguous expert layout.Performance evidence
Hardware: 4 x NVIDIA GB200. Shape unless noted:
S=8192,E=896, routing skew1.0. Timing uses CUDA graphs, 10 warmups, and 100 measured iterations.Owner-pull materialization
Each row is the mean of five fresh processes.
Producer direct-out with overlapped publication
The benchmark uses a synthetic tensor-core producer with equivalent local-output and direct-out epilogues. It measures the producer-to-ready-dispatch boundary, not a model step. Each row is the mean of five fresh processes.
The non-overlapped direct-out path regressed by 37.04-42.02 us for all three
H=7168, K=16cells. Those cells require the prepared-publication overlap; ordinary dispatch remains the fallback when the framework cannot schedule it.Completed coverage
The final EP4 gate
H={3584,7168} x K={8,16} x skew={0.1,1,5}completed with five fresh processes per point for both paths. This proves the explicit benchmarked boundaries, not universal performance outside the measured shapes or full-model latency.Representative commands are:
The submitter retained all raw logs, CSVs, the failed initial harness-order attempt, and the audited summary.
Correctness validation
Completed on four NVIDIA GB200 ranks:
Safety and compatibility
enable_source_object=Falsepreserves the original allocation size.dispatchremains the fallback for unsupported producers, unsupported consumers, and unmeasured selector cells.Bufferand generation.cuda.tileis used only by a benchmark producer and is not imported by the runtime package.Community coordination
No open MoonEP issue or PR currently implements owner-sharded activation objects or producer direct publication. PRs #10-#13 remain open with no reported checks. This branch does not absorb their broad fixes: #11 overlaps public API validation, #12 overlaps plan provenance, and #13 overlaps VMM/C++ error handling. Rebase or stack after maintainers choose their order, and preserve the memory-semantic diff as a separate feature review.
AI assistance
AI assistance was used for implementation, test design, benchmark orchestration, analysis, and drafting. The human submitter must review and understand every changed line and reproduce the reported validation before publication.