engine: opt-in GPU offload for the decision engine
Let the SemIf decision engine run on a GPU via llama.cpp. SemIf's llamacpp backend is CPU-only by construction (it hardcodes n_gpu_layers=0), so the agent wraps `_cpu_model_params` for the duration of the load and restores it after — no patch to the re-cloned engine source. - `engine.gpu_layers` / `gpu_device` / `gpu_split` in config (default 0 = CPU). - On the GPU path, force a full cache reset (`llama_memory_clear(mem, True)`): SemIf's metadata-only clear leaves stale hybrid-attention state on Vulkan, so repeated scores drift (0.08 -> 0.36 -> 0.43) and return wrong probabilities. - Fail loudly when `gpu_layers` is set but the build has no GPU backend. - bootstrap.sh: opt-in `--gpu auto|vulkan|rocm|cuda|cpu`. A GPU build is opt-in because llama.cpp's Vulkan backend splits the graph across CPU and Vulkan even at `n_gpu_layers=0`, roughly halving CPU throughput, so a CPU-only host must keep the CPU wheel. Detects the backend, installs the Vulkan build prereqs, and rebuilds when offload support disagrees (pip's wheel cache otherwise serves the CPU wheel back). - Bump the SemIf pin 1f2dea3 -> 23cf1f3. - Tests: unit coverage for the config mapping + loader patches; an integration test asserting GPU determinism and CPU parity. - Offload needs the accelerator to itself (~2.9 GiB for the 4B Q4 model): a GPU already holding another model makes the engine slower than CPU and can abort with `vk::DeviceLostError`.
This commit is contained in:
1 parent
4e70a5889e
commit
17f16a6bfc
9 files changed
+329
-16
No files matched your search
@@ -422,8 +422,10 @@ machines:
|
||||
decision engine model generates in-process, with no endpoint and no
|
||||
`llm.model` at all (see the `llm.semif` block in `config.json`).
|
||||
|
||||
The **decision engine is separate** and runs via llama.cpp CPU (or Vulkan if your
|
||||
build enables it), not ollama.
|
||||
The **decision engine is separate** and runs via llama.cpp, not ollama. It is CPU
|
||||
by default; to offload it to a GPU, set `engine.gpu_layers` in `config.json` and
|
||||
run `scripts/bootstrap.sh --gpu vulkan|rocm|cuda` (a GPU build is opt-in because
|
||||
it is slower on CPU).
|
||||
|
||||
### Option A: one-command provisioning (`bootstrap.sh`)
|
||||
|
||||
|
||||
Reference in new issue
Block a user