okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge branch 'f-split-int' into f-split-fitfa6367a98

main
2.5 KiB36 linesraw

v100/gdn-chunk: chunked GDN prompt recurrence and Volta recurrence variants (2026-10-02)

Measured on the V100-SXM2-16GB x2 (one card, CUDA 12.8, driver 570.x), build: -DSTRATA_EXPERIMENTAL_SM60=ON -DCMAKE_CUDA_ARCHITECTURES=70, Release. bench/gdn_chunk_bench (CUDA events, real GDN geometry S=128 / 16 q/k heads / 48 v heads / C=10240, one gdn_recurrence call per side including the out norm, 5-20 iterations).

GDN prompt recurrence kernel, one layer, one prompt chunk

Tpipe (old)chain-split (default now)sync-free warpchunked FMAchunked wmma
10241.056 ms1.042 ms (+1%)2.712 ms6.67 ms4.57 ms
40963.836 ms3.600 ms (+6%)9.34 ms25.0 ms17.7 ms
81927.703 ms7.190 ms (+7%)18.7 ms50.2 ms35.4 ms
  • pipe = gdn_rec_cols_pipe_kernel (the old path, bit-exact reference).
  • chain-split = gdn_rec_cols_pipe_fast_kernel: same structure and loads, the k^T W / q^T W accumulators split 4 ways (FP32-level, NOT bit-exact; gdn_chunk_parity bounds it).
  • sync-free warp = gdn_rec_cols_warp_kernel: warp-shuffle reductions, no __syncthreads, BIT-EXACT vs pipe (asserted) - but 2.6x SLOWER: its per-thread row loads cost more than the barriers it removes. Kept as the bitwise control.
  • chunked = the FlashQLA-style chunked recurrence (cumsum / kkt / fwd, 64-token chunks). Correct (parity below) but 4-6x SLOWER than the recurrence as implemented: with 128 threads and the ~84 KB tile staging a CTA only feeds ~4 warps to the tensor cores, and every phase is latency-bound (measured ablation: staging+Gram+U GEMMs alone = 2.4 ms of the wmma kernel's 4.6 ms at T=1024). Opt-in only (STRATA_GDN_CHUNK=1 wmma / 2 FMA).

Error bounds (gdn_chunk_parity, vs a double-precision transcription of the recurrence)

pathy max absstate max absnote
pipelined recurrence1.1e-063.0e-08the FP32 floor
chain-split recurrence7.2e-073.0e-08FP32-level, not bit-exact
sync-free warp recurrence00bit-exact vs the pipelined kernel
chunked FMA3.1e-061.2e-07FP32-level (reordered sums)
chunked wmma2.3e-038.9e-05q/k/v and the state staged f32->f16, f32 accumulate
1# v100/gdn-chunk: chunked GDN prompt recurrence and Volta recurrence variants (2026-10-02)
2
3Measured on the V100-SXM2-16GB x2 (one card, CUDA 12.8, driver 570.x), build:
4`-DSTRATA_EXPERIMENTAL_SM60=ON -DCMAKE_CUDA_ARCHITECTURES=70`, Release.  `bench/gdn_chunk_bench`
5(CUDA events, real GDN geometry S=128 / 16 q/k heads / 48 v heads / C=10240, one `gdn_recurrence`
6call per side including the out norm, 5-20 iterations).
7
8## GDN prompt recurrence kernel, one layer, one prompt chunk
9
10| T     | pipe (old) | chain-split (default now) | sync-free warp | chunked FMA | chunked wmma |
11|-------|-----------:|--------------------------:|---------------:|------------:|-------------:|
12| 1024  | 1.056 ms   | 1.042 ms (+1%)            | 2.712 ms       | 6.67 ms     | 4.57 ms      |
13| 4096  | 3.836 ms   | 3.600 ms (+6%)            | 9.34 ms        | 25.0 ms     | 17.7 ms      |
14| 8192  | 7.703 ms   | 7.190 ms (+7%)            | 18.7 ms        | 50.2 ms     | 35.4 ms      |
15
16- pipe = `gdn_rec_cols_pipe_kernel` (the old path, bit-exact reference).
17- chain-split = `gdn_rec_cols_pipe_fast_kernel`: same structure and loads, the k^T W / q^T W
18  accumulators split 4 ways (FP32-level, NOT bit-exact; `gdn_chunk_parity` bounds it).
19- sync-free warp = `gdn_rec_cols_warp_kernel`: warp-shuffle reductions, no __syncthreads,
20  BIT-EXACT vs pipe (asserted) - but 2.6x SLOWER: its per-thread row loads cost more than the
21  barriers it removes.  Kept as the bitwise control.
22- chunked = the FlashQLA-style chunked recurrence (cumsum / kkt / fwd, 64-token chunks).  Correct
23  (parity below) but 4-6x SLOWER than the recurrence as implemented: with 128 threads and the
24  ~84 KB tile staging a CTA only feeds ~4 warps to the tensor cores, and every phase is
25  latency-bound (measured ablation: staging+Gram+U GEMMs alone = 2.4 ms of the wmma kernel's
26  4.6 ms at T=1024).  Opt-in only (STRATA_GDN_CHUNK=1 wmma / 2 FMA).
27
28## Error bounds (`gdn_chunk_parity`, vs a double-precision transcription of the recurrence)
29
30| path                        | y max abs | state max abs | note |
31|-----------------------------|----------:|--------------:|------|
32| pipelined recurrence        | 1.1e-06   | 3.0e-08       | the FP32 floor |
33| chain-split recurrence      | 7.2e-07   | 3.0e-08       | FP32-level, not bit-exact |
34| sync-free warp recurrence   | 0         | 0             | bit-exact vs the pipelined kernel |
35| chunked FMA                 | 3.1e-06   | 1.2e-07       | FP32-level (reordered sums) |
36| chunked wmma                | 2.3e-03   | 8.9e-05       | q/k/v and the state staged f32->f16, f32 accumulate |