Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦
C
deepseek: the device goes at exit even when the tier refuses
JustVuggb2747b2f7cd2
diff --git a/c/deepseek_v4.c b/c/deepseek_v4.cindex 33cc9690..308611e9 100644--- a/c/deepseek_v4.c+++ b/c/deepseek_v4.c@@ -12583,8 +12583,11 @@ static void v4_vk_tier_start(const ColiV4Engine *engine) {.dense_bytes = coli_vk_dense()? (size_t)(engine->dense_resident.total_bytes + engine->head_cache.bytes) : 0,.in_ram = v4_vkt_in_ram, .ram_ctx = store};+ /* The device goes before the drivers unload, after the tier's teardown (atexit runs+ * last-registered first), and whether or not the tier starts: vkt_init makes the+ * expert batch's pipelines before it can refuse (no room). */+ atexit(coli_vk_shutdown);if (!vkt_init(&vc, coli_v4_expert_store_history(store))) return;- atexit(coli_vk_shutdown); /* runs after the tier's teardown: the device goes before the drivers unload */atexit(vkt_shutdown);g_v4_vkt = (ColiV4VkTier){store, v4_vkt_issue, v4_vkt_join, v4_vkt_note, v4_vkt_routed};int all = c->num_hidden_layers * c->n_routed_experts;diff --git a/c/deepseek_v41.c b/c/deepseek_v41.cindex 02cf6ff7..9ea5ef14 100644--- a/c/deepseek_v41.c+++ b/c/deepseek_v41.c@@ -4218,8 +4218,12 @@ static void vk_tier_start(Model *m, const char *snap, int cap) {else snprintf(g_vk_usage, sizeof g_vk_usage, "%s/.coli_usage", snap);int64_t h = rt_load(g_vk_usage);if (h > 0) fprintf(stderr, "[USAGE] expert history: %lld selections (%s)\n", (long long)h, g_vk_usage);+ /* The device goes before the drivers unload, after the tier's teardown (atexit runs+ * last-registered first), and whether or not the tier starts: vkt_init makes the+ * expert batch's pipelines before it can refuse (no room), and a driver still+ * compiling them at exit crashed one run in sixteen on Mesa's Dozen. */+ atexit(coli_vk_shutdown);if (!vkt_init(&vc, rt_counts_all())) { rt_destroy(); g_vk_usage[0] = 0; return; }- atexit(coli_vk_shutdown); /* runs after the tier's teardown: the device goes before the drivers unload */atexit(vkt_shutdown);int all = c->n_layers * c->n_routed;int *pl = malloc((size_t)all * sizeof(int)), *pe = malloc((size_t)all * sizeof(int));