vit_cpu.cpp and vit_ref.cpp were compiled with -mavx2 -mfma in every x86 GCC build. Setup's own build on a CPU without AVX2 (STRATA_PORTABLE=OFF)
therefore contained AVX2/FMA code in VitCpu itself and in standard-library template copies (std::vector<unsigned short>::_M_fill_assign,
std::vector<std::thread>, std::function managers) that the linker keeps for the whole program. A floor build of the whole strata-vision had
64 functions with AVX instructions outside the kernel tiers (SSE4.2 floor) and 23 with AVX2/FMA (AVX floor).
- The two loops of the tower whose result depends on multiply-add contraction (the rotary of a token row, the position table's bilinear
add) move into the tier tables (CpuOps::rope_row, pos_add), written as before, so each tier compiles them with its own flags.
- vit_cpu.cpp is compiled at the baseline.
- vit_ref.cpp (the float32 oracle) gets -march=native in native builds (STRATA_VIT_OWN_NATIVE or setup's STRATA_PORTABLE=OFF), -mavx2 -mfma
only in the portable helper (an AVX2 floor for the whole program), the floor's flags in an older-CPU test build.
- tools/vision: STRATA_ISA_FLOOR = none (SSE4.2) / avx / avx_f16c, a test build of the program a CPU without AVX2 runs (ggml-cpu and the
reference at that floor), as the engine's option of the same name. Empty changes nothing.
- check_floor_isa.py: objdump scan of a linked binary; every function with instructions above the floor must be kernel-tier code.
Checked (p2006, job p2006-20261111-1101-c643): AVX-512 and AVX2 tiers byte-identical before and after on all 18 pictures, both readers
(standalone reader), and 6 / 6 per tier through the portable helper's --tower own. The scalar tier changes (GCC no longer contracts its
rotary): global cosine old against new 0.99942 to 0.99999 (Qwen3.8), 1.000000 (Qwen3.6). cpu-test passes on every tier. Floor scan of
the whole strata-vision after the change: 0 functions outside the tiers at the SSE4.2 floor, 0 at the AVX floor.
The MSVC-built CPU reader was 1.057 of mtmd-CPU's time on a 1,024-token picture (Ryzen 5 7600, 6 threads); level at 1 thread and ahead at 12, so the loss was the attention at 4,096 patches: every task (one head, 48 query rows) streamed all of the head's K and V again, V was read in place from the qkv rows (a 3,456-float stride), and the P*V product's last 8 columns (head size 72) went through a 32-wide tile and a buffer.
- V is packed per head (VP[h][j][d]) in the same pass as K^T.
- A task takes 96 query rows (kQBDefault), so K and V are streamed half as often.
- The raw-vector tiers (AVX2, AVX-512) compute a last column tile of one vector or less with a one-vector micro-kernel (the same FMA chain per lane as the two-vector one).
Every change moves only addresses, row grouping or tile width, never the order of a sum: outputs are byte-identical to 88fc47ccf. Diagnostics: STRATA_VIT_CPU_VPACK=0, STRATA_VIT_CPU_QB=<multiple of 48>, STRATA_VIT_CPU_TAIL1=0; and STRATA_VIT_PROF=1 prints the CPU tower's stage times (stderr, off by default).
Identity, old 88fc47ccf against new, 6 pictures:
- MSVC (owner PC): AVX-512 and AVX2 tiers, Qwen3.8: 12 of 12 identical
- GCC 13.3 (Ryzen 5 5600X): scalar and AVX2 tiers, Qwen3.6 and Qwen3.8: all identical; strata-vision-own-cpu-test passes
- Apple clang (M5 Max): NEON and scalar tiers, both readers: all identical; the unit test passes
Speed, 5 alternating pairs:
- MSVC against mtmd-CPU, 6 threads: big1024 0.986 (pairs 0.968-0.998; was 1.057, pairs 1.049-1.079), code4217 0.903, tiny_64x48 0.851
- NEON new against old: big1024 0.987, code4217 0.993, tiny 1.000; 96 against 48 query rows: 1.001 (level)
- GCC AVX2 new against old (3 runs, before the 96 default): about 0.95
`--tower auto` is unchanged (it keeps mtmd for an MSVC-built x86 reader until the numbers are confirmed).
NOT MEASURED YET: the build, the unit test and the ROUND speed pairs on the vectorised code are still queued on p2006 and l620 at the time of this commit.