Repository navigation
Conversation
This was referenced Nov 19, 2026
cobanov
requested changes
Nov 22, 2026
cobanov
left a comment
Owner
There was a problem hiding this comment.
Thanks for the before/after repro; that's exactly what I hoped for, and both patches are welcome.
Two things before it goes in:
- #103 (llama.cpp to b12600) takes
patches/0019, and neither patch applies on b12600. Please rebase once #103 lands and move the grammar patch to the next free number (0014 can stay). - When you regenerate them, please use file mode 100644;
git applycurrently warns about 100755.
One optional note: a bad_alloc inside llama_decode skips its KV rollback (seq_rm), so a retry may end in "Invalid input batch". It fails safely, but a comment in the patch saying so would help.
Banan412
force-pushed
the
split/2-oom-safety
branch
from
November 23, 2026 15:34
06e1c71 to
6209281
Compare
Contributor
Author
|
@cobanov Updated
|
Owner
Banan412
force-pushed
the
split/2-oom-safety
branch
from
November 25, 2026 12:02
6209281 to
0882305
Compare
Contributor
Author
|
@cobanov Pushed the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Decode and grammar-sampling memory safety fixes split out of #89, with live PS5 before/after reproduction.
Patch Numbering
patches/0014-decode-bad-alloc-recovery.patchfills the unused slot between0013(Qwen3.5 keeps earlier turns' thinking, so a new message only appends #88) and0015/0016(Fleet: conversations are parked on the console, not in the host's memory #87) onmain.patches/0019-grammar-low-memory.patchkeeps the next free patch slot onmain(regenerated cleanly with100644file modes; zero100755git applywarnings). Note: llama.cpp moves to d2bceda3d (after b12602) for Inkling 2 Mini, with every patch carried over #103 dropped its temporary0019/ moves grammar changes forward ond2bceda3d; a ported,llama-server-compiled version of both0014and0019ford2bceda3dis already verified locally so this PR can rebase immediately if llama.cpp moves to d2bceda3d (after b12602) for Inkling 2 Mini, with every patch carried over #103 lands first.Changes
0014-decode-bad-alloc-recovery.patch(tools/server/server-context.cpp):std::bad_allocduringllama_process/llama_synchronize(yield_to_queue) andupdate_slotsbatch processing, clears idle slots andintrospect_capture, and halvesn_batchdown to1to retry.std::bad_allocinsidellama_decodeskips its KV rollback (seq_rm), so a retry can still fail safely with"Invalid input batch".n_batch == 1or a slot callback still throwsstd::bad_alloc, sends a server error, runsslot.prompt_clear(), clearsintrospect_capture, and releases the slot cleanly instead of crashing.0019-grammar-low-memory.patch(src/llama-grammar.cpp):decoded_cp_buf(decode_utf8_into) insidellama_grammar_apply_implinstead of allocating up tocur_p->size(248,320on Qwen3.5) separatestd::vector<uint32_t>heap buffers, and dropsdecoded_metabefore rejection.rejects/next_candidatesreserves inllama_grammar_reject_candidates_for_stackatmin(candidates.size(), 64)and returns early whennext_candidatesis empty.Verification (Live PS5 Before / After Repro)
qwen3.5-18b-a3b-reap-coding-heretic-v0.i1-Q4_K_M.gguf(11.38 GB,vocab 248320,LLAMA_INTROSPECT=1, strict nestedcharacter_sheetjson_schemaresponse_format).origin/mainpatches): Server immediately closed the socket (Remote end closed connection without response) and crashed/restartedPS5LM.split/2-oom-safetyat0.14 GiBfree): CompletedHTTP 200(139tokens —19prompt /120completion,1.56 s,83.82 tok/s), and a follow-up normal chat turn completedHTTP 200(32tokens,0.31 s).split/ps5-all,fa0fc59base): Identical strict nestedcharacter_sheetjson_schemacompletedHTTP 200, valid JSON, and/health200 {"status":"ok"}on:qwen3.5-18b-a3b(16k q8_0,LLAMA_INTROSPECT=1)Qwen3.5-2B(64k q8_0, bothOffandOn,8.51 GiBfree)Qwen3.5-9B(64k q8_0 On,2.01 GiBfree)Qwen3.6-12B(64k q8_0 On,2.46 GiBfree)qwen3.5-14b-a3b(64k q8_0 On,2.05 GiBfree)Qwen3.8-27B IQ2_M(32k q8_0 Offat0.11 GiBfree, and64k q4_0 Onat0.12 GiBfree)scripts/apply-patches.shpassed with exit0and zero100755/mode warnings on bothorigin/main(970b51ce7) and#103(d2bceda3d+ hostllama-serverbuild).Refs #89.
Console Screenshot
Live PS5 TV HUD (
qwen3.5-18b-a3b, non-thinking capture) showing plain text and the nestedcharacter_sheetJSON output after passing.Generated with Google's Antigravity