Skip to content

[docs] Document the Dist-MoE integration - #4543

Merged
sanketpurandare merged 1 commit into
mainfrom
gh/sanketpurandare/19/head
Oct 3, 2026
Merged

sanketpurandare merged 1 commit into
mainfrom
gh/sanketpurandare/19/head

Conversation

@sanketpurandare

@sanketpurandare sanketpurandare commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Summary:
Add a user-facing Dist-MoE integration guide under
torchtitan/models/common/dist_moe/README.md and link it from the top-level
feature list.

The guide documents the optional package boundary, nightly Git installation,
BF16/MXFP8 transforms, parameter/checkpoint ownership, runtime lifecycle,
scratch and activation-slot planning, VMM, eager PP and GraphPP slot selection,
FSDP prepared-weight handling, WGrad ownership, output postprocessing, recipe
locations, and current limitations.

Test Plan:

  • Markdown formatting and codespell pass.
  • Link checking passes for README.md and the Dist-MoE guide.
  • BF16, MXFP8, and VMM examples use the final API and import paths.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 9, 2026
sanketpurandare added a commit that referenced this pull request Sep 9, 2026
Document the model conversion, checkpoint compatibility, shared MXFP8 FSDP
lifecycle, memory ownership, VMM controls, pipeline slot planning, and cleanup
contract for the standalone Dist-MoE backend.

Test Plan:
- `pre-commit run --files README.md docs/dist_moe.md`


ghstack-source-id: 64d71a5
Pull-Request: #4543
sanketpurandare added a commit that referenced this pull request Sep 9, 2026
Document the model conversion, checkpoint compatibility, shared MXFP8 FSDP
lifecycle, memory ownership, VMM controls, pipeline slot planning, and cleanup
contract for the standalone Dist-MoE backend.

Test Plan:
- `pre-commit run --files README.md docs/dist_moe.md`


ghstack-source-id: 6ef9187
Pull-Request: #4543
sanketpurandare added a commit that referenced this pull request Sep 10, 2026
Document the model conversion, checkpoint compatibility, shared MXFP8 FSDP
lifecycle, memory ownership, VMM controls, pipeline slot planning, and cleanup
contract for the standalone Dist-MoE backend.

Test Plan:
- `pre-commit run --files README.md docs/dist_moe.md`


ghstack-source-id: 6cb01d3
Pull-Request: #4543
sanketpurandare added a commit that referenced this pull request Sep 10, 2026
Document the model conversion, checkpoint compatibility, shared MXFP8 FSDP
lifecycle, memory ownership, VMM controls, pipeline slot planning, and cleanup
contract for the standalone Dist-MoE backend.

Test Plan:
- `pre-commit run --files README.md docs/dist_moe.md`


ghstack-source-id: 1ee88b8
Pull-Request: #4543
sanketpurandare added a commit that referenced this pull request Sep 10, 2026
Document the model conversion, checkpoint compatibility, shared MXFP8 FSDP
lifecycle, memory ownership, VMM controls, pipeline slot planning, and cleanup
contract for the standalone Dist-MoE backend.

Test Plan:
- `pre-commit run --files README.md docs/dist_moe.md`


ghstack-source-id: 0f603b3
Pull-Request: #4543
sanketpurandare added a commit that referenced this pull request Sep 10, 2026
Document the model conversion, checkpoint compatibility, shared MXFP8 FSDP
lifecycle, memory ownership, VMM controls, pipeline slot planning, and cleanup
contract for the standalone Dist-MoE backend.

Test Plan:
- `pre-commit run --files README.md docs/dist_moe.md`


ghstack-source-id: cc45371
Pull-Request: #4543
sanketpurandare added a commit that referenced this pull request Sep 10, 2026
Summary:
Add the single TorchTitan-owned guide for the standalone Dist-MoE backend. It
documents conversion, checkpoint compatibility, the shared MXFP8/FSDP
lifecycle, memory and VMM ownership, pipeline slot planning, configuration, and
cleanup. Kernel and allocator internals remain in the package documentation.
It distinguishes the direct ordinary-eager entry from the registered
ordered-effect entry used under dispatch and tracing.

