The upstream release tree, every tracked file byte for byte, from https://github.com/VecSzn/PolyStrata at tag v0.1.45-poly.1, commit d0cd84dc6bd009d1d9e2191e4e28cc76b80f1ee3. Nothing added, removed or edited; git diff against this commit is the whole story of the fork. Verified: the commit's tree hash equals the upstream commit's tree hash.
2.3 KiB
The interleaved small-batch matvec (STRATA_MMVQ_IL): how to measure a table for your card
The decode and verify windows run their dense projections (2 to 4 tokens at a time) through native_mmvq_il, which reads an
interleaved copy of the q8_1 activations. Every choice it makes gives the same bits as the plain kernels
(STRATA_MMVQ_IL=0 turns the whole path off); only the speed differs. How many matrix rows one warp takes
(1, 2 or 4, or 0 = use the plain kernel) is a table in src/kernels/cuda/native_mmvq.cu, indexed by the
quantisation type (IQ4_XS, Q4_K, Q5_K, Q6_K), the token count (2-4) and the matrix's row count (five classes).
Which table a card gets:
| card | table |
|---|---|
| sm_86 (Ampere consumer) and sm_120 (Blackwell consumer) | kIlRowsShared, measured on an RTX 3060 and an RTX 5070 together (a cell is non-zero only if the worse of the two cards still gains 3%) |
| sm_89 (Ada) and every other sm_80+ card | kIlRowsShared too. Nobody has measured sm_89 yet (we have no such card). |
| sm_75 and older | the path is off; the plain kernels run |
a card listed in kIlArch |
its own table |
Measuring sm_89 (or any other card)
- Build with tests:
cmake -S . -B build -DSTRATA_BUILD_TESTS=ONandcmake --build build --target mmvq_il_parity. - Close everything else on the GPU, then run
build/mmvq_il_parity --bench --emit-table(a few minutes). It first checks bit-for-bit parity of every shape and every rows choice (it must end withmmvq_il_parity: OK), prints aBENCHline per shape and token count, and last a ready-to-paste block, one line per type. - Post the whole output on the issue. A maintainer pastes the block as
kIlRows_89[]and adds{89, kIlRows_89, sizeof(kIlRows_89) / sizeof(IlRows)}tokIlArch. - To try a table without rebuilding, set
STRATA_MMVQ_IL_ROWS="type:ncols:r0,r1,r2,r3,r4;...", for exampleSTRATA_MMVQ_IL_ROWS="23:3:0,0,2,4,4;12:2:0,1,1,1,1"(the five numbers are the row classes below 2048, 4096, 8192, 12288 and above; each is 0, 1, 2 or 4). Then A/B the decode: same flags,STRATA_MMVQ_IL_ROWSset or unset, 10 interleaved pairs, medians.
The emit rule: per cell, the fastest rows count if it takes at least 3% off the plain kernel's time, else 0; shapes of one class that disagree give 0; a class with no measured shape copies its neighbour below.