Unit 11 of 11 · about 4 hours · derive, measure

Choosing TP and CP degrees, and asynchronous tensor parallelism

Increasing a degree shrinks local work but adds communication and can worsen kernel efficiency. Choose a correct, memory-feasible plan before testing whether overlap reduces its critical path.

You'll be able to

  • Derive feasible TP and CP degree candidates from head policy, memory, sequence length and link bandwidth.
  • Measure synchronous and asynchronous CPU correctness paths without claiming GPU overlap from their timings.
  • Distinguish an asynchronous launch from hidden communication using a dependency model and, when hardware permits, a GPU trace.

Covers

TP or CP degree choice under link bandwidth and sequence lengthAsynchronous tensor parallelism and collective overlap
1

Read

In this order, only the parts listed

0 of 4 done

  1. Degree choice depends on the workload and linksUltra-Scale Playbook - Tensor, Sequence and Context Parallelism

    Closing TP throughput/memory trade-off; Sequence parallelism closing benchmark summary; Context Parallelism and Ring Attention overlap discussion

    Use the trends and dependencies, not the plotted throughput as a target. The node boundary and eight-GPU threshold describe the authors' topology, not a universal TP limit.

  2. Chunked communication and matmul overlapHow to Scale Your Model - Chapters 3 and 5

    Chapter 3, How to overlap matmul communication with compute: collective-matmul animation and chunked matmul/ring-reduction explanation

    Read this subsection only. Transfer the dependency reasoning; TPU bandwidth and tiled-kernel behavior are not GPU measurements.

  3. Input-gradient reduction beside weight-gradient computePicotron - Tensor and Context Parallelism

    LinearWithAsyncAllReduce.backward; linear_with_all_reduce and linear_with_async_all_reduce

    Trace launch, independent weight/bias work and final wait. This is backward overlap at one column layer, not a tiled forward asynchronous-TP implementation.

  4. Asynchronous results still need completionPyTorch Tensor Parallel Tutorial

    DTensor.redistribute: async_op; DTensor.to_local: AsyncCollectiveTensor return and wait contract

2

Focus on

  • TP shards large weights and feature work but communicates at projection boundaries. CP partitions tokens and attention work without sharding parameters by itself. Longer sequences supply more attention compute per streamed KV byte, but causal imbalance and small local blocks can limit that advantage.
  • Enumerate legal degrees, keep global valid tokens and model semantics fixed, and combine the earlier storage/traffic ledger with launch latency and effective bandwidth. Local GEMM efficiency and temporary-buffer peaks can invalidate an otherwise attractive byte-only plan.
  • Picotron computes the input gradient, launches its all-reduce, computes independent weight/bias gradients, then waits before returning. Tiled forward asynchronous TP instead overlaps partial matmuls with communication chunks; it requires additional scheduling and buffer dependencies.
  • For ideal independent compute and communication durations, an overlap window costs , not their sum. Startup, final drain and contention remain. CPU timings and a host's early return establish neither this ideal nor real GPU overlap.
Common mistakes · 3
  • Timing only the asynchronous launch or reading a collective output before completion. Neither measures the completed operation.
  • Increasing TP until local matmuls become too small, or choosing CP to solve parameter memory that remains replicated.
  • Claiming overlap because compute and communication appear on different streams. Their actual intervals, dependencies and contention determine the exposed tail.
3

Try it yourself

Closed-book, before checking anything

Without notes, draw Picotron's synchronous and asynchronous backward dependencies. On four CPU/Gloo processes, run the previous linear oracle with async_all_reduce=False and async_all_reduce=True, keeping inputs and weights fixed. Compare all gradients and record warmed-up wall-clock backward samples with communication complete before stopping the timer; label them CPU execution, not GPU overlap evidence. In a deterministic timing model with independent 3 ms compute and 2 ms communication, compare a 5 ms serial window with a 3 ms ideal overlapped window. Sweep hypothetical bandwidth and sequence length for legal TP/CP candidates using the earlier ledger. With two or more GPUs, optionally repeat the matched NCCL variants with synchronized timing and a profiler trace; report exposed communication and any regression, not an assumed speedup.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Which work can Picotron place beside the input-gradient all-reduce?Answer

    Weight- and bias-gradient computation. They use saved input and upstream gradient, not the reduced input gradient. The caller still needs completion before consuming that input gradient.

  2. 2.Does a longer sequence always make a larger CP degree faster?Answer

    No. It can improve compute per KV byte, but local block size, imbalance, launch latency and link contention still constrain useful degrees.

  3. 3.Can an asynchronous variant pass every oracle and still be slower?Answer

    Yes. Correct scheduling may add launches, waits, buffers or contention without hiding enough communication. Preserve correctness and report the measured regression.

You're done when

Your legal candidate table names memory and communication limits, both CPU variants match the gradient oracle, and your model or available GPU trace distinguishes launch, useful overlap and exposed communication.

Only when you can do this without notes.

Leads to

Notes

Resources · 4 for this unit, 9 more in the section
  • Ultra-Scale Playbook - Tensor, Sequence and Context ParallelismHugging Face · primary

    Read Tensor Parallelism, Tensor parallelism in a transformer block, Sequence parallelism, Context Parallelism, Ring Attention and Zig-Zag Ring Attention in order. Redraw every tensor shape and collective for a concrete batch, sequence, hidden and head configuration; the context-parallel section gives no byte formula, so derive one yourself.

  • Picotron - Tensor and Context ParallelismHugging Face · required

    Read tensor_parallel/tensor_parallel.py, tp_communications.py, context_parallel/context_parallel.py and cp_communications.py. tests/test_tensor_parallel.py hardcodes NCCL and CUDA; port it to Gloo on CPU and compare with torch.testing.assert_close, because its exact equality check fails when sharded and full matmuls round differently.

  • PyTorch Tensor Parallel TutorialPyTorch · required

    Use the tutorial to map ColwiseParallel, RowwiseParallel, SequenceParallel, PrepareModuleInput and loss parallelism to the ownership model you derived, with the DTensor reference at https://docs.pytorch.org/docs/2.14/distributed.tensor.html for Shard, Replicate, Partial and redistribute. Add assertions around every layout transition.

  • How to Scale Your Model - Chapters 3 and 5Google DeepMind · support

    Solve the sharded-matrix multiplication layouts in Chapter 3 and the Megatron sharding section of Chapter 5. Translate the results into PyTorch DTensor placements and collective counts.

Also in this section