coli: measured Windows launcher defaults — OMP tuning parity + DIRECT/PIPE/PILOT_REAL
On Windows the engine self-exec OMP tuning never runs (Linux/FreeBSD-only)
and posix_fadvise readahead is a compat.h no-op, so a stock Windows run
leaves large measured wins on the table. The launcher now setdefaults, on
win32 only, each independently overridable by setting the variable:
- OMP_WAIT_POLICY=active, GOMP_SPINCOUNT=200000, OMP_DYNAMIC=FALSE,
OMP_NUM_THREADS=<physical cores> (parity with the glm.c self-exec block;
COLI_NO_OMP_TUNE disables exactly this block, presence-based like the
engine). OMP_PROC_BIND/OMP_PLACES deliberately omitted and also removed
from environment_for_plan on win32: MinGW libgomp has no affinity support
("Affinity not supported on this configuration").
- DIRECT=1: unbuffered expert reads. Measured on a 9950X3D + Samsung 9100
PRO Gen5 + Win11: iobench 10.68 GB/s O_DIRECT vs 9.03 buffered (warm);
end-to-end REPLAY 0.48 -> 1.02 tok/s. Matches #162 (1.47x same class).
- PIPE=1: load/matmul overlap, byte-identical output; +8% on top of DIRECT
(PIPE_WORKERS untouched at 8 - 4/8/16 swept flat on Gen5).
- PILOT_REAL=1: real cross-layer prefetch, the only working prefetch on
Windows; +11% and expert hit rate +19 points.
Full ladder methodology and numbers: 96-token greedy REPLAY, one lever per
step, medians of 3-4 runs (see the fork tuning doc referenced in the PR).
tests/test_env_defaults.py covers the defaults, explicit-override-wins,
the kill-switch scope, and the non-win32 no-op.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -161,6 +161,34 @@ def resource_request(a, env):
|
||||
|
||||
def env_for(a):
|
||||
e = dict(os.environ, SNAP=a.model)
|
||||
if sys.platform == "win32":
|
||||
# COLI_NO_OMP_TUNE spegne SOLO il blocco OMP (stesso perimetro del
|
||||
# self-exec di glm.c; presence-based come nel motore: impostarla a
|
||||
# qualsiasi valore, anche 0, disattiva). I default I/O piu' sotto
|
||||
# restano attivi: kill-switch dedicati = le var stesse (DIRECT=0 ecc.)
|
||||
if not e.get("COLI_NO_OMP_TUNE"):
|
||||
# parita' col tuning OMP self-exec di glm.c (solo Linux/FreeBSD, e
|
||||
# comunque saltato sotto CUDA/Metal): libgomp legge queste variabili
|
||||
# prima di main, quindi su Windows vanno nell'ambiente del figlio.
|
||||
# niente OMP_PROC_BIND/OMP_PLACES: la libgomp di MinGW non supporta
|
||||
# l'affinity su Windows ("Affinity not supported on this configuration")
|
||||
from resource_plan import physical_cpu_count
|
||||
for k, v in (("OMP_WAIT_POLICY", "active"),
|
||||
("GOMP_SPINCOUNT", "200000"),
|
||||
("OMP_DYNAMIC", "FALSE"),
|
||||
("OMP_NUM_THREADS", str(physical_cpu_count()))):
|
||||
e.setdefault(k, v)
|
||||
# Default Windows misurati sul box di riferimento (docs/tuning-9950x3d-5090.md),
|
||||
# tutti lossless e tutti setdefault (un override esplicito vince sempre):
|
||||
# - DIRECT=1: 10.7 GB/s O_DIRECT vs 9.0 buffered (iobench, anche a cache
|
||||
# calda); nel motore 0.48 -> 1.02 tok/s. Upstream #162: 1.47x.
|
||||
# - PIPE=1: overlap load/matmul, +8% sopra DIRECT (byte-identico, riordina
|
||||
# solo l'I/O). PIPE_WORKERS resta al default 8 (sweep 4/8/16 piatto).
|
||||
# - PILOT_REAL=1: prefetch cross-layer con load veri (unico prefetch
|
||||
# funzionante su Windows: fadvise e' no-op), +11%, hit rate +19 punti.
|
||||
e.setdefault("DIRECT", "1")
|
||||
e.setdefault("PIPE", "1")
|
||||
e.setdefault("PILOT_REAL", "1")
|
||||
e["COLI_POLICY"]=a.policy
|
||||
if a.ram: e["RAM_GB"]=str(a.ram)
|
||||
if a.ngen: e["NGEN"]=str(a.ngen)
|
||||
|
||||
Reference in New Issue
Block a user