Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦
C
Move the no-CUDA-flags guard from kimi_k3 to olmoe
ZacharyZcR53b99591bf8c
diff --git a/c/Makefile b/c/Makefileindex 4a349411..19084f1d 100644--- a/c/Makefile+++ b/c/Makefile@@ -688,8 +688,14 @@ cuda-bench: backend_cuda.cu backend_cuda.h backend_gpu_compat.h tests/bench_tens"$(GPUCC)" $(GPUFLAGS) backend_cuda.cu tests/bench_tensor_core.cu -o backend_cuda_bench$(EXE) $(ANS_NVCC_LIBS)./backend_cuda_bench$(EXE)+# NOCUDA_*: olmoe.c has no COLI_CUDA code at all, so CUDA=1 would otherwise+# hand it a define matching nothing and link a runtime it never calls -- a+# build whose compile line, libraries and exit status all claim "CUDA" while+# the GPU sits idle. Same guard #783 put on kimi_k3, which since gaining an+# MXFP4 expert path no longer needs it. tests/test_makefile_cuda_scope.py+# asserts this shape.olmoe$(EXE): olmoe.c st.h json.h compat.h sample.h tok.h tok_unicode.h tok_unicode_o200k.h omp_tune.h route_trace.h- $(CC) $(CFLAGS) olmoe.c -o olmoe$(EXE) $(LDFLAGS)+ $(CC) $(NOCUDA_CFLAGS) olmoe.c -o olmoe$(EXE) $(NOCUDA_LDFLAGS)inkling$(EXE): inkling.c st.h json.h compat.h $(INK_CUDA_OBJ) $(METAL_OBJ)$(CC) $(CFLAGS) inkling.c $(INK_CUDA_OBJ) $(METAL_OBJ) -o inkling$(EXE) $(LDFLAGS)diff --git a/c/tests/test_makefile_cuda_scope.py b/c/tests/test_makefile_cuda_scope.pyindex eb08d2e1..5169db1b 100644--- a/c/tests/test_makefile_cuda_scope.py+++ b/c/tests/test_makefile_cuda_scope.py@@ -1,10 +1,15 @@"""CUDA=1 must not decorate engines that have no CUDA backend (#783).-kimi_k3.c contains no COLI_CUDA code — its GPU path is Vulkan. CUDA=1 appends--DCOLI_CUDA to the global CFLAGS and the cudart libraries to LDFLAGS, so the-kimi_k3 target used to compile a define that matches nothing and link a runtime-it never calls. The build printed no warning, so the compile line, the linked-libraries and the exit status all said "CUDA build" while the GPUs sat idle.+CUDA=1 appends -DCOLI_CUDA to the global CFLAGS and the cudart libraries to+LDFLAGS. An engine with no COLI_CUDA code then compiles a define that matches+nothing and links a runtime it never calls -- and since the build prints no+warning, the compile line, the linked libraries and the exit status all say+"CUDA build" while the GPUs sit idle.++olmoe.c is the engine in that position today (zero COLI_CUDA references).+kimi_k3 WAS, and this file guarded it; it now has an MXFP4 expert path, so the+assertions moved to olmoe and kimi_k3 is checked from the other side -- it must+receive the flag, because it now uses it.This asserts the shape of the recipe rather than running a compiler, so itworks on hosts without CUDA installed.@@ -48,28 +53,34 @@ def cuda_flag_is_accepted():@unittest.skipUnless(shutil.which("make") and cuda_flag_is_accepted(),"this toolchain rejects CUDA=1 before any recipe is emitted")class MakefileCudaScopeTest(unittest.TestCase):- def test_kimi_k3_is_not_built_with_cuda_flags(self):- out = recipe("kimi_k3", "CUDA=1")- compile_lines = [l for l in out.splitlines() if "kimi_k3.c" in l]- self.assertTrue(compile_lines, f"no kimi_k3 compile line in:\n{out}")+ def test_olmoe_is_not_built_with_cuda_flags(self):+ out = recipe("olmoe", "CUDA=1")+ compile_lines = [l for l in out.splitlines() if "olmoe.c" in l]+ self.assertTrue(compile_lines, f"no olmoe compile line in:\n{out}")for line in compile_lines:for marker in CUDA_MARKERS:self.assertNotIn(marker, line,- f"kimi_k3 has no CUDA backend but the recipe "+ f"olmoe has no CUDA backend but the recipe "f"carries {marker}:\n{line}")- def test_kimi_k3_says_why_cuda_was_dropped(self):- """Silently ignoring CUDA=1 would be its own trap: say it out loud."""+ def test_olmoe_without_cuda_is_unchanged(self):+ out = recipe("olmoe")+ for marker in CUDA_MARKERS:+ self.assertNotIn(marker, out)++ def test_kimi_k3_now_gets_cuda(self):+ """The other half of the rule: an engine that HAS the backend must get+ the flag. kimi_k3 decodes MXFP4 (fmt=7) on device under K3_CUDA=1, so+ dropping -DCOLI_CUDA here would compile that path out silently."""out = recipe("kimi_k3", "CUDA=1")- self.assertIn("no CUDA backend", out)- self.assertIn("Vulkan", out, "the message must name the path that does work")+ self.assertIn("-DCOLI_CUDA", out,+ "kimi_k3 has a CUDA expert path and must keep the define")- def test_kimi_k3_without_cuda_is_unchanged(self):+ def test_kimi_k3_without_cuda_is_clean(self):out = recipe("kimi_k3")for marker in CUDA_MARKERS:- self.assertNotIn(marker, out)- self.assertNotIn("no CUDA backend", out,- "the warning must only appear when CUDA=1 was asked for")+ self.assertNotIn(marker, out,+ "a default build must not carry CUDA flags")def test_colibri_still_gets_cuda(self):"""The guard must be scoped to the engines that lack the backend."""