Commit Graph
8 Commits
Author SHA1 Message Date
Niko1221 0991006d2c strata-vision own CPU tower: SSE4.1 and AVX kernel tiers for x86 CPUs without AVX2
Two new tiers on the CpuOps contract (cpu_tier.h: no standard-library code in the tier files), for the CPUs below AVX2 that setup builds for
(STRATA_ISA_FLOOR none / avx): Nehalem / Westmere and the Pentium / Celeron / Atom parts without AVX (sse41), Sandy / Ivy Bridge and AMD's AVX
CPUs before Excavator (avx).

- cpu_kernels_sse41.cpp: 6 x 8 register tile on __m128; cpu_kernels_avx.cpp: 6 x 16 on __m256 (-msse4.1 / -mavx; MSVC /arch:AVX).
- No FMA on these CPUs: every product term is a multiply then an add, in the k order of every tier. The SSE4.1 tier's products are bit-identical
  to the scalar tier's on x86 (unit test).
- F16 weights are converted in integer code, bit exact, without F16C (Sandy Bridge has none); the 16-bit rounding equals the scalar tier's bit
  for bit; exp is the Cephes polynomial of the AVX2 tier with separate multiply and add; the one-vector tail product as in AVX2 / AVX-512.
- Dispatch: Isa ranks scalar < sse41 < avx < avx2 < avx512 (Neon apart); the probe reads SSE4.1 and AVX (with the OS ymm state);
  STRATA_FORCE_ISA takes sse41 and avx.
- own_reader_supported keeps `auto` on mtmd for every x86 tier below AVX2 (the line reads `< Avx2` instead of `== Scalar`): behaviour unchanged
  until the gate.
- strata-vision-own-cpu-test runs every tier the CPU has, capped by STRATA_FORCE_ISA, and adds the rotary / position-add kernels and the SSE4.1 =
  scalar product check.

Checked: cpu-test on z440 (Haswell-EP) with each tier forced (scalar, sse41, avx, avx2): all passed; under qemu-user -cpu Westmere the cpu-test
picks sse41 and passes, and strata-vision --tower own / mtmd / auto and strata-vision-own read Qwen3.8 and Qwen3.6 pictures with no illegal
instruction (z440 job z440-20261111-1105-4195).
2026-11-11 12:29:51 +01:00
Niko1221 59e0758810 tools/vision: our picture reader is the default (owner 11-11: "Our tower, the other selectable"); llama.cpp's mtmd reader stays selectable and takes over by itself where ours was measured slower or does not start
- the default tower is `auto` (was mtmd); without --tower, STRATA_VISION_TOWER=mtmd|own|auto decides (the run config's env carries it when someone picks llama.cpp's reader; an older strata-vision ignores it); an explicit --tower wins
- `auto` now takes ours on Metal (gate passed on the M5 Max, RESULTS-OWN-3V.md D1/D4-D8) and on MSVC x86 builds (rule cab87a2e8 removed: 0.986 of mtmd-CPU since 54f9cc3c0, D2)
- kept: gfx1151, Pascal with F16 matrices at <= 1,024 tokens, x86 without AVX2; new hold: every card on Windows HIP (not measured with the Windows ROCm package; remove when one RX 9000 / RX 7000 run on Windows is in)
- under `auto`, a failure of ours before READY (no GPU, the load, the warm-up) writes nothing on stdout; strata-vision logs the reason and starts mtmd's reader in the same process; `--tower own` keeps its hard failure
- READY names the reader: "READY <n> own", "READY <n> mtmd", "READY <n> mtmd fallback" (servers read only the start)
- test hook STRATA_VIT_TEST_FAIL=gpu|load|warmup; unit tests for the default, the Windows HIP hold, the soft start and the hook (p2006 job p2006-20261111-0743-7d3b: strata-vision-own-test ok, cpu-test all passed)
2026-11-11 07:44:24 +01:00
Niko1221 cab87a2e8f tools/vision/own: --tower auto keeps mtmd on an MSVC-built x86 CPU reader (owner PC, Zen 4: 33.4 s against mtmd-CPU's 18.5 s at 1,024 tokens, while the GCC build is 0.80 to 0.95 of mtmd-CPU); keyed on the compiler, not the OS; unit test; --tower own unchanged 2026-11-10 04:10:04 +01:00
Niko1221 92d379070d tools/vision/own: the Arm NEON kernel tier of the CPU tower (cpu_kernels_neon.cpp, baseline AArch64, 12 x 8 tile, on the cpu_tier.h contract; quant::Isa::Neon is the best tier on AArch64, STRATA_FORCE_ISA=scalar still forces the portable one); --tower auto keeps mtmd on Arm until the gate is accepted 2026-11-10 02:05:15 +01:00
Niko1221 d4283e0215 tools/vision/own: the CPU tower rounds to 16 bits by default when the mmproj's weights are BF16 (off for F16), chosen from the GGUF weight type; STRATA_VIT_REF_ROUND=0/1 still overrides; unit test of the choice 2026-11-09 23:46:48 +01:00
Niko1221 aec86299d2 tools/vision/own: vectorised 16-bit rounding for STRATA_VIT_REF_ROUND on the CPU tower (round16 per ISA tier, BF16 and F16, plus a bit-exact test against the scalar tier)
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.
2026-11-09 20:51:48 +01:00
Niko1221 3ea10ec5dc tools/vision/own: CPU tower keeps its 16-bit weights as panels made once at load (a product task converts a contiguous slice, no per-task transposition: small pictures no longer slower than mtmd-CPU), conv test, speed_pairs.py alternating-pairs speed test 2026-11-09 19:54:10 +01:00
Niko1221 cc4110ed42 tools/vision/own: the fast CPU tower VitCpu (kernels per ISA tier, tiled online-softmax attention, fork-join team) with its unit test; STRATA_VIT_CPU=fast selects it, the default stays VitRef 2026-11-09 19:23:03 +01:00