Skip to content

[PP][1/3] DTensor metadata foundation for Pipeline Parallelism - #177727

Closed
sanketpurandare wants to merge 1 commit into
mainfrom
sanketpurandare/stack/1
Closed

sanketpurandare wants to merge 1 commit into
mainfrom
sanketpurandare/stack/1

Conversation

@sanketpurandare

@sanketpurandare sanketpurandare commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

Stacked PRs:

Fixes #172419


[PP][1/3] DTensor metadata foundation for Pipeline Parallelism

Summary:
Introduces core DTensor metadata types, helper infrastructure, and
utility additions for DTensor-aware Pipeline Parallelism (PP).

This commit adds:

  • Foundational metadata dataclasses: _TensorMeta, _DTensorMeta,
    _StageMeta, _StageForwardMeta, _StageBackwardMeta
  • InferenceMode enum (STATIC/DYNAMIC)
  • _MeshCache for DeviceMesh caching with get_mesh() API and
    GetMeshCallback protocol
  • to_tensor(device) / to_dtensor(device, mesh) methods on metadata classes
  • Refactored flatten_args with optional detach parameter
  • DTensor-aware microbatch splitting/merging in microbatch.py
  • Metadata extraction helpers: extract_tensor_meta, extract_tensor_metas,
    to_local_if_dtensor, validate_and_normalize_to_tuple
  • TensorMeta-based validation: validate_metadata,
    validate_static_arg_grad_correspondence
  • _derive_grad_metas for gradient metadata derivation
  • _autograd_grad_for_inputs and refactored stage_backward_input in _backward.py
  • Grad context and detach fixes in test_schedule_multiproc.py

Legacy functions (PipeliningShapeError, validate_tensor_metadata,
old validate_tensors_metadata) are kept for backward compatibility
— removed in the next commit.

Test Plan:
python -m pytest test/distributed/pipelining/ -x

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

Labels

ciflow/torchtitan Run TorchTitan integration tests ciflow/trunk Trigger trunk jobs on your pull request Merged module: pipelining Pipeline Parallelism release notes: distributed (pipeline) release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC: DTensor Support for Pipeline Parallelism Stages

6 participants