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): partial-glm's chunks within the bound on glm53, a declined verify, docs

JustVuggf5e79e8ef5b6
diff --git a/c/tests/vulkan_partial_glm.sh b/c/tests/vulkan_partial_glm.sh
index 9aa692f3..f5d7817b 100644
--- a/c/tests/vulkan_partial_glm.sh
+++ b/c/tests/vulkan_partial_glm.sh
@@ -214,7 +214,8 @@ ptl_mla_dho() {
# ptl_mla_same <engine> <tag> <env A> <env B> <env...> -- <argv...>: two chained runs that
# differ only in env A / env B (each one string, KEY=VALUE words): the same tokens and the
# same logits, bit for bit (COLI_VK_TIER_BALANCE=0: the tier's split of the routed experts
-# with the CPU follows the timings, and with it which side's bits a row gets)
+# with the CPU follows the timings, and with it which side's bits a row gets); TOL=1: the
+# logits within 1e-4 of the largest (logits_close)
ptl_mla_same() {
local eng=$1 tag=$2 a=$3 b=$4; shift 4
local envs=(); while [ "$1" != "--" ]; do envs+=("$1"); shift; done; shift
@@ -229,8 +230,13 @@ ptl_mla_same() {
done
rm -f chain.usage
{ [ -s same-a.tok ] && cmp -s same-a.tok same-b.tok; } || { cat same-a.tok same-b.tok; fail "$tag: the tokens differ"; }
- cmp -s same-a.f32 same-b.f32 || fail "$tag: the logits differ"
- echo "OK $tag: the same tokens and logits ($a | $b)"
+ if [ "${TOL:-0}" = 1 ]; then
+ local lg; lg=$(logits_close same-a.f32 same-b.f32) || { echo "$lg"; fail "$tag: logits"; }
+ echo "OK $tag: the same tokens, $lg ($a | $b)"
+ else
+ cmp -s same-a.f32 same-b.f32 || fail "$tag: the logits differ"
+ echo "OK $tag: the same tokens and logits ($a | $b)"
+ fi
}
# ptl_mla_resident <log>: colibri's "resident dense" MB after the load (what cap_for_ram counts)
ptl_mla_resident() { grep -ao 'resident dense: [0-9.]* MB' "$1" | head -1 | sed 's/[^0-9.]//g'; }
@@ -264,6 +270,9 @@ ptl_family_glm() {
ptl_mla colibri "partial colibri n-gram drafts" 2 $G DRAFT=3 -- 64 16 16
for k in 1 3; do ptl_mla colibri "partial colibri MTP depth 3, $k of 5 layers" $k $T DRAFT=3 -- 64 16 16; done
ptl_mla colibri "partial colibri MTP with DSA top-4" 2 $T DSA_TOPK=4 -- 64 16 16
+ # a declined step: the exact verify of COLI_EXACT_VERIFY runs on the CPU (every layer),
+ # the other forwards take the device's layers
+ ptl_mla colibri "partial colibri MTP, the exact verify declined" 2 $T DRAFT=2 COLI_EXACT_VERIFY=1 -- 64 16 16
ptl_mla colibri "partial colibri tier off" 2 $G COLI_VK_TIER=0 -- 64 16 16
ptl_mla colibri "partial colibri beside COLI_VK_DENSE=1 COLI_VK_ATTN=1" 2 SNAP=glm_tiny_i4 REF=glm_tiny_i4/ref_glm.json IDOT=0 COLI_VK_DENSE=1 COLI_VK_ATTN=1 -- 2 4 4
CHAINMODE=2 ptl_mla colibri "partial colibri prompts only, drafts" 2 $G DRAFT=3 -- 64 16 16
@@ -337,7 +346,10 @@ ptl_family_glm() {
KV=16:4 ptl_mla glm53 "partial glm53 the KV split, chain chunks of 3" 2 GLM53_BITS=32 COLI_VK_CHAIN_ROWS=3 -- $F --ids $ids --greedy 8
FAULT_BACK=7 REBUILD=1 ptl_mla glm53 "partial glm53 device lost, the device layers' KDA state rebuilt" 3 GLM53_BITS=32 GLM53_PREFILL_CHUNK=16 -- $F --ids $ids --greedy 6
FAULT_BACK=2 REBUILD=1 ptl_mla glm53 "partial glm53 device lost after an image" 2 GLM53_BITS=32 -- $M --greedy 4
- ptl_mla_same glm53 "partial glm53 chunks of 1 = 7" "COLI_VK_CHAIN_ROWS=1" "COLI_VK_CHAIN_ROWS=7" COLI_VK_CHAIN_LAYERS=4 GLM53_BITS=32 -- $F --ids $ids --greedy 4
+ # glm53's chain rounds differently with the chunk's rows with every layer on the device
+ # too (the binary before this branch: 3.6e-7 of 1.54 between chunks of 1 and 7): the
+ # chunks compare within the bound, the tokens exactly
+ TOL=1 ptl_mla_same glm53 "partial glm53 chunks of 1 = 7" "COLI_VK_CHAIN_ROWS=1" "COLI_VK_CHAIN_ROWS=7" COLI_VK_CHAIN_LAYERS=4 GLM53_BITS=32 -- $F --ids $ids --greedy 4
# ---- the dense weights on the device only
for k in 1 3; do ptl_mla_dho glm53 "partial glm53 device only, $k of 6 layers" $k glm53_l6s-i4 GLM53_BITS=32 -- $F --ids $ids --greedy 4; done
ptl_mla_dho glm53 "partial glm53 device only, 4-bit trunk" 4 glm53_l6s-i4 GLM53_BITS=4 -- $F --ids $ids --greedy 4
diff --git a/docs/vulkan.md b/docs/vulkan.md
index 3b13f94a..c35cab6c 100644
--- a/docs/vulkan.md
+++ b/docs/vulkan.md
@@ -1276,9 +1276,10 @@ switches (`COLI_VK_DENSE`, `COLI_VK_ATTN`, `COLI_VK_DEV2`) keep working beside i
chain's tensors are their device copies where they made one.
**A partial chain** ([the fit](#a-partial-chain)). GLM-5.2's dense part is 9.9 GB, more
-than an 8 or 12 GB card holds. Both engines decide N right after the load, before
-colibri's pins and `cap_for_ram`, glm53's expert cache and the tier size themselves, and
-place layers 0..N-1 one at a time (`COLI_VK_CHAIN_LAYERS=n` forces N). A forward runs all
+than an 8 or 12 GB card holds. Both engines decide N right after the load, before the
+chain's pipelines take their first blocks and before colibri's pins and `cap_for_ram`,
+glm53's expert cache and the tier size themselves, and place layers 0..N-1 one at a time
+(`COLI_VK_CHAIN_LAYERS=n` forces N). A forward runs all
its chunks through the N device layers; then the residual rows (colibri) or the hc_mult
streams (glm53) come back to the host once per chunk, and the CPU's own layer loop runs
layers N..L-1, the final norm and the head on them. When colibri's layer N is a shared
@@ -1290,7 +1291,11 @@ alone. After a lost device colibri runs the forward again on the CPU, and glm53
the KDA state of the device's layers only (the CPU layers ran every position already).
With `COLI_VK_DENSE_HOST=0` only the N layers drop their host copies, each once all of it
reached the device; colibri's `resident dense`, and with it the pins and `cap_for_ram`,
-counts only what was dropped, and glm53's expert cache sizes itself after them. lm_head,
+counts only what was dropped, and glm53's expert cache sizes itself after them. `coli
+plan` predicts glm53's N from the same numbers (`_glm53_chain_layout` in
+`resource_plan.py`, checked against the engine's fit line); colibri's dense formats come
+from its command line, which the plan does not see, so it gives colibri no device-only
+credit and no N. lm_head,
and colibri's MTP layer and eh_proj, go to the device only with every layer there and
room for them. Until then the per-matrix path (`COLI_VK_DENSE`, `COLI_VK_ATTN`) multiplies
on the device only what the chain placed, and the line
@@ -2390,6 +2395,8 @@ predict a layer more than the engine places.
| qwen36 (Qwen3.6, Qwen3-Coder, Qwen3.8-27B, Clef) | the residual rows alone; a prompt-lookup verify rolls each side back with its own copies (the device's DeltaNet slots, the CPU's snapshots) ([qwen36](#the-dense-chain-vk_chainc)) | yes |
| olmoe | the residual rows alone; `PILOT` keeps prefetching the next layers from the chain's rows ([olmoe](#olmoe-and-inkling)) | yes |
| qwen38 | the four hyper-connection streams of every row; the MTP head reads the final streams from whichever side ran the last layer, and the PLE ring and n-gram history stay with the PLE layer's side | yes |
+| colibri (GLM-5.2) | the residual rows; when layer N is a shared DSA indexer layer, the selection the device's last full layer made (1 + `index_topk` ints a row) | yes ([GLM](#glm-52-and-glm-53-flash-on-the-chain)) |
+| glm53 (GLM-5.3 Flash) | the hc_mult streams | yes ([GLM](#glm-52-and-glm-53-flash-on-the-chain)) |
**`COLI_VK_DEVICE_CAP_MB=n`** (tests) makes the device hold at most n MiB of device-local
memory (a fraction is taken): every allocation of the backend and the chain (tensors, the