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 pull request #988 from dcutugno/pr/v4-ssd-mirror

Vincenzo Fornaro9371b17d616a
diff --cc c/deepseek_v4.c
index 594421b6,b8fba4ff..6bc2d1ce
--- a/c/deepseek_v4.c
+++ b/c/deepseek_v4.c
@@@ -6245,17 -6481,12 +6551,18 @@@ static int lookup_hot(ColiExpertStore *
state->active_leases++;
slot->used = ++state->clock;
pthread_mutex_unlock(&state->mutex);
+ int rep = coli_st_expert_route(key.layer, key.expert);
struct timespec disk_t0;
clock_gettime(CLOCK_MONOTONIC, &disk_t0);
- int read_result = v4_read_expert_record(state, record, slot);
+ int read_result = v4_read_expert_record(state, record, slot, rep);
struct timespec disk_t1;
clock_gettime(CLOCK_MONOTONIC, &disk_t1);
+ /* Pack outside the mutex: the slot holds our reference so its slab is
+ * stable, and the heavy FP4 rows16 work must not serialise other
+ * fetches (issue #900). Committed under the lock below. */
+ unsigned char *v4_pack_buf = NULL;
+ if (hot_is_pinned(policy, key.layer, key.expert))
+ v4_pack_buf = hot_pack_slot_prepare(record, slot);
pthread_mutex_lock(&state->mutex);
state->disk_sec +=
(double)(disk_t1.tv_sec - disk_t0.tv_sec) +