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

fix(cli): exclude unqualified GPUs from auto-enable

Kenneth-Javier Ortigoza9ffa28bcf470
diff --git a/c/coli b/c/coli
index 1e0127d6..41474729 100755
--- a/c/coli
+++ b/c/coli
@@ -565,8 +565,15 @@ def env_for(a):
if (sys.platform == "win32" and a.gpu is None and not a.vram
and e.get("COLI_CUDA") != "0"):
if cuda_binary():
- from resource_plan import discover_gpus, build_plan, environment_for_plan, format_bytes
- gpus = discover_gpus()
+ from resource_plan import (discover_gpus, plans_placement, build_plan,
+ environment_for_plan, format_bytes)
+ # Auto-enable is an automatic placement decision, so it may only
+ # be made from devices whose free memory is a qualified budget.
+ # A discovered-but-unqualified device (free_bytes None: a Windows
+ # AMD part found through hipInfo) reaches the engine env here
+ # WITHOUT passing through environment_for_plan, so the planner's
+ # own gate cannot cover this path -- filter at the source.
+ gpus = [g for g in discover_gpus() if plans_placement(g)]
if gpus:
e["COLI_CUDA"]="1"
e.setdefault("COLI_GPUS", ",".join(str(g["index"]) for g in gpus))
diff --git a/c/tests/test_env_defaults.py b/c/tests/test_env_defaults.py
index 3bb08fc8..c1c93205 100644
--- a/c/tests/test_env_defaults.py
+++ b/c/tests/test_env_defaults.py
@@ -132,6 +132,20 @@ class CudaAutoEnableTest(unittest.TestCase):
self.assertNotIn("COLI_GPUS", e)
self.assertNotIn("CUDA_EXPERT_GB", e)
+ def test_win32_does_not_auto_enable_an_unqualified_gpu(self):
+ # A device whose free memory is not qualified as a placement budget
+ # (free_bytes is None -- a Windows AMD part found through hipInfo) is
+ # discovered and worth reporting, but auto-enable is an automatic
+ # placement decision and must not be made from it. Bare `coli chat`
+ # stays on the CPU path, exactly as if nothing had been found.
+ identity_only = {"index": 0, "name": "AMD Radeon(TM) 8060S Graphics",
+ "arch": "gfx1151", "total_bytes": 78 * 1024 ** 3,
+ "free_bytes": None, "unified_memory": True}
+ e = self._env_for("win32", cuda=True, gpus=[identity_only])
+ self.assertNotIn("COLI_CUDA", e)
+ self.assertNotIn("COLI_GPUS", e)
+ self.assertNotIn("CUDA_EXPERT_GB", e)
+
def test_win32_cpu_build_stays_silent(self):
# No coli_cuda.dll (cuda=False) -> CPU build, nothing GPU-related emitted.
e = self._env_for("win32", cuda=False, gpus=[self._fake_gpu()])