From 7a5ffd192dd01b43a7cf50dee9d7ffcfd9228fef Mon Sep 17 00:00:00 2001 From: JustVugg Date: Mon, 6 Jul 2026 19:56:24 +0200 Subject: [PATCH] async I/O: WILLNEED readahead of the next expert block while computing the current one Co-Authored-By: Claude Fable 5 --- c/glm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/c/glm.c b/c/glm.c index f3028c0..fee5d78 100644 --- a/c/glm.c +++ b/c/glm.c @@ -814,6 +814,18 @@ static void moe(Model *m, Layer *l, int layer, float *x, int S, float *out){ #pragma omp parallel for schedule(dynamic,1) for(int q=0;qws[q]); m->t_edisk += now_s()-t0; } + /* I/O ASINCRONO: readahead (WILLNEED) del blocco SUCCESSIVO mentre calcoliamo + * questo — il kernel legge in background, le pread dopo trovano cache calda */ + if(base+64pin[layer]; + for(int z=0;znpin[layer] && !found;z++) if(P[z].eid==eid) found=1; + ESlot *Sl=m->ecache[layer]; + for(int z=0;zecn[layer] && !found;z++) if(Sl[z].eid==eid) found=1; + if(!found) expert_prefetch(m,layer,eid); + } + } for(int j=0;j