Repository navigation
perf(lemonade): run the embedder on CPU instead of slowing every model - #4512
Conversation
|
Verdict: Request changes Moving only the embedder to the CPU backend is the right fix: chat models get their GPU prompt speed back and the embedder still avoids the Vulkan crash. The change is incomplete in two places, though, so some users would lose the speedup and others would get the crash back.
Real-world evidenceN/A: no evidence bundle was produced for this run. The PR description reports manual runs on a Radeon 8060S (the embedder fails on Vulkan and works on CPU; 🔍 Technical details🟡 TUI and installer launchers still set
Either update these in this PR, or state the scope in the PR and track the rest in an issue. As it stands, the headline claim ("chat models get the full GPU path back") holds only for the embedded server and the daemon's Python launch path. 🟡 Auto-loaded embedder falls back to Vulkan on non-embedded GAIA-started servers ( That still needs one explicit load before the first embedding, so memory init would also have to load the embedder (or GAIA would have to pin it through 🟢 Inconsistent handling of unreadable files ( 🟢 Leftover string concatenation ( Strengths
|
Every Lemonade GAIA started carried GGML_VK_DISABLE_COOPMAT=1 to stop llama.cpp's Vulkan cooperative-matrix crash when loading the embedding model on AMD Radeon iGPUs (amd#1831). The flag also turned off the fast matrix path for chat models: Qwen3 30B A3B on a Radeon 8060S dropped from 1,293 to 683 prompt tokens/s. Generation was unaffected. The embedder now loads on llama.cpp's CPU backend instead: every load GAIA makes asks for it, and GAIA's embedded Lemonade saves it in its recipe options so Lemonade's own on-demand loads use it too. A query embeds in about 34 ms and 60 document chunks in about 7 s on the CPU. The global flag is gone from every launch path, and the troubleshooting guide and crash remedy describe the new setup.
a2484d7 to
4ce6bca
Compare
|
Rebased onto main (picks up the The perf fix itself is sound and worth landing: moving only the embedder to CPU is the right call, and 1,293→683 tok/s is a real, well-measured regression to undo. But I can't merge yet — verified two gaps that mean the fix doesn't reach most users on a Radeon iGPU:
Pushed the rebase to unblock the stale pylint check, but leaving this open rather than merging until the backend pin covers the non-embedded auto-load path (or memory/RAG explicitly |
… own Memory's first embedding made Lemonade load the embedder by itself, on its default Vulkan backend, so any server other than GAIA's embedded one could hit the amd#1831 crash again now that the global Vulkan flag is gone. GAIA now loads the embedder on the CPU backend before its first embedding and saves that choice in Lemonade, so later auto-loads use the CPU too. The TUI no longer sets the flag when it starts Lemonade or prints a start command, so chat models it launches get their full prompt speed back. The CI runner scripts keep it. An options file that is not a JSON object now fails loudly instead of being replaced.
…sh Qwen3.6 (amd#4674) On a Strix Halo with an older AMD driver, the new default model couldn't answer at all: Qwen3.6-35B-A3B loaded, then llama-server died on its first token, so `gaia init` failed its verification. llama.cpp's Vulkan cooperative-matrix path is the cause. Turning it off fixes the crash but halves prompt speed on drivers that don't crash (amd#4512 removed a blanket version of this flag for that reason). GAIA's embedded Lemonade now turns coopmat off only on a Strix Halo iGPU (8060S/8050S/8040S, Windows) whose driver is at or below the version measured crashing. Newer drivers keep the faster path, and a `GGML_VK_DISABLE_COOPMAT` the user set always wins. | Strix Halo, Vulkan, llama.cpp b10825 | coopmat on (default) | coopmat off | |---|---|---| | Qwen3.6 on driver **32.0.12078.30** | crashes on first token | 273 tok/s prompt, 34.0 tok/s gen | | Qwen3.6 on driver **32.0.31016.2** (May 2026) | loads and answers (400-token reply in 23 s, no watchdog reset) | — | | Qwen3-30B (from amd#4512) | 1,293 tok/s prompt | 683 tok/s prompt | ## Test plan - [x] `pytest tests/unit/test_lemonade_embedded.py tests/unit/test_embedder_cpu_backend.py` (86 passed): old driver turns coopmat off on each Strix Halo name; driver 32.0.12078.31 and newer, other GPUs, an unreadable version, non-Windows and a user-set value leave it alone; the real registry reads without raising - [x] On a Strix Halo with driver 32.0.31016.2 and no override, Qwen3.6 loads through the embedded Lemonade and answers - [x] `python util/lint.py --black --isort --flake8` <details> <summary>🔍 Technical details</summary> - `_windows_display_adapters()` returns `(DriverDesc, DriverVersion)` from the display-adapter class key; `vulkan_workarounds()` compares the parsed version to `_COOPMAT_BROKEN_THROUGH = (32, 0, 12078, 30)`. - The first driver that fixes the crash is unknown — only these two points are measured. A driver between them is treated as working; if one crashes, raise `_COOPMAT_BROKEN_THROUGH` or set `GGML_VK_DISABLE_COOPMAT=1`. - An unreadable version logs at info with the remedy and leaves coopmat on. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
On Strix Halo, every chat model GAIA ran read prompts at about half speed. To stop the embedding model crashing on AMD Radeon GPUs (#1831), GAIA started Lemonade with a flag that turns off llama.cpp's fast matrix path for every model. Measured on a Radeon 8060S with Qwen3 30B A3B, prompt processing dropped from 1,293 to 683 tokens/s. Long agent turns pay that on every step, and the troubleshooting guide understated it as "about 12%". Now only the small embedder moves to the CPU backend, where it embeds a query in about 34 ms, and chat models get the full GPU path back.
Test plan
llamacpp_backend=cpu, including Lemonade's own on-demand load once the option is saved.gaia lemonade embedded startfrom this branch:lemondhas noGGML_VK_DISABLE_COOPMAT,recipe_options.jsonpins the embedder to CPU, and GAIA's client loads it and returns a 768-dimension embedding.pytest tests/unit/test_embedder_cpu_backend.py tests/unit/test_lemonade_launcher.py tests/unit/test_lemonade_embedded.py tests/unit/test_memory_mixin.py tests/unit/test_ui_gpu_detection.py: no failures beyond thosemainhas on Windows.llama-benchor a Qwen3 30B chat shows prompt processing near 1,300 tokens/s on a GAIA-started Lemonade, and memory and document search work.