Skip to content

[dev] Megatron Lite (2/4) runtime layering guard - #5425

Closed
ISEEKYAN wants to merge 2 commits into
NVIDIA:devfrom
ISEEKYAN:dev-mlite-2-runtime-layering-guard
Closed

[dev] Megatron Lite (2/4) runtime layering guard#5425
ISEEKYAN wants to merge 2 commits into
NVIDIA:devfrom
ISEEKYAN:dev-mlite-2-runtime-layering-guard

Conversation

@ISEEKYAN

Copy link
Copy Markdown
Contributor

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_ids are 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 runtime/backends/{bridge, mbridge, mlite} and runtime/megatron_utils.
  • bench and VERL connector layers reworked to hand the runtime only a model-agnostic batch.
  • Static layering guard: 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.
  • Optimizer-config builders renamed 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.

@ISEEKYAN ISEEKYAN changed the title Dev mlite 2 runtime layering guard [dev] Megatron Lite (1/4) runtime layering guard Jun 22, 2026
@ISEEKYAN ISEEKYAN changed the title [dev] Megatron Lite (1/4) runtime layering guard [dev] Megatron Lite (2/4) runtime layering guard Jun 22, 2026
@ISEEKYAN
ISEEKYAN marked this pull request as ready for review June 24, 2026 14:29
@ISEEKYAN
ISEEKYAN requested review from a team as code owners June 24, 2026 14:29
@copy-pr-bot

copy-pr-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

ISEEKYAN added 2 commits June 24, 2026 07:51
Signed-off-by: Yan Bai <bayan@nvidia.com>
…overnance)

Signed-off-by: Yan Bai <bayan@nvidia.com>
@ISEEKYAN
ISEEKYAN force-pushed the dev-mlite-2-runtime-layering-guard branch from a22fe3a to ae4e853 Compare June 24, 2026 14:52
@ISEEKYAN ISEEKYAN closed this Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants