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
3 files

files

README.md6.3 KiB
mmvq-il-bench-v100.txt8.7 KiB
stage-profile.txt6.1 KiB

V100 (sm_70): three decode kernels that were built for other cards (2026-10-07)

On a V100 a verify window's GPU work is mostly memory-bound GEMVs that ran at a third to a half of the card's HBM2 bandwidth. Three kernels Strata already has for other cards are now Volta's defaults, each with exactly the old arithmetic, so every output is bitwise the old one:

WhatWas on sm_70Now on sm_70Switch (old path)
Routed experts in VRAM (native_expert_grouped)the CUDA layout (mode 0)gfx906's mode 8: the codebook grid and the group's q8_1 activations in shared memory, SwiGLU + q8_1 in the gate/up epilogue; IQ2_XXS gate/up added to it (CUDA only)STRATA_EXP_MODE=0
Dense 2-4 column GEMVs and the head (native_mmvq_il)native_mmvq (the interleaved kernel was sm_80+)the interleaved kernel with a rows table read off a V100STRATA_MMVQ_IL=0
Hyper-connection read, up projectiongr_up_multi_kernelgfx906's gr_up_fast_kernel (built for CUDA, now also writes the QFUSE q8_1 tail)STRATA_GR_FAST=0

Every other card keeps what it ran: the new paths are picked only when the device is sm_70 (and gfx906 keeps its own defaults). The idea of putting the lattice codebook in shared memory on Volta comes from 1Cat-vLLM's SM70 GGUF kernels (csrc/sm70_turbomind/ops/gguf_dp4a.cuh); Strata's gfx906 kernels already did the same, so no 1Cat code was copied.

Rig

Kernels (synthetic or real rows, no engine)

Experts, native_expert_bench <shard1> <layers> 28 T 0 8 (28 groups = a verify window's VRAM call, the model's real rows; mode 0 vs mode 8, bitwise equal on all 48 layers):

Layer gate/up / downT = 1T = 3
IQ2_S / Q2_0 (34 layers, e.g. 24)118.5 -> 104.8 us180.4 -> 150.4 us
IQ2_XXS / Q2_0 (11 layers, e.g. 10)117.6 -> 91.4 us169.9 -> 134.1 us
IQ1_M / Q2_0 (3 layers; gate/up keeps the CUDA layout)159.0 -> 144.7 us

A strided call (the window's PCIe call, grid_groups 1..cap) keeps the CUDA layout: the AMD layouts launch a block row per possible group, which cost the empty call 11.3 vs 6.5 us. A format without a shared-memory kernel falls back to the CUDA layout on CUDA, not to R2 (R2 on IQ2_XXS gate/up: 183 vs 113 us). The nib_mask sign handling gfx906 uses was also the faster one here (158.5 vs 162.2 us on native_grouped_parity --bench's VRAM call).

Dense GEMVs, mmvq_il_parity --bench (two runs, mean; il_rows1/2/4 all bitwise native_mmvq's output), a few of the cells the table picks (3 columns):

Shapenative_mmvqinterleaved
Q5_K head 2560 x 248,3201,094 us821 us (rows 2)
Q6_K 2560 x 12,28868.9 us47.9 us (rows 2)
Q4_K 2560 x 10,24043.9 us32.5 us (rows 2)
IQ4_XS 2560 x 6,14428.2 us19.3 us (rows 2)
Q6_K 2560 x 5127.0 us9.2 us (rows 2): the table keeps native_mmvq below 2,048 rows

Hyper-connection read, fused_gr_bench (bitwise): the fast norm/up take 4-6 us off a 51-72 us read in the plain variant. The engine runs the staged variant, whose norm is the split one, so only the up projection changes there (below).

Engine: GPU time per verify window

STRATA_DECODE_TIMING=1 STRATA_VERIFY_PROFILE=1, tools/ab_engine.py: one server start per arm and round, the arms' order alternating, 3 rounds; per round three short chats (256 tokens) and one 6,345-token prompt (122-128 tokens). orig is e8ca9af as setup built it, off this branch with the three switches above set to the old paths, v70 this branch. Medians over the rounds of the engine's own stage table (ms per window, GDN + QSA layers):

Stageorigoffv70
VRAM hits (routed experts)4.504.443.73
q8 + qkv / q-idx GEMV1.601.571.40
z1.031.020.87
head0.990.970.69
hc-read0 up1.081.080.96
q + q-idx0.760.750.68
out-proj1.351.341.40
everything else on the GPU11.4911.4911.51
GPU work, the waits (A, B, CPU) left out22.8022.6621.24 (-6.8%)

Decode tokens per second over the same runs (medians):

Requestorigoffv70
chat 065.867.174.7
chat 155.058.162.7
chat 257.158.059.7
6,345-token prompt52.348.752.5

These decode numbers are noisy and mostly CPU-bound on this rig: the windows' waitCPU (the GPU waiting for the CPU experts) was 0.3 ms in some server starts and 6-9 ms in others, whatever the arm, which moves decode by 25-30%. The GPU-side table above is the reliable comparison; on a PC whose CPU keeps up, the window is shorter by about the 1.5 ms it saves. Prompt speed (1,360-1,390 tok/s) does not change: the prompt path uses none of these kernels.

Output checks

Each change keeps the old sums in the old order, so the engine's output is unchanged by construction; checked with:

Raw: stage-profile.txt (the engine's stage lines of every run above), mmvq-il-bench-v100.txt (both bench runs).