You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Router phase 2: weight-reuse pass for backward input/weight #54
Router phase 2: weight-reuse pass for backward input/weight
Follow-up to #44 (PR #52), which fixed the launch-geometry pathologies (combined 43.8 → 18.5 ms). The remaining cost is L2 weight-bandwidth: backward.router.weight (7.96 ms) and backward.router.input (6.59 ms) still re-read operands ~15–20× over the pure-HBM floor.
Notes from the #52 A/B to save the next person a dead end: routing these through the shared BM=BN=BK=64 fp32 GEMM regressed both (input 9.0 ms — it broke the wide coalesced dx write; weight 33.7 ms — 8× waste on the E=8 dimension and block starvation). The lever is a purpose-built skinny pass with real weight reuse, like the router_gemm_impl that took logits to 3.96 ms, but shaped for the backward dataflows: per-CTA staging of the [D,E] weight (24 KB fp32 fits SMEM) for input, and a token-tiled fixed-order reduction for weight-grad that keeps determinism.
Constraint carried over: router stays fp32 end-to-end; routing decisions and reduction determinism must not change.
Landed on main (64e74a4, merge 2a07208). Both passes rebuilt as register-tiled kernels — SMEM staging turned out wrong-shaped (full [D,E] weight is 96 KB at D=3072, over the static-shared cap, and per-lane columns are private anyway): backward-input stages each lane's [E] weight rows in registers across a 64-token sweep (weight traffic 2.36 GB → 74 MB/layer, coalesced dx preserved); backward-weight is a 256-way split-K over tokens with an ascending-order merge — deterministic by construction, now enforced by a bit-identical-across-launches assert in the ops gate. Measured (B200, same-container A/B, B=12): input 6.63 → 1.10 ms (6.0×), weight 8.01 → 2.09 ms incl. merge (3.8×), combined 14.64 → 3.19 ms (4.6×); full step 617.9 → 605.7 ms. Both now ~2–4× off the HBM floor; the residual gap is scalar-load bytes-in-flight — float4/u128 vectorization (the #55 lever) is the noted follow-up. Router stays fp32; routing decisions unchanged. SPEC §13.9.
Activity
perf: register-tiled weight reuse for the router backward passes
Merge branch 'perf/issue-54-router-weight-reuse': register-tiled rout…
docs: SPEC 13.9 descriptor-transpose weight gradients (#53)
feitreim commentedon Jul 25, 2026
Landed on main (64e74a4, merge 2a07208). Both passes rebuilt as register-tiled kernels — SMEM staging turned out wrong-shaped (full [D,E] weight is 96 KB at D=3072, over the static-shared cap, and per-lane columns are private anyway): backward-input stages each lane's [E] weight rows in registers across a 64-token sweep (weight traffic 2.36 GB → 74 MB/layer, coalesced dx preserved); backward-weight is a 256-way split-K over tokens with an ascending-order merge — deterministic by construction, now enforced by a bit-identical-across-launches assert in the ops gate. Measured (B200, same-container A/B, B=12): input 6.63 → 1.10 ms (6.0×), weight 8.01 → 2.09 ms incl. merge (3.8×), combined 14.64 → 3.19 ms (4.6×); full step 617.9 → 605.7 ms. Both now ~2–4× off the HBM floor; the residual gap is scalar-load bytes-in-flight — float4/u128 vectorization (the #55 lever) is the noted follow-up. Router stays fp32; routing decisions unchanged. SPEC §13.9.
Merge branch 'main' into chore/issue-56-cuda-oxide-b099f64