Skip to content

[release/0.4] Backport required PyTorch 2.15 pipelining fixes - #5570

Merged
acisseJZhong merged 4 commits into
release/0.4from
codex/torch-2.15-rc-compat
Oct 22, 2026
Merged

acisseJZhong merged 4 commits into
release/0.4from
codex/torch-2.15-rc-compat

Conversation

@acisseJZhong

Copy link
Copy Markdown
Contributor

TorchTitan release/0.4 uses pipelining behavior missing from the inspected PyTorch 2.15 RC: core PP rejects loss_kwarg_mbs, Dist-MoE PP cannot register metadata cleanup, and ZeroBubble with release-pinned remat fails when split backward detaches a view in place. This adds an automatically applied compatibility shim for those three upstream fixes.

PyTorch PRs backported

Upstream PR Author Required behavior
pytorch/pytorch#199884 Sanket Purandare Register post-metadata-inference cleanup callbacks, used by Titan's Dist-MoE PP integration and forwarded by GraphTrainer.
pytorch/pytorch#200238 Jiani Wang Support per-microbatch loss_kwarg_mbs, already passed by core Titan PP training.
pytorch/pytorch#200199 Animesh Jain Skip in-place detach of view stage outputs during split input/weight backward, needed by ZeroBubble with activation rematerialization.

The corresponding upstream commits are f722f226bbcebd522c6fec3bc463b21df273cb7e, 9a2d9d7b6434e9aa4e048aa8d1b76939e5fe9962, and b7442f6915a1d95412d7fab784e554053746b08d.

Behavior and compatibility boundary

  • The packaged shim runs during import torchtitan, before training constructs pipeline schedules. Users do not need to call a patch function manually.
  • It replaces the affected Python functions in the current process, preserves schedule class identities, and updates the backward alias used by stage.py. Installed PyTorch files are not modified.
  • The tested wheel is torch==2.15.0+cu130, source commit dd1fefe31baf1bc8efbab6dc5291eebfb948b7bf. The version gate accepts the public version 2.15.0; other public versions are left untouched.
  • Missing-feature checks and exact before/after function-source fingerprints bound the backports to the reviewed implementations. All replacements are prepared before publication; an unsupported source layout raises an explicit error without partially patching the modules. Later RCs, the final wheel, and partial cherry-pick combinations need revalidation.
  • Set TORCHTITAN_DISABLE_TORCH_COMPAT=1 before import in a fresh process to disable the shim for diagnosis.

Validation

  • 66 CPU tests passed: 13 new compatibility regressions and 53 existing PP tests. Coverage includes five schedules, microbatch loss values and gradients, cleanup lifecycle, split-backward view outputs, invalid inputs, and import gates/atomicity.
  • Original RC core PP training reproduces the loss_kwarg_mbs failure. With only the two API backports, ZeroBubble + Full remat reproduces Can't detach views in-place.
  • Two-H100 Llama3 training: 1F1B completed three steps; ZeroBubble + Full remat completed four, including CUDA Graph replay. With seed 42 and deterministic algorithms enabled, recorded loss and grad norm exactly matched an independent application of the upstream source diffs for each recipe.
  • Selected GraphTrainer runner tests: 13 passed, plus 6 subtests. WGrad fusion: 24 passed, plus 13 subtests. GraphTrainer Llama3 FSDP2 completed four steps in both regional and full Inductor modes; these additional runs are smoke tests, not numerical-equivalence checks.
  • Built and installed the 0.4.0rc1 wheel with --no-deps into a separate directory, then imported it outside the checkout. Automatic activation, idempotence, class identity, backward alias binding, and unchanged on-disk Torch hashes passed.
  • pre-commit run --all-files: formatting/style checks passed; global Pyrefly remains failing in files outside this diff (61 diagnostics with the shared development environment; 38 when pointed at the RC overlay). Unrelated automatic edits were restored. Static type checking does not observe the runtime-added PyTorch API.

This remains a draft pending release-wheel revalidation and the full release CI matrix, including B200/Dist-MoE. No additional compiler or performance backports are included.

Apply process-local backports for pytorch/pytorch#199884, #200238, and #200199 when importing TorchTitan on the validated 2.15 RC. Preserve installed torch files and reject unsupported function sources before publishing replacements.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 20, 2026
@acisseJZhong
acisseJZhong marked this pull request as ready for review October 22, 2026 21:41
@pytorch-bot pytorch-bot Bot added the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Oct 22, 2026
@acisseJZhong
acisseJZhong merged commit fed83ea into release/0.4 Oct 22, 2026
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/fake-pg Run 1-GPU Fake PG integration tests 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.

1 participant