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): hold GEMV arithmetic fixed for exact GLM pin checks

JustVuggd1d3930a21b9
diff --git a/c/tests/test_glm53_vk_f32.c b/c/tests/test_glm53_vk_f32.c
index eacfe997..ef4f3feb 100644
--- a/c/tests/test_glm53_vk_f32.c
+++ b/c/tests/test_glm53_vk_f32.c
@@ -40,6 +40,23 @@ int main(void) {
}
}
}
+ /* Exact prefix/pin checks fix the kernel to GEMV: a cold prompt and its
+ * resumed suffix must then have identical arithmetic at every batch size.
+ * Default GEMM/GEMV selection is checked numerically above instead. */
+ const char *gemm_min = getenv("COLI_VK_GEMM_MIN_S");
+ if (gemm_min && !strcmp(gemm_min, "0")) {
+ float single[S * O];
+ for (int t = 0; t < S; t++) mv(single + t * O, &w, x + t * I);
+ if (memcmp(single, gpu, sizeof(single))) {
+ fputs("FAIL: f32 GEMV rows differ between a full batch and individual rows\n", stderr);
+ failed = 1;
+ }
+ mm(gpu, &w, x + (S - 5) * I, 5);
+ if (memcmp(single + (S - 5) * O, gpu, 5 * O * sizeof(float))) {
+ fputs("FAIL: f32 GEMV resumed suffix differs from the full batch\n", stderr);
+ failed = 1;
+ }
+ }
/* Nonresident weights still belong to the CPU and take no dense budget. */
w.resident = 0;
unsigned long long before = coli_vk_matmul_calls();
diff --git a/c/tests/vulkan_engines.sh b/c/tests/vulkan_engines.sh
index 19031b1b..cd012d27 100755
--- a/c/tests/vulkan_engines.sh
+++ b/c/tests/vulkan_engines.sh
@@ -65,6 +65,7 @@ shader_formats() {
./tests/test_vk_tier shaders/qmatmul.spv | tee vk_tier.log
tail -1 vk_tier.log | grep -qx PASS || fail "routed-expert tier"
./tests/test_glm53_vk_f32
+ COLI_VK_GEMM_MIN_S=0 ./tests/test_glm53_vk_f32
}
# tier_count <engine> <log>: N from the last "[VK] tier <engine> run: device N of M" line;
@@ -1837,9 +1838,15 @@ family_glm_chain() {
CHAIN_SERVE_DIALECT=numeric $PY tests/vulkan_chain_serve.py ./glm53 glm53_serve GLM53_BITS=4 COLI_VK_CHAIN_ROWS=3
CHAIN_SERVE_SLOTS=2 CHAIN_SERVE_DIALECT=numeric $PY tests/vulkan_chain_serve.py ./glm53 glm53_serve GLM53_BITS=32 KV_SLOTS=2
COLI_VK_CHAIN=2 CHAIN_SERVE_DIALECT=numeric $PY tests/vulkan_chain_serve.py ./glm53 glm53_serve GLM53_BITS=32
- # a pin restored over rows another branch rewrote: the KDA state goes up from the pin,
- # the MLA rows' watermark comes down
- COLI_VULKAN=1 COLI_VK_CHAIN=1 COLI_USAGE=$PWD/chain.usage $PY tests/glm53_pin_branch_harness.py --binary ./glm53 --fixture glm53_mm_tiny
+ # A pin restored over rows another branch rewrote: the KDA state goes up from the
+ # pin, the MLA rows' watermark comes down. This check compares printed logprobs
+ # exactly, so keep the per-row GEMV for every prompt length (as for MiMo's exact
+ # prefix check). A cold prompt and a short resumed tail can otherwise straddle
+ # the GEMM threshold, including at the now-device-resident f32 lm_head, and differ
+ # in the last printed digit from reduction order alone. The gates above exercise
+ # the default GEMM/GEMV policy against CPU tokens and the numerical tolerance.
+ COLI_VULKAN=1 COLI_VK_CHAIN=1 COLI_VK_GEMM_MIN_S=0 COLI_USAGE=$PWD/chain.usage \
+ $PY tests/glm53_pin_branch_harness.py --binary ./glm53 --fixture glm53_mm_tiny
unset OMP_NUM_THREADS CAP_RAISE
}