This change defines no independent runtime contract and does not duplicate
kernel derivations. Examples must continue to match the registered config schema
and the released package API.

Dependencies and risks:
- Documentation follows #4539-#4542/#4559 and the released annex API.
- Broken links or stale examples are release-blocking documentation drift.

Test Plan:
- `pre-commit run --files README.md docs/dist_moe.md`
- Markdown link check and executable validation of copied configuration examples.

ghstack-source-id: cc45371
Pull-Request: #4543
sanketpurandare added a commit that referenced this pull request Sep 10, 2026
Summary:
Add the single TorchTitan-owned guide for the standalone Dist-MoE backend. It
documents conversion, checkpoint compatibility, the shared MXFP8/FSDP
lifecycle, memory and VMM ownership, pipeline slot planning, configuration, and
cleanup. Kernel and allocator internals remain in the package documentation.
It distinguishes the direct ordinary-eager entry from the registered
ordered-effect entry used under dispatch and tracing.

This change defines no independent runtime contract and does not duplicate
kernel derivations. Examples must continue to match the registered config schema
and the released package API.

Dependencies and risks:
- Documentation follows #4539-#4542/#4559 and the released annex API.
- Broken links or stale examples are release-blocking documentation drift.

Test Plan:
- `pre-commit run --files README.md docs/dist_moe.md`
- Markdown link check and executable validation of copied configuration examples.

ghstack-source-id: cc45371
Pull-Request: #4543
@sanketpurandare sanketpurandare changed the title [Do not review] [docs] Document the Dist-MoE integration [docs] Document the Dist-MoE integration Sep 10, 2026
@sanketpurandare
sanketpurandare marked this pull request as ready for review September 10, 2026 20:03
sanketpurandare added a commit that referenced this pull request Sep 11, 2026
Summary:
Add the single TorchTitan-owned guide for the standalone Dist-MoE backend. It
documents conversion, checkpoint compatibility, the shared MXFP8/FSDP
lifecycle, memory and VMM ownership, pipeline slot planning, configuration, and
cleanup. Kernel and allocator internals remain in the package documentation.
It distinguishes the direct ordinary-eager entry from the registered
ordered-effect entry used under dispatch and tracing.

This change defines no independent runtime contract and does not duplicate
kernel derivations. Examples must continue to match the registered config schema
and the released package API.

Dependencies and risks:
- Documentation follows #4539-#4542/#4559 and the released annex API.
- Broken links or stale examples are release-blocking documentation drift.

Test Plan:
- `pre-commit run --files README.md docs/dist_moe.md`
- Markdown link check and executable validation of copied configuration examples.

ghstack-source-id: ec33322
Pull-Request: #4543
sanketpurandare added a commit that referenced this pull request Sep 11, 2026
Summary:
Add the single TorchTitan-owned guide for the standalone Dist-MoE backend. It
documents conversion, checkpoint compatibility, the shared MXFP8/FSDP
lifecycle, memory and VMM ownership, pipeline slot planning, configuration, and
cleanup. Kernel and allocator internals remain in the package documentation.
It distinguishes the direct ordinary-eager entry from the registered
ordered-effect entry used under dispatch and tracing.

This change defines no independent runtime contract and does not duplicate
kernel derivations. Examples must continue to match the registered config schema
and the released package API.

Dependencies and risks:
- Documentation follows #4539-#4542/#4559 and the released annex API.
- Broken links or stale examples are release-blocking documentation drift.

Test Plan:
- `pre-commit run --files README.md docs/dist_moe.md`
- Markdown link check and executable validation of copied configuration examples.

