Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦
C
build: list the headers each engine includes as Makefile prerequisites
Léon Avic Simmons0de98d71942b
diff --git a/c/Makefile b/c/Makefileindex 141b4260..9bac94c1 100644--- a/c/Makefile+++ b/c/Makefile@@ -716,7 +716,7 @@ $(file >.build-config,$(BUILD_CONFIG))endif.build-config: ;-colibri$(EXE): colibri.c cli_args.h st.h uring.h json.h tok.h tok_unicode.h compat.h grammar.h quant.h sample.h kv_persist.h telemetry.h route_trace.h omp_tune.h kv_fp8.h kv_tq.h $(CUDA_OBJ) $(METAL_OBJ) $(VK_OBJ) $(VK_SPV) .build-config+colibri$(EXE): colibri.c cli_args.h st.h uring.h json.h tok.h tok_unicode.h compat.h grammar.h quant.h sample.h kv_persist.h telemetry.h route_trace.h omp_tune.h kv_fp8.h kv_tq.h abl.h backend_cuda.h backend_metal.h backend_vulkan.h decode_batch.h edge_adapters.h edge_runtime.h edge_tok_internal.h schema_gbnf.h segment_adapter_internal.h segment_adapters.h segment_runtime.h tier.h $(CUDA_OBJ) $(METAL_OBJ) $(VK_OBJ) $(VK_SPV) .build-config$(CC) $(CFLAGS) colibri.c $(CUDA_OBJ) $(METAL_OBJ) $(VK_OBJ) -o colibri$(EXE) $(LDFLAGS)# Vulkan backend object (plain C + vulkan headers) and its SPIR-V shaders.@@ -997,7 +997,7 @@ fp8-bench: fp8_bench$(EXE)# 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 cli_args.h st.h json.h compat.h sample.h tok.h tok_unicode.h tok_unicode_o200k.h omp_tune.h route_trace.h serve_codec.h+olmoe$(EXE): olmoe.c cli_args.h st.h json.h compat.h sample.h tok.h tok_unicode.h tok_unicode_o200k.h omp_tune.h route_trace.h serve_codec.h edge_adapters.h edge_runtime.h edge_tok_internal.h fused_simd.h segment_adapter_internal.h segment_adapters.h segment_runtime.h$(CC) $(NOCUDA_CFLAGS) olmoe.c -o olmoe$(EXE) $(NOCUDA_LDFLAGS)# Qwen3.6-35B-A3B engine (hybrid Gated Attention + Gated DeltaNet + streaming@@ -1019,7 +1019,7 @@ QWEN36_TIER_SRC =QWEN36_CFLAGS = $(NOCUDA_CFLAGS)QWEN36_LDFLAGS = $(NOCUDA_LDFLAGS)endif-qwen36$(EXE): qwen36.c cli_args.h qwen36_tier.h st.h json.h compat.h $(QWEN36_TIER_SRC) $(CUDA_OBJ)+qwen36$(EXE): qwen36.c cli_args.h qwen36_tier.h st.h json.h compat.h edge_adapter_internal.h edge_adapters.h edge_runtime.h segment_adapter_internal.h segment_adapters.h segment_runtime.h $(QWEN36_TIER_SRC) $(CUDA_OBJ)$(CC) $(QWEN36_CFLAGS) qwen36.c $(QWEN36_TIER_SRC) $(CUDA_OBJ) -o qwen36$(EXE) $(QWEN36_LDFLAGS)# Qwen3.8-Flash-Next text-only sibling. This target is intentionally CPU-only;@@ -1071,7 +1071,7 @@ tests/test_qwen36_json_escape$(EXE): tests/test_qwen36_json_escape.c qwen36.c qwtests/bench_qwen36_dense_batch$(EXE): tests/bench_qwen36_dense_batch.c qwen36.c qwen36_tier.h st.h json.h compat.h $(QWEN36_TIER_SRC) $(CUDA_OBJ)$(CC) $(QWEN36_CFLAGS) $< $(QWEN36_TIER_SRC) $(CUDA_OBJ) -o $@ $(QWEN36_LDFLAGS)-inkling$(EXE): inkling.c cli_args.h st.h json.h tok.h tok_unicode.h tok_unicode_o200k.h compat.h omp_tune.h route_trace.h kv_prefix.h serve_codec.h $(INK_CUDA_OBJ) $(METAL_OBJ)+inkling$(EXE): inkling.c cli_args.h st.h json.h tok.h tok_unicode.h tok_unicode_o200k.h compat.h omp_tune.h route_trace.h kv_prefix.h serve_codec.h backend_cuda_ink.h backend_metal.h edge_adapters.h edge_runtime.h edge_tok_internal.h segment_adapter_internal.h segment_adapters.h segment_runtime.h $(INK_CUDA_OBJ) $(METAL_OBJ)$(CC) $(CFLAGS) inkling.c $(INK_CUDA_OBJ) $(METAL_OBJ) -o inkling$(EXE) $(LDFLAGS)# ENGINES WITHOUT A CUDA BACKEND (#783).@@ -1092,7 +1092,7 @@ NOCUDA_LDFLAGS = $(filter-out -lcudart -lstdc++ -lcuda -L$(CUDA_HOME)/lib64 \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)$(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 $(CUDA_OBJ) $(VK_OBJ) $(VK_SPV) $(METAL_OBJ)+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)$(CC) $(CFLAGS) kimi_k3.c $(CUDA_OBJ) $(VK_OBJ) $(METAL_OBJ) -o kimi_k3$(EXE) $(LDFLAGS)# Use a baseline that matches the compiler target. macOS already targets adiff --git a/c/tests/test_makefile_deps.py b/c/tests/test_makefile_deps.pynew file mode 100644index 00000000..e269e397--- /dev/null+++ b/c/tests/test_makefile_deps.py@@ -0,0 +1,77 @@+"""Makefile header prerequisites must cover what each engine actually includes.++`make` tracks file timestamps, not #include graphs, and this Makefile has no+-MMD/-include dependency generation. So a header that an engine includes but+that is absent from its rule's prerequisite list produces the worst kind of+build result: `make` reports success, changes nothing, and leaves a STALE+binary that looks freshly built.++Reproduce on a tree without the accompanying fix:++ make colibri # builds+ touch edge_runtime.h && make colibri+ -> "make: 'colibri' is up to date." # colibri.c includes it++whereas touching a header the rule DOES list (st.h) relinks as expected.++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.+"""+import re+import unittest+from pathlib import Path++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",+}++RULE_RE = re.compile(r"^([A-Za-z0-9_./$()]+)\s*:\s+(.*)$")+INCLUDE_RE = re.compile(r'^#include "([^"]+)"', re.M)+++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+++class MakefileHeaderDepsTest(unittest.TestCase):+ 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()))+ # 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])+ if missing:+ problems.append(f"{target} ({source}) is missing: {' '.join(missing)}")+ self.assertEqual(+ problems, [],+ "Headers included by an engine but absent from its Makefile "+ "prerequisites. Editing one of these alone will NOT relink the "+ "binary -- make will report success and leave a stale artifact "+ ":\n " + "\n ".join(problems),+ )+++if __name__ == "__main__":+ unittest.main()