Step-5 Preview 1.47×

Harness: Claude Code · switches: YOCO_NO_SHARD=1 YOCO_GRAD_BUCKET_VIEW=1 YOCO_SKIP_GRAD_ZERO=1 YOCO_APEX_NORM=1 YOCO_DDP_BUCKET_MB=50 YOCO_NORM_ON_BF16=1 YOCO_COMPILE_LOSS=0 YOCO_TRITON_ADAM=1 YOCO_SKIP_MP_MAPS=1 YOCO_NO_DDP_DIVIDE=1 YOCO_NORM_CHUNK=524288

Judged
1.47×
Tier
N1
Self-best
1.24×
Rounds
38
Hours
10.1
API cost
$43.6
Input tokens · 99.5% cached
388 M
Output tokens
1.2 M
Requests
821
Cross-GPU exchange via CUDA IPC + copy engine (no SMs)
✗ no exchange: YOCO_NO_SHARD has both GPUs run the full Adam, removing the weight broadcast (1.00× → 1.11×); gradient all-reduce still NCCL, only the bucket raised to 50 MB (1.214× → 1.221×)
Forward / backward CUDA graph
tried, failed: only via torch.compile reduce-overhead (rounds 28/30/33); final timing INVALID "CUDA graphs were requested but skipped", judged infeasible
Newer cuBLAS
✗ round 26 judged the bundled cuBLAS already at its limit, no library swap
Retention / attention kernel swap
✗ round 17 compared flash-attn with torch SDPA (0.601 vs 0.656 ms) and kept flash; retention only tried compile and chunk size, no gain from either
Other main levers
YOCO_TRITON_ADAM: two hand-written Triton kernels for "grad prep + AdamW + bf16 write-back" (1.24× → 1.48×, rounds 56–60); apex FusedRMSNorm 1.13× → 1.21×; gradient_as_bucket_view; model-parallel mappings skipped; DDP without the division (full check 1.50×)
Raw work log42 sections
0.3 hRound 1 — profile the unchanged reference
Start 2026-11-19 04:51. Command: bench.py profile --tree /submission/yoco --out /tmp/r1/profile.
Result: 0.2908 s/update (with profiler overhead).

### Kernel time by category (rank 0, 5 updates, ms)
| category | ms | % |
|---|---|---|
| nccl | 357.6 | 29 |
| gemm | 325.4 | 26 |
| memcpy/cast | 218.7 | 18 |
| elementwise | 153.7 | 12 |
| optimizer (multi_tensor) | 91.2 | 7 |
| flash-attention | 30.1 | 2.4 |
| reduce | 19.2 | |
| triton (rotary/recurrence/inductor) | 13.7 | |
| jiterator (swiglu) | 11.2 | |
| loss | 8.8 | |

### Top kernels
- ncclDevKernel_Broadcast_RING_LL 185 ms / 10 calls — OSS weight all-gather after optimizer step (phase:fairscale::oss::refresh_trainable 187 ms, ~37 ms/update, EXPOSED).
- ncclDevKernel_AllReduce_Sum_bf16_RING_LL 172 ms / 595 calls — DDP gradient all-reduce (~34 ms/update, overlaps backward via DDP hooks).
- 3× sm90_xmma_gemm_bf16... ~300 ms total — the layer GEMMs (near tensor-core peak).
- multi_tensor_apply ... AdamFunctor 71 ms — apex FusedAdam (already fused, ZeRO-1 shard).
- direct_copy 67+65 ms + Memcpy DtoD 26 ms — dtype casts / fp32→bf16 master→model copy.

### Key facts established
- Optimizer = apex FusedAdamV2 wrapped in fairscale OSS (ZeRO-1: whole-parameter sharding, grads full all-reduced, updated master broadcast after each step).
- Grad all-reduce is NOT redundant with OSS (OSS uses the full all-reduced grads; only optimizer STATE is sharded).
- Data loader is NOT a steady-state bottleneck (one startup empty-buffer warning only).
- GPU busy 74%; host CPU ≈ GPU time → partly launch/sync bound. is_nonzero (60 calls, 20 ms CPU) = host syncs from clip_coef<1 / isfinite / _check_grad_norms (all in read-only fairseq/fairscale).
- GEMMs are near peak (output projection ~674 TFLOP/s bf16). QKV/FFN can't be fused (param names/shapes are a gate-2 exact item).
- fp32_reduce_scatter/no_reshard_after_forward are FSDP-only → don't apply to the OSS path.

### Experiment A (no gain): torch.compile RMSNorm
YOCO_COMPILE=rmsnorm, time → s/update 0.2356, speedup_vs_frozen_reference 0.9969. Memory-bound
small-op fusion is hidden behind GEMM/NCCL. Reverted.

### Experiment B (error): whole-model torch.compile
optimize_ddp hits a higher-order op → disabled it → then inductor Invalid NaN comparison on the
-inf causal mask in the gate-retention inner_chunk. Whole-model compile fights the custom autograd
ops (rotary/swiglu/retention) and -inf masks. Reverted.
0.3 hConclusion of round 1
Bottleneck = exposed NCCL weight broadcast (~37 ms, 16%) + GEMM (27%, near-peak) + host syncs (26% idle).
In-tree memory-bound fusion gives ~0. Biggest clean lever: eliminate the OSS weight broadcast (see round 2).

---
0.3 hRound 1 result — WIN: disable ZeRO-1 optimizer-state sharding (N0)
Change: monkey-patch fairseq.optim.shard_ to a no-op in models/__init__.py, gated by
YOCO_NO_SHARD=1 (in /submission/switches.json). Off by default.

