diff --git a/c/glm.c b/c/glm.c index 7f2d491..bbebd81 100644 --- a/c/glm.c +++ b/c/glm.c @@ -392,8 +392,12 @@ static void matmul_i4_pair(float *yg, float *yu, const float *x, } static void matmul_qt(float *y,const float *x,QT *w,int S); +static int g_no_fused_pair=0; /* COLI_NO_FUSED_PAIR=1: disable the gate+up kernel fusion + * that changes OMP scheduling vs separate matmul_qt calls — this + * shifts floating-point accumulation order and can collapse MTP + * draft acceptance by flipping near-ties (#163). */ static void expert_gate_up(float *g,float *u,const float *x,QT *wg,QT *wu,int S){ - if(S==1&&wg->fmt==2&&wu->fmt==2&&wg->I==wu->I&&wg->O==wu->O) + if(!g_no_fused_pair&&S==1&&wg->fmt==2&&wu->fmt==2&&wg->I==wu->I&&wg->O==wu->O) matmul_i4_pair(g,u,x,wg->q4,wg->s,wu->q4,wu->s,wg->I,wg->O); else { matmul_qt(g,x,wg,S); matmul_qt(u,x,wu,S); } } @@ -3667,7 +3671,8 @@ int main(int argc, char **argv){ * re-exec + tuning path (distinct from the internal COLI_OMP_TUNED sentinel). * * Must remain the FIRST statement in main(): argv is passed verbatim to execv(). */ - if(!getenv("COLI_OMP_TUNED") && !getenv("COLI_NO_OMP_TUNE")){ + if(!getenv("COLI_OMP_TUNED") && !getenv("COLI_NO_OMP_TUNE") && + !getenv("COLI_CUDA") && !getenv("COLI_METAL")){ setenv("OMP_WAIT_POLICY","active",0); /* keep the team hot across the tiny per-expert matmul regions */ setenv("GOMP_SPINCOUNT","200000",0); /* spin briefly, then yield so long disk waits don't burn a core */ setenv("OMP_PROC_BIND","close",0); /* pack the team onto adjacent cores for cache locality */ @@ -3704,7 +3709,8 @@ int main(int argc, char **argv){ } g_mlock = getenv("MLOCK")?atoi(getenv("MLOCK")):-1; /* -1 auto (ON macOS), 0 off, 1 force / auto (ON macOS), 0 off, 1 force */ g_spec = getenv("SPEC")?atoi(getenv("SPEC")):1; - g_draft = getenv("DRAFT")?atoi(getenv("DRAFT")):-1; /* -1 = auto: 3 se MTP, 0 senza */ + g_draft = getenv("DRAFT")?atoi(getenv("DRAFT")):-1; + g_no_fused_pair = getenv("COLI_NO_FUSED_PAIR")?atoi(getenv("COLI_NO_FUSED_PAIR")):0; /* -1 = auto: 3 se MTP, 0 senza */ g_looka = getenv("LOOKA")?atoi(getenv("LOOKA")):0; /* 1 = misura predicibilita' routing */ g_pilot = getenv("PILOT")?atoi(getenv("PILOT")):0; /* 1 = prefetch pilotato dal router */ g_pilot_real = getenv("PILOT_REAL")?atoi(getenv("PILOT_REAL")):0; /* default OFF: load VERI cross-layer (value-preserving prefetch); PILOT_REAL=1 opta in */