Skip to content

[PP][3/3] DTensor Pipeline Parallelism unit and integration tests - #177729

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

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

Conversation

@sanketpurandare

@sanketpurandare sanketpurandare commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

Stacked PRs:


[PP][3/3] DTensor Pipeline Parallelism unit and integration tests

Summary:
Adds comprehensive test suites for DTensor-aware Pipeline Parallelism.

test_dtensor_pp_unit_tests.py:

  • Tests for _TensorMeta, _DTensorMeta metadata validation
  • Tests for _StageMeta, _StageForwardMeta, _StageBackwardMeta
  • Tests for InferenceMode enum and _MeshCache
  • Tests for _RecvInfo with is_root_arg
  • Tests for validate_tensors_metadata with TensorMeta inputs
  • Tests for _make_tensor_from_meta DTensor reconstruction

test_dtensor_pp_integration.py:

  • Multi-process integration tests for DTensor PP
  • Tests STATIC and DYNAMIC inference modes end-to-end
  • Tests ScheduleGPipe, Schedule1F1B, ScheduleInterleaved1F1B
    with DTensor inputs across multiple ranks
  • Tests DTensor microbatch splitting and gradient propagation
  • Tests DeviceMesh integration with PP world groups

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

@pytorch-bot

pytorch-bot Bot commented Mar 18, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/177729

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 5 New Failures, 1 Pending, 16 Unrelated Failures

