Files
leleka/docs/windows-runtime.md
T
Pavlo RatushnyiandClaude Sonnet 5.5 0d5d95eb0e
Linux / verify (push) Canceled after 0s
Linux / keyless-cuda (push) Canceled after 0s
Linux / static-cuda-package (push) Canceled after 0s
Linux / hosted-cuda-package (push) Canceled after 0s
Linux / linux-static-cli (push) Canceled after 0s
Linux / linux-cli-container (push) Canceled after 0s
Linux / release-cli (push) Canceled after 0s
build: Linux x64 build and unit-test check in Docker; recorded in the Windows runtime doc (STRA-220)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 13:53:21 +02:00

82 lines
5.8 KiB
Markdown

# Leleka runtime for Windows x64 (gpt-oss-20b, AVX2 / iGPU / NPU)
Status 2026-10-21: usable and tested on the reference laptop (Core Ultra 7 265U, 32 GB, one DDR5-5600 module); the
iGPU and NPU paths and speculation are experimental switches, the CPU path is the baseline. Pure Rust; production
serving needs no Python and no CUDA. Linux x64 builds and passes its unit tests (see Limits) but has not been run with a model.
## What it is
`strata-next serve` (control plane) exposes `POST /v1/responses` (and `/health`, `/ready`) and supervises one worker
process that decodes gpt-oss-20b-MXFP4 on the CPU (AVX-VNNI / AVX2 / portable kernels, chosen at run time).
| worker | long prompts (prefill) | decode | notes |
| --- | --- | --- | --- |
| `leleka-cpu-worker` | CPU | CPU | baseline |
| `leleka-igpu-worker` | integrated GPU (wgpu / Vulkan), falls back to the CPU by itself | CPU | default of the launcher; `docs/igpu-prefill.md` |
| `leleka-npu-worker` | Intel NPU through `leleka-npu-service` (OpenVINO, a separate process) | CPU | experimental; `docs/npu-service.md` |
| `leleka-gpu-npu-worker` | GPU and NPU together | CPU | measured: no gain over the GPU alone; `docs/worker-pool.md` |
Switches common to the workers: `--speculate` (exact prompt-lookup speculation), `--cache-slots N` (KV caches of N
conversations), `--ctx`, `--threads`. Decode quality is checked against llama.cpp on teacher-forced text
(`benchmarks/quality/gpt-oss-20b-teacher-forced`); the iGPU and NPU prefills sit about one rounding-noise step above the
CPU path there (`docs/igpu-prefill.md`, `docs/npu-service.md`).
## Build (Docker, no Visual Studio)
```powershell
powershell -File scripts\windows\Package-Windows.ps1
```
Runs `deploy/Dockerfile.windows-build`: a Linux container cross-compiles the six executables for
`x86_64-pc-windows-gnu` (mingw, runtime linked statically) and writes `dist\windows`; the script then packs
`dist\leleka-windows-x64.zip` (about 23 MB: `bin\*.exe`, `Start-Leleka.ps1`, `README.txt`, `SHA256SUMS.txt`). The first
build downloads the Rust and mingw packages (a few minutes). Docker Desktop's VM takes several GB of RAM while it runs:
stop it (`docker desktop stop`) before measuring anything. A native build with the MSVC toolchain
(`cargo build --release -p strata-control -p leleka-cpu-worker ...`) also works where Visual Studio Build Tools exist.
## Run
```powershell
powershell -File Start-Leleka.ps1 -Model C:\models\gpt-oss-20b-MXFP4.gguf # iGPU prefill, CPU decode
powershell -File Start-Leleka.ps1 -Model ... -Mode cpu
powershell -File Start-Leleka.ps1 -Model ... -Mode npu -OpenVinoRoot C:\ov\openvino_toolkit_windows_2026.3.0...
```
It writes a configuration, starts the control plane, waits for `/ready` (about 1.5 minutes: the 12 GB model is read once
so requests do not page it in) and keeps running; Ctrl+C stops the control plane and its workers. Defaults and why:
speculation on (output identical to plain decoding, up to 1.5x on copy-heavy output, within noise otherwise), 4 cache
slots (several agents do not evict each other's prefix), threads = logical processors minus two (12 or 14 threads give
the same decode speed: 8.74 and 8.73 tok/s medians; the low-power cores add nothing to a memory-bound loop), context
16,384. Add `-NoSpeculate`, `-CacheSlots`, `-Context`, `-Port`, `-Bind` as needed. The control plane binds to
127.0.0.1 by default; there is no authentication layer in this launcher.
Requirements: an AVX2 CPU; free memory of about 12 GB for the mapped model plus 0.05 MB x context x slots for the KV
caches and 1-2 GB of scratch (the launcher warns when it looks short); for the iGPU a Vulkan driver with integer dot
product support (Intel Arc / Xe graphics); for the NPU the Intel NPU driver and an unpacked OpenVINO 2026.3 runtime
(not shipped; loaded from `-OpenVinoRoot` at run time).
## Verified (cross-built binaries, 2026-10-21)
Started with `Start-Leleka.ps1 -Mode igpu` from the Docker-built executables: ready after 78-87 s, the GPU adapter
found, and through `/v1/responses`: a plain answer ("Paris"), a function call (`get_weather({"city":"Kyiv"})`), and
prefix reuse (975-token prompt, second identical request: 974 cached). All completed with status `completed`.
Per-feature tests (cargo, native MSVC build): kernels against integer references, speculation exactness, serve loop,
control plane, real-model tests.
Speed on this machine: 8-12 tok/s decode on a quiet machine (LM Studio's llama.cpp CPU: 7.6-8.7 earlier on the same
laptop), 16-17 tok/s on rewrites with speculation, prefill 14-19 tok/s on the CPU, about 60 on the iGPU and 50-55 on the
NPU at 4,096-token prompts. The smoke run itself was slow (1.5-4 tok/s) because another WSL VM on the machine held
about 11 GB of RAM and the model did not fit in free memory: with less than about 20 GB free the runtime pages and
every number above is out of reach. Do not run it next to large virtual machines.
## Limits
* One decode at a time per worker; several conversations share it through cache slots, not concurrency.
* Decode is bound by memory bandwidth: lossless decode on a single-channel laptop stops near 14 tok/s (see
`docs/cpu-runtime.md`); 20+ tok/s needs dual-channel memory.
* Custom (non-function) tools are not supported for this model family; tool-call arguments arrive in one piece.
* The iGPU prefill refuses (and uses the CPU) when free memory is below its estimate; the NPU path does the same.
* Linux x64: `deploy/Dockerfile.linux-check` builds the workers and the control plane and runs the unit tests of the runtime crates (45 test binaries, all passing, 2026-10-21); no model was loaded and the Linux runtime was not run end to end. The cross-build uses mingw, so the iGPU worker's wgpu path was exercised on that build only
for startup and a short prompt (the long-prompt GPU path was skipped for lack of memory in the smoke run and
was tested on the native build earlier).