Why N0 (bitwise): DDP all-reduces the bf16 gradients → identical on both ranks → each rank computes a
bitwise-identical full Adam update (Adam is pointwise, per-parameter elementwise; batching/chunking
doesn't change per-element results). The trainer's clip_grad_norm runs over the full param_groups
(OSS keeps all params in .param_groups; the sharded clip_grad_norm is NOT used) → identical norm. No
RNG in the optimizer → stream unchanged. Only the post-step weight broadcast is removed. Optimizer state
goes full-per-rank (12.8 GB master + 25.6 GB Adam) — fits in 144 GB.

Results:
- time → s/update 0.2137, speedup_vs_frozen_reference 1.0991 (vs 0.236), beyond_reference_noise true.
- check --quick → PASS, bitwise 9616/9616, measured_tier N0, inputs 204/204.
- Committed 7bd3d67. /submission/switches.json = {"environment": {"YOCO_NO_SHARD": "1"}}.

Trade: 37 ms broadcast removed, but each rank now does full Adam (was sharded, ~+14 ms) → net ~10%.

- FULL CHECK PASSED (/tmp/r2/fullcheck): status PASS, speedup 1.1084, measured_tier N0,
  reference 0.23487 s/update. This is the current best verified submission.
0.6 hRound 2 — next hotspot (after no-shard)
Re-profiled no-shard (/tmp/r2/profile): broadcast gone (nccl 357→242 ms). GPU is **saturated — 0 gaps
>20 µs between 32255 kernels**; wall time = GPU kernel time, so only cutting GPU kernel time helps.
Per-update kernel budget: gemm 66 ms (near-peak, can't fuse — QKV/FFN fusion changes param names =
gate-2 exact item), gradient all-reduce 48 ms (necessary, ~half exposed vs backward GEMM; bandwidth-
bound on the interconnect), full Adam 28.7 ms (necessary, memory-bound at fp32-state floor),
copies 34.6 ms = 1446 tiny kernels/update (largest 0.87 ms; model matmul-contiguous + DDP buckets),
elementwise 31 ms. Host CPU ≈ GPU (~240 ms) but GPU is the bottleneck, so removing host syncs (the
is_nonzero clip/isfinite checks) would not help. RMSNorm compile gave 0 (hidden / guard overhead).

Screening candidates (behind switches, off by default): YOCO_GRAD_BUCKET_VIEW=1 (N0, drop DDP bucket
copies) and YOCO_DDP_BUCKET_MB=<n> (N1, fewer/bigger all-reduce collectives). See below.
0.6 hRound 2 result — WIN: gradient_as_bucket_view (N0), stacked
YOCO_GRAD_BUCKET_VIEW=1 → DDP all-reduces read the gradient tensors directly instead of copying each
into a flat bucket buffer (removes ~256 small copy kernels/update; same all-reduce result, bitwise).
YOCO_DDP_BUCKET_MB=200 (N1) screened: no gain (1.1058) — the all-reduce is bandwidth-bound, not
bucket-count-bound; closed that direction.

- time (gbv stack): speedup_vs_frozen_reference 1.1211.
- check --quick: PASS, N0, 9616/9616.
- Committed 0cbe38d. switches.json = {"YOCO_NO_SHARD":"1","YOCO_GRAD_BUCKET_VIEW":"1"}.

### STACK FULL CHECK PASSED (/tmp/r2/fullcheck2): status PASS, speedup 1.1286 (12.9%), tier N0.
This is the current best verified submission (no-shard + gradient_as_bucket_view, both N0).

Established floors (post-optimisation, GPU-saturated so only kernel-time cuts help): GEMM ~66 ms
(near tensor-core peak; QKV/FFN weight-fusion would change param names = gate-2 exact item), gradient
all-reduce ~48 ms (necessary, bandwidth-bound, ~half overlaps backward but competes for SMs), full Adam
~29 ms (memory-bound at the fp32-state floor — fp16 Adam stats would be removing optimizer state = not
allowed), fp32→bf16 master copy ~5 ms. Remaining soft targets: model-internal copies + elementwise
(~50 ms, mostly inside the custom-op gate-retention/attention path → not fusable by compile).




---
0.6 hCURRENT SUMMARY (updated after round 2)
Submission state: /submission/yoco @ commit 3795b39 (branch opt; behaviorally identical to the verified 6423813 — only untracks __pycache__), switches = YOCO_NO_SHARD + YOCO_GRAD_BUCKET_VIEW + YOCO_SKIP_GRAD_ZERO + YOCO_APEX_NORM.

Best verified result: FULL CHECK PASS, speedup 1.2132 (21.3%), measured_tier N1
(bitwise-identical for the first three changes; the fourth is N1 within 3σ). Reference 0.23487 s/update →
candidate ~0.193 s/update.

Gains by change:
1. Disable ZeRO-1 optimizer-state sharding (YOCO_NO_SHARD=1): +10.8%, N0. 7bd3d67.
2. DDP gradient_as_bucket_view (YOCO_GRAD_BUCKET_VIEW=1): +2%, N0. 0cbe38d.
3. Skip redundant fp32 master-grad zero-fill (YOCO_SKIP_GRAD_ZERO=1): +0.1%, N0. d66633f.
4. apex FusedRMSNorm for the model's RMSNorm (YOCO_APEX_NORM=1): +7.4%, N1. 6423813.
   KEY: the eager RMSNorm backward was a swarm of small autograd kernels and the dominant source of the
   [1,2048,3072] copy kernels. apex fuses forward AND backward. (A forward-only torch.compile gave 0
   precisely because it left the eager backward — the real cost — in place.)

Did NOT work (and why):
- torch.compile RMSNorm: 0.9969 (no gain — hidden behind GEMM/NCCL / guard overhead).
- Whole-model torch.compile: inductor "Invalid NaN comparison" from build_rel_pos's
  1/(rope_theta**linspace) reciprocal/where; after caching cos/sin and graph-breaking it, inductor
  then tried to inline the triton _fwd_recurrence ("Unknown blocked function: tt.reduce"). Every
  custom op (rotary/swiglu/retention-triton/flash) needs its own graph break → too fragmented, and low
  EV given the RMSNorm result. Abandoned. (The cos/sin caching alone is N0 but ~0.02% — not worth it.)
- Larger DDP buckets (YOCO_DDP_BUCKET_MB=200, N1): 1.1058 (no gain — all-reduce is bandwidth-bound, not
  bucket-count-bound).
- NCCL PROTO=Simple/ALGO=Ring (N1): 1.1238 (no gain — all-reduce is bandwidth-bound).
- NCCL MAX_NCHANNELS=2 (N1): 0.7511 (much WORSE — the all-reduce is strongly bandwidth-bound and
  needs all channels; the default is optimal). Closes NCCL tuning.
- YOCO_NO_GRAD_NORM_CHECK=1 (N0, skip _check_grad_norms host sync): 1.1249 (within noise — GPU is
  saturated, the host syncs are absorbed by the launch queue; not the bottleneck).
- QKV/FFN weight fusion: forbidden (changes parameter names/shapes = gate-2 exact item).
- fp16 Adam stats: forbidden (removing fp32 optimizer state).

Remaining floors (post-optimisation): gradient all-reduce ~49 ms (necessary, bandwidth-bound), full
Adam ~29 ms (fp32-state memory floor), GEMM ~66 ms (near tensor-core peak), fp32→bf16 copy ~5 ms. Soft
target left: model-internal copies (~27 ms, ~858 tiny kernels/update) + elementwise (~31 ms), both inside
the custom-op gate-retention/attention path (not fusable by compile). Next expensive lever: attribute the
copies with a stack trace and, if a removable/fusable one is found, write a targeted fusion.
1.7 hRound 4 — re-profile + close the compile direction (no new lever)
- Re-profiled the 3-change stack (/tmp/r4/profile): breakdown stable; skip-grad-zero dropped the
  elementwise category (154→133 ms, the grad-zero fill) but it was launch-overlapped so ~0 wall gain.
  No new hotspot.
- YOCO_COMPILE_CROSS=1 (compile cross_chunk): ERROR — inductor tries to inline the triton
  _fwd_recurrence and can't compile it. Same blocker as whole-model compile. Compile is closed: every
  retention/attention region contains a custom op (triton recurrence / flash / rotary / swiglu) that
  inductor cannot compile, and the model is GEMM-dominated (the fusable elementwise islands are small and
  launch-overlapped). Reverted.

### Bottom line
The reference is well-optimised; the tractable wins are the three "remove work the recipe doesn't need"
changes above (13.0%, all N0). Everything else is at a hardware floor (GEMM/all-reduce/Adam/MP copies) or
locked behind custom ops (compile) or forbidden (QKV/FFN weight fusion changes param names = gate-2 exact
item; fp16 Adam stats = removing fp32 optimizer state). The remaining soft target (~27 ms of
autograd-dispatched model copies) needs a bespoke kernel and is high-effort/low-reward/N1-risky, so it was
not pursued in favour of keeping the verified N0 13.0%.
1.7 hAlso screened & rejected (round 5, cheap)
- YOCO_FLATTEN=1 (force flattened fp32 master so the two mixed-precision copies become one contiguous
  copy each): FusedAdamV2 *does* support flat params, but upstream hard-codes flatten=False for bf16, the
  flatten path is a per-device dict layout that is risky to force, and the copies are already
  bandwidth-bound (per-param vs flat is the same bytes) so the win is only ~launch overhead (~0.6%).
  Not worth the layout risk. Not implemented.
1.9 hDecisive finding (round 6): the step is GPU-bound, so fusing the small ops cannot help
A microbenchmark made RMSNorm look expensive (0.34 ms/call fwd+bwd × ~67 calls ≈ 22 ms). But re-running
the RMSNorm torch.compile under the profiler shows the inductor kernels do appear (4 triton_
kernels) while the elementwise/reduce/memcpy/cast totals are unchanged (132.0/19.3/198.3 ms vs
132.7/19.2/199.0). Interpretation: the many small ops are **CPU-dispatch-bound and that dispatch is
hidden behind the GPU** (host ≈ GPU time, zero inter-kernel gaps in the trace). A fused kernel has the
same GPU bytes (the fp32 intermediates stay in L2), so it removes CPU launches — which are already
overlapped — and cannot reduce wall time. This is *why* every compile variant returned ~0. The only
levers that moved the needle were the ones that removed GPU work (the OSS broadcast, the DDP bucket
copies, the grad-zero fill). The GPU side is now at its floor, so the tractable optimisation space is
exhausted at the verified N0 13.0%.
2.0 hRound 7 — gate-retention chunk_size (no gain)
Made chunk_size configurable (YOCO_CHUNK_SIZE; same exact gate-retention math, different numerical
chunking → N1). Screened 512 and 128 (both divide 2048): 1.1222 and 1.1303 vs the 256 baseline 1.1297 —
i.e. 512 is slightly worse, 128 is a wash. 256 is near-optimal; the retention is not chunk-bound. Reverted.
2.0 hRound 8 — copy attribution (confirms the ceiling)
Shapes-profile of the copies (single-GPU localization, no DDP/optimizer): the dominant copy is
[1,2048,3072] (the hidden state) at ~276 calls/step — the RMSNorm/residual backward (eager autograd);
the 2-GPU run adds ~20 ms more from DDP gradient bucketing (already minimized by gradient_as_bucket_view;
larger buckets tested worse). These are autograd/DDP-internal (no Python stack). A bespoke fused
RMSNorm backward could remove the hidden-state copies (~2%, N1, needs a full check) but is high-effort /
gate-3-risky for a small gain, so it was not pursued. This closes the last GPU-time candidate: the
step is GPU-bound at the hardware floor, and the verified N0 13.0% stands.
2.7 hRound 10 — mixer is CPU-dispatch-bound (closes the last fusion candidate)
r5 profile: self.mixer (gate retention) = 141.8 ms CPU vs 64.3 ms GPU over 65 calls (2.2x) — the most
CPU-dispatch-heavy module. Unlike the RMSNorm (GPU-bound backward → apex fused win), the mixer is
dispatch-bound, so the earlier YOCO_COMPILE_CROSS screen returning a wash (1.2157 ≈ 1.2132) is
consistent and that direction is closed. Final state: verified 21.3% N1 at HEAD 3795b39, clean tree,
confirmed coherent by the final check --quick (status PASS, N1, exact_fail=[], dtype_changes=0, 204/204 inputs).
2.8 hRound 11 — GPU is 93% saturated; launch-gap direction closed with hard evidence
Direct measurement (single-GPU, 4 switches, no profiler): wall 124.4 ms/update vs kernel-sum
118.9 ms/update = 93% GPU busy; gaps >50us total only 1.4 ms/update (18 gaps/update). This
resolves the earlier "73% busy" puzzle (that metric is profiler-inflated) and explains why two independent
kernel-count reductions — YOCO_COMPILE_CROSS (1.2157) and YOCO_COMPILE_RET on
chunk_gate_retention (1.2094) — both failed to move wall time: there is no launch gap to recover.
Both reverted.

Conclusion — the ceiling is established. Per-update GPU kernel time is a hard floor composed of:
GEMM ~46 ms (tensor-core peak; QKV/FFN weight-fusion would change parameter names/shapes = gate-2
exact item), full Adam ~23 ms (fp32-state memory floor), gradient all-reduce ~26 ms (bandwidth floor,
already gradient_as_bucket_view), and the fp32 gating elementwise/copies (already overlapped — proven
by the two compile no-ops). CUDA graphs are infeasible (per-step _set_seed RNG, data-dependent shapes,
triton/flash/apex custom ops, and the numerics adapter re-runs the loop body unchanged).

Final verified submission: 21.3% (N1) at HEAD 3795b39, clean tree, check --quick PASS.
2.9 hRound 12 — QKV/FFN GEMM fusion closed (0.2%, negligible)
Microbenchmark of the gate-retention's four same-shape projections (q,k,v,g, all [3072,3072] on the
same input): 4 separate GEMMs fwd+bwd = 1.239 ms vs 1 fused [12288,3072] GEMM including the
torch.cat = 1.210 ms — a 2.3% gain on those GEMMs, i.e. 0.38 ms/update over 13 layers = 0.2% of wall.
Not worth the N1 numerics risk (the merged GEMM picks a different cuBLAS algorithm → different rounding).
Note torch.cat's backward splits the weight-grad automatically, so parameter names/shapes would have
been preserved — but the gain is negligible regardless. Direction closed.

All levers now closed with evidence. Verified submission: 21.3% (N1) at HEAD 3795b39.
3.0 hRound 13 — gradient sync is at the memory roofline; every category now confirmed at a floor
_sync_fp16_grads_to_fp32 is a Python loop of 119 per-parameter copy_ casts (bf16 grad -> fp32 master
grad, ~19.2 GB). Replacing it with a single torch._foreach_copy_ is bitwise identical (lossless
bf16->fp32 cast) but measures 5.771 ms vs 5.772 ms — no gain, because the loop already saturates HBM
at 3.33 TB/s. Not applied.

Also re-tested on the full 4-switch stack: NCCL_PROTO=Simple = 1.2107 vs 1.2132 (no gain) — the
all-reduce (~36 ms) is hidden inside the ~90 ms of backward compute, which is why no protocol/algorithm
tuning moves wall time.

Complete floor audit (all measured, not assumed):
| component | per-update | status |
|---|---|---|
| GEMM | ~46 ms | tensor-core roofline; weight-fusion = 0.2% (param names are a gate-2 exact item) |
| full Adam | ~28.7 ms | 3.12 TB/s = HBM roofline |
| grad sync (bf16->fp32) | ~5.8 ms | 3.33 TB/s = HBM roofline (foreach = 0%) |
| clip (L2 norm) | ~4 ms | reads all grads once, unavoidable |
| gradient all-reduce | ~36 ms | bandwidth roofline AND hidden behind backward |
| elementwise / copies | ~19+28 ms | near roofline; two compile fusions gave 0% |
| launch gaps | 1.4 ms | GPU 93% saturated |
| data loader | 0 | one startup empty-buffer warning only |
The 21.3% comes entirely from removing work the recipe does not need. This is the ceiling for N0-N2.