As of commit 7c84d9b with merge base 4f596a5 (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

UNSTABLE - The following jobs are marked as unstable, possibly due to flakiness on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot Bot added the topic: not user facing topic category label Mar 18, 2026
sanketpurandare added a commit that referenced this pull request Mar 18, 2026
Summary:
Adds comprehensive test suites for DTensor-aware Pipeline Parallelism.

test_dtensor_pp_unit_tests.py (617 lines):
- Tests for _TensorMeta, _DTensorMeta metadata validation
- Tests for _StageMeta, _StageForwardMeta, _StageBackwardMeta
- Tests for InferenceMode enum and _MeshCache
- Tests for _RecvInfo with is_root_arg
- Tests for validate_tensors_metadata with TensorMeta inputs
- Tests for _make_tensor_from_meta DTensor reconstruction

test_dtensor_pp_integration.py (838 lines):
- Multi-process integration tests for DTensor PP
- Tests STATIC and DYNAMIC inference modes end-to-end
- Tests ScheduleGPipe, Schedule1F1B, ScheduleInterleaved1F1B
  with DTensor inputs across multiple ranks
- Tests DTensor microbatch splitting and gradient propagation
- Tests DeviceMesh integration with PP world groups

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

stack-info: PR: #177729, branch: sanketpurandare/stack/3
@sanketpurandare
sanketpurandare force-pushed the sanketpurandare/stack/3 branch from 6134f9a to e87554b Compare March 18, 2026 11:55
@sanketpurandare
sanketpurandare force-pushed the sanketpurandare/stack/2 branch from 382466f to d653abe Compare March 18, 2026 11:55
@sanketpurandare sanketpurandare added module: pipelining Pipeline Parallelism release notes: distributed (pipeline) release notes category labels Mar 18, 2026
@sanketpurandare sanketpurandare added the ciflow/trunk Trigger trunk jobs on your pull request label Mar 18, 2026
@sanketpurandare
sanketpurandare force-pushed the sanketpurandare/stack/2 branch from d653abe to cb7d43d Compare March 20, 2026 23:25
@sanketpurandare
sanketpurandare changed the base branch from sanketpurandare/stack/2 to main March 20, 2026 23:34
@pytorch-bot pytorch-bot Bot added the ciflow/torchtitan Run TorchTitan integration tests label Mar 20, 2026
@sanketpurandare
sanketpurandare force-pushed the sanketpurandare/stack/3 branch from e87554b to a35d42c Compare March 20, 2026 23:34
sanketpurandare added a commit that referenced this pull request Mar 20, 2026
Summary:
Adds comprehensive test suites for DTensor-aware Pipeline Parallelism.

test_dtensor_pp_unit_tests.py (617 lines):
- Tests for _TensorMeta, _DTensorMeta metadata validation
- Tests for _StageMeta, _StageForwardMeta, _StageBackwardMeta
- Tests for InferenceMode enum and _MeshCache
- Tests for _RecvInfo with is_root_arg
- Tests for validate_tensors_metadata with TensorMeta inputs
- Tests for _make_tensor_from_meta DTensor reconstruction

test_dtensor_pp_integration.py (838 lines):
- Multi-process integration tests for DTensor PP
- Tests STATIC and DYNAMIC inference modes end-to-end
- Tests ScheduleGPipe, Schedule1F1B, ScheduleInterleaved1F1B
  with DTensor inputs across multiple ranks
- Tests DTensor microbatch splitting and gradient propagation
- Tests DeviceMesh integration with PP world groups

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

stack-info: PR: #177729, branch: sanketpurandare/stack/3
@sanketpurandare
sanketpurandare changed the base branch from main to sanketpurandare/stack/2 March 20, 2026 23:34
@sanketpurandare
sanketpurandare changed the base branch from sanketpurandare/stack/2 to main March 23, 2026 21:32
sanketpurandare added a commit that referenced this pull request Mar 23, 2026
Summary:
Adds comprehensive test suites for DTensor-aware Pipeline Parallelism.

test_dtensor_pp_unit_tests.py (617 lines):
- Tests for _TensorMeta, _DTensorMeta metadata validation
- Tests for _StageMeta, _StageForwardMeta, _StageBackwardMeta
- Tests for InferenceMode enum and _MeshCache
- Tests for _RecvInfo with is_root_arg
- Tests for validate_tensors_metadata with TensorMeta inputs
- Tests for _make_tensor_from_meta DTensor reconstruction

test_dtensor_pp_integration.py (838 lines):
- Multi-process integration tests for DTensor PP
- Tests STATIC and DYNAMIC inference modes end-to-end
- Tests ScheduleGPipe, Schedule1F1B, ScheduleInterleaved1F1B
  with DTensor inputs across multiple ranks
- Tests DTensor microbatch splitting and gradient propagation
- Tests DeviceMesh integration with PP world groups

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

stack-info: PR: #177729, branch: sanketpurandare/stack/3
@sanketpurandare
sanketpurandare force-pushed the sanketpurandare/stack/3 branch from a35d42c to c0bb6b9 Compare March 23, 2026 21:32
@sanketpurandare
sanketpurandare changed the base branch from main to sanketpurandare/stack/2 March 23, 2026 21:32
@sanketpurandare
sanketpurandare changed the base branch from sanketpurandare/stack/2 to main March 24, 2026 12:59
@sanketpurandare
sanketpurandare force-pushed the sanketpurandare/stack/3 branch from c0bb6b9 to aae6a5a Compare March 24, 2026 12:59
sanketpurandare added a commit that referenced this pull request Mar 24, 2026
Summary:
Adds comprehensive test suites for DTensor-aware Pipeline Parallelism.

test_dtensor_pp_unit_tests.py (617 lines):
- Tests for _TensorMeta, _DTensorMeta metadata validation
- Tests for _StageMeta, _StageForwardMeta, _StageBackwardMeta
- Tests for InferenceMode enum and _MeshCache
- Tests for _RecvInfo with is_root_arg
- Tests for validate_tensors_metadata with TensorMeta inputs
- Tests for _make_tensor_from_meta DTensor reconstruction

test_dtensor_pp_integration.py (838 lines):
- Multi-process integration tests for DTensor PP
- Tests STATIC and DYNAMIC inference modes end-to-end
- Tests ScheduleGPipe, Schedule1F1B, ScheduleInterleaved1F1B
  with DTensor inputs across multiple ranks
- Tests DTensor microbatch splitting and gradient propagation
- Tests DeviceMesh integration with PP world groups

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

stack-info: PR: #177729, branch: sanketpurandare/stack/3
@sanketpurandare
sanketpurandare changed the base branch from main to sanketpurandare/stack/2 March 24, 2026 12:59
@sanketpurandare
sanketpurandare changed the base branch from sanketpurandare/stack/2 to main March 24, 2026 15:04
sanketpurandare added a commit that referenced this pull request Mar 24, 2026
Summary:
Adds comprehensive test suites for DTensor-aware Pipeline Parallelism.

test_dtensor_pp_unit_tests.py (617 lines):
- Tests for _TensorMeta, _DTensorMeta metadata validation
- Tests for _StageMeta, _StageForwardMeta, _StageBackwardMeta
- Tests for InferenceMode enum and _MeshCache
- Tests for _RecvInfo with is_root_arg
- Tests for validate_tensors_metadata with TensorMeta inputs
- Tests for _make_tensor_from_meta DTensor reconstruction

test_dtensor_pp_integration.py (838 lines):
- Multi-process integration tests for DTensor PP
- Tests STATIC and DYNAMIC inference modes end-to-end
- Tests ScheduleGPipe, Schedule1F1B, ScheduleInterleaved1F1B
  with DTensor inputs across multiple ranks
- Tests DTensor microbatch splitting and gradient propagation
- Tests DeviceMesh integration with PP world groups

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

stack-info: PR: #177729, branch: sanketpurandare/stack/3
@sanketpurandare
sanketpurandare changed the base branch from main to sanketpurandare/stack/2 March 27, 2026 19:20
@sanketpurandare
sanketpurandare changed the base branch from sanketpurandare/stack/2 to main April 9, 2026 09:26
@sanketpurandare
sanketpurandare force-pushed the sanketpurandare/stack/3 branch from 46850dc to a9bcf18 Compare April 9, 2026 09:26
sanketpurandare added a commit that referenced this pull request Apr 9, 2026
Summary:
Adds comprehensive test suites for DTensor-aware Pipeline Parallelism.

test_dtensor_pp_unit_tests.py:
- Tests for _TensorMeta, _DTensorMeta metadata validation
- Tests for _StageMeta, _StageForwardMeta, _StageBackwardMeta
- Tests for InferenceMode enum and _MeshCache
- Tests for _RecvInfo with is_root_arg
- Tests for validate_tensors_metadata with TensorMeta inputs
- Tests for _make_tensor_from_meta DTensor reconstruction

test_dtensor_pp_integration.py:
- Multi-process integration tests for DTensor PP
- Tests STATIC and DYNAMIC inference modes end-to-end
- Tests ScheduleGPipe, Schedule1F1B, ScheduleInterleaved1F1B
  with DTensor inputs across multiple ranks
- Tests DTensor microbatch splitting and gradient propagation
- Tests DeviceMesh integration with PP world groups

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

stack-info: PR: #177729, branch: sanketpurandare/stack/3
@sanketpurandare
sanketpurandare changed the base branch from main to sanketpurandare/stack/2 April 9, 2026 09:26
@sanketpurandare
sanketpurandare changed the base branch from sanketpurandare/stack/2 to main April 9, 2026 11:16
sanketpurandare added a commit that referenced this pull request Apr 9, 2026
Summary:
Adds comprehensive test suites for DTensor-aware Pipeline Parallelism.

test_dtensor_pp_unit_tests.py:
- Tests for _TensorMeta, _DTensorMeta metadata validation
- Tests for _StageMeta, _StageForwardMeta, _StageBackwardMeta
- Tests for InferenceMode enum and _MeshCache
- Tests for _RecvInfo with is_root_arg
- Tests for validate_tensors_metadata with TensorMeta inputs
- Tests for _make_tensor_from_meta DTensor reconstruction

test_dtensor_pp_integration.py:
- Multi-process integration tests for DTensor PP
- Tests STATIC and DYNAMIC inference modes end-to-end
- Tests ScheduleGPipe, Schedule1F1B, ScheduleInterleaved1F1B
  with DTensor inputs across multiple ranks
- Tests DTensor microbatch splitting and gradient propagation
- Tests DeviceMesh integration with PP world groups

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

stack-info: PR: #177729, branch: sanketpurandare/stack/3
@sanketpurandare
sanketpurandare force-pushed the sanketpurandare/stack/3 branch from a9bcf18 to f13d3fd Compare April 9, 2026 11:16
@sanketpurandare
sanketpurandare changed the base branch from main to sanketpurandare/stack/2 April 9, 2026 11:16
pytorchmergebot pushed a commit that referenced this pull request Apr 9, 2026
Stacked PRs:
 * #177729
 * #177728
 * __->__#177727

--- --- ---

### [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

Pull Request resolved: #177727
Approved by: https://github.com/wconstab, https://github.com/acisseJZhong
@sanketpurandare
sanketpurandare changed the base branch from sanketpurandare/stack/2 to main April 9, 2026 13:29
@sanketpurandare
sanketpurandare force-pushed the sanketpurandare/stack/3 branch from f13d3fd to 82e7b31 Compare April 9, 2026 13:29
sanketpurandare added a commit that referenced this pull request Apr 9, 2026
Summary:
Adds comprehensive test suites for DTensor-aware Pipeline Parallelism.

test_dtensor_pp_unit_tests.py:
- Tests for _TensorMeta, _DTensorMeta metadata validation
- Tests for _StageMeta, _StageForwardMeta, _StageBackwardMeta
- Tests for InferenceMode enum and _MeshCache
- Tests for _RecvInfo with is_root_arg
- Tests for validate_tensors_metadata with TensorMeta inputs
- Tests for _make_tensor_from_meta DTensor reconstruction

test_dtensor_pp_integration.py:
- Multi-process integration tests for DTensor PP
- Tests STATIC and DYNAMIC inference modes end-to-end
- Tests ScheduleGPipe, Schedule1F1B, ScheduleInterleaved1F1B
  with DTensor inputs across multiple ranks
- Tests DTensor microbatch splitting and gradient propagation
- Tests DeviceMesh integration with PP world groups

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

stack-info: PR: #177729, branch: sanketpurandare/stack/3
@sanketpurandare
sanketpurandare changed the base branch from main to sanketpurandare/stack/2 April 9, 2026 13:29
@sanketpurandare
sanketpurandare changed the base branch from sanketpurandare/stack/2 to main April 9, 2026 19:51
sanketpurandare added a commit that referenced this pull request Apr 9, 2026
Summary:
Adds comprehensive test suites for DTensor-aware Pipeline Parallelism.

test_dtensor_pp_unit_tests.py:
- Tests for _TensorMeta, _DTensorMeta metadata validation
- Tests for _StageMeta, _StageForwardMeta, _StageBackwardMeta
- Tests for InferenceMode enum and _MeshCache
- Tests for _RecvInfo with is_root_arg
- Tests for validate_tensors_metadata with TensorMeta inputs
- Tests for _make_tensor_from_meta DTensor reconstruction

test_dtensor_pp_integration.py:
- Multi-process integration tests for DTensor PP
- Tests STATIC and DYNAMIC inference modes end-to-end
- Tests ScheduleGPipe, Schedule1F1B, ScheduleInterleaved1F1B
  with DTensor inputs across multiple ranks
- Tests DTensor microbatch splitting and gradient propagation
- Tests DeviceMesh integration with PP world groups

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

stack-info: PR: #177729, branch: sanketpurandare/stack/3
@sanketpurandare
sanketpurandare force-pushed the sanketpurandare/stack/3 branch from 82e7b31 to 5f89142 Compare April 9, 2026 19:51
@sanketpurandare
sanketpurandare changed the base branch from main to sanketpurandare/stack/2 April 9, 2026 19:51
pytorchmergebot pushed a commit that referenced this pull request Apr 9, 2026
Stacked PRs:
 * #177729
 * __->__#177728

Fixes #172419
--- --- ---

### [PP][2/3] DTensor-aware stage and schedule refactoring

Summary:
Refactors PipelineStage and schedule infrastructure for DTensor-aware
Pipeline Parallelism, migrating to the new metadata utilities from [1/3].

Key changes in stage.py:
- Refactored _PipelineStageBase, _PipelineStage, PipelineStage for
  DTensor support with STATIC/DYNAMIC inference modes
- Replaced _RootArgPlaceholder with unified _RecvInfo.is_root_arg flag
- New _prepare_forward_infra/_prepare_backward_infra for metadata-driven
  initialization with DTensor shape/placement tracking
- Replaced PipeliningShapeError with PipeliningMetadataError
- Added _validate_fwd_inputs using new TensorMeta-based validation
- _make_tensor_from_meta moved from stage.py to _utils.py

Key changes in schedules.py:
- Added _determine_and_set_global_inference_mode() for cross-stage
  consensus on STATIC vs DYNAMIC mode
- Refactored _initialize_stage(s) with mode-change detection
- Updated step() callers to extract first_target from target_mbs

Key changes in _utils.py:
- Replaced old validate_tensors_metadata (torch.Tensor signature) with
  new TensorMeta-based version
- Removed legacy backward-compat shims: PipeliningShapeError,
  validate_tensor_metadata, old validate_tensors_metadata

Test fixes:
- test_stage.py: PipeliningShapeError -> PipeliningMetadataError

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

Pull Request resolved: #177728
Approved by: https://github.com/wconstab
@sanketpurandare
sanketpurandare changed the base branch from sanketpurandare/stack/2 to main April 9, 2026 22:44
sanketpurandare added a commit that referenced this pull request Apr 9, 2026
Summary:
Adds comprehensive test suites for DTensor-aware Pipeline Parallelism.

test_dtensor_pp_unit_tests.py:
- Tests for _TensorMeta, _DTensorMeta metadata validation
- Tests for _StageMeta, _StageForwardMeta, _StageBackwardMeta
- Tests for InferenceMode enum and _MeshCache
- Tests for _RecvInfo with is_root_arg
- Tests for validate_tensors_metadata with TensorMeta inputs
- Tests for _make_tensor_from_meta DTensor reconstruction

test_dtensor_pp_integration.py:
- Multi-process integration tests for DTensor PP
- Tests STATIC and DYNAMIC inference modes end-to-end
- Tests ScheduleGPipe, Schedule1F1B, ScheduleInterleaved1F1B
  with DTensor inputs across multiple ranks
- Tests DTensor microbatch splitting and gradient propagation
- Tests DeviceMesh integration with PP world groups

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

stack-info: PR: #177729, branch: sanketpurandare/stack/3
@sanketpurandare
sanketpurandare force-pushed the sanketpurandare/stack/3 branch from 5f89142 to 721ea2b Compare April 9, 2026 22:44
Summary:
Adds comprehensive test suites for DTensor-aware Pipeline Parallelism.

test_dtensor_pp_unit_tests.py:
- Tests for _TensorMeta, _DTensorMeta metadata validation
- Tests for _StageMeta, _StageForwardMeta, _StageBackwardMeta
- Tests for InferenceMode enum and _MeshCache
- Tests for _RecvInfo with is_root_arg
- Tests for validate_tensors_metadata with TensorMeta inputs
- Tests for _make_tensor_from_meta DTensor reconstruction

test_dtensor_pp_integration.py:
- Multi-process integration tests for DTensor PP
- Tests STATIC and DYNAMIC inference modes end-to-end
- Tests ScheduleGPipe, Schedule1F1B, ScheduleInterleaved1F1B
  with DTensor inputs across multiple ranks
- Tests DTensor microbatch splitting and gradient propagation
- Tests DeviceMesh integration with PP world groups

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

stack-info: PR: #177729, branch: sanketpurandare/stack/3
@sanketpurandare
sanketpurandare force-pushed the sanketpurandare/stack/3 branch from 721ea2b to 7c84d9b Compare April 10, 2026 14:50
@sanketpurandare

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge -f "Unrelated Failures and 1 rocm job stuck. All distributed jobs passing."

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

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 topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants