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(dsv4): cover reported cache capacities

JustVugg0b953c2977be
diff --git a/c/deepseek_v4.c b/c/deepseek_v4.c
index 4842b918..67d13c7f 100644
--- a/c/deepseek_v4.c
+++ b/c/deepseek_v4.c
@@ -7040,8 +7040,10 @@ typedef struct {
V4ExpertSlot *slots;
int *slot_by_expert; /* resident/in-flight slot; every StoreOps variant that
* mutates slot identity must maintain this index */
- int *allocated_per_layer;
- int *lru_head;
+ int *allocated_per_layer; /* shared by the embedded base and hot StoreOps:
+ * every slab allocation must advance this cursor */
+ int *lru_head; /* every recency update in either StoreOps must touch the
+ * intrusive list while state->mutex is held */
int *lru_tail;
uint64_t clock;
unsigned active_leases;
@@ -13914,6 +13916,11 @@ int coli_v4_shared_expert_forward_ref(float *output,
#ifdef COLI_V4_UNIT_EXPERT_STORE
/* ######## deepseek_v4_expert_store.c ######## */
+/* Legacy standalone unit with its own private V4ExpertStoreState. The target
+ * binary and DeepSeek-V4 tests use COLI_V4_UNIT_EXPERT_STORE_HOT_ROWS16,
+ * which embeds the indexed base StoreOps above; never register these ops on
+ * that unit's state, whose slot index, allocation cursor, and intrusive LRU
+ * have stricter mutation invariants. */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
diff --git a/c/tests/test_deepseek_v4.c b/c/tests/test_deepseek_v4.c
index fa4f8a04..fc083271 100644
--- a/c/tests/test_deepseek_v4.c
+++ b/c/tests/test_deepseek_v4.c
@@ -833,12 +833,13 @@ static int test_expert_store_miss_scaling(void) {
return 1;
}
int result = run_expert_miss_scaling_case(directory, 256, 44) ||
- run_expert_miss_scaling_case(directory, 256, 219);
+ run_expert_miss_scaling_case(directory, 256, 104) ||
+ run_expert_miss_scaling_case(directory, 256, 208);
unlink(path);
rmdir(directory);
if (result) return 1;
puts("DeepSeek-V4 ExpertStore miss scaling: ok "
- "(44 slots=1 probe, 219 slots=1 probe)");
+ "(44/104/208 slots=1 probe each)");
return 0;
}
/* ==== end test_deepseek_v4_expert_store.c ==== */