[dev] Megatron Lite (2/4) runtime layering guard - #5425
Closed
ISEEKYAN wants to merge 2 commits into
Closed
Conversation
ISEEKYAN
marked this pull request as ready for review
June 24, 2026 14:29
Signed-off-by: Yan Bai <bayan@nvidia.com>
…overnance) Signed-off-by: Yan Bai <bayan@nvidia.com>
ISEEKYAN
force-pushed
the
dev-mlite-2-runtime-layering-guard
branch
from
June 24, 2026 14:52
a22fe3a to
ae4e853
Compare
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.
Summary
Part 2/4 of the Megatron Lite foundation series. Establishes and enforces the layering contract across the bench / VERL-connector / runtime / model / primitive layers, so that model-specific metadata cannot leak into model-agnostic layers.
Motivation
packed_seq_params/position_idsare transient THD metadata. They may be materialized only at the immediate forward boundary — inside an explicitly marked allow-range in the bridge runtime — and must never be carried as model-agnostic batch fields or leaked through the connector/runtime layers. This PR makes that boundary explicit and guards it.What's included
runtime/backends/{bridge, mbridge, mlite}andruntime/megatron_utils.tests/unit/runtime/test_layering_contracts.py,test_packed_batch_bridge.py,tests/run_layering_contracts.sh— directional import boundaries (denylist + vetted, documented allowlist) plus the transient-metadata allow-range check.build_mc_* → build_dist_opt_*, with the bridge/optimizer consumers updated atomically in this PR.Depends on
The 1/4 "shared primitive core" PR in this series.