Skip to content

Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

test(vulkan): fix fixture dependencies and runtime assertions

JustVugge649c3d62e12
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ef862ef9..4a96884b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -275,10 +275,10 @@ jobs:
req: c/tools/requirements-qwen38-tiny.txt
- family: dense-only-inkling-mimo-kimi
req: c/tools/requirements-kimi-k3-tiny.txt
- extra: pillow
+ extra: -r c/tools/oracle-requirements.txt pillow
- family: dense-only-inkling-mimo-kimi-sanitize
req: c/tools/requirements-kimi-k3-tiny.txt
- extra: pillow
+ extra: -r c/tools/oracle-requirements.txt pillow
- family: dense-only-glm
req: c/tools/requirements-qwen38-tiny.txt
extra: pillow
diff --git a/c/tests/vulkan_dense_only_inkling-mimo-kimi.sh b/c/tests/vulkan_dense_only_inkling-mimo-kimi.sh
index 449d559d..adc39528 100644
--- a/c/tests/vulkan_dense_only_inkling-mimo-kimi.sh
+++ b/c/tests/vulkan_dense_only_inkling-mimo-kimi.sh
@@ -268,7 +268,10 @@ dho_family_inkling_mimo_kimi_sanitize() {
env COLI_USAGE=chain.usage USAGE_SAVE=0 COLI_VK_TIER_SYNC=1 COLI_VULKAN=1 COLI_VK_CHAIN=1 COLI_VK_DENSE_HOST=0 "$@" > san.log 2>&1 || true
if grep -qE "ERROR: AddressSanitizer|runtime error:" san.log; then cat san.log; fail "asan $tag: sanitizer diagnostic"; fi
[ "$(dho_dropped san.log)" -gt 0 ] || { cat san.log; fail "asan $tag: nothing on the device only"; }
- if [ "$lost" = 1 ]; then [ "$(dho_reloaded san.log)" -gt 0 ] || { cat san.log; fail "asan $tag: nothing read back"; }; fi
+ if [ "$lost" = 1 ]; then
+ grep -q 'queue submit (COLI_VK_CHAIN_FAULT)' san.log || { cat san.log; fail "asan $tag: device loss was not injected"; }
+ [ "$(dho_reloaded san.log)" -gt 0 ] || { cat san.log; fail "asan $tag: nothing read back"; }
+ fi
echo "OK asan $tag: sanitizers clean, $(dho_dropped san.log) matrices on the device only, $(dho_reloaded san.log) read back"
}
local R=tiny_inkling/ref_inkling.json
@@ -277,10 +280,14 @@ dho_family_inkling_mimo_kimi_sanitize() {
dsan_run "dense-only inkling device lost" 1 COLI_VK_CHAIN_FAULT=150 SNAP=tiny_inkling ./inkling 8 0 $R
dsan_run "dense-only mimo picture" 0 MIMO_DENSE_BITS=0 COLI_VK_DENSE=1 ./mimo mimo_tiny --ids "$(mimo_ids image prompt_ids)" --ngen 4 --image mimo_tiny/patches.f32 --grid $MGRID
dsan_run "dense-only mimo device lost" 1 MIMO_DENSE_BITS=0 COLI_VK_CHAIN_FAULT=20 ./mimo mimo_tiny --ids "$(mimo_ids long prompt_ids)" --ngen 4
- local O=(K3_BITS=4 K3_IDOT=0 COLI_TEMP=0)
+ local O=(K3_BITS=4 K3_IDOT=0 COLI_TEMP=0) frames
dsan_run "dense-only kimi_k3 int4" 0 "${O[@]}" ./kimi_k3 kimi_k3_tiny --ids "$(k3c_ids long)" --ngen 4
+ # Chunk sizing changes the submission count. Inject during the last decode of
+ # this exact configuration instead of assuming it reaches a fixed frame.
+ frames=$(sed -n 's/^\[VK\] kimi_k3 chain: [0-9]* forwards, \([0-9]*\) frames.*/\1/p' san.log | tail -1)
+ [ "${frames:-0}" -gt 3 ] || { cat san.log; fail "asan dense-only kimi_k3: too few frames for device-loss test"; }
dsan_run "dense-only kimi_k3 prompts only" 0 "${O[@]}" COLI_VK_CHAIN=2 ./kimi_k3 kimi_k3_tiny --ids "$(k3c_ids long)" --ngen 4
- dsan_run "dense-only kimi_k3 device lost" 1 "${O[@]}" COLI_VK_CHAIN_FAULT=40 ./kimi_k3 kimi_k3_tiny --ids "$(k3c_ids long)" --ngen 4
+ dsan_run "dense-only kimi_k3 device lost" 1 "${O[@]}" COLI_VK_CHAIN_FAULT=$((frames - 2)) ./kimi_k3 kimi_k3_tiny --ids "$(k3c_ids long)" --ngen 4
CHAIN_SERVE_TOL=2e-2 CHAIN_SERVE_EXPECT='dense matrices on the device only' COLI_VK_DENSE_HOST=0 \
$PY tests/vulkan_chain_serve.py ./kimi_k3 kimi_k3_serve K3_BITS=32 K3_MLA_BITS=32 K3_HEAD_BITS=32 K3_IDOT=0 USAGE_SAVE=0 > san.log 2>&1 ||
{ cat san.log; fail "asan dense-only kimi_k3 serve"; }
diff --git a/c/tests/vulkan_engines.sh b/c/tests/vulkan_engines.sh
index b3aa5490..2f302a61 100755
--- a/c/tests/vulkan_engines.sh
+++ b/c/tests/vulkan_engines.sh
@@ -580,9 +580,11 @@ EOF
# The warm start: a CPU run writes the history (inkling's PIN=<file>, olmoe's
# COLI_USAGE), and the tier's run fills the device from it before the first token.
rm -f tier.hist
- PIN=tier.hist SNAP=tiny_inkling ./inkling 8 -p "The capital of France is" -n 8 > cpu.log 2>&1
- PIN=tier.hist COLI_VK_TIER_SYNC=1 COLI_VULKAN=1 SNAP=tiny_inkling ./inkling 8 -p "The capital of France is" -n 8 > vk.log 2>&1
- $PY - cpu.log vk.log <<'PY' || { cat vk.log; fail "inkling tier warm start: the text differs from the CPU's"; }
+ # Streaming can report its first device batch after the prompt has been printed.
+ # Keep diagnostics separate so the exact text comparison measures stdout alone.
+ PIN=tier.hist SNAP=tiny_inkling ./inkling 8 -p "The capital of France is" -n 8 > cpu.log 2> cpu.err
+ PIN=tier.hist COLI_VK_TIER_SYNC=1 COLI_VULKAN=1 SNAP=tiny_inkling ./inkling 8 -p "The capital of France is" -n 8 > vk.log 2> vk.err
+ $PY - cpu.log vk.log <<'PY' || { cat cpu.log vk.log vk.err; fail "inkling tier warm start: the text differs from the CPU's"; }
import re, sys
def text(p):
m = re.search(rb"\[\d+ prompt tokens\](.*?)\n\[prefill", open(p, "rb").read(), re.S)
@@ -590,9 +592,9 @@ def text(p):
a, b = text(sys.argv[1]), text(sys.argv[2])
sys.exit(0 if a is not None and a == b else 1)
PY
- grep -qa '^\[VK\] tier inkling: warm start, [1-9]' vk.log || { cat vk.log; fail "inkling tier: no warm start"; }
- [ "$(tier_count inkling vk.log)" -gt 0 ] || { cat vk.log; fail "inkling tier warm start: no routed expert ran on the device"; }
- echo "OK inkling tier warm start: text = CPU, $(grep -a -o 'warm start, [0-9]* experts' vk.log), $(grep -a -o 'device [0-9]* of [0-9]* routed experts' vk.log | tail -1)"
+ grep -qa '^\[VK\] tier inkling: warm start, [1-9]' vk.err || { cat vk.err; fail "inkling tier: no warm start"; }
+ [ "$(tier_count inkling vk.err)" -gt 0 ] || { cat vk.err; fail "inkling tier warm start: no routed expert ran on the device"; }
+ echo "OK inkling tier warm start: text = CPU, $(grep -a -o 'warm start, [0-9]* experts' vk.err), $(grep -a -o 'device [0-9]* of [0-9]* routed experts' vk.err | tail -1)"
rm -f tier.hist
COLI_USAGE=tier.hist SNAP=olmoe_tiny_c ./olmoe 8 8 $OR > cpu.log 2>&1
COLI_USAGE=tier.hist COLI_VK_TIER_SYNC=1 COLI_VULKAN=1 SNAP=olmoe_tiny_c ./olmoe 8 8 $OR > vk.log 2>&1