Files
UnbiasedStrata/Makefile
T
Robert KarlandClaude Fable 5.1 46c46ecfc1 Front end: image input through the model's vision encoder; engine child supervision; tests
Images: --mmproj PATH loads the Qwen3.8 Flash-Next projector through llama.cpp's mtmd
library and encodes image_url parts on the CPU (frontend/vision.hpp). The embeddings go to
the engine as a GENI request, its existing vision path, with the prompt's <|image_pad|>
runs standing in for each image. --vision-tokens caps the tokens per image. GET /v1/models
lists "image" under input_modalities when the encoder is loaded. Checked on an RTX 4090:
screenshots, photos, several images in one message, and pi's file attachments and
clipboard paste.

Engine process: the engine is started and watched from frontend/engine.hpp; when it exits
or its stall watchdog fires, the front end exits too, for a supervisor to restart. Stall
reports add the current stage and thread wait channels. Reasoning streams; content and
tool calls are sent once the whole message is parsed, so partial JSON never changes
arguments already sent.

Tests: make test-frontend (child exit, protocol, backpressure; no model needed) and
make test-chat-parser MODEL=<gguf> (template and tool-call parsing against the real GGUF).

The image path and the supervision were written by a Codex session; this commit finishes,
documents and checks them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-08 15:54:53 -07:00

48 lines
2.8 KiB
Makefile

# UnbiasedStrata build. Needs CMake 3.24+, a C++20 compiler and the CUDA toolkit. Nothing is downloaded.
BUILD_DIR ?= build
# RTX 30 (86), RTX 40 (89) and RTX 50 (120) in one binary. sm_120 needs CUDA 12.8+, and upstream recommends 13.0+.
CUDA_ARCHS ?= 86;89;120
# capped: inside a container nproc reports the host's CPUs, not the container's quota
JOBS ?= $(shell n=$$(nproc 2>/dev/null || echo 4); [ $$n -gt 16 ] && n=16; echo $$n)
.PHONY: build clean
build:
@test -f third_party/llama.cpp/ggml/CMakeLists.txt || \
{ echo "third_party/llama.cpp is empty: run 'git submodule update --init' first"; exit 1; }
@git -C third_party/llama.cpp apply --check --reverse ../../patches/llama.cpp-qwen3-coder-any-argument-order.patch 2>/dev/null || \
git -C third_party/llama.cpp apply ../../patches/llama.cpp-qwen3-coder-any-argument-order.patch
cmake -S . -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_CUDA=ON -DSTRATA_NATIVE_EXPERTS=ON \
-DSTRATA_PORTABLE=ON -DSTRATA_BUILD_TESTS=OFF "-DCMAKE_CUDA_ARCHITECTURES=$(CUDA_ARCHS)"
cmake --build $(BUILD_DIR) -j $(JOBS) --target unbiased-strata
@echo "built: $(BUILD_DIR)/unbiased-strata"
clean:
rm -rf $(BUILD_DIR)
# Protocol and child supervision regressions; no CUDA/model required.
.PHONY: test-frontend
test-frontend:
mkdir -p $(BUILD_DIR)/frontend-tests
$(CXX) -std=c++20 -Wall -Wextra -Werror frontend/child_watch_test.cpp -o $(BUILD_DIR)/frontend-tests/child-watch-test
$(BUILD_DIR)/frontend-tests/child-watch-test
$(CXX) -std=c++20 -Wall -Wextra -Werror frontend/engine_test.cpp -o $(BUILD_DIR)/frontend-tests/engine-test
$(BUILD_DIR)/frontend-tests/engine-test
$(CXX) -std=c++20 -Wall -Wextra -Werror -pthread frontend/engine_backpressure_test.cpp -o $(BUILD_DIR)/frontend-tests/engine-backpressure-test
$(BUILD_DIR)/frontend-tests/engine-backpressure-test
# Model-template compatibility; CPU only, after the regular build produced llama libraries.
.PHONY: test-chat-parser
test-chat-parser:
@test -n "$(MODEL)" || { echo 'set MODEL to the first GGUF shard'; exit 2; }
mkdir -p $(BUILD_DIR)/frontend-tests
$(CXX) -std=c++20 -O0 -Ifrontend -Ithird_party/llama.cpp/include -Ithird_party/llama.cpp/common \
-Ithird_party/llama.cpp/ggml/include -Ithird_party/llama.cpp/vendor -Ithird_party/llama.cpp/tools/mtmd \
frontend/chat_parser_test.cpp \
-o $(BUILD_DIR)/frontend-tests/chat-parser-test $(BUILD_DIR)/llama.cpp/tools/mtmd/libmtmd.a \
$(BUILD_DIR)/llama.cpp/vendor/hash/libvendor-hash.a $(BUILD_DIR)/llama.cpp/common/libllama-common.a \
$(BUILD_DIR)/llama.cpp/src/libllama.a $(BUILD_DIR)/llama.cpp/vendor/cpp-httplib/libcpp-httplib.a \
$(BUILD_DIR)/ggml/src/libggml.a $(BUILD_DIR)/ggml/src/libggml-cpu.a $(BUILD_DIR)/ggml/src/libggml-base.a \
$(BUILD_DIR)/llama.cpp/common/libllama-common-base.a -lpthread -ldl -lm
$(BUILD_DIR)/frontend-tests/chat-parser-test "$(MODEL)"