Repository navigation
third_party: bump llama.cpp to d70b67bf0 — a decoder that cannot share its KV starts instead of dying (#212) - #1233
Conversation
…hat cannot share starts instead of dying)
|
#1233 ready for review at ff32988 — MERGEABLE, one commit, 4 files (+14/−4). Pin → (fork #208, #209, #210, #211, #212), registry regenerated and / clean, plus the two doc lines the pin makes true. Device half of the gate is queued through |
|
Correction to the line above: the shell ate the backticks, so the shas came out empty. As written: #1233 ready for review at |
|
Device half: PASS.
That last row is the one #212 could have broken — it only touches the path where the export fails — and the decoder that cannot export is the case the PR body measures. So both halves are green on |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at ff329883.
The pin is five commits and the list is exact: gh api compare/4a375bf2d36f...d70b67bf0974 -> total_commits 5, and the
subjects are the body's table row for row (8ac62a3f7 #208, 62c0282fb #209, d368a18d6 #210, a402b136c #211,
d70b67bf0 #212). The submodule pointer, registry/architectures.json's source sha and KNOWN-ISSUES.md's "today" sha
all move to the same commit.
#212 does exactly what the body says, in both pins' source — this is the part I would not take on trust, and it is
unambiguous:
4a375bf2d src/llama-kv-share.cpp:169 throw runtime_error("shared memory: %s cannot export its memory")
src/llama-kv-share.cpp:184 throw runtime_error("shared memory: %s allocation or dma-buf export failed")
d70b67bf0 :178 static ggml_backend_buffer_t share_degrade(...) <- allocates normally, warns once
:191 return share_degrade(..., "cannot export its memory")
:211 return share_degrade(..., "allocation or dma-buf export failed")
The AFTER behaviour, measured on my own build of the fork at the new pin (CPU-only, -ngl 0,
Qwen3-0.6B-Q4_K_M, ONEBIT_KV_SHARE=1):
/health 200 after ~6 s (the old pin's shape is an exit at load)
share_degrade lines in serve log 1 (exactly once, at load)
"share_degrade: CPU cannot export its memory; its KV cache is allocated normally and a shared handoff
will be refused for this context (the state-file handoff still works)"
load-failure lines ("exiting due to model loading error" / "failed to initialize the context") 0
POST /slots/0?action=share {"socket": "..."} 501
"This server's memory has no shareable region: either it was not created with ONEBIT_KV_SHARE=1, or its KV
backend cannot export memory (the load-time warning names the backend)"
Both sentences are the ones the body quotes, verbatim. Worth recording for whoever repeats it, because the 501 has three
shapes and only one is the claim: without --slot-save-path the route itself answers 501 ("does not support slots action
… --slot-save-path"), with slot saving but no body it is 400 ("share needs {socket}"), and the "names both causes"
501 appears only once the request is well-formed.
Not re-run, stated rather than glossed: the old-pin arm. I built the new pin standalone twice (the engine's own build
has no llama-server target) and the first attempt also silently skipped the old pin, because the submodule is a
--depth 1 clone that does not contain 4a375bf2d; by the time I had fetched that commit I had also deleted the build
directory with a careless rm -rf of the log dir. So "the old pin exits at load" rests on the source above plus your row,
not on my own run — and that is the weaker half of this verdict, on the one claim where the two pins differ by two throws.
Also not regenerated: registry/architectures.json. It says it is generated by tools/registry_build.py and the diff
changes only the source sha with the counts untouched, which is what regeneration should look like — but I did not run
the tool, so I am saying that as a reading, not a check.
docs/hybrid.md's new paragraph is right about which side the pin has to be on ("a hybrid deployment running the flag needs
this pin or later on both sides"), and the ONEBIT_KV_SHARE=0-still-enables note it adds beside it is a real trap that
belongs in that file.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
Follow-up: the before arm is now mine too, so my verdict rests on a measured pair rather than half on source. I built
llama-server from the fork at both pins (the engine's own build has no such target) and ran the same request against
each — Qwen3-0.6B-Q4_K_M, -ngl 0, ONEBIT_KV_SHARE=1, CPU only:
OLD pin 4a375bf2d exit=1, never listened
E llama_init_from_model: failed to initialize the context: shared memory: CPU cannot export its memory
E srv llama_server: exiting due to model loading error
NEW pin d70b67bf0 /health 200 in ~6 s, 0 load failures
1x share_degrade: CPU cannot export its memory; its KV cache is allocated normally and a shared handoff
will be refused for this context (the state-file handoff still works)
POST /slots/0?action=share {"socket": …} -> 501 "either it was not created with ONEBIT_KV_SHARE=1, or its KV
backend cannot export memory (the load-time warning names the backend)"
The pin identity of each binary is checkable, not assumed: strings libllama.so gives the old build 3 occurrences of
allocation or dma-buf export failed and 0 of share_degrade; the new build is the reverse.
One wording correction for the body, since it is the sentence a reader will grep for: the c29-style message your PR quotes
is shared KV: CPU allocation or dma-buf export failed, but on this box the old pin fails one branch earlier and says
shared memory: CPU cannot export its memory — the cannot export site (now share_degrade(..., "cannot export its memory")) rather than the allocation … failed one. Both throw at that pin and both exit at load, so the claim is
unchanged; the quoted text just names the other of the two throws.
Merging on the lane's hardware arm — the hw-gate could not get the dieThe The hardware validation this bump needs already exists in the thread: device half PASS on this head — |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Bumps
third_party/llama.cpp4a375bf2d→d70b67bf0, the five fork commits merged after the old pin:input_size % 4(engine #991)Why #212 makes this a fix and not just a bump
ONEBIT_KV_SHARE=1makes a context allocate its KV as exportable dma-buf chunks.ggml-hrxis the onlybackend in this tree with an exporter, so on any other backend (ggml-cpu — and a hybrid route may legitimately
decode on the CPU) the old pin handed the buffer a foreign exporter and then threw. The server therefore exited
at load, before any request existed to fall back for — so engine#1203's per-request fallback to the state-file
route, which shipped in
e0f0362d, could not reach this case. The pin is what makes #1203's fallback reachablein a shipped build, and
docs/hybrid.mdnow says so.Measured, before and after (same box, same model, no device)
Qwen3-0.6B-Q4_K_M, one llama-server,-ngl 0,ONEBIT_KV_SHARE=1:4a375bf2d(shipped binary)d70b67bf0(this branch)E llama_init_from_model: failed to initialize the context: shared KV: CPU allocation or dma-buf export failed/E srv llama_server: exiting due to model loading error/health200, one warning:W share_degrade: CPU cannot export its memory; its KV cache is allocated normally and a shared handoff will be refused for this context (the state-file handoff still works)POST /slots/0?action=shareComposition through the engine's own route on this pin (
1bit serve --device hybrid, flag on, CPU decoder):tests/hybrid_e2e.shPASS —the backend prefilled only the last token (prompt_n 1, plain 22),no fallback happened; the same test with the flag off also PASS.Suite on this branch (Release CPU build,
ctest -j2,ONEBIT_SERVE_TEST_GGUF=Qwen3-0.6B):100% tests passed, 0 failed of 94 (
npu_repack_pathSkipped, no NPU ticket). One earlier run showedsmoke_servered ona client disconnect reaches the backendwhilethermal-run.shhad the suite frozen at78 °C; it passes 3/3 on its own, so that was contention on this box, not the pin.
What also changed in the tree
registry/architectures.jsonregenerated (tools/registry_build.py, which reads the gitlink): thesourcesline moves with the pin;
--checkand--check-pinsboth clean. Counts unchanged (298 hrx / 7 npu).docs/hybrid.md: the decoder that cannot export now starts, warns once, refuses per request and takes thestate-file route; a decoder pinned before repack_gguf: refuse the inverted k_b converter instead of rewriting its source #212 needs this pin or later on both sides. Also states what the
code actually does about the flag: both sides read
ONEBIT_KV_SHAREas "set and non-empty", so=0stillturns the route on and the opt-out is an unset variable (measured both ways just now, same warning line in
both arms).
KNOWN-ISSUES.md: engine#370's "the pin is … today" reference follows the pin.Not run, and why
tests/serve_e2e.sh … hrx,hrx_cpu_weight_parity, and a check that a decoder whichcan export still exports — repack_gguf: refuse the inverted k_b converter instead of rewriting its source #212 touched that path) is queued through
~/.local/bin/gpu-hold -l zerocopybehind the box's FIFO; the die has been held by other lanes all night and my ticket is 12th. I will comment
the numbers here when it runs. Everything above needs no GPU.
numbers); the parity test in the device half is the correctness gate that matters for a bump.
Refs: fork 1bit-MONSTER/llama.cpp#212 (merged), engine#1203 (merged, the fallback this composes with), tracker #753.