Phase Tracking

Barriers reuse across iterations by flipping phase 0 ↔ 1

phase = 0
Iter 0
phase = 1
Iter 1
phase = 0
Iter 2
phase = 1
Iter 3
phase = 0
Iter 4
phase = 1
Iter 5
phase = 0
Iter 6
phase = 1
Iter 7

How It Works

Each barrier has a phase bit (0 or 1). After all expected arrivals and tracked asynchronous transfers complete, the barrier advances to the next phase and resets — ready for the next iteration. No reinitialization is needed.
1
Producer reports the arrival and expected transfer bytes (phase 0)
2
Arrivals and transfers finish; the barrier advances to phase 1
3
try_wait(phase=0) returns; the kernel updates its local parity

Why Phase Tracking?

In a pipelined kernel, barriers are reused every iteration of the K-loop. Phase tracking solves the problem of "did this barrier fire for iteration i or iteration i-1?"
phase_tma = 0
for k in range(K):
  try_wait(tma_bar, phase_tma)
  phase_tma ^= 1  # flip