Plan: what one more barrier per loop step costs on GB10 (registration)
Plan, not a result. Registered before any code or capture, for two ROADMAP.md items: the core charges a stage synchronization (sync_ns) on every pipeline step, also on a loop with no barrier; and it charges one sync_ns per step whatever the number of barriers. It produces measurements only. It does not propose how the core should change; that is a separate pull request once this result exists.
Why
sync_ns in the core (Machine::sync_ns, charged per Phase::Main step in sim.rs) is looked up in pipeline.fixed_sync_ns by warp count and buffer count. That value comes from fixed_sync_empty_kernel: one CTA (grid = 1), 4 or 8 warps, and per step one cp.async.wait_group, one __syncthreads() and one cp.async.commit_group with no other work (profiles/gb10-0.23.0.json: 26.0 ns at 4 warps and 29.2 ns at 8 warps, one buffer). So it is the cost of one barrier per step on an otherwise empty loop. The archived v0.2 kernels have 2 to 14 barriers per step, and the synthetic non-MMA kernels have none (post-hoc look, non-MMA registration). The post-hoc look could not separate the barrier count from head dimension and tile shape in kernel timings; this measures it directly, at fixed work.
What is measured
A new mode, barrier-step. One kernel template, compiled per barrier count B: a loop of steps iterations; each iteration runs a fixed block of independent FP32 FMA work (8 chains per thread, as in fp32_fma_kernel) of W warp instructions per warp, then B plain __syncthreads() (bar.sync 0). A loop-carried counter keeps the loop alive at B = 0 and W = 0. No memory access in the loop.
Points, every combination of:
barriers_per_stepB: 0, 1, 2, 4, 8, 14 (14 is the largest count in the v0.2 kernels).work_per_stepW: 0, 64 and 512 warp instructions per warp: an empty step, as infixed_sync_ns; a short step, about twice a barrier's cost at 8 warps on GB10's measured issue rate; and a step several times a barrier's cost.num_warps: 4 and 8 (the warp counts offixed_sync_nsand of the v0.2 kernels).grid: 1 CTA (asfixed_sync_nsis measured) and one CTA on every SM.
72 points. Each point's value is the time per step: launch time over steps, from the long-launch protocol below.
Before any capture, the assembler output of every instance is checked: exactly B BAR.SYNC and W FFMA per loop iteration (after unrolling), and nothing else in the loop except the counter, compare and branch. An instance that fails is fixed before the capture; the check is reported with the result.
Launch protocol
As every scheduled mode (long-launch-capture.md): a pilot sizes each point's steps until its fastest launch reaches 1.25 ms, the schedule is frozen with B, W, num_warps and grid as design fields, every launch is at least 1.0 ms, and --clock-probe records the SM clock around every point. 15 samples and 3 warm-ups per point. Spark 1 under the GPU lock, after the quiet-host gate, three processes in one session, each host-checked; a failed host check voids that process and it is replaced once.
Quantities
For each (W, num_warps, grid) and each process, the per-step time t(B) at the six barrier counts, as the median of the point's samples. Over processes, a point's value is the median of the three process values.
- The one-barrier step cost
d1 = t(1) - t(0). - The per-barrier increment
b: the least-squares slope oft(B)overB= 1, 2, 4, 8, 14. - Linearity: the largest absolute residual of that fit relative to
t(B)at the sameB.
Frozen reading
Per (W, num_warps, grid), in this order:
- Capture rules. Rules 1 and 2 per process and rule 3 over the three processes on
launch_ns_samples, with the usual tolerances. A failing point is reported, not dropped. A configuration with a point that fails a rule gets neither reading below: it is not resolved. - A barrier-free step does not pay the barrier cost when, in all three processes,
t(1) - t(0)is above both 5% oft(1)and half of the profile'sfixed_sync_nsfor that warp count and one buffer. It pays it when, in all three,t(1) - t(0)is below 5% oft(1). Otherwise: not resolved. - The barrier count matters when, in all three processes, the slope
bis positive andt(14) - t(1)is above 5% oft(1). It does not when, in all three,|t(14) - t(1)|is below 5% oft(1). Otherwise: not resolved. - Linear in the count (read only where reading 3 says it matters) when the largest residual of the fit is at most 5% of
t(B)in all three processes; otherwise not linear, and the shape is reported.
Each reading is stated per configuration; the plan draws no single verdict across them. A configuration where the work hides the barriers (readings 2 and 3 negative at W = 512 but positive at W = 0) is reported as such.
Reported without a verdict
d1andbagainst the profile'sfixed_sync_ns(26.0 ns at 4 warps, 29.2 ns at 8 warps, one buffer).- The same quantities in SM cycles, from the clock probes.
- One CTA against all SMs.
Not covered
- Barriers next to asynchronous copies (
cp.async.wait_group), and named or partial barriers. - More than one CTA per SM, and other warp counts.
- The RTX 4070: the same plan applies later, under the quiet desktop gate.
- How the core should charge barriers.
Owners: 7; review 6.