Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦
C
build: cover every engine, and derive the engine list from the Makefile
Léon Avic Simmonsa40384de19b1
diff --git a/c/Makefile b/c/Makefileindex 9bac94c1..91da0af3 100644--- a/c/Makefile+++ b/c/Makefile@@ -1025,7 +1025,7 @@ qwen36$(EXE): qwen36.c cli_args.h qwen36_tier.h st.h json.h compat.h edge_adapte# Qwen3.8-Flash-Next text-only sibling. This target is intentionally CPU-only;# qwen38.c owns the direct checkpoint loader and SERVE=1 protocol, with no# CUDA/Metal tier advertised by the control plane.-qwen38$(EXE): qwen38.c cli_args.h qwen38_core.h qwen38_nfc.h qwen38_nfc_tables.h st.h json.h compat.h quant.h route_trace.h tok.h tok_unicode.h tok_unicode_o200k.h serve_codec.h+qwen38$(EXE): qwen38.c cli_args.h qwen38_core.h qwen38_nfc.h qwen38_nfc_tables.h st.h json.h compat.h quant.h route_trace.h tok.h tok_unicode.h tok_unicode_o200k.h serve_codec.h edge_adapter_internal.h edge_adapters.h edge_runtime.h qwen38_vision.h segment_adapter_internal.h segment_adapters.h segment_runtime.h$(CC) $(NOCUDA_CFLAGS) qwen38.c -o qwen38$(EXE) $(NOCUDA_LDFLAGS).PHONY: qwen38-tiny-generate qwen38-tiny-check@@ -1089,7 +1089,7 @@ NOCUDA_LDFLAGS = $(filter-out -lcudart -lstdc++ -lcuda -L$(CUDA_HOME)/lib64 \# GLM-5.3-Flash: CPU puro, esperti in streaming dal contenitore int4 gs64.# Nessun oggetto CUDA/Vulkan/Metal fra le dipendenze perche' il motore non ne# ha ancora: quando li avra', questa riga somigliera' a quella di kimi_k3.-glm53$(EXE): glm53.c cli_args.h st.h json.h tok.h tok_unicode.h tok_unicode_o200k.h compat.h quant.h hyper_connections.h delta_attention.h sparse_index.h vision_tower.h $(VK_OBJ) $(VK_SPV)+glm53$(EXE): glm53.c cli_args.h st.h json.h tok.h tok_unicode.h tok_unicode_o200k.h compat.h quant.h hyper_connections.h delta_attention.h sparse_index.h vision_tower.h backend_vulkan.h edge_adapter_internal.h edge_adapters.h edge_runtime.h segment_adapter_internal.h segment_adapters.h segment_runtime.h $(VK_OBJ) $(VK_SPV)$(CC) $(CFLAGS) glm53.c $(VK_OBJ) -o glm53$(EXE) $(LDFLAGS)kimi_k3$(EXE): kimi_k3.c cli_args.h st.h json.h tok.h tok_unicode.h tok_unicode_o200k.h compat.h quant.h omp_tune.h route_trace.h kv_prefix.h serve_codec.h backend_cuda.h backend_metal.h backend_vulkan.h edge_adapters.h edge_runtime.h edge_tok_internal.h hybrid_split.h segment_adapter_internal.h segment_adapters.h segment_runtime.h $(CUDA_OBJ) $(VK_OBJ) $(VK_SPV) $(METAL_OBJ)diff --git a/c/tests/test_makefile_deps.py b/c/tests/test_makefile_deps.pyindex e269e397..be1c48e5 100644--- a/c/tests/test_makefile_deps.py+++ b/c/tests/test_makefile_deps.py@@ -6,64 +6,95 @@ that is absent from its rule's prerequisite list produces the worst kind ofbuild result: `make` reports success, changes nothing, and leaves a STALEbinary that looks freshly built.-Reproduce on a tree without the accompanying fix:+Reproduce on a tree without the accompanying fix, without a compiler:- make colibri # builds- touch edge_runtime.h && make colibri- -> "make: 'colibri' is up to date." # colibri.c includes it+ touch colibri && sleep 1 && touch edge_runtime.h+ make -q colibri; echo $?+ -> 0 # "up to date", though colibri.c includes edge_runtime.h-whereas touching a header the rule DOES list (st.h) relinks as expected.+whereas touching a header the rule DOES list (st.h) exits 1, meaning make+would relink. This test is the enforcement a comment cannot provide: nothing+else compares the two lists, and the drift is invisible from inside a green+build.-This test is the enforcement a comment cannot provide: nothing else compares-the two lists, and the drift is invisible from inside a green build.+The engine list is DERIVED from the Makefile, never kept here. A hand-written+list can only catch a rule that was renamed or removed; it cannot catch a rule+that was never added, which is the case that actually happened -- glm53 and+qwen38 sat with incomplete prerequisites while a hand-listed version of this+test passed green. Anything matching `NAME$(EXE):` with a `NAME.c` beside it+is a target built from one translation unit, so its prerequisites are+checkable, and the next engine added is covered without anyone remembering."""import reimport unittestfrom pathlib import Path+from family_registry import FAMILIES+C_DIR = Path(__file__).resolve().parent.parent-# Engine binaries whose rule compiles a single .c directly into the target.-ENGINE_RULES = {- "colibri$(EXE)": "colibri.c",- "inkling$(EXE)": "inkling.c",- "kimi_k3$(EXE)": "kimi_k3.c",- "qwen36$(EXE)": "qwen36.c",- "olmoe$(EXE)": "olmoe.c",-}+# `NAME$(EXE): prereqs`. Targets with a path separator (tests/foo$(EXE)) are+# deliberately excluded: this checks the engines built at the top of c/.+RULE_RE = re.compile(r"(?m)^([A-Za-z0-9_]+)\$\(EXE\):[ \t]*(.*)$")+INCLUDE_RE = re.compile(r'^[ \t]*#[ \t]*include[ \t]*"([^"]+)"', re.M)++# deepseek_v4 is built by Makefile.deepseek-v4 through a phony delegating+# target, so it has no `NAME$(EXE):` rule here and no prerequisite list of its+# own to check. test_family_registry pins that separately.+SEPARATE_MAKEFILE = {"deepseek-v4"}-RULE_RE = re.compile(r"^([A-Za-z0-9_./$()]+)\s*:\s+(.*)$")-INCLUDE_RE = re.compile(r'^#include "([^"]+)"', re.M)+def _engine_rules():+ """Every target built from a single same-named .c, taken from the Makefile.-def _prereqs_by_target():- out = {}- for line in (C_DIR / "Makefile").read_text().split("\n"):- m = RULE_RE.match(line)- if m and m.group(1) in ENGINE_RULES:- out[m.group(1)] = set(m.group(2).split())- return out+ Line continuations are folded first: a rule wrapped across lines would+ otherwise present a truncated prerequisite list and report headers as+ missing that are listed on the next line.+ """+ text = (C_DIR / "Makefile").read_text(encoding="utf-8")+ joined = re.sub(r"\\\n[ \t]*", " ", text)+ rules = {}+ for name, prereqs in RULE_RE.findall(joined):+ source = C_DIR / f"{name}.c"+ if source.exists():+ rules[name] = (source, set(prereqs.split("#", 1)[0].split()))+ return rulesclass MakefileHeaderDepsTest(unittest.TestCase):+ def test_the_engine_list_is_derived_and_not_empty(self):+ """A parse that matches nothing would make every other check vacuous.++ The rule syntax is the input to this whole file. If it ever changes,+ the header check below starts passing for zero targets and says+ nothing, which reads exactly like a clean tree. The registry is the+ authority on what must be buildable, so cross-check against it rather+ than against a second list kept here.+ """+ rules = _engine_rules()+ self.assertTrue(rules, "no `NAME$(EXE):` rule with a matching NAME.c was "+ "found -- the Makefile rule syntax changed and "+ "this file now checks nothing")+ for family in FAMILIES:+ if family.build_target in SEPARATE_MAKEFILE:+ continue+ with self.subTest(family=family.id):+ self.assertIn(+ family.build_target, rules,+ f"{family.id}: registered family whose build target is not "+ f"a checkable `{family.build_target}$(EXE):` rule")+def test_every_engine_rule_lists_the_headers_its_source_includes(self):- prereqs = _prereqs_by_target()- self.assertEqual(- set(prereqs), set(ENGINE_RULES),- "an engine rule was renamed or removed -- update ENGINE_RULES",- )problems = []- for target, source in sorted(ENGINE_RULES.items()):- src = C_DIR / source- if not src.exists():- continue- included = set(INCLUDE_RE.findall(src.read_text()))+ for target, (source, prereqs) in sorted(_engine_rules().items()):+ included = set(INCLUDE_RE.findall(source.read_text(encoding="utf-8")))# Only headers that exist in c/ are ours to track; system headers# and anything generated elsewhere are not prerequisites.local = {h for h in included if (C_DIR / h).exists()}- missing = sorted(local - prereqs[target])+ missing = sorted(local - prereqs)if missing:- problems.append(f"{target} ({source}) is missing: {' '.join(missing)}")+ problems.append(f"{target} ({source.name}) is missing: "+ f"{' '.join(missing)}")self.assertEqual(problems, [],"Headers included by an engine but absent from its Makefile "