ghstack-source-id: a2aec19
Pull-Request: #4543
sanketpurandare added a commit that referenced this pull request Sep 14, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `max_routing_imbalance_factor` is the HBM scratch boundary, while `vmm_host_scratch_imbalance_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains how `device_memory_budget_bytes` includes both hot scratch and saved activations, why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly resource construction before context creation, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, automatic four-phase runtime setup, eager PP stage-microbatch slot selection, native pre-combine postprocessing, idempotent cleanup, and the current GraphPP metadata limitation. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: c3749e1
Pull Request resolved: #4543
sanketpurandare added a commit that referenced this pull request Sep 14, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `max_routing_imbalance_factor` is the HBM scratch boundary, while `vmm_host_scratch_imbalance_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains how `device_memory_budget_bytes` includes both hot scratch and saved activations, why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly resource construction before context creation, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine postprocessing, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime before model-state initialization, initializes its annex context afterward, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: ec42c6f
Pull Request resolved: #4543
sanketpurandare added a commit that referenced this pull request Sep 14, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `max_routing_imbalance_factor` is the HBM scratch boundary, while `vmm_host_scratch_imbalance_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains how `device_memory_budget_bytes` includes both hot scratch and saved activations, why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly resource construction before context creation, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine postprocessing, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime before model-state initialization, initializes its annex context afterward, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: 799d22c
Pull Request resolved: #4543

@tianyu-l tianyu-l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address comment

Comment thread .claude/skills/dist_moe/SKILL.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry by #4543 (comment) I didn't mean creating a skill for DistMoE. I was saying maybe I should create a skill to let people be aware that documents should be put close to the module they refer to. When I read my comment, it was indeed confusing.

Please remove this skill.md.

sanketpurandare added a commit that referenced this pull request Sep 14, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `max_routing_imbalance_factor` is the HBM scratch boundary, while `vmm_host_scratch_imbalance_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains how `device_memory_budget_bytes` includes both hot scratch and saved activations, why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly resource construction before context creation, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine postprocessing, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime before model-state initialization, initializes its annex context afterward, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: 0515e8c
Pull Request resolved: #4543
sanketpurandare added a commit that referenced this pull request Sep 14, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `max_routing_imbalance_factor` is the HBM scratch boundary, while `vmm_host_scratch_imbalance_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains how `device_memory_budget_bytes` includes both hot scratch and saved activations, why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly resource construction before context creation, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine postprocessing, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime before model-state initialization, initializes its annex context afterward, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: 0963709
Pull Request resolved: #4543
@pytorch-bot pytorch-bot Bot added the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Sep 23, 2026
sanketpurandare added a commit that referenced this pull request Sep 23, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `max_routing_imbalance_factor` is the HBM scratch boundary, while `vmm_host_scratch_imbalance_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains how `device_memory_budget_bytes` includes both hot scratch and saved activations, why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly resource construction before context creation, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine postprocessing, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime before model-state initialization, initializes its annex context afterward, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: 70ad2b0
Pull Request resolved: #4543
sanketpurandare added a commit that referenced this pull request Sep 23, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `max_routing_imbalance_factor` is the HBM scratch boundary, while `vmm_host_scratch_imbalance_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains how `device_memory_budget_bytes` includes both hot scratch and saved activations, why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly resource construction before context creation, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine postprocessing, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime before model-state initialization, initializes its annex context afterward, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: 8f9831a
Pull Request resolved: #4543
sanketpurandare added a commit that referenced this pull request Sep 23, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `max_routing_imbalance_factor` is the HBM scratch boundary, while `vmm_host_scratch_imbalance_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains how `device_memory_budget_bytes` includes both hot scratch and saved activations, why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly resource construction before context creation, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine postprocessing, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime before model-state initialization, initializes its annex context afterward, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: 8f9831a
Pull Request resolved: #4543
sanketpurandare added a commit that referenced this pull request Sep 24, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `max_routing_imbalance_factor` is the HBM scratch boundary, while `vmm_host_scratch_imbalance_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains how `device_memory_budget_bytes` includes both hot scratch and saved activations, why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly resource construction before context creation, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine postprocessing, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime before model-state initialization, initializes its annex context afterward, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: 0f6063c
Pull Request resolved: #4543
sanketpurandare added a commit that referenced this pull request Sep 24, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `max_routing_imbalance_factor` is the HBM scratch boundary, while `vmm_host_scratch_imbalance_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains how `device_memory_budget_bytes` includes both hot scratch and saved activations, why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly resource construction before context creation, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine postprocessing, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime before model-state initialization, initializes its annex context afterward, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: 071a693
Pull Request resolved: #4543
sanketpurandare added a commit that referenced this pull request Sep 24, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `max_routing_imbalance_factor` is the HBM scratch boundary, while `vmm_host_scratch_imbalance_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains how `device_memory_budget_bytes` includes both hot scratch and saved activations, why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly resource construction before context creation, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine postprocessing, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime before model-state initialization, initializes its annex context afterward, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: d5f8931
Pull Request resolved: #4543
sanketpurandare added a commit that referenced this pull request Sep 25, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `max_routing_imbalance_factor` is the HBM scratch boundary, while `vmm_host_scratch_imbalance_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains how `device_memory_budget_bytes` includes both hot scratch and saved activations, why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly resource construction before context creation, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine postprocessing, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime before model-state initialization, initializes its annex context afterward, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: c5534a1
Pull Request resolved: #4543
sanketpurandare added a commit that referenced this pull request Sep 25, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `max_routing_imbalance_factor` is the HBM scratch boundary, while `vmm_host_scratch_imbalance_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains how `device_memory_budget_bytes` includes both hot scratch and saved activations, why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly resource construction before context creation, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine postprocessing, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime before model-state initialization, initializes its annex context afterward, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: 23f887c
Pull Request resolved: #4543
sanketpurandare added a commit that referenced this pull request Sep 25, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `max_routing_imbalance_factor` is the HBM scratch boundary, while `vmm_host_scratch_imbalance_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains how `device_memory_budget_bytes` includes both hot scratch and saved activations, why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly resource construction before context creation, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine postprocessing, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime before model-state initialization, initializes its annex context afterward, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: e929859
Pull Request resolved: #4543
sanketpurandare added a commit that referenced this pull request Sep 25, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `max_routing_imbalance_factor` is the HBM scratch boundary, while `vmm_host_scratch_imbalance_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains how `device_memory_budget_bytes` includes both hot scratch and saved activations, why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly resource construction before context creation, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine postprocessing, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime before model-state initialization, initializes its annex context afterward, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: 4356718
Pull Request resolved: #4543
sanketpurandare added a commit that referenced this pull request Sep 25, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `max_routing_imbalance_factor` is the HBM scratch boundary, while `vmm_host_scratch_imbalance_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains how `device_memory_budget_bytes` includes both hot scratch and saved activations, why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly resource construction before context creation, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine postprocessing, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime before model-state initialization, initializes its annex context afterward, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: 2b3b93e
Pull Request resolved: #4543
sanketpurandare added a commit that referenced this pull request Sep 25, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `max_routing_imbalance_factor` is the HBM scratch boundary, while `vmm_host_scratch_imbalance_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains how `device_memory_budget_bytes` includes both hot scratch and saved activations, why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly resource construction before context creation, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine postprocessing, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime before model-state initialization, initializes its annex context afterward, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: 2b3b93e
Pull Request resolved: #4543
sanketpurandare added a commit that referenced this pull request Sep 26, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `device_scratch_capacity_factor` is the HBM scratch boundary, while `VmmConfig.total_scratch_capacity_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains that `saved_activation_buffer_bytes` controls only saved forward state, while the annex planner adds mandatory hot scratch to derive the complete device allocation. It explains why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly annex-owned resource construction during context initialization, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine `output_postprocess`, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime after schedule construction, initializes its annex context after model-state materialization, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: f3712fd
Pull Request resolved: #4543
sanketpurandare added a commit that referenced this pull request Sep 26, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `device_scratch_capacity_factor` is the HBM scratch boundary, while `VmmConfig.total_scratch_capacity_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains that `saved_activation_buffer_bytes` controls only saved forward state, while the annex planner adds mandatory hot scratch to derive the complete device allocation. It explains why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly annex-owned resource construction during context initialization, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine `output_postprocess`, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime after schedule construction, initializes its annex context after model-state materialization, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: f4e46fa
Pull Request resolved: #4543
sanketpurandare added a commit that referenced this pull request Sep 26, 2026
Summary:
Add the user-facing tutorial and operational skill for TorchTitan's standalone DistMoE integration. The README is an explanation of the integration contract, not a restatement of dataclass fields: it starts from the routing and ownership boundary, shows how to select BF16 or asynchronous MXFP8 routed experts through model transforms, and follows setup through FSDP, pipeline activation ownership, execution, and teardown.

The configuration tutorial defines the receive-capacity model. For `T` local tokens, top-k `K`, and EP degree `P`, balanced routing receives `T * K` rows per rank and the topology maximum is `T * P * min(K, num_local_experts)`. It explains that `device_scratch_capacity_factor` is the HBM scratch boundary, while `VmmConfig.total_scratch_capacity_factor` is the larger device-plus-host correctness boundary. It also distinguishes the peer-addressable symmetric communication buffers, the device-only activation arena, shared device scratch, and optional pinned host-backed VMM overflow.

Two complete examples show the intended choices:

- A device-only factor-four configuration, where all activation and scratch storage is in HBM and exceeding factor four is an error.
- A VMM configuration with factor one in HBM and factor four total capacity, where only overflow scratch uses pinned host-backed pages and saved activations remain in HBM.

The README explains that `saved_activation_buffer_bytes` controls only saved forward state, while the annex planner adds mandatory hot scratch to derive the complete device allocation. It explains why `None` selects the minimum all-recompute plan, how additional bytes reduce dynamic recomputation up to the logged maximum useful budget, and how the selected bytes are divided across schedule-derived activation slots. It documents every common and MXFP8-only transform setting with its default, ownership, memory/performance implications, and valid use. VMM prefetch is explicitly annex-owned resource construction during context initialization, not managed memory, demand paging, or a CPU/GPU synchronization mode.

The remainder documents stable `w13.weight`/`w2.weight` checkpoint ownership, shared MXFP8/FSDP prepared-weight lifetime, the trainer-owned two-step runtime lifecycle, eager PP stage-microbatch slot selection, native pre-combine `output_postprocess`, failure cleanup, and the current GraphPP metadata limitation. It explains why the trainer prepares one rank-global runtime after schedule construction, initializes its annex context after model-state materialization, and closes it exactly once instead of making every expert module own the same resource or relying on implicit process-global state. The operational skill links back to this authoritative component guide and keeps VMM validation off personal development GPUs.

No model, kernel, allocator, or execution behavior changes in this PR.

Test Plan:
- Scoped pre-commit formatting, codespell, and link checks passed for the README and skills
- The device-only and VMM examples were checked against the current transform and annex planner APIs
- The documented pure-fake and hybrid backend launch examples were executed in the owning distributed-topology PR

ghstack-source-id: 6d4077c
Pull Request resolved: #4543

@tianyu-l tianyu-l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment


```bash
python -m pip install "dist-moe==0.1.0"
```

@sanketpurandare sanketpurandare Oct 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wwwjn changed the installation to git nightly

Summary:
Add a user-facing Dist-MoE integration guide under
torchtitan/models/common/dist_moe/README.md and link it from the top-level
feature list.

The guide documents the optional package boundary, nightly Git installation,
BF16/MXFP8 transforms, parameter/checkpoint ownership, runtime lifecycle,
scratch and activation-slot planning, VMM, eager PP and GraphPP slot selection,
FSDP prepared-weight handling, WGrad ownership, output postprocessing, recipe
locations, and current limitations.

Test Plan:
- Markdown formatting and codespell pass.
- Link checking passes for README.md and the Dist-MoE guide.
- BF16, MXFP8, and VMM examples use the final API and import paths.

ghstack-source-id: d1fa2f6
Pull Request resolved: #4543
@weifengpy

Copy link
Copy Markdown
Contributor

this README.md helped me. thanks for including it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/b200 Trigger B200 CI ciflow/fake-pg Run 1-GPU Fake PG integration tests ciflow/rl CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants