Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦
C
build(windows): include XDNA capability in release host
Kenneth-Javier Ortigoza1038ad664a82
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 5b39d2fe..04e733ec 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -28,7 +28,14 @@ jobs:- os: windows-latestname: windows-x86_64ext: ".exe"- make_args: ""+ # XDNA=1 compiles the optional AMD Ryzen AI NPU lane into the+ # ordinary Windows host. It stays OFF unless the user passes+ # `coli --xdna`, adds no XRT or helper import (the helper is+ # resolved with LoadLibraryExA at runtime, and only on request),+ # and needs nothing installed on the runner. The artifacts and+ # coli_xdna.dll it would use are NOT built here -- they need XRT+ # and the AIE toolchain -- and ship as a separate optional asset.+ make_args: "XDNA=1"v4: "1"# GitHub shells are format strings: 'msys2 {0}', never bare 'msys2'# (the v1.0.0 tag build failed on exactly this). Same as ci.yml.diff --git a/c/Makefile b/c/Makefileindex f14f4feb..ca665a53 100644--- a/c/Makefile+++ b/c/Makefile@@ -605,6 +605,22 @@ VK_OBJ = backend_vulkan.oVK_SPV = shaders/qmatmul.spv shaders/qmatmul_gate_up.spv shaders/attention_absorb.spv shaders/rmsnorm.spvendif+# Optional AMD XDNA2 (Ryzen AI NPU) lane, Windows. Same opt-in shape as VK=1:+# a switch, a define, an object. Deliberately NOT a second executable -- the+# capability compiles into the ordinary host and stays off until the user passes+# `coli --xdna`.+#+# No LDFLAGS entry, unlike VK: this side never links XRT. backend_xdna.c resolves+# the optional helper (coli_xdna.dll) through LoadLibraryExA at runtime, so an+# XDNA=1 host has the same import table as a default one and starts normally on a+# machine with no NPU, no XRT and no helper. See docs/xdna.md.+XDNA ?= 0+XDNA_OBJ =+ifeq ($(XDNA),1)+CFLAGS += -DCOLI_XDNA+XDNA_OBJ = backend_xdna.o+endif+all: colibri$(EXE)# Tiny Kimi K3 fixture + vendor oracle. The generator is numpy-only and@@ -686,7 +702,7 @@ glm: colibri$(EXE)# rewrite it ONLY when they change (evaluated here at parse time, so the file's# timestamp moves exactly when the config moves). The binary and CUDA/loader objects depend# on it, so they relink on a config change and stay put otherwise. (#306)-BUILD_CONFIG := $(CC)|$(CFLAGS)|$(LDFLAGS)|CUDA=$(CUDA)|CUDA_DLL=$(CUDA_DLL)|ARCH=$(ARCH)|CUDA_ARCH=$(CUDA_ARCH)|METAL=$(METAL)|HIP=$(HIP)|HIP_DLL=$(HIP_DLL)|HIP_ARCH=$(HIP_ARCH)|VK=$(VK)+BUILD_CONFIG := $(CC)|$(CFLAGS)|$(LDFLAGS)|CUDA=$(CUDA)|CUDA_DLL=$(CUDA_DLL)|ARCH=$(ARCH)|CUDA_ARCH=$(CUDA_ARCH)|METAL=$(METAL)|HIP=$(HIP)|HIP_DLL=$(HIP_DLL)|HIP_ARCH=$(HIP_ARCH)|VK=$(VK)|XDNA=$(XDNA)BUILD_CONFIG_OLD := $(shell cat .build-config 2>/dev/null)ifneq "$(BUILD_CONFIG)" "$(BUILD_CONFIG_OLD)"# $(file ...) writes via make's own primitive (GNU Make >= 4.0, 2013), NOT by@@ -699,8 +715,9 @@ $(file >.build-config,$(BUILD_CONFIG))endif.build-config: ;-colibri$(EXE): colibri.c 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- $(CC) $(CFLAGS) colibri.c $(CUDA_OBJ) $(METAL_OBJ) $(VK_OBJ) -o colibri$(EXE) $(LDFLAGS)+colibri$(EXE): colibri.c 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) $(XDNA_OBJ) .build-config+ $(CC) $(CFLAGS) colibri.c $(CUDA_OBJ) $(METAL_OBJ) $(VK_OBJ) $(XDNA_OBJ) -o colibri$(EXE) $(LDFLAGS)+# Vulkan backend object (plain C + vulkan headers) and its SPIR-V shaders.backend_vulkan.o: backend_vulkan.c backend_vulkan.h .build-config@@ -716,10 +733,12 @@ backend_loader.o: backend_loader.c backend_cuda.h compat.h .build-config# Optional XDNA2 (Ryzen AI NPU) lane, host side only. This object resolves an# optional coli_xdna.dll at runtime and links nothing: it needs no XRT header,# no XRT import library and no NPU, exactly like backend_loader.o needs no CUDA-# SDK. colibri$(EXE) does NOT link it yet -- there is no caller until the-# operation seam lands -- so the default build stays byte-for-byte what it was.-# The rule exists so an ordinary `make xdna-obj` (and the loader tests, which-# compile the same source in place) catch a break in the C side early.+# SDK.+#+# W2-N8: colibri$(EXE) NOW links it, but only under XDNA=1 (see the switch+# beside VK above). The default build still does not, and stays byte-for-byte+# what it was. `make xdna-obj` remains useful on its own so a break in the C+# side is caught without building a whole host..PHONY: xdna-objxdna-obj: backend_xdna.obackend_xdna.o: backend_xdna.c backend_xdna.h .build-configdiff --git a/docs/xdna.md b/docs/xdna.mdindex b06081d3..0aba9bed 100644--- a/docs/xdna.md+++ b/docs/xdna.md@@ -68,8 +68,30 @@ Both locations are resolved **relative to the executable**, by absolute path.that one place. Every artifact is checked against a hash built into the binarybefore it is used.-Requirements: Windows, an XDNA2-class NPU, and AMD's XRT runtime installed for-the helper to load.+## What the optional package needs installed++The sidecar is small because it ships only the helper and the kernels. Two+things have to already be on the machine for `coli_xdna.dll` to load:++- **AMD XRT runtime** (`xrt_coreutil.dll`), from AMD's Ryzen AI / XRT install.+- **Microsoft Visual C++ Redistributable** (x64). The helper is built with MSVC+ — that is how it reaches XRT's C++ interface — so it imports `MSVCP140.dll`,+ `VCRUNTIME140.dll` and `VCRUNTIME140_1.dll`.++Neither is bundled. If either is missing the helper simply will not load, and+`--xdna` reports it and continues on the normal path:++```+[XDNA] requested, and the artifact package is valid, but the XDNA helper+ (coli_xdna.dll) is not usable beside the executable: continuing on the+ normal path+```++**The ordinary colibrì host needs neither of these.** It imports only Windows+system libraries, with or without the NPU capability compiled in — the external+dependencies belong to the optional package alone.++Also required: Windows and an XDNA2-class NPU.## When something is missing