interplane.Get Omega
Read in your language

aien-train

AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished.

Brought by drakestapleton

branch main Branches Tags History

aien-train / evidence / OMEGALLM / gpu-k4 / README.md

109 lines · 8040 bytes Raw Blame History Source

GB10 kernels k4: warp-per-row cross-entropy (aien-train#52)

After ../gpu-k3/, the cross-entropy kernel (gr.om id 21 grce) was among the largest single kernels of the profiled step (13.511 ms in this window's prof-K3.txt). It ran one thread per row of the R × V logit matrix: each thread walked its row's 4096 columns, so a warp's loads touched 32 rows at a stride of 4·V bytes, and it made three read passes and two write passes over the matrix (max; exp, sum and store e; scale and store). This change runs one warp per row:

Status: EXERCISED on one GB10, window 20261102T141140Z-b2bc92 (win-k4.txt), opened --gb10 shared --quiet none. spark-window printed the verdict "quiet machine", but the quiet lock was not taken and the rung-6 P5 CPU eval held core 7 (load average 4.26 at open and 3.84 at close, open.json, close.json), so the timings are non-quiet. Not QUALIFIED.

Setup

Results

prediction (prereg.txt)receiptresult
K4 gcmp2 small, 3 steps, rc 0gc2-small-s3-K4.txt GCMP2 PASS rc=0PASS
K4 gcmp2 max, 7 steps, rc 0gc2-max-s7-K4.txt GCMP2 PASS rc=0PASS
K4 gacmp max rc 0ga-max-K4.txt GACMP PASS rc=0PASS
mutant x gcmp2 small FAIL rc 47gc2-small-s3-KX.txt GCMP2 FAIL rc=47PASS (caught)
mutant x gcmp2 max FAIL rc 47gc2-max-s7-KX.txt GCMP2 FAIL rc=47PASS (caught)
mutant x geval of rung 5 ck9000: |E − 1445466| ≥ 10ge-max-9000-KX.txt E 9000 2243 1083383 404152PASS (caught, Δ −362083)
K4 geval of rung 5 ck9000: |E − 1445466| < 10 (CPU eval)ge-max-9000-K4.txt E 9000 2243 1445466 539226PASS (Δ 0)
K4 geval of rung 6 ck30000: |E − 1338156| < 10 (chip value)ge-max-30000-K4.txt E 30000 2243 1338156 499194PASS (Δ 0)
mutant k geval ck9000, ck30000: reported onlyge-max-9000-KK.txt E 9000 2243 1445465 539226; ge-max-30000-KK.txt E 30000 2243 1338156 499194observation: Δ −1 and 0
gprof K3 and K4: id 21 lower for K4prof-K3.txt GP 21 gx 256 13511312 ns; prof-K4.txt GP 21 gx 8192 3676255 nsPASS
t200 K3 then K4, both rc 0; K4 T line reportedt200-K3.txt T 9200 1508121, ck_after 70ede05c… (same as ../gpu-k3/); t200-K4.txt T 9200 1508182, ck_after ec4a8c21…PASS (both rc 0)

A wrong half-warp sum (mutant x) moves the held-out loss by 0.362 nats, so the geval gate and both gcmp2 runs catch it. Without Kahan per lane (mutant k) the E line moves by at most 1 µnat, below the 10 µnat gate. With 128 terms per lane the plain sum's rounding is too small for the gate to see, so mutant k is no longer a control for this kernel and is not counted as one. The K4 training loss after 200 steps is 61 µnats above K3's; the runs differ in the CE sum order, so the trajectories diverge after the first step [INFERENCE: one sample, no repeat].

Speed (non-quiet)

t200: 200 gtrainf steps 9000→9200 from rung 6's ck9000, both binaries in this window, K3 first.

binarywallGPU wait (GT field 9)launcheswait per launch
K3, k341.959 s38.160 s638000.5981 ms
K4, this tree40.289 s36.455 s638000.5714 ms

K4 is 1.0415× faster than K3 in wall time (−3.98%) and 1.0468× in GPU wait (WolframLanguageEvaluator: 41959244921/40289056359 → 1.04146, 38159852007/36455215481 → 1.04676, (1 − 40289056359/41959244921)·100 → 3.981). The wait is 90.48% of K4's wall. K3 ran 0.282 s faster here than in the k3 window (42.241 s).

prof-K3.txt and prof-K4.txt (one profiled step each, 383 launches, ns summed per line):

idkernellaunchesk3 msk4 msspeed-upk3 GB/sk4 GB/s
21grce113.5113.6763.67599.3292.1

GB/s counts the bytes each version must move at the max shape (16384 rows × 4096 columns, f32, 256 MiB per pass): k3 makes 5 passes, k4 makes 4 (WolframLanguageEvaluator: 5·16384·4096·4/13511312 → 99.337, 4·16384·4096·4/3676255 → 292.07, 13511312/3676255 → 3.6753). The profile total fell from 196.03 ms to 179.84 ms (1.0901×, WolframLanguageEvaluator: 196034469/179835228 → 1.09008); grce saved 9.84 ms of that and the other kernels 6.36 ms, within the run-to-run spread of one profile [INFERENCE: one profile per binary, no repeat]. grce is now 2.04% of the profiled wait.

Next targets

In prof-K4.txt the largest remaining wait is the attention block: the 256×256×32 score GEMM (id 35 at batch gz 512, 16 launches, 13.876 ms; id 35 also serves 33 other GEMM launches), the two 32-tile attention GEMMs at batch 512 (ids 1 and 0, 12.580 and 11.728 ms) and the softmax kernels (id 16 grsoftb 14.018 ms, id 15 grsoftf 9.553 ms), 61.76 ms of the 179.84 ms together. Next is causal tile skipping or a fused attention kernel, then the softmax kernels.