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

build: expose segment edge runtime archive

JustVuggf1986b25df2f
diff --git a/c/Makefile b/c/Makefile
index 71b7187a..290b75dc 100644
--- a/c/Makefile
+++ b/c/Makefile
@@ -1293,7 +1293,7 @@ include Makefile.deepseek-v4.units
# is advertised only after an adapter has a real backend implementation.
SEGMENT_BUILD_DIR = build/segment
SEGMENT_CPU_CFLAGS = $(filter-out -DCOLI_CUDA -DCOLI_ANS -DCOLI_METAL \
- -DCOLI_VULKAN,$(CFLAGS)) -D_GNU_SOURCE -include pthread.h \
+ -DCOLI_VULKAN,$(CFLAGS)) -include pthread.h \
-DCOLI_SEGMENT_ADAPTER -DCOLI_EDGE_ADAPTER
SEGMENT_ENGINE_OBJS = \
$(SEGMENT_BUILD_DIR)/glm.o \
@@ -1307,6 +1307,10 @@ SEGMENT_V4_OBJS = $(addprefix $(SEGMENT_BUILD_DIR)/,$(addsuffix .o,$(SEGMENT_V4_
SEGMENT_V4_REGISTRY_OBJ = $(SEGMENT_BUILD_DIR)/expert_store_registry.o
SEGMENT_ALL_OBJS = $(SEGMENT_ENGINE_OBJS) $(SEGMENT_V4_OBJS) \
$(SEGMENT_V4_REGISTRY_OBJ)
+SEGMENT_RUNTIME_OBJS = \
+ $(SEGMENT_BUILD_DIR)/segment_runtime.o \
+ $(SEGMENT_BUILD_DIR)/edge_runtime.o
+SEGMENT_RUNTIME_LIB = $(SEGMENT_BUILD_DIR)/libcolibri_segment_edge.a
$(SEGMENT_BUILD_DIR):
mkdir -p $@
@@ -1346,6 +1350,18 @@ $(SEGMENT_V4_REGISTRY_OBJ): expert_store_registry.c expert_store_registry.h \
expert_store.h | $(SEGMENT_BUILD_DIR)
$(CC) $(SEGMENT_CPU_CFLAGS) -c expert_store_registry.c -o $@
+$(SEGMENT_BUILD_DIR)/segment_runtime.o: segment_runtime.c segment_runtime.h | $(SEGMENT_BUILD_DIR)
+ $(CC) $(SEGMENT_CPU_CFLAGS) -c segment_runtime.c -o $@
+
+$(SEGMENT_BUILD_DIR)/edge_runtime.o: edge_runtime.c edge_runtime.h | $(SEGMENT_BUILD_DIR)
+ $(CC) $(SEGMENT_CPU_CFLAGS) -c edge_runtime.c -o $@
+
+$(SEGMENT_RUNTIME_LIB): $(SEGMENT_RUNTIME_OBJS) $(SEGMENT_ALL_OBJS)
+ $(AR) rcs $@ $^
+
+.PHONY: segment-edge-library
+segment-edge-library: $(SEGMENT_RUNTIME_LIB)
+
tests/test_segment_adapters_registration$(EXE): \
tests/test_segment_adapters_registration.c segment_runtime.c \
edge_runtime.c segment_runtime.h edge_runtime.h segment_adapters.h \
diff --git a/docs/edge-runtime.md b/docs/edge-runtime.md
index c2c0e211..d809503a 100644
--- a/docs/edge-runtime.md
+++ b/docs/edge-runtime.md
@@ -16,6 +16,13 @@ a real model without loading every transformer layer locally.
The ABI is additive. Ordinary Colibri CLIs do not link or register Edge
adapters and keep their existing initialization and inference paths.
+External consumers can build the complete CPU-baseline runtime with
+`make -C c segment-edge-library`. The resulting
+`c/build/segment/libcolibri_segment_edge.a` contains both public runtimes and
+all six built-in adapters. Consumers link it after their own objects and call
+the explicit registration functions below; ordinary Colibri executables do
+not link this archive.
+
## Lifecycle and compatibility
1. Explicitly register the required adapters during process initialization.