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

Merge dev: TEST_BINS derives from build rules (#733); keep abl.h in the colibri rule

JustVugg1a7d65bc6be0
diff --cc c/Makefile
index a4e942ac,4cd545fb..3129c5d2
--- a/c/Makefile
+++ b/c/Makefile
@@@ -281,8 -358,15 +358,15 @@@ $(file >.build-config,$(BUILD_CONFIG)
endif
.build-config: ;
- colibri$(EXE): colibri.c st.h uring.h json.h tok.h tok_unicode.h compat.h grammar.h abl.h quant.h sample.h kv_persist.h telemetry.h $(CUDA_OBJ) $(METAL_OBJ) .build-config
- $(CC) $(CFLAGS) colibri.c $(CUDA_OBJ) $(METAL_OBJ) -o colibri$(EXE) $(LDFLAGS)
-colibri$(EXE): colibri.c st.h uring.h json.h tok.h tok_unicode.h compat.h grammar.h quant.h sample.h kv_persist.h telemetry.h $(CUDA_OBJ) $(METAL_OBJ) $(VK_OBJ) $(VK_SPV) .build-config
++colibri$(EXE): colibri.c st.h uring.h json.h tok.h tok_unicode.h compat.h grammar.h abl.h quant.h sample.h kv_persist.h telemetry.h $(CUDA_OBJ) $(METAL_OBJ) $(VK_OBJ) $(VK_SPV) .build-config
+ $(CC) $(CFLAGS) colibri.c $(CUDA_OBJ) $(METAL_OBJ) $(VK_OBJ) -o colibri$(EXE) $(LDFLAGS)
+
+ # Vulkan backend object (plain C + vulkan headers) and its SPIR-V shaders.
+ backend_vulkan.o: backend_vulkan.c backend_vulkan.h .build-config
+ $(CC) $(CFLAGS) -c backend_vulkan.c -o $@
+ shaders/%.spv: shaders/%.comp
+ @command -v $(GLSLC) >/dev/null 2>&1 || { echo "glslc not found: install shaderc (for VK=1)" >&2; exit 1; }
+ $(GLSLC) --target-env=vulkan1.2 $< -o $@
# Windows runtime loader object: resolves coli_cuda_* from coli_cuda.dll.
backend_loader.o: backend_loader.c backend_cuda.h compat.h .build-config
diff --cc c/colibri.c
index 6c98790a,8bf7cc4b..68bcbcc5
--- a/c/colibri.c
+++ b/c/colibri.c
@@@ -6777,14 -8528,12 +8658,18 @@@ int main(int argc, char **argv)
cap_for_ram(&m, ram_env, ebits, est_ctx);
g_prof = getenv("PROF")?atoi(getenv("PROF")):0; /* PROF=1: opt-in performance profile */
if(g_prof) prof_config(&m, ram_env, est_ctx); }
+ #ifdef COLI_VULKAN
+ vk_dense_preload(&m); /* dense claims VRAM first — the tier fill sizes to the remainder */
+ vk_registry_fill(&m); /* pinned VK expert tier: needs the usage history loaded above */
+ #endif
const char *stats=getenv("STATS"); /* STATS=<file> -> istogramma uso expert a fine run */
+ /* CAUSAL ABLATION: ABLATE_SCORE=<manifest> -> teacher-forced per-expert
+ * ablation sweep with per-target-position final-logit read-out (ABLATE_OUT=
+ * <file>). Precedes SCORE. Optional ROUTE_TRACE=<file> records the
+ * post-ablation router trace. */
+ if(getenv("ABLATE_SCORE")){ run_ablate_score(&m, getenv("ABLATE_SCORE")); if(stats) stats_dump(&m,stats); return 0; }
+
/* modo scoring per benchmark: SCORE=<requests.txt> -> log-likelihood per riga */
if(getenv("SCORE")){ run_score(&m, snap, getenv("SCORE")); if(stats) stats_dump(&m,stats); return 0; }