okami.mom/strata

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

albedocmake: strata_kernels links strata_kernels_cpu (iq_kernels.cu reads the latent colscale table from expert_layout.cpp; strata-q36ref failed to link)a4af4df61

main
4 files

files

README.md6.1 KiB
timing-off.txt2.6 KiB
timing-on.txt2.6 KiB
tune-summary.txt18.5 KiB

RX 6900 XT (gfx1030): rocBLAS's kernel choice for the FP16 prompt GEMMs, and a solution table (2026-10-05)

On gfx103x the prompt path's dense GEMMs run through rocBLAS as FP16 in -> FP16 out (#835). rocBLAS picks the kernel for each product from its own table by shape, and for some shapes that pick is far from the best kernel the same library holds. The clearest case is the GDN input projection, N = 10240, K = 2560: below T = 1152 tokens rocBLAS's choice runs at 5.2-5.3 TFLOPS (n = 682 ... 1120, measured with rocblas_gemm_ex on this card, 8.1 ms at n = 799), at T = 1152 it jumps to 38 TFLOPS (1.6 ms), and the best of the 237 solutions rocblas_gemm_ex_get_solutions lists for n = 799 runs it in 1.36 ms. It is not an alignment effect (n = 800 is as slow as 799). In the engine's own phase timing this is why the "gdn" phase of a 799-token prompt (445 ms) was nearly as long as that of an 8,874-token one (1,345 ms).

tools/hip/tune_rocblas.cpp enumerates rocBLAS's solutions per shape and token bucket, times them, checks the fastest against the default kernel's output and writes the winners as a table; Gemm::f16_inplace runs the table's solution for a shape in place of rocBLAS's choice (STRATA_ROCBLAS_TUNING; docs/AMD_HIP.md, "rocBLAS table"). The table shipped, tools/hip/gfx1030-rocblas-5.6.0.8d1ae90e.txt, is calibrated against rocBLAS 5.6.0.8d1ae90e (ROCm 10.0.0, /opt/rocm/lib); its indices are valid for that build only, and the engine refuses any other.

Rig

Table

tune_rocblas --tuning-out ... with the defaults: the engine's 14 FP16 dense shapes (ldy = N) at T = 256, 512, 768, 1024, 1536, 2048, 4096, 8192; 112 rows, 76 with a solution that beat the default by at least 5% and also ran at T-1, T-37, T-63 and T/2+1 (a kernel can refuse a token count it was not measured at), default for the other 36. tune-summary.txt is the tool's per-case output (default ms, best solution, gain). The large gains are at small T: N = 10240 K = 2560 at T = 256 ... 1024, 7.0-7.8x; N = 12288 K = 2560 at T = 256, 5.8x; N = 6144 K = 2560 at T = 256 / 512, 3.6-3.8x; N = 2560 K = 6144 at T = 256, 4.5x; N = 320 K = 10240 (hc read), 2.5-8.7x across the buckets. At T >= 2048 most shapes keep the default (1.0-1.2x where a solution still wins).

Method

One server per arm, the same binary; STRATA_PREFILL_TIMING=1 (the engine's prompt-phase timing), STRATA_ROCBLAS_VERBOSE=1; the on arm with STRATA_ROCBLAS_TUNING pointing at the directory holding the table. Four prompts from four different offsets of one text (no prefix reuse between them), "Reply with one word", max_tokens 8, temperature 0; the answer text compared between arms. The GPU timeline is the engine's strata prefill timing line; the per-phase numbers are its phases (timing-off.txt, timing-on.txt). One run per arm; the off arm repeated an earlier run of the same prompts the same day (with the table's first version) to within 10 ms on every prompt, and the on arm's gains repeated within 100 ms.

Results

prompt tokens (read)armGPU timeline msgdnhc readwait copyanswer
806 (799)default3,3294432701,376Estimated
806 (799)table2,985177771,384Estimated
502 (495)default2,477365811,077Incomplete
502 (495)table2,139146521,075Incomplete
1,115 (1,108)default3,3915981581,144Incomplete
1,115 (1,108)table3,395201991,637Incomplete
8,881 (8,874)default11,9781,3461,2001,683Strata
8,881 (8,874)table11,4591,1288981,670Strata

Limits

One machine, one card, one model; one run per arm, four prompts. The table is for one rocBLAS build; another build (or ROCm's 5.1 packaged by Ubuntu) needs tune_rocblas run against it. Prompts above ~1,150 tokens gain only through their tail chunk and hc read, and copy-bound prompts gain nothing. Whether other gfx103x cards (gfx1031 / gfx1032) share rocBLAS's gfx1030 kernel table was not checked; the engine's architecture check would refuse this table on them.