Skip to main content

Post-hoc: does the number of barriers per loop step belong in the core?

Post-hoc. Uses only the opened v0.2 holdout labels and the archived v0.2 IRs; no core change, no unopened data. It answers one question from ROADMAP.md: the core charges one stage synchronization (sync_ns) per pipeline step whatever the number of barriers in the loop, while the v0.2 kernels have 2 to 14 per step. Is the barrier count worth a mechanism candidate after v0.3?

What the profile measures​

fixed_sync_ns comes from fixed_sync_empty_kernel (m2_kernels.cuh): per step, one cp.async.wait_group, one __syncthreads() and one cp.async.commit_group, with no other work. stage_sync_overhead_ns comes from the stage_overhead_* kernels, also one __syncthreads() per step. So the profile value is the cost of one barrier per step, and the core charges that one value per step (sim.rs, Phase::Main), whatever the loop's barrier op says.

Data​

  • Labels: the measured medians of the opened v0.2 holdouts, v02-holdout-scores.json (sha256 6557eebc...), 1,024 measured configurations (GEMM 324 and attention 188 per GPU), warm and cold.
  • Predictions: the current core (built at ad2fc38; no core change up to d8eefdb) on the bundled gb10.json and rtx4070.json, nominal (draws=0), from the archived v0.2 holdout IRs (1,104 files, digest 28f17ea3... of the sorted sha256sum list; not in the repository). Signed error is predicted / measured - 1; negative means predicted too fast.
  • The v0.2 development set is not included: its IR archive is not on the machine this was run on.

Barrier counts​

From the IRs' loop barrier op (the PTX barriers per step the frontend counts):

2 per step31014
GB10 GEMM324
RTX 4070 GEMM156168
Attention, each GPU1443410

They are not spread over the configurations. In attention, 10 and 14 occur only with head dimension 128 and 64-row tiles; head dimension 128 with 128-row tiles, and every head dimension 64 tile, has 2. Within the 64-row, head dimension 128 configurations, 14 occurs only at 8 warps (m64n64, m64n128), 10 at 4 warps and at 8 warps with m64n32. In RTX 4070 GEMM, 3 tracks Triton's stage count (most s2 and all s4 configurations); on GB10 the same configurations compile to 2.

Residuals by barrier count​

Median signed error, warm / cold:

GPUAttention, 21014GEMM, 23
GB10-4.7% / +2.5%-7.4% / -7.1%-13.2% / -12.9%-8.3% / -7.6%
RTX 4070+5.6% / +7.1%-4.4% / -3.8%-11.2% / -8.4%-4.0% / -1.1%-1.9% / -0.4%

In attention the error falls with the barrier count on both GPUs. What can and cannot be separated:

  • 10 against 14: no barrier effect left at a fixed warp count. At 8 warps, 10 barriers (m64n32) and 14 (m64n64) give -14.6% and -15.0% on GB10 (warm) and -12.9% and -11.2% on the RTX 4070; at 4 warps, 10 barriers give -7.5% and -1.3% (m64n32, m64n64, GB10). The step from 10 to 14 follows the warp count, not the barriers.
  • 2 against 10: not separable. The change from 2 to 10 comes with a change of head dimension (64 to 128 at 64-row tiles) or of tile height (128 to 64 rows at head dimension 128). Along the first, GB10 warm does not move (-8.0% to -7.4%) while GB10 cold and the RTX 4070 fall by 9 to 11 points; along the second, all four fall by 12 to 15 points. Head dimension and tile shape could carry all of it.
  • GEMM, 2 against 3 (RTX 4070), goes the other way: at Triton s2 the 2-barrier configurations are predicted -5.7% (warm) and the 3-barrier ones +0.2%. These are different tiles (the 2-barrier s2 configurations are 24 of 108), so this is not a barrier effect either.
  • The sync share of the predicted time (bound_fraction) is 0 in every configuration, so the per-step charge never limits a v0.2 prediction outright, though it does enter the time.

A counterfactual with no fitted parameter​

Charging the measured one-barrier cost once per barrier (each profile's fixed_sync_ns multiplied by the configuration's barrier count, core otherwise unchanged) narrows the attention groups' medians (GB10 warm -2.1%, +2.8%, -3.9%; RTX 4070 warm +7.5%, +2.9%, +2.3%), but over all configurations it does not help:

Cohort, warmMedian absolute errorMedian Kendall tau per case
GB10 attention10.0% to 9.0%0.641 to 0.620
GB10 GEMM9.0% to 8.8%0.788 to 0.788
RTX 4070 attention6.8% to 7.5%0.714 to 0.707
RTX 4070 GEMM7.4% to 8.9%0.803 to 0.787

Cold is the same in direction (GB10 attention 8.6% to 8.4%, RTX 4070 GEMM 6.9% to 7.6%; tau within 0.015). These are the opened labels, so this validates nothing either way.

Answer​

Not worth a mechanism candidate on this evidence. At a fixed warp count the barrier count shows no effect (10 against 14); the larger contrast (2 against 10) cannot be told apart from head dimension and tile shape in this set; the RTX 4070 GEMM contrast points the other way; and charging each barrier with the measured cost makes absolute error and ranking no better overall. If the question comes back, the first step is a microbenchmark that varies only the barriers per step at fixed work, not more mining of these residuals.

The two ROADMAP.md items stay open as known model behaviour; this note settles neither.