Boot straight into a model. No Python, no console/GUI in production.
OS + weights image exposing an OpenAI-compatible API on :8000.
Target v1 model: Qwen/Qwen3-1.7B → GGUF Q4_K_M (~1.1 GB).
| guide | answers |
|---|---|
| docs/architecture.md | boot flow, request flow, module map, constraints |
| docs/api.md | endpoints, SSE, errors, limits |
| docs/configuration.md | every knob, precedence, validation |
| docs/formats.md | GGUF/SafeTensors/PyTorch, conversion, adding a format |
| docs/building.md | profiles, host run, QEMU test, ISO build |
| docs/development.md | test suite, conventions, where to extend |
| docs/perf.md | V vs Python benchmarks on identical hardware |
| ROADMAP.md | phased plan with exit gates |
| kernel/mini.md | vinix-mini trim spec, memory budget, boot gates |
A trimmed OS (Vinix fork: net + block + minimal scheduling only) that
boots directly into an inference loop. Outside the box it looks like
OpenAI: GET /v1/models, POST /v1/chat/completions (incl. SSE stream),
POST /v1/completions. Weights ship inside the boot image.
There is intentionally no Python runtime, no shell, and no desktop
in the image. Host-side Python exists only for one-off weight conversion
(safetensors → GGUF → quant) and is never shipped.
src/main.v # boot entry: config -> detect format -> serve API
src/cfg/ # vllm.json + VLLM_* env loader, sampler resolution, validation
src/formats/ # weight containers: registry (ContainerHandler) + SafeTensors index
src/infer/gguf.v # GGUF header + KV + tensor table (no blob load)
src/infer/cfile.v # tiny C file probe (header only, 1 GB-safe)
src/infer/model.v # Qwen3 arch config + KV override + generate path
src/infer/attention.v # KVCache arena + full/windowed attention (opt-in sinks)
src/infer/sampler.v # presets, fused softmax-scale, min-p, heap top-k, zero-alloc top-k/top-p + xorshift RNG
src/infer/pld.v # opt-in prompt-lookup drafts + greedy verification (bit-exact, phase 8)
src/infer/tokenizer.v # Tokenizer iface (BPE loader + stub) + Qwen ChatML template
src/infer/quant.v # Q4_0/Q4_1/Q4_K/Q6_K/IQ4_NL/Q2_0(+R8)/F16 dequant + fused dots (no materialize)
src/infer/nn.v # rmsnorm/rope-tables/swiglu/unrolled+blocked matvec
src/infer/backend.v # Backend interface + registry (cpu/cpu-blocked/cpu-simd/cpu-parallel/auto)
src/infer/parallel.v # threaded row-block matvec (VLLM_THREADS, freestanding-safe fallback)
src/infer/worker_pool.v # persistent decode worker pool (per-batch WaitGroups, no global state)
src/infer/simd_c.v # V wrappers for vllm_kernels.{h,c} (prod-only link, runtime-dispatched)
src/infer/tensor_view.v # VTL-aligned zero-copy Tensor view (no dependency)
src/api/routes.v # Route table + match_route (new endpoint = one row)
src/api/handlers.v # per-endpoint logic + sampler merging
src/api/limits.v # bearer-auth check + per-IP token-bucket gate (accept-loop only)
src/api/server.v # raw-socket HTTP + backpressure, no veb (bare-metal portable)
src/api/types.v # OpenAI JSON shapes
src/api/context.v # HandlerCtx: shared model + resolved config
tools/bench_kernels.v # host-only kernel benchmark (links real C file, embeds V refs)
tools/forward_bench.v # host-only full-decode probe (real GGUF, best-of-N ms/token)
tools/quality_gates.v # PPL/KLD/Same-top-p/maxdiff/VmHWM gate harness (baseline JSON)
tools/pld_bench.v # PLD accept-rate + wall-time probe (opt-in batch verifier)
tools/attn_bench.v # full vs windowed attention head-step scaling probe
tools/infer_smoke.v # host-only greedy smoke (also runs as /sbin/vllm in-guest; outputs must match)
docs/ # architecture/api/configuration/formats/building/development/security
kernel/ # vinix-mini fork plan, mini.md spec, mini.ld, cmdline.txt, features.conf
scripts/ # fetch/build profiles (ps1+sh)/qemu test/build_iso.py (phase-6 builder)/perf CI
gui/ # phase-6 ISO-builder desktop app (vlang/ui2; compose/ unit-tested)
GNUmakefile # `make image` (WSL): static server + weights + config -> vllm-os.iso
qemu/ # QEMU harness docs
vllm.example.json # config starting point (all sections)
ROADMAP.md # phased plan with exit criteria
v run src --model models/qwen3-1.7b-q4_k_m.gguf --port 8000
curl localhost:8000/v1/models
curl -N localhost:8000/v1/chat/completions -H 'Content-Type: application/json' \
-d '{"model":"qwen3-1.7b","messages":[{"role":"user","content":"hi"}]}'No weights file yet? The server still boots in stub mode so you can test the HTTP surface before downloading gigabytes.
Copy vllm.example.json to vllm.json and pass --config
(CLI flags win over VLLM_* env, which wins over the file; partial
files valid; BOM tolerated):
v -prod -cc gcc -o server src
./server --config vllm.json
./server --config vllm.json --port 9000
VLLM_PRESET=creative VLLM_PORT=9000 ./server --config vllm.json
./server --print-config # dump effective config, exit
./server --list-backends # compute backends, exit
./server --list-formats # weight containers, exit
./server --tune # host-tuned backend/threads/quant, exitKnobs: server (bind/port/limits), model (weights/format/ctx/backend),
sampler (preset/temp/top-k/top-p/min-p/seed/fast), api (max_tokens).
Full knob reference: docs/configuration.md.
GGUF (full index parse), SafeTensors (header-only index), PyTorch (detected, convert-first error). Details + conversion + the 5-step new-format checklist: docs/formats.md.
.\scripts\build.ps1 -Profile host-release # windows daily driversh scripts/build.sh host-release # linux/mac
sh scripts/build.sh bare-metal # experimental freestanding kernel-port elfProfiles: host-debug / host-release / host-minimal (no C layer) /
qemu / bare-metal. tcc is never used; SIMD comes from
function-target attributes + runtime dispatch
(VLLM_NO_SIMD=1 disables, backend in vllm.json selects).
Full matrix + flag hygiene: docs/building.md.
See qemu/README.md. Requires qemu-system-x86_64 on PATH.
Windows: winget install -e --id SoftwareFreedomConservancy.QEMU.
v -o server.exe src
./scripts/qemu_test.ps1Phase-1 QEMU test proves the guest→host network path: server runs on
the host, a tiny QEMU guest curls /v1/models and /v1/chat/completions
over the SLIRP link (10.0.2.2). The bootable vinix-mini ISO is phase 3.
./scripts/fetch_model.shDownloads Qwen3-1.7B safetensors, converts with llama.cpp
convert_hf_to_gguf.py, quantizes to Q4_K_M, drops the result in
models/. The OS image build bakes models/*.gguf + tokenizer.json
into the boot partition.
GET /health→{"status":"ok","model":"..."}GET /v1/models→{"object":"list","data":[{"id":"qwen3-1.7b",...}]}POST /v1/chat/completions→ chat completion,stream:truegives SSEPOST /v1/completions→ legacy completion (top_p/top_k/seedsupported)
Qwen3 chat template (<|im_start|>…) is applied server-side.
Full reference with streaming framing and error table:
docs/api.md.
| area | state |
|---|---|
| Host API (stub + config + formats) | done, tested |
| Inference kernels (dequant/nn/sampler/BPE/backend) | done, beat NumPy on every kernel row (docs/perf.md) |
| C SIMD layer (AVX2 matvec/Q8-dot/RMSNorm/fast-softmax) | done, runtime-dispatched, removable |
| VTL/VSL integration | parity-tested (vtl_parity_test.v, needs v install vtl vsl); VTL-aligned tensor_view.v in-tree |
| QEMU network path | harness green (loopback); guest SLIRP via $GUEST_IMG |
| Transformer forward (real logits, phase 1b) | done: GQA + QK-norm + split-half RoPE decode, fused Q4_0/Q4_1/Q6_K matvecs, q/k/v + gate/up fork-join, boot-cached blob + request-sized arenas, real BPE; greedy output identical to llama.cpp, PPL close (see docs/perf.md) |
| Forward speed (host, same-box measured) | C AVX2 quantized kernels (row-vector Q4) + threaded vocab head + layer fork-join, runtime-dispatched: decode ~48-50 ms/token threaded (~65-67 ms serial, ~800-1000 ms pure-V) on Qwen3-0.6B-Q4_0 (warm, Ryzen 7 5800HS), ~18x over warm pure-V; Q4_0/Q4_1 matvecs ~2x via accumulation + f16 LUT, vocab head ~9.5x, gate matvec 4 ms to sub-ms; serve path chat8 ~1.5 s wall (prefill-bound) |
| vinix-mini fork / bare-metal port / ISO | gate green: fork boots, userland V runs, full server in-guest serves real completions from the ISO (make image, scripts/mini_boot_gate.ps1) |
- Inference is pure V + C SIMD intrinsics,
-gc none, arena KV-cache. No GC pauses inside the token loop on bare metal. All builds use gcc-prod; tcc is never used. - VTL/VSL stay in
tools/+ parity tests (host-only). The token loop links onlyvllm_kernels.c(no libc/libm, freestanding-safe). - HTTP is hand-rolled on
netsockets —vebneeds OS syscalls Vinix-mini does not provide yet. - Context is capped at 4k tokens in v1 (Qwen3 native is 32k; full 32k KV does not fit the v1 RAM budget).
- RAM budget: ~1.1 GB weights + KV + server → 4 GB guest minimum.
Apache-2.0 (matches Qwen3-1.7B licensing for the weights flow).
Kernel fork keeps upstream Vinix license notices — see kernel/.