Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦
C
ci: the Vulkan formats and every engine's Vulkan path on Lavapipe
JustVugg6fdc4ea44640
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 56b3996a..d3e8e19e 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -143,6 +143,50 @@ jobs:grep -q "expert tier active" vk.log || {echo "FAIL: Vulkan initialised but the expert tier did not activate"; exit 1; }echo "OK: shaders compiled, device negotiated, expert tier active"+ - name: Every qmatmul weight format against a CPU reference+ run: |+ cd c+ # int8, int4, grouped int4, int3, f32, bf16 and fp8-e4m3, through the staged,+ # batched and unstaged paths and odd widths, before any engine is involved.+ bash tests/vulkan_engines.sh shader++ # Every engine with a Vulkan hook, run twice on its tiny fixture: on the CPU and on+ # Lavapipe, with the same snapshot and settings. The gate is the CPU's tokens (and+ # the engine's own oracle where the configuration is the one it was built for) plus+ # a non-zero "[VK] <engine>: N matmuls on the GPU": a hook that declined every+ # matrix would otherwise pass. One leg per family keeps each under its timeout.+ vulkan-engines:+ name: Vulkan engines (${{ matrix.family }}, Lavapipe)+ runs-on: ubuntu-latest+ timeout-minutes: 45+ strategy:+ fail-fast: false+ matrix:+ include:+ - family: qwen+ req: c/tools/requirements-qwen38-tiny.txt+ - family: inkling-olmoe+ req: c/tools/oracle-requirements.txt+ - family: mimo-qwenimage+ req: c/tools/requirements-qwenimage-tiny.txt+ - family: deepseek+ req: c/tools/requirements-deepseek-v4-tiny.txt+ extra: sympy pillow # the V4.1 fixture's reference and its vision tower+ steps:+ - uses: actions/checkout@v4+ - uses: actions/setup-python@v5+ with:+ python-version: '3.12'+ cache: pip+ cache-dependency-path: ${{ matrix.req }}+ - name: Install the Vulkan toolchain, Lavapipe and the fixture dependencies+ run: |+ sudo apt-get update+ sudo apt-get install -y --no-install-recommends \+ libvulkan-dev glslc mesa-vulkan-drivers+ pip install -r ${{ matrix.req }} ${{ matrix.extra }}+ - name: CPU against Vulkan, engine by engine+ run: bash c/tests/vulkan_engines.sh ${{ matrix.family }}musl:name: musl libc (Alpine)diff --git a/c/tests/vulkan_engines.sh b/c/tests/vulkan_engines.shindex b2359d85..b2014b83 100755--- a/c/tests/vulkan_engines.sh+++ b/c/tests/vulkan_engines.sh@@ -244,6 +244,52 @@ PYCOLI_VULKAN=1 QWENIMAGE_TINY=qwenimage_tiny $PY -m unittest tests.test_qwenimage_engine_serve}+family_deepseek() {+ make deepseek_v41 VK=1+ # deepseek_v41: fp8 dense in 32x32 ue8m0 tiles (fmt 12, gs 32, the tile scale+ # repeated over its rows) and bf16 (fmt 11). The engine exits non-zero on any+ # token mismatch with the reference; the CPU run must print the same stream.+ $PY tools/make_dsv41_tiny.py --out dsv41_tiny --emit-ref dsv41_tiny/ref.json+ $PY tools/make_dsv41_tiny.py --out dsv41_long --emit-ref dsv41_long/ref.json --prompt-len 40 --max-new 6+ v41() { # <tag> <env and argv...>+ local tag=$1; shift+ env "$@" > v41-cpu.txt 2> v41-cpu.err || { cat v41-cpu.err; fail "deepseek_v41 $tag: CPU run"; }+ env COLI_VULKAN=1 "$@" > v41-vk.txt 2> v41-vk.err || { cat v41-vk.err; fail "deepseek_v41 $tag: Vulkan run misses the oracle"; }+ cmp -s v41-cpu.txt v41-vk.txt || { diff v41-cpu.txt v41-vk.txt | head; fail "deepseek_v41 $tag: Vulkan output differs from the CPU"; }+ need_gpu deepseek_v41 v41-vk.err "deepseek_v41 $tag"+ echo "OK deepseek_v41 $tag: output = CPU, $(vk_count deepseek_v41 v41-vk.err) matmuls on the GPU"+ }+ local cap force+ for cap in 1 2 8; do v41 "cap=$cap" SNAP=dsv41_tiny ./deepseek_v41 $cap dsv41_tiny/ref.json; done+ for cap in 2 8; do v41 "40-token prompt cap=$cap" SNAP=dsv41_long ./deepseek_v41 $cap dsv41_long/ref.json; done+ for force in 1 2 3 4 5; do+ v41 "DSpark spec=$force" SNAP=dsv41_tiny V41_DSPARK=1 V41_SPEC_FORCE=$force ./deepseek_v41 8 dsv41_tiny/ref.json+ done++ # deepseek_v4: fp8 128x128 blocks (fmt 12, gs 128) and the bf16 router, compressors+ # and head (fmt 11). The GPU gets the activations after the CPU's own E4M3 rounding,+ # so the two runs do the same arithmetic. The tiny check builds the VK=1 binary and+ # keeps passing with the device open; its --oracle path reloads the dense weights+ # every forward and so stays on the CPU, which is why the device is checked on the+ # session path below: ids and teacher-forced predictions equal to the CPU's and to+ # the reference's greedy stream.+ COLI_VULKAN=1 make deepseek-v4-tiny-check VK=1+ local prompt+ prompt=$($PY -c 'import json; c=json.load(open("deepseek_v4_tiny/ref.json"))["cases"]["long"]; print("".join("<t%03d>" % t for t in c["prompt_ids"]))')+ ./deepseek_v4 ./deepseek_v4_tiny "$prompt" --raw-prompt --max-tokens 4 --record-oracle v4-cpu.json > /dev/null+ COLI_VULKAN=1 ./deepseek_v4 ./deepseek_v4_tiny "$prompt" --raw-prompt --max-tokens 4 --record-oracle v4-vk.json > /dev/null 2> v4-vk.err+ $PY - <<'PY' || fail "deepseek_v4: the Vulkan session differs from the CPU's"+import json, sys+a, b = json.load(open("v4-cpu.json")), json.load(open("v4-vk.json"))+ref = json.load(open("deepseek_v4_tiny/ref.json"))["cases"]["long"]["greedy_full_ids"]+ok = a["full_ids"] == b["full_ids"] == ref and a["tf_pred"] == b["tf_pred"]+print("OK deepseek_v4 session: ids = CPU = reference" if ok else ("CPU", a, "VK", b, "ref", ref))+sys.exit(0 if ok else 1)+PY+ need_gpu deepseek_v4 v4-vk.err "deepseek_v4 session"+ echo "OK deepseek_v4: $(vk_count deepseek_v4 v4-vk.err) matmuls on the GPU"+}+case "${1:-}" inshader) shader_formats ;;qwen) family_qwen ;;