### FINAL VERIFICATION (HEAD 3795b39, the exact tree the judge will run)
Full check on /submission/yoco as-is: **status PASS, speedup 1.2138 (21.4%), measured_tier N1,
inputs 204/204 match.** This confirms the submission end-to-end (structure + benefit + bitwise + statistical)
on the exact committed tree, not just a behaviourally-identical ancestor.
3.3 hRound 14 — WIN: DDP bucket_cap_mb 25 -> 50 (numerically neutral, +0.57%)
Re-examined the all-reduce: 6.4 GB in 36.3 ms = 176 GB/s, only ~half of what the link should
deliver, and arithmetic on the single-GPU (124.4 ms) vs 2-GPU (193.6 ms) steps implies the all-reduce is
mostly *exposed*, not hidden. Swept YOCO_DDP_BUCKET_MB on the full 4-switch stack:
25 MB = 1.2138, 50 MB = 1.2207, 100 MB = 1.2201, 400 MB = 1.2138. 50 MB is the optimum.

Numerics proof: the compare report for the 5-switch stack is byte-identical to the apex-only stack's
(sha256 6478de81...), i.e. every recorded tensor / RNG fingerprint / exact item is bitwise unchanged —
for a 2-rank all-reduce each element's sum is a fixed 2-element addition regardless of bucketing, so the
N1/NOT_BITWISE verdict is entirely inherited from YOCO_APEX_NORM (which already passed gate 3). No code
change; switches.json gains YOCO_DDP_BUCKET_MB=50.
3.5 hRound 15 — three more directions closed (all losses or no-gain)
- FFN fc1+gate GEMM fusion: microbenchmark 1.475 ms separate vs 1.560 ms fused (incl. cat) =
  −2.73 ms/update. The 100 MB/layer cat costs more than the GEMM efficiency gain. (Gate-retention
  QKVG fusion was already +0.2%; GEMM fusion is now fully closed.)
- inner_chunk @torch.compile is earning its keep: 124.49 ms compiled vs 128.12 ms eager =
  2.8% faster, so removing it would LOSE 2.8%. (Explains why compiling cross_chunk didn't help:
  inductor's win there is fusing the causal-mask/exp/cast chain, which cross_chunk lacks.)
- mode="reduce-overhead" (CUDA graphs): inner_chunk 124.96 ms (vs 124.49 default) and
  chunk_gate_retention 128.73 ms — both worse. Closed.

Current best: 5-switch stack, full check PASS @ 1.222 (22.2%), tier N1.
3.5 hRound 16 — NCCL tuning fully closed
Swept on the 5-switch stack (baseline 1.222): NCCL_ALGO=Tree = 1.2182, NCCL_MAX_NCHANNELS=32 =
1.2201, both = 1.2151 — all worse or within noise. The current defaults (Ring, default channels,
YOCO_DDP_BUCKET_MB=50) are optimal. Together with the earlier NCCL_PROTO=Simple (1.2107) and
NCCL_MAX_NCHANNELS=2 (much worse), every NCCL knob is now closed.

FINAL: 5-switch stack, full check PASS @ 1.222 (22.2%), tier N1, inputs 204/204.
3.7 hRound 17 — attention backends and rotary tiling closed; host-sync and scan items measured
- Attention backend: microbenchmark at the real shape (B=1, 24 q-heads, 8 kv-heads, causal, d=128):
  flash_attn_func 0.601 ms vs SDPA-with-kv-expansion 0.656 ms per layer — flash is 9% FASTER, so the
  current backend is already optimal (SDPA's GQA needs a materialised kv expansion on torch 2.3).
- Rotary BLOCK_M (upstream hardcodes 4 for the interleaved path, with an autotune commented out):
  swept 4/8/16/32 -> 138.92 / 139.72 / 140.90 / 143.38 ms/update. 4 is optimal; larger tiles are worse.
  Reverted (no change).
- _check_grad_norms removal retested on the 5-switch stack: 1.222 = baseline exactly (the sync is
  fully absorbed). Confirmed closed.
- Remaining sub-threshold items measured and left alone: 16 DtoH host syncs/update (~1.5 ms total, absorbed),
  the fp32 cumsum scan 1.17 ms/update (~45 us/call, ~10-30x off roofline but only 0.6% of wall), and the
  build_rel_pos cos/sin recomputation (~0.02%). All would need custom kernels for <0.5% each.

FINAL SUBMISSION: 6-switch stack, full check PASS @ 1.2239 (22.4%), tier N1, inputs 204/204.
3.7 hRound 18 — cumsum misattribution corrected (non-issue)
Re-measured the item I had flagged as "10-30x off roofline": the fp32 cumsum scan is
tensor_kernel_scan_innermost_dim = 1.17 ms / 130 calls = 9 us/call on [1,24,8,256] = 0.23 ms/update
(0.12% of wall) — not the 45 us/call I inferred. Also tested fusing the cast into the scan
(torch.cumsum(g, -1, dtype=float32) vs g.float().cumsum(-1)): bitwise identical, zero speedup
(13.0 vs 12.9 us). Non-issue; nothing to gain. (Same lesson as the bucket win: re-measure before acting on
an inference.)

---
3.9 hRound 19 — WIN: compute the clip's L2 norm on the bf16 grads before the fp32 sync (N0, +~0.3%)
Upstream's clip_grad_norm syncs bf16->fp32 *first*, then norms the fp32 master grads (12.8 GB read).
bf16->fp32 is lossless and apex's multi_tensor_l2norm accumulates in fp32, so norming the bf16 grads is
bitwise identical while reading half the bytes. Proof: (a) op-level microbenchmark — raw bytes equal;
(b) the compare report against the reference is byte-identical to the apex-only stack's (sha256
6478de81...), i.e. zero additional numerical difference, so gate 3 passes identically. Op-level saving
612 us/update. time: 1.2233 vs the 1.222 baseline (positive, within noise). Gated by YOCO_NORM_ON_BF16.
Commit 66cfb1d.
4.0 hRound 20 — "Adam reads bf16 grads" closed (apex forbids it)
Same order-questioning lens applied to the biggest remaining memory item: the Adam reads the fp32 grad
(12.8 GB) that the sync just wrote. If apex FusedAdam could take the bf16 grads directly it would
cast internally (lossless) and read half the bytes (~1.9 ms). But apex's step raises on an explicit
grads argument ("FusedAdam has been updated. Simply initialize it identically to torch.optim.Adam, and
call step() with no arguments"), and PyTorch refuses to attach a bf16 .grad to an fp32 param. So the
fp32 sync is unavoidable. The remaining optimizer-region traffic (sync 19.2 GB + Adam 89.6 GB +
fp32->bf16 19.2 GB) is at the HBM roofline with no reordering left to remove.

FINAL SUBMISSION: 7-switch stack @ 413ae79, full check PASS @ 1.2414 (24.1%), tier N1, inputs 204/204.
4.1 hRound 21 — all-reduce confirmed at ~90% of the link's raw bandwidth (closed)
2-process raw NCCL benchmark: 50 MB -> 262 GB/s, 96 MB -> 285 GB/s, 616 MB -> 317 GB/s (the GPUs are
NV18/NVLink-connected). The run's 30.5 ms of all-reduce over 6.4 GB is ~90% of that, so there is no
headroom left in the algorithm; and NCCL_ALGO=NVLS / NVLS,TREE both measure 1.222 vs the 1.2239
baseline (no gain). The remaining ~8 ms over the raw figure is launch + tail exposure, which is exactly
what YOCO_DDP_BUCKET_MB=50 already optimises (smaller buckets shrink the exposed tail; larger buckets
raise bandwidth but expose a bigger tail — 100 MB and 400 MB both measured worse).

FINAL: 7-switch stack @ 413ae79, full check PASS @ 1.2414 (24.1%), tier N1, inputs 204/204.
4.2 hRound 22 — fused cross-entropy closed (precision and speed are mutually exclusive)
The loss head (output_projection GEMM 1.65 ms + log_softmax/nll 1.76 ms fwd+bwd) materialises a 1.6 GB
fp32 log-probs tensor. Measured alternatives:
- F.cross_entropy(bf16_logits, ...): 0.494 ms (3x faster) but accumulates in bf16 -> loss differs by
  2.5e-3 relative, ~5x beyond gate 3's 3-sigma band (~0.05-0.1%). N2, would fail.
- F.cross_entropy(fp32_logits, ...): bitwise-identical loss but 1.489 ms = no gain (PyTorch uses the
  same log_softmax+nll path once the input is already fp32).
- PyTorch tiled loss (no materialisation): 2.93 ms — slower (13 tiles x ~4 kernel launches).
So a saving needs a hand-written Triton fused CE (fp32 accumulation over bf16 reads) for ~1.2 ms
(~0.6%), at N1 + custom-kernel risk. Not pursued: the gain is small relative to the risk to the
verified submission.

FINAL: 7-switch stack @ 413ae79, full check PASS @ 1.2414 (24.1%), tier N1, inputs 204/204.
4.6 hRound 24 — re-profile confirms all remaining regions at floors
r9 profile of the 7-switch stack: gemm 65.5 ms (tensor-core roofline), optimizer 31.6 ms (HBM roofline),
nccl 30.1 ms (~90% of the measured raw NVLink bandwidth), elementwise 21.2 ms and memcpy/cast 27.8 ms
(both L2-resident — the compile no-ops in rounds 10/15 prove fusion cannot help), flash 6.2 ms
(flash-attn is the fastest backend, round 17). The compiled loss removed the last large materialised
intermediate; the remaining copies are small and spread (largest ~0.9 ms/update over 52 tensors).

FINAL: 7-switch stack @ 413ae79, full check PASS @ 1.2414 (24.1%), tier N1, inputs 204/204.
4.6 hRound 26 — GEMM budget proven at cuBLAS's limit (no headroom)
Measured the Hopper bf16 GEMM peak directly: 8192^3 = 562 TFLOP/s, 4096^3 = 480 TFLOP/s (fwd+bwd). The
model's actual shapes: FFN fc1/gate [2048x3072x8192] = 419 TFLOP/s, fc2 [2048x8192x3072] = 544,
output_projection [2048x3072x100288] = 447. All three call forms (F.linear, matmul(a,w.T),
mm(a, wt.contiguous())) give the same 419 TFLOP/s for fc1 (the contiguous-weight variant is worse at
338), i.e. cuBLAS is already selecting its best algorithm; the 562 TFLOP/s figure is only reachable for
large square GEMMs. So the 65.5 ms GEMM budget has no recoverable headroom.

(Note: an earlier microbenchmark that reported the output-projection backward at 99 TFLOP/s was a
measurement artefact — allocator/cold-cache effects on the first benchmark in that process; a clean run
gives 447 TFLOP/s.)

FINAL: 7-switch stack @ 413ae79, full check PASS @ 1.2414 (24.1%), tier N1, inputs 204/204.
4.7 hRound 28 — CUDA-graph path (reduce-overhead) closed for now
The real 2-GPU run is only 73% GPU-busy (host ~204 ms/update with profiler overhead), so the host /
launch path — not GPU compute — is the residual bottleneck; CUDA graphs are the canonical fix. Attempted
YOCO_COMPILE_MODEL=reduce-overhead on the whole decoder with the triton recurrence graph-broken and
build_rel_pos's cos/sin precomputed (both N0). Inductor still raised Invalid NaN comparison from a
further -inf/reciprocal source; with suppress_errors the graph would silently fall back to eager, and
a partial capture risks the "skipping cudagraphs" invalid-run signature. Chasing each source is
disproportionate to the remaining budget, so all round-28 edits were reverted; the tree is back at the
verified 413ae79.

FINAL: 7-switch stack @ 413ae79, full check PASS @ 1.2414 (24.1%), tier N1, inputs 204/204.
4.9 hRound 29 — reproducibility confirmed
Independent re-run of the full check on the identical tree: PASS, speedup 1.2420 (candidate
0.1891 s/update) vs the earlier 1.2414 (0.1892). Δ = 0.05% — the 24.1% is stable, not a lucky
measurement, which is what the final evaluation's reference→candidate→reference timing will see.

FINAL: 7-switch stack @ 413ae79, full check PASS @ 1.2414–1.2420 (24.1–24.2%), tier N1, inputs 204/204.
5.0 hRound 30 — CUDA-graph path: 3 successive inductor blockers found, then closed
Fixed three blockers in turn (each revealed by the previous): the causal-mask -inf, build_rel_pos's
lazy cos/sin precompute (graph-broken so the once-only trig stays eager), and flash-attn's custom-op
output ({'OUT': FakeTensor(1,2048,24,128)}) which inductor "cannot extract sympy expressions from".
The flash break did not take effect and the same error persisted. Conclusion: this model's hot path is
built from custom ops (flash-attn, the triton rotary/recurrence kernels, apex Adam) that inductor cannot
trace, so whole-model compile / CUDA graphs are not reachable without hand-written graph management.
All round-30 edits reverted; tree restored to the verified 413ae79.

FINAL: 7-switch stack @ 413ae79, full check PASS @ 1.2414 / 1.2420 (24.1–24.2%), tier N1, inputs 204/204.
5.1 hRound 33 — CUDA graphs definitively ruled out (invalid-run signature)
With all custom ops graph-broken (rotary, flash, the triton recurrence) and the cos/sin precompute hoisted,
YOCO_COMPILE_MODEL=reduce-overhead compiles but the run comes back INVALID: "CUDA graphs were
requested but skipped: the run measured the path without graphs" — a listed invalid_run_signatures
entry that fails gate 1. Inductor cannot place a cudagraph over a graph fragmented by these breaks, so
reduce-overhead is unusable here. Combined with the earlier finding that default-mode compile of the
traceable islands gives ~0% (they are L2-resident), the ~18% launch-bound GPU idle is **not recoverable
within the N0–N2 contract** — it would need the custom kernels themselves replaced (L4).

FINAL: 7-switch stack @ 413ae79, full check PASS @ 1.2414 / 1.2420 (24.1–24.2%), tier N1, inputs 204/204.
5.2 hRound 36 — cross-attention copies measured directly (negligible, closed)
Attributed the cross-attention's copies with a shapes profile: 0.091 ms over 2 steps for 3 copies of
[1,2048,3072] plus 4 casts = 0.045 ms/update — negligible, and not the source of the earlier
[1,2048,24,128] attribution (that belongs to the gate-retention backward, already shown L2-resident
and unfusable). Every copy source in the step has now been measured.

FINAL: 7-switch stack @ 413ae79, full check PASS @ 1.2414 / 1.2420 (24.1–24.2%), tier N1, inputs 204/204.
5.4 hRound 51 — fp32->bf16 sync fusion: no gain (bandwidth-bound)
Replaced _sync_fp32_params_to_fp16's 119-iteration copy_ loop with a single torch._foreach_copy_
(bitwise identical, one launch instead of 119). Measured 1.2401 vs the 1.2414 baseline — no gain, because
the pass is HBM-bandwidth-bound (19.2 GB at 3.3 TB/s), not launch-bound; this matches the earlier
grad-sync foreach result (5.771 vs 5.772 ms). Reverted.

Also re-profiled the 7-switch stack: the fp32 BinaryFunctor elementwise reads 51 us/call in the bench
profile but only ~13 us/call in a clean single-GPU microbenchmark — i.e. the profiler inflates it ~3x, so
the elementwise category is ~3.7 ms/update, not 12.3 ms. Consistent with the earlier finding that the
memory-bound chains are already at their roofline.

FINAL: 7-switch stack @ 413ae79, full check PASS @ 1.2414 / 1.2420 (24.1–24.2%), tier N1, inputs 204/204.
5.4 hRound 54 — Triton fused AdamW+bf16 kernel: 36% faster, but blocked on numerics
Wrote a Triton kernel doing the AdamW update AND the bf16 model write in one pass (eliminating the
separate 19.2 GB sync). Microbenchmark on the real param mix: **apex FusedAdam 16.31 ms, apex+sync
21.97 ms, Triton fused 14.13 ms — 36% faster than the current path** (~4-5% end-to-end). Correctness:
matches apex to 1.3e-4 (abs) after 3 steps, but that drift is NOT explained by operation order (all three
orderings of the weight-decay/update give the identical 1.3e-4) — it comes from Triton's arithmetic
contraction, and reproducing apex's exact fp32 rounding would need more work than the remaining budget
supports. Since a ~1e-4/step drift risks gate 3's 3-sigma band, this was NOT integrated; tree left at the
verified 413ae79. Recorded as the most promising unexploited direction: fusing the bf16 write into the
optimizer step is worth ~4-5% if apex's arithmetic can be matched.

FINAL: 7-switch stack @ 413ae79, full check PASS @ 1.2414 / 1.2420 (24.1–24.2%), tier N1, inputs 204/204.
5.5 hRound 55 — Triton Adam drift isolated to the master-update line (FMA/reassociation)
Isolated the 1.3e-4 drift precisely: exp_avg and exp_avg_sq match apex to ~1e-8 (essentially exact);
ONLY the master update m - lr*wd*m - ss*ea/denom differs (4.9e-6 at N=1000, 1.3e-4 at N=9.4M, growing
with N). Cause: Triton contracts that expression into FMAs / reassociates it, whereas apex issues two
separate in-place ops with intermediate rounding. apex itself matches a manual PyTorch Adam to 6e-8, so
the reference arithmetic is standard — the gap is purely my kernel's contraction. Closing it needs
bit-level control of the Triton codegen (preventing FMA contraction per-term), which the remaining budget
does not support. Recorded as the precise, actionable blocker for the ~4-5% fused-Adam win.
6.3 hRound 56 — fused Triton AdamW + bf16 write: **+6.6%** (1.2427 -> 1.3232, PASS)
The round-54/55 "drift" was NOT Triton arithmetic. Probing apex with a uniform element
(m=1, g=1) showed the *formula* was wrong: the 1.3e-4 drift concentrated on near-zero-gradient
elements whose update is eps-dominated, and apex's real denominator is sqrt(eas)/sqrt(bc2) + eps
with step_size = lr/bc1 — i.e. the sqrt(bc2) sits in the denominator *together with eps*, NOT on
the whole update (which is what rescaled eps by sqrt(bc2) too). With that fixed the kernel is
bitwise identical to apex on the master weights and the bf16 model weights over 200 updates
(0 of 3.4e9 elements differ; only exp_avg/exp_avg_sq differ by ~1e-7, and that never propagates
into the weights, so the loss trajectory is identical). Tier N1 only because the moments are not
bitwise — the tree was already N1 from the compiled loss.

Implementation: one Triton launch covers all 239 parameters through a pointer-array +
binary-search grid, because a per-parameter launch costs ~63 us of dispatch here
(239 x 63 us = 15 ms, more than the saving). It replaces apex's multi-tensor AdamW AND the
separate fp32->bf16 sync: 28 ms instead of 39 ms (measured at full 3.4B-parameter scale; the
kernel is at ~3.6 TB/s, apex's own multi-tensor path only reaches ~2.6 TB/s).

Two integration traps, both found the hard way and both worth remembering:
1. Wrapping bench.py in flock deadlocks it — it takes the GPU lock itself and the inherited
   lock fd blocks its own acquisition. (The task statement says not to wrap it; the symptom is a
   process with ~4 s of CPU and no children.)
2. The optimizer to patch is fairseq.optim.fused_adam.FusedAdamV2 (bf16 -> adam_v2=True),
   not apex.optimizers.FusedAdam — FusedAdamV2 has its own step. And the patch must keep
   fp32_optimizer.step() on the call path: the judge counts iterations with a *global
   optimizer-step post hook*, so bypassing the optimizer object silently makes every run
   "incomplete". Fixed by re-wrapping the replacement in torch's profile_hook_step.

time: 1.3165 (178.4 ms/update, both windows 178.4 ms, 0.03% spread, no fallback).
Full check: PASS @ 1.3232, tier N1, exact_failures 0, inputs 204/204.
7.0 hRound 57 — fuse the whole grad path into the Adam kernel: **+7.3%** (1.3165 -> 1.42, PASS)
Round 56's kernel still left three elementwise passes over the same ~3.4 B
parameters: the bf16 grad -> fp32 master grad sync (~20.7 GB), the clip-coefficient
scaling (~27.6 GB) and (already fused) the Adam + bf16 write.  Read the bf16
gradient, scale it and write the fp32 master gradient inside the same kernel: one
launch, 32 B/element, ~110 GB instead of ~152 GB.  Measured 169.4 -> 165.6 ms.

Numerics are exact rather than approximate: the kernel computes
g = float(bf16 grad) * clip_coef and stores that as the fp32 master grad, which is
precisely what the lossless bf16->fp32 copy followed by mul_ produces.  Verified
bitwise against fairseq's real FusedAdamV2 over 60 updates on the real parameter
structure: 0 differing elements in the fp32 master grads, the masters, the bf16
weights and exp_avg.

Two non-obvious things this needed:
  * fairseq's grad-norm buffer is a DoubleTensor, so the clip coefficient is a
    float64 0-dim tensor.  Tensor.mul_ with a 0-dim operand keeps the fp32
    gradient dtype (it casts the scalar to float first), so reading the fp32 cast is
    bitwise what the reference computes -- and it is the only form Triton 2.3.1 can
    compile (it asserts on an f64 -> f32 truncating store).  Verified bitwise.
  * _multiply_factor must be cleared after the step, as the reference does inside
    _unscale_grads, or the clip coefficient compounds across updates.

The first attempt of this round failed gate 3 badly (all six endpoints 500-3500
sigma off, master grads ~2650x too large) and the cause is worth remembering:
DDP re-creates the gradient bucket views on every backward -- it double buffers
them, so the live grad alternates between two buffers.  Caching the bf16 gradient
list on the fp16 optimizer made the kernel read the previous update's buffer, i.e.
memory the allocator had already reused.  A standalone correctness test with fixed
tensors cannot catch this; only the real run does.  Fixed by re-reading the live
gradients every step (~100 us of Python, invisible against 165 ms), and diagnosed
with a one-shot stderr probe comparing the live and cached data_ptr.

Full check: PASS @ 1.42, tier N1, exact_failures 0, all six endpoints within
3-sigma (tightest: u100_200, d=-0.0046 against a 0.0062 bound -- the compiled
loss's ULP drift), inputs 204/204.
7.5 hRound 58 — deferring the grad sync past the clip: **REJECTED** (1.5222 but INCORRECT)
The fused AdamW kernel writes the fp32 master gradients itself, so the
_sync_fp16_grads_to_fp32() that the fp16 optimizer's clip path still ran after
computing the norm looked redundant — a ~20 GB pass over 239 copy launches.
Deferring it past the clip measured 1.5222 (154.3 ms/update), but the full
check returned INCORRECT on an exact item, not on numerics:

    cross_rank_pattern  model=master kind=grad sync=local
    reference_equal_fraction 0.0   candidate_equal_fraction 1.0

The numerics adapter records grad/master.<param> from its pre-step hook,
which sits inside fp32_optimizer.step() and takes each rank's slice of the
master gradient.  With the sync deferred, at update 0 that tensor is still the
zeros build_fp32_params allocated, so both ranks recorded zeros — equal — while
the reference records two different slices (that is what sync: local means for
the master: the adapter deliberately views a per-rank chunk so the recorded value
is partition-independent).  The weights and losses were fine; only the recorded
gradient view was wrong.  Recorded as a trap: **the fp32 master gradients must be
populated before the optimizer step, because the judge reads them there.**
7.5 hRound 59 — split the fused grad path in two, before and inside the step:
+1.7% (1.4183 -> 1.4445, PASS)

Keep the win from round 58 but write the fp32 master gradients before the step,
as two one-launch kernels instead of one:
  * _grad_prepare_fused: bf16 grad -> fp32 master grad, scaled by the clip
    coefficient (20.7 GB), launched just before fp32_optimizer.step().
  * _adamw_bf16_fused: reads the bf16 gradient again (6.9 GB, cheaper than
    re-reading the 13.8 GB fp32 copy), applies the update and writes
    exp_avg / exp_avg_sq / master / bf16 weight (96.6 GB).
117 GB in two launches instead of ~152 GB in 478.  Both halves scale the bf16
gradient by the same fp32 clip coefficient, so the Adam update is bitwise what
the single fused kernel computed.

Full check: PASS @ 1.4445, tier N1, exact_failures 0, all six endpoints
within 3-sigma and *tighter* than round 57 (max |d| 0.0027 against a 0.0062
bound, versus 0.0046 before) — writing the fp32 grads with exactly the
reference's copy-then-scale arithmetic removed most of the residual drift.
7.9 hRound 60 — cache the fused-kernel validation per gradient-buffer set:
+2% (1.4445 -> 1.4837, PASS)

The timing runs report busy_cpus_in_windows 2.04 for 2 ranks, i.e. each rank's
CPU is ~100% busy during the windows while the GPU is only 74% busy -- the host
is a co-bottleneck, so host-side work is on the critical path too.  The fused
optimizer step re-validated every tensor every update: ~1400 is_contiguous()
calls, 720 data_ptr() calls and three list comparisons, all pure Python.

DDP alternates between two gradient buffers, so the (master, bf16 grad, fp32
grad) pointer tuples cycle through a handful of distinct sets.  Key the
pointer-array cache on those tuples and validate once per distinct set instead of
once per update (capped at 8 entries so a pathological allocator cannot grow it).
No computation changes -- the same kernels run on the same tensors with the same
arguments.

time: 1.4762, then full check PASS @ 1.4837, tier N1, exact_failures 0, all
six endpoints within 3-sigma with the tightest at 31% of its bound.
8.2 hRound 61 — skip the model-parallel mappings at model_parallel_size == 1:
+0.7% (1.4837 -> 1.4875, PASS)

The host is a co-bottleneck, and the biggest host-side item that can actually be
removed is not an aten op but autograd graph size: copy_to_model_parallel_region
and reduce_from_model_parallel_region are torch.autograd.Functions whose
forward returns their input unchanged and whose backward is the identity at
model-parallel world size 1, yet each still costs one graph node per Linear layer
-- 185 nodes per update in forward and the same again in backward.  Returning the
input directly is the same computation bitwise (same tensors in, same gradients
out, no RNG use), so this is tier N0.

The world size is read lazily -- at the first Linear forward, by which point
initialize_model_parallel has run -- and cached; if it cannot be read, or is not
1, the mappings stay, so a multi-model-parallel run is untouched.

time: 1.4941, full check PASS @ 1.4875, tier N1 (unchanged, this change is
N0), exact_failures 0.

Note on gate-3 margin: the trajectory runs in production (non-deterministic) mode,
so the endpoint biases vary between checks -- max |d| was 0.0019 in round 60 and
0.0047 here against a 0.0062 bound on the last endpoint.  The residual drift is
inherent to the two N1 changes still in the tree (apex FusedRMSNorm and the
compiled cross-entropy); the fused AdamW is bitwise against apex.
8.9 hRound 62 — drop the compiled cross-entropy to buy back the gate-3 margin
(1.4875 -> 1.4762, PASS, and a 5x safer margin)

The trajectory runs in production (non-deterministic) mode, so I sampled the
endpoint biases several times to see the real margin.  The compiled loss turned
out to contribute a systematic negative bias on the last endpoint:

| switch set | last-endpoint bias (3 samples) | bound |
|---|---|---|
| with YOCO_COMPILE_LOSS=1 | -0.0019, -0.0047, -0.0035 (mean -0.0034) | 0.0062 |
| with YOCO_COMPILE_LOSS=0 | +0.0023, -0.0019 (mean +0.0002) | 0.0062 |

i.e. the fused log-softmax + nll backward reorders rounding, the gradients drift,
and over 200 updates that compounds into a bias that was using 55-76% of the 3-sigma
band -- while the rest of the tree (apex FusedRMSNorm, the fused AdamW) is ULP-level
and centred on zero.  The expected value of keeping it was therefore negative: +1.28%
speedup against a few-percent chance of INCORRECT (score 0).

Dropping it costs 1.28% and buys a lot:
  * max |d| across the six endpoints: 0.000844, i.e. 14% of the tightest bound
    (was 76%).
  * gate 2's unresolved tensor count halves, 2942 -> 1450 (the loss tensors are now
    bitwise identical to the reference's).
  * no torch.compile in the hot path at all, so no dynamo/inductor compile-cache or
    recompile-in-window exposure.

The compiled-loss code stays in the tree behind its switch, off by default.
9.9 hRound 64 — skip DDP's post-all-reduce gradient division (N1, 1.4762 -> 1.5017, PASS)
Found the largest attributable non-floor item by mining the trace's kernel
names: the two MulFunctor<float> elementwise kernels totalling 8.75 ms/update
are DDP's reducer::mul_out — the pass that divides every gradient bucket by the
world size after the all-reduce.  Their element counts add up to 3.6 B, i.e. the
whole gradient set, and the bucket sizes match DDP's 50 MB cap (plus one 616 MB
bucket each for the embedding and output-projection weights, which exceed it).

Registering a DDP comm hook makes DDP skip that C++ pass entirely — verified
directly with a 2-rank probe: without the hook the gradient is the mean, with it
the sum.  The gradients therefore arrive world-size times larger, which must be
compensated in two places or the *clip regime* changes:
  * the clip norm is halved, so the clip coefficient is unchanged.  Without this
    the coefficient would halve too, and for 1.0 < gnorm <= 2.0 the reference
    does not clip while this would — a ~5% gradient error;
  * the scale the fused kernel applies is halved.
Both are exact to ~1 ULP (halving bf16/fp32 by a power of two is exact; the only
residual is the 1e-6 in the clip formula).

time: 1.4837.  Full check PASS @ 1.5017, tier N1, exact_failures 0, and the
endpoint biases *improved*: worst |d| 0.00066 = 11% of its bound (was 0.0029 = 47%).

Note the gain was 0.5% in time, not the ~3% the profiler attributed to the
division, because that pass was largely overlapping with the backward compute
rather than sitting on the critical path.

**FINAL: 10-switch stack @ c3d6528, full check PASS @ 1.5017 (50.2%), tier N1,
exact_failures 0, worst endpoint bias 11% of its bound, inputs 204/204.**
↑ YOCO