Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦
C
test(inkling): enforce cache capacity invariance
dyKiU2f8957ce597f
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex c22d8c13..2e5f977d 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -120,7 +120,12 @@ jobs:# forward); the greedy pass exits non-zero on any mismatch, so this# gate fails the moment a shared-code change regresses the engine.python3 tools/make_tiny_inkling.py tiny_inkling- SNAP=tiny_inkling ./inkling 8 0 tiny_inkling/ref_inkling.json+ # The oracle at several cache capacities (#784): a capacity-1 cache+ # exercises eviction on every routed expert, which is where a slot+ # bookkeeping bug shows up and a capacity-8 run never would.+ for cap in 1 2 8; do+ SNAP=tiny_inkling ./inkling "$cap" 0 tiny_inkling/ref_inkling.json+ done- name: KV prefix reuse is token-identical (serve, two turns)run: |cd cdiff --git a/c/inkling.c b/c/inkling.cindex d05e50b6..c9f3a035 100644--- a/c/inkling.c+++ b/c/inkling.c@@ -1250,6 +1250,18 @@ static void moe(Model *m, Layer *l, int layer, float *x, int S, float *out) {for (int j = 0; j < nfill; j++) slot_fill(m, fl[j], fill[j]);m->t_fill += now_s() - tf;}+ /* Validate before the CPU/Metal split: either backend must refuse a+ * cache slot whose weights belong to a different routed expert. */+ for (int64_t t = base; t < end; t++) {+ Slot *e = use[t - base];+ if (!e) continue; /* scartato da TOPP */+ int s = (int)(t / K), kk = (int)(t % K);+ if (e->eid != idx[(int64_t)s*K + kk]) {+ fprintf(stderr, "layer %d: cache served expert %d for requested expert %d\n",+ layer, e->eid, idx[(int64_t)s*K + kk]);+ exit(1);+ }+ }double te = now_s();#ifdef COLI_METALif (mxg) {