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

metal: advance the LFRU recency clock on the GPU-prerouted decode path (#417)

JustVuggcfcc742591a0
diff --git a/c/glm.c b/c/glm.c
index 26e7fc49..0f97ad21 100644
--- a/c/glm.c
+++ b/c/glm.c
@@ -2931,6 +2931,11 @@ static void moe(Model *m, Layer *l, int layer, float *x, int S, float *out, int
m->eusage[layer][idxs[(int64_t)s*K+kk]]++;
ehit_mark(m,layer,idxs[(int64_t)s*K+kk]);
if(m->eheat[layer][idxs[(int64_t)s*K+kk]]<UINT32_MAX) m->eheat[layer][idxs[(int64_t)s*K+kk]]++;
+ /* #417: la scorciatoia GPU-prerouted deve far avanzare l'orologio di recency
+ * come il percorso router completo (riga ~3055), altrimenti elast/eaccess_clock
+ * si congelano a fine prefill e il tie-breaker LFRU di REPIN gira su punteggi
+ * stantii durante il decode su Metal. */
+ m->elast[layer][idxs[(int64_t)s*K+kk]]=++m->eaccess_clock;
}
for(int d=0;d<D;d++) out[(int64_t)s*D+d]=0;
}