Unit 7 of 10 · about 4 hours · implement
A validated pipeline schedule event simulator
A simulator turns schedule arguments into checkable traces. It is the oracle the section checkpoint asks for: valid GPipe and 1F1B traces with predicted bubbles and peaks.
You'll be able to
- Implement a deterministic event simulator for GPipe and 1F1B with timeline and per-stage live-activation state.
- Validate traces against dependency, order and peak-live checks plus hand traces for small stage and microbatch counts.
- Emit failure-injection cases with wrong order, short microbatches and stalled peers that the validator rejects.
Covers
Read
In this order, only the parts listed
0 of 5 done
- Fill-drain specificationGPipe: Efficient Training of Giant Neural Networks using Pipeline Parallelism
Sections 2 and 3 (arXiv:1811.06965v5) as the fill-drain specification the simulator reproduces: equal microbatches, simultaneous work on different microbatches, synchronous apply at mini-batch end
- AFAB and 1F1B as event-order oraclesPicotron - Pipeline Parallelism
train_step_pipeline_afabandtrain_step_pipeline_1f1bas event-order oracles: FIFO tensor pops, the warmup formula, bidirectional steady-state exchanges, and the cooldown drain - Action tables as the trace formatTorchFeather - Pipeline Minimal Example and Runtime
build_stage_zero_scheduleandbuild_stage_one_scheduleaction tables withActionKindevents andformat_scheduleprints as the trace format to match, including the empty-schedule guard - Schedule cell representationTensorTonic - Pipeline Bubble Utilization
Time-ordered stage-ordered lists with forward, backward and idle cells as the interchange format for traces
- Scheduler contract from the subsystem projectDistributed Training Subsystem - Pipeline Scheduler
Milestones B, D and E: per-rank event trace (B), failure-injection cases (D), and bubble and activation-peak prediction versus measurement (E); keep the simulator runnable without GPUs
Focus on
- Events are timestamped stage ops with explicit dependencies: a forward needs the previous stage's forward for its microbatch, a backward needs its own forward plus the next stage's backward.
- Live-activation state is part of the trace: each stored forward increments the count, each consumed backward decrements it, and the peak per stage is checked against for GPipe and for 1F1B.
- Validation is three checks on every trace: dependencies completed, each microbatch's backward after its forward on every stage, and no stage running two ops at once.
- Failure cases are first-class outputs: wrong order, short microbatch and stalled peer must each fail validation with a named cause, not a silent wrong trace.
Common mistakes · 3
- Validating only the happy path. Inject wrong order, short microbatches and stalled peers, and require the validator to reject each by name.
- Reporting simulator makespans as hardware predictions. Unit-cost traces prove schedule validity, not GPU step time.
- Accepting degenerate inputs. Mirror the TorchFeather guards: reject empty microbatch counts and warn when microbatches undercount stages.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.What three checks validate a trace?Answer
Every op's dependencies completed first; each microbatch's backward comes after its forward on every stage; no stage runs two ops at once.
2.GPipe with 3 stages and 5 microbatches at unit forward and backward cost: what makespan and peak live count does the simulator predict?Answer
Each wave lasts slots for a makespan of 14, and each stage peaks at 5 live microbatches at the wave boundary.
3.1F1B with 3 stages and 5 microbatches: what warmup counts and peak live counts apply?Answer
Warmup forwards by rank, and each stage peaks at warmup plus one live, at most 3 on the first stage.
4.Why keep the simulator deterministic and CPU-only?Answer
Schedule validity is a discrete property of event order, so determinism makes traces diffable. Hardware timing belongs to the trade-offs unit with a stated topology.
You're done when
Hand traces for small stage and microbatch counts match simulator output cell for cell, and all three injected failures fail validation by name.
Only when you can do this without notes.
Leads to
Notes
Resources · 5 for this unit, 7 more in the section
- Picotron - Pipeline ParallelismHugging Face · required
Read pipeline_parallel/pipeline_parallel.py and pp_communications.py beside the pipeline branch in train.py. Build a schedule event simulator first, then reproduce GPipe and 1F1B with shape, tag and ordering assertions.
- TorchFeather - Pipeline Minimal Example and RuntimeTorchFeather · required
Run
minimal_examples/pp_gpipe.pywith 8 Gloo processes on CPU (two stages by four replicas); it checks outputs and averaged gradients against a reference. Read its taggedisendandirecvcalls, thendistributed/pipeline_parallel.py, and compare the event order with Picotron. - GPipe: Efficient Training of Giant Neural Networks using Pipeline ParallelismHuang et al. (NeurIPS 2019) · support
Read the partitioning, microbatching and re-materialization design and the bubble overhead statement. Use it as the fill-drain specification your simulator reproduces.
- TensorTonic - Pipeline Bubble UtilizationTensorTonic · support
Solve the pipeline bubble utilization problem, then extend its model to 1F1B and interleaved stages in your simulator.
- Distributed Training Subsystem - Pipeline SchedulerRoadmap-Final · support
Complete the scheduler, event trace, activation-lifetime accounting and failure injection required in Milestone B. Keep the simulator runnable without GPUs.
Also in this section
- Ultra-Scale Playbook - Pipeline ParallelismHugging Face · primary
Read Pipeline Parallelism through All forward, all backward, One forward, one backward, Interleaving stages and Zero bubble and DualPipe. Derive bubble fraction and peak activation count for your simulator before running any schedule.
- Picotron Tutorial - Steps 7 and 8Hugging Face · support
Read
step7_pipeline_parallel_afabandstep8_pipeline_parallel_1f1bwith their diffs; the video series stops before pipeline parallelism. - First-Principles Video - Pipeline Parallelism SegmentUmar Jamil · support
Watch 06:06:17 for pipeline parallelism and 06:26:52 for GPipe, 1F1B and zero-bubble schedules. Stop after GPipe and 1F1B to draw and test those event traces; zero-bubble implementation remains depth work.
- PyTorch Pipeline Parallelism TutorialPyTorch · required
Complete the tutorial and compare
ScheduleGPipeandSchedule1F1B, then read https://docs.pytorch.org/docs/2.14/distributed.pipelining.html for the interleaved, looped, zero-bubble and DualPipeV schedules the tutorial omits. Preserve the model split, microbatch and loss contracts before adapting it. - How to Scale Your Model - Pipeline Parallelism in Chapter 5Google DeepMind · support
Work the pipeline bubble and communication examples in Chapter 5. Use them to test your cost model under different stage counts, microbatch counts and imbalanced layers.
- Memory-Efficient Pipeline-Parallel DNN TrainingNarayanan et al. (ICML 2021) · support
Read the PipeDream-Flush (1F1B) schedule and its activation-memory bound. Compare its stashed-activation count with GPipe in your simulator.
- Zero Bubble Pipeline ParallelismQi et al. (ICLR 2024) · support
Read the split of backward into input and weight gradients and the handcrafted schedules. Optional vocabulary for zero-bubble and DualPipe schedules.