Commit Graph
891 Commits
Author SHA1 Message Date
Niko1221 638533e3fc Merge f-pr-split-n4534 cca88a011 into f-p4-int (each card keeps only its own layers' dense weights on a layer split; the last card's draft-head room)
#4522 (the trim of each card's dense weights to its own layers, now the default for explicit and auto layer splits) and #4549 (the last card's draft-head room), with fixes on top as separate commits: the PLE hash constants and their row-range check restored, STRATA_STAGE_TRIM=0 as the way back, the trim's freed bytes credited to the first card only, exact pricing of a later card's hyper-connection rows and PLE key, a quieter pricing check, one test-fixture fix. #4534 is not in.

One card: nothing changes (48 forced continuations byte-identical to the base). Two RTX A6000 that already hold every expert: decode 122.27 against 122.71 tok/s, prompts 5.6 to 10.0% faster at 2K, 8K and 20K tokens (the base streams experts for the prompt, this build none). Two cards held to 15.5 GB free each: decode 75.88 against 64.16 tok/s (+18.3%), 867 more expert slots on the first card. Way back: STRATA_STAGE_TRIM=0.
2026-11-13 05:26:46 +01:00
Niko1221 8c1fa57f6f Merge f-loan-walk 5bc07c47a into f-p4-int (the prompt loan is sized by the walk a piece takes)
Two commits on c5e4e5109. The prompt path borrows cache slots from the experts for its buffers; the size of that loan is now taken from the walk the piece really takes, not from the rounded chunk. Only a piece whose rounded chunk reaches the floor while its real size is under it changes; every prompt of 1,024 tokens or more with a first chunk at or above the floor is unchanged. Way back: STRATA_PREFILL_LOAN_WALK=0 (settings register entry and one generated row in docs/SETTINGS.md). The second commit is test-only.

Measured on an RTX A6000 (UD-Q4_K_XL, 13,580 of 24,576 slots resident, MTP, fixed draft-cost table): prompt time -14 to -15% at 770 to 1,024 tokens with the CPU share off, -10 to -12% at 2,818 to 3,072 tokens with it on; no change below or above those pieces. R9700: -2 to -4%. With the way-back switch the base numbers come back.
2026-11-13 05:26:29 +01:00
Niko1221 e474c27bf8 Layer split: price a pipelined two-stage split as the sum of the stages again
Reverts the effect of the merge of PR 4534 (b1b8b8d3d): with --pipeline-windows 2 and two stages the
search priced a split by its slower stage (its layers, 12 layer-times for the last stage's head and draft
chain, its misses) instead of the sum of the stages.

On two RTX A6000 (UD-Q4_K_XL, MTP, 36 requests of 300 tokens, fixed draft-cost table, medians of three
interleaved rounds) the rule moved a pair that already holds every expert from K=24 to K=30 and
decoded 119.2 tok/s [118.5, 119.5] against 126.8 [126.7, 126.9] with the sum. With the split fixed
under --pipeline-windows 2 the measured decode falls as K grows: K=24 126.5, K=26 126.0, K=28 124.0,
K=30 120.3 tok/s. The overlap the rule assumes is 3.5% on this pair (126.8 against 122.7 serial), not
the 17% it predicted. The rule is not on by default on CUDA; it would change the default placement
of AMD gfx12 pairs, which have not been measured with it.
2026-11-13 02:16:01 +01:00
Niko1221 3ffa59e2be Merge f-kq-line 0ce77eaf8 into f-p4-int (the K-quant start-up line prints only when the loaded model has K-quant experts)
Two commits on 7d7590f40. The line "a model with K-quant experts (Unsloth UD-Q4/Q5/Q6_K_XL) reads its prompt on ..." was printed at option time, before the model is known, so an IQ3_S or IQ2_XS set that has no K-quant layer also showed it. The default is still set at that point; the line is now printed once the expert layout is loaded, and only when some layer has a gate/up or a down tensor of Q4_K, Q5_K, Q6_K or Q5_1 (the types the K-quant switches decide for). The wording is unchanged and so is every default. Unit tests on the two deciding functions; the second commit keeps the unit test from reading STRATA_DEFAULTS before the check that sets it. The same kind of line on gfx12 (HIP) is not changed.
2026-11-13 01:41:31 +01:00
Niko1221 b637627a37 prefill: size the prompt loan from the walk a piece takes
A prompt piece below the stream floor walks staged, but its loan of cache
slots was sized from the chunk rounded up to the 256 grid: a 999-token piece
under a 1,024 floor was lent the streamed layout (512-slot ring, fused MoE
buffers). The loan now uses floor - 1 for such a piece. Default on;
STRATA_PREFILL_LOAN_WALK=0 keeps the rounded chunk. Pure rule with a unit test.
2026-11-13 00:52:55 +01:00
Niko1221 3e28250e84 Docs: the dense-weight trim is the default with a layer split
STRATA_STAGE_TRIM moves from the opt-in table of docs/MULTI_GPU.md to a new "Turning a default off"
table (STRATA_STAGE_TRIM=0 or --no-trim-stage-weights keeps every card's full copy). docs/BATCHING.md
and the --trim-stage-weights usage line say the trim applies to explicit and auto splits and is the
default. The settings register marks STRATA_STAGE_TRIM as a rollback setting.
2026-11-13 00:29:52 +01:00
Niko1221 4f84787d6e nvidia: the start-up line about K-quant experts prints only when the loaded model has them
The line "a model with K-quant experts (Unsloth UD-Q4/Q5/Q6_K_XL) reads its prompt on ..." was printed at option time, before the model is known, so it also appeared for an IQ3_S or IQ2_XS set that has no K-quant layer. The default is still set at that point (before any engine code reads its switches); the line is now printed once the expert layout is loaded, and only when some layer has a gate/up or a down tensor of one of the four types STRATA_MMQ_KQ and STRATA_PF_FUSED_KQ decide for (Q4_K, Q5_K, Q6_K, Q5_1; the types prefill::mmq::supported() hands to the K-quant switch). A set whose only such tensor is a Q5_1 down still prints it, because the switch decides that product. The wording is unchanged, and so is every default.

nv_kq_expert_type and nv_kq_line_wanted are the deciding functions, with unit tests in nv_defaults_test (IQ3_S / IQ2_S / IQ2_XS sets: no line; Q8_0 down only: no line; UD-Q4_K_XL: line; one Q5_K layer among i-quant ones: line; Q5_1-only down: line). apply_nv_kq_default gets a say argument (true by default) so the engine can set the default early and print later.
2026-11-13 00:19:15 +01:00
Niko1221 210bf9410c Layer split: do not warn about under-pricing of a few MiB
The check after a later stage's load compared the search's price with what the card lost.
With the hyper-connection rows and the PLE key priced (previous commit) the two agree to
1-2 MiB (2677 against 2678 MiB, 2020 against 2022 MiB on a two-card UD-Q4_K_XL start), and
the card reports free memory in 2 MiB steps, so an exact "priced < took" test warned on
rounding. It now warns when the price is more than 8 MiB under what was taken, or more than
5% over, as before.
2026-11-13 00:16:40 +01:00
Niko1221 59211f98b1 Merge f-fused-staged e521524f3 into f-p4-int (Windows Strix Halo reads prompt pieces below 1,024 tokens on the fused kernels' staged group entry; --short-read defaults to 24 there)
Five commits on f33e9fa7b (the earlier short-piece rule). On Windows with one gfx1151 card and a layer set in which every layer has no MMQ tile and the fused kernels take it (UD-Q4_K_XL), a
prompt piece below 1,024 tokens (the batched ones, from 26 tokens) now takes the staged walk's fused group entry: only the routed experts stream and they run on the fused kernels, with FP32 down
rows, instead of a dequantize and two FP16 GEMMs per routed expert. The step-one floor of 64 applies only with the entry off. The serve loop's --short-read default is 24 instead of 64 on that
class (a --short-read on the command line wins). Pieces of 1,100 tokens and more, other cards, other systems and sets with an MMQ tile are unchanged. STRATA_PF_STAGED_FO=0 is the way back
(the earlier behaviour byte for byte); with STRATA_PREFILL_STREAM_MIN=1024 as well it is the old FP16 path; STRATA_PF_STAGED_FO=1 asks for the entry on any card (research).

Measured on a Strix Halo (UD-Q4_K_XL, three rounds, one start per arm): prompt ms with the old FP16 path / the earlier rule / this default 303 / 303 / 268 at 32 tokens, 595 / 595 / 317 at 64,
1,797 / 418 / 343 at 128, 2,305 / 514 / 449 at 256, 3,675 / 1,022 / 977 at 1,000; 1,100 and 2,048 tokens the same in every arm. Forced-token KL of the default against the long path with FP32 rows 0
at 256 and 768 tokens, the way back equals the earlier rule (KL 0, 36 of 36 request ids identical). Decode unchanged (65.8 ms a window).

The branch changes data/settings-register.json, docs/STRIX_HALO.md, prefill.cpp and generate.cpp; the register is regenerated by its tool on the merged tree with the branch's hand-kept entries
(the new STRATA_PF_STAGED_FO and the note of STRATA_PREFILL_STREAM_MIN).
2026-11-13 00:09:19 +01:00
Niko1221 0b3364d416 Layer split: price a later stage's Q8_0 hyper-connection rows and the PLE key
The split search prices a later stage's weights from the pack index and the GGUF headers
(carve_bytes, NativeDense::weight_bytes_for), and NativeDense::load then allocates them.
Two parts of the load were not in the price:

- With STRATA_HC_Q8=1 (set by default when the GGUF carries Q8_0 hyper-connection rows) load
  copies those rows of its layers, and the final mixer's, to the card: 0.32 GiB for the second
  card of a 48-layer UD-Q4_K_XL file on two cards. weight_bytes_for now adds them, one granule-rounded
  allocation each, with the same filters as load (stage-local unless STRATA_HC_Q8_ALL_STAGES=1,
  F32 inject rows only with STRATA_HC_Q8_INJECT=1, and the bf16 pack's down / up projections).
- load takes the PLE key (blk.1.ple_key.weight) on every stage; the price skipped it for a stage
  that does not run layer 1.

allocated_bytes() now counts the Q8_0 hyper-connection rows too. When the check after a later
stage's load still finds the price off by more than 5%, the log says which part drifted
(projections priced against loaded, the rest priced against what the card lost).

native_dense_price_test builds a small GGUF and checks, for three stage ranges, that the price
equals what load allocates (needs a CUDA device; skipped without one).
2026-11-12 23:51:22 +01:00
Niko1221 191202132c Layer split auto: credit the trim's freed VRAM to CUDA0 only, not to the later stages
The search adds what the trim frees to each stage's room for experts. That is right for CUDA0, whose arena holds the dense weights of all layers when the search runs and gives back everything outside its own layers when it reloads trimmed. A later stage has not loaded anything yet when the search runs (its weights load after the split is known) and the search already prices its trimmed weights, so crediting it the bytes a trim would free counted the same bytes twice and handed the card cache room it does not have.
split_rules::trim_credit(stage, freed) is the rule (stage 0 gets the freed bytes, the others 0) with a unit check in split_rules_test; generate.cpp calls it where it used trim_frees directly.
2026-11-12 23:39:34 +01:00
Niko1221 116cdf2a35 serve: --short-read defaults to 24 where the staged fused entry reads short pieces
With the staged group entry on (Windows gfx1151, a layer set with no MMQ tile that the fused kernels take, STRATA_PF_STAGED_FO not 0) a batched read of a short
piece is cheaper than the verify windows from about 28 tokens. Strix Halo, UD-Q4_K_XL, prompt ms, median of 3 (windows / batched): 24 tokens 231 / 261,
32 tokens 303 / 265-270, 48 tokens 453 / 293-299, 64 tokens 598 / 314-316. The class default of --short-read is therefore 24 (the largest size measured
where the windows win; 64 stays everywhere else). A --short-read on the command line wins; the setting is not part of the draft-cost table key
unless it is given.
2026-11-12 22:40:12 +01:00
Niko1221 2f1b77b262 Layer split: do not count the PLE weights as freed by the trim
The split search adds what the trim frees to each card's expert-cache room. It counted the six blk.1.ple_* weights of layer 1 as freed on every later card, but the loader keeps the PLE weights on every card (the same rule as add_foreign), so the search room was a little too big. The per-layer row list now leaves the PLE rows out, which also keeps them in the first card's reload.
2026-11-12 22:30:35 +01:00
Niko1221 7c76ce4f16 One GPU: do not print the "--trim-stage-weights needs a layer split" line unless the flag was given
With the trim on by default, the line "--trim-stage-weights needs a layer split across GPUs (ignored)" would have printed at every start on one card. It now prints only when --trim-stage-weights was given on the command line, as before. The engine log of a one-card start is unchanged.
2026-11-12 22:30:01 +01:00
Niko1221 4c39e8624e Layer split: STRATA_STAGE_TRIM=0 still turns the trim off, and the short-card spill walk keeps its rule
The trim of each card's dense weights to its own layers is on by default with a split now (PR 4522). Two documented things must not move because of that:
- STRATA_STAGE_TRIM=0 is the documented way back and must keep switching the trim off, next to --no-trim-stage-weights. A given --trim-stage-weights still wins over STRATA_STAGE_TRIM=0, as before.
- The spill walk of 0.2.10 / 0.2.11 (two 8 GB cards: the split is chosen before anything loads, every card trimmed) reads "the user asked for the trim" (the flag or STRATA_STAGE_TRIM=1), as it always did. With the trim on by default that condition was always false and the walk was never reached, so short cards would have loaded the full dense set on CUDA0 again. The walk's two conditions now test the request, not the default.
No change with one card, and none for cards with room.
2026-11-12 22:30:01 +01:00
Niko1221 7e9bf8c8f8 PLE: use the model file's hash constants again, and keep the row-range check
The engine reads the PLE hash constants out of the model file when it carries them (ple_consts_run), and refuses to start when a hash would reach past the PLE table's rows. A rebase of the trim change (PR 4522) lost both: the wiring step took the default constants (ple_artifact_consts) and the range check was gone. That change reaches a single card too, so a model whose file has its own constants would have been hashed with the wrong ones.
This puts back the two lines and the check as they were before the merge. No other change.
2026-11-12 22:29:34 +01:00
Niko1221 3f64aa6534 Merge PR 4549 (f9a09885c) into f-pr-split: a layer split keeps the draft head's room out of the last card's cache
One commit by cobra91 on dbb2d168c, merged as written: in the per-stage cache sizing the last stage subtracts the draft head and its logits (mtp.bind_bytes), as one GPU does (#199), so they no longer come out of that card's reserve.
1 file: src/program/generate.cpp, 7 lines added, 2 changed. Git merged it without a conflict.
2026-11-12 22:28:51 +01:00
Niko1221 d20c94caeb Merge PR 4534 (b1b8b8d3d) into f-pr-split: the split search prices a pipelined two-stage split by its slower stage
One commit by cobra91 on dbb2d168c, merged as written: with --pipeline-windows 2 and exactly two stages the search's predicted window time is the slower stage's (its layers, plus about 12 layer-times for the last stage's head and draft chain, plus that stage's misses on its own link) instead of the sum of the stages. Nothing changes without --pipeline-windows 2 (on CUDA it is not on by default).
1 file: src/program/generate.cpp, 16 lines added in the search's predict lambda. Git merged it without a conflict.
2026-11-12 22:28:51 +01:00
Niko1221 b4a0b5e227 Merge PR 4522 (935165402) into f-pr-split: every card trims its dense weights to its own layers on --layer-split auto too
Two commits by cobra91 on dbb2d168c, merged as written: per-card weight trimming on --layer-split auto (default on, --no-trim-stage-weights keeps the copies; the split search counts the freed VRAM towards each card's expert cache; CUDA0 reloads only its own layers' dense weights), and the reload resets the process-wide layer range before each stage.
3 files: include/strata/core/native_dense.hpp, src/core/native_dense.cpp, src/program/generate.cpp. Git merged generate.cpp without a conflict.
2026-11-12 22:28:38 +01:00
Niko1221 c54a0cf460 Merge f-kq-default d1ec6f039 into f-p4-int (Flash-Next's K-quant experts are read by Strata's fused prompt kernels by default on the NVIDIA cards the i-quant default takes, with the 128-row tile where it was measured)
Five commits on 662e72ac2. Flash-Next's K-quant packs (UD-Q4_K_XL: Q4_K / Q5_K gate/up with a Q5_1 or Q8_0 down) took llama.cpp's MMQ kernels for the
prompt by default. Now, on compute capability 8.0 / 8.6 / 8.9 and 12.0 cards with 80 or more multiprocessors (RTX A6000, A40, RTX 3090, A100, RTX 40 and
RTX PRO 5000 class), and on the 40 to 79 multiprocessor cards (RTX A4000, RTX 5070 class) for the staged launches, the fused kernels read them;
STRATA_PF_FUSED_KQ=0 gives MMQ back (STRATA_PF_FUSED_SM40=0 for the 40 to 79 class only, STRATA_PF_FUSED=0 for every fused kernel). The tile: sm_86-class
cards with 80 to 99 multiprocessors take the 128-row tile for these pairs from 5.8 rows an expert, sm_120 cards with 100 to 149 multiprocessors the same for
the two Q8_0-down pairs; every other card keeps its tile pick. Under 40 multiprocessors, compute capability below 8, HIP and the other formats: as before.
The start-up line about K-quant experts says what runs on the card (src/core/nv_defaults.cpp, nv_kq_fused_here), and the QUANTS.md row names the fused kernels.

Measured on an RTX A6000 (UD-Q4_K_XL, 55% of the experts on the card): the 48 forced continuations score byte for byte the same as the old tile with the fused
kernels on (scored-file hash 362035373b02d395...), and with the way back set the same as MMQ (0f58ac95a92d51a6...); prompt speed against the way back
0.99 / 0.96 / 0.98 / 0.99 / 1.01 / 0.99 at 300 / 1,000 / 2,049 / 4,097 / 8,193 / 20,001 tokens; decode unchanged.

The branch changed data/settings-register.json (the status and the note of STRATA_PF_FUSED_KQ); so did the head (generated fields). The register conflicted
in one hunk: the STRATA_PF_FUSED_KQ entry's git stamps (head: 3a61182bbf, the branch: 4dbaf703fd) and its status (head: opt-in, the branch: rollback). The status
of the branch is kept (a hand-kept field); the file was then regenerated with tools/settings_register.py on the merged tree, so every generated field is the
tool's output for this tree (the new reads in nv_defaults.cpp and moe_fused_iq.cu, and the line numbers that moved). The hand-kept fields of both sides
are carried unchanged (checked field by field against each side's change). docs/SETTINGS.md is regenerated after the gate round, not here.
2026-11-12 22:18:38 +01:00
Niko1221 47d46ccce9 Merge f-strix-c4 00807c9b3 into f-p4-int (with two or more requests at once on Windows integrated AMD, the pinned RAM copy of experts is capped so every slot fits)
With --batch 2 or more on Windows, HIP, integrated AMD (the gfx1151 block that sets the own-path prompt chunk) and a RAM budget in the start
arguments, every session (the main one and each slot) pins its streamed K/V for the whole context, and the RAM copy of experts is pinned on top of
that; at 4 slots and 131,072 tokens the engine stopped inside the prompt path's allocation, and with a smaller budget the OS ran out of page-locked
memory. The RAM copy is now cut to what keeps it plus the sessions' pinned K/V at 22.75 GiB (include/strata/core/uma_cache.hpp, two plain inline
functions, unit tested in src/core/uma_cache_test.cpp), the level of the largest 4-slot start that worked (15 GiB of experts, 7.75 GiB of K/V).
The experts left out are read from the SSD when needed. Context, slot count and the 16,384-token chunk are untouched; --batch 1, starts without
--batch, every other OS and backend, and 2 and 3 slots on a 64 GB box (their RAM copy is under the cap) are unchanged.

The cap has no floor: for any number of requests the engine keeps as little in RAM as needed and starts. With so many slots that their pinned K/V
alone is over 22.75 GiB the RAM copy is empty (budget 1 byte; 0 would mean no limit) and every expert outside the GPU cache is read from the SSD;
the start goes on.

The engine says so once after the pin, only when the cap cut: "N requests at once: X GiB of experts are kept in RAM so that everything fits in
this PC's memory; the rest are read from the SSD when needed (STRATA_UMA_PIN_CAP=0 keeps the RAM budget as set)", or at cap 0 the same without
the figure. After a start that really failed with 2 or more slots the engine says "N requests at once do not fit in this PC's memory: start with
--batch N-1", and the Terminal's step for that failure reads "This PC's memory cannot hold that many requests at once. Lower Concurrent requests
in the app (or `--parallel` in the Terminal) by one and start again." (strata_cli/launch/runner.py, tests/terminal/test_batch_memory_words.py).
STRATA_UMA_PIN_CAP=0 keeps the RAM budget as set (settings register status rollback; one sentence in docs/BATCHING.md).

Measured on a Strix Halo with 64 GB (UD-Q4_K_XL, 131,072 context, 4 prompts of 68 to 2,067 tokens): 2 slots and 3 slots print no line and keep their
cache slots; 4 slots print the line with 15.0 GiB, start and serve every slot; the one-slot run gives the same 36 ids as before.

Both branches changed data/settings-register.json and src/program/generate.cpp. generate.cpp merged without a conflict. The register conflicted in
three hunks, all generated fields (the line numbers of the STRATA_PF_FUSED reads and defaults, and one read entry); it was resolved by running
tools/settings_register.py on the merged tree, so every generated field is the tool's output for this tree, and the hand-kept fields (status, owner,
note) of both branches are carried unchanged (checked against git's own merge of the file: no hand-kept field differs). docs/SETTINGS.md is
regenerated after the gate round, not here.
2026-11-12 20:29:16 +01:00
Niko1221 00807c9b30 [Engine] Strix Halo: the RAM cap with several requests at once has a way back and speaks only when it cuts
The cap on the pinned RAM copy of experts (--batch 2 or more, Windows HIP, integrated GPU) printed
its line at 2 and 3 slots too, where the whole copy (12.47 and 16.40 GiB) is under the cap and
nothing is cut: "18.1 GiB of experts are kept in RAM" was wrong there. Now the line comes after
the pin and only when the RAM copy reached the cap (4 slots at 131,072 tokens: 15.0 GiB).

STRATA_UMA_PIN_CAP=0 keeps the RAM budget as set (any other value, or unset, leaves the cap on);
the line names it: "(STRATA_UMA_PIN_CAP=0 keeps the RAM budget as set)". The register entry is
now status rollback with the measured points in its note, and docs/BATCHING.md has one sentence
where the memory per slot is described.
2026-11-12 20:00:01 +01:00
Niko1221 3a25581693 [Engine] Strix Halo: cap the pinned RAM copy of experts when --batch slots pin their K/V
With --batch 4 at 131,072 tokens on a Strix Halo (UD-Q4_K_XL, the usual 38 GiB RAM
budget) the engine stopped inside the prompt path's allocation, and with an 18 GiB
budget the OS ran out of page-locked memory. Every session (the main one and each
slot) pins its streamed K/V for the whole context, 1.55 GiB at 131,072 tokens, and the
RAM copy of experts is pinned on top of that.

Now, with --batch 2 or more on this path, the RAM copy is cut to what leaves the RAM
copy plus the sessions' pinned K/V at 22.75 GiB, the level of the largest 4-slot start
that worked (15 GiB of experts, 7.75 GiB of K/V). The experts left out are read from
the SSD when needed. Context, slot count and the 16,384-token prompt chunk are
untouched; --batch 1 does not enter the code. The engine says so in one line, and
after a real init failure with 2 or more slots it names --batch N-1.

Measured on the box (4 slots, 131,072 tokens, 15 GiB): starts and serves, 49.2
tok/s inside the batch windows against 56.4 with the whole copy at a 65,536 context;
the 2,067-token prompt reads at 837 against 1,054 tok/s. 3 slots and below are not
changed: their RAM copy plus K/V is at or under the level.

The constant and its measured starts are in include/strata/core/uma_cache.hpp.
STRATA_UMA_PIN_CAP (test only, register status research) turns the cap off.
2026-11-12 19:41:47 +01:00
Niko1221 4d958fbdbf nv_defaults, docs: the start-up line about K-quant experts says what happens on the card; the QUANTS.md row names the fused kernels
The line apply_nv_kq_default prints at every NVIDIA start of compute capability 8.0 and up said that a model with K-quant experts reads its
prompt on llama.cpp's MMQ kernels.  With the previous commit that is no longer true on the cards the fused K-quant default takes.  The call
now gets one more argument: whether Strata's own kernels read the K-quant experts on a visible card, from the new nv_kq_fused_here(major,
minor, SM count), which is fused_tile::kq_takes with the switches the engine reads (STRATA_PF_FUSED=0, STRATA_PF_FUSED_KQ, STRATA_PF_FUSED_SM40,
STRATA_PF_FUSED_SM86).  Where it is true the line reads

  strata: a model with K-quant experts (Unsloth UD-Q4/Q5/Q6_K_XL) reads its prompt on Strata's own kernels where they cover the layer (Q4_K and
  Q5_K gate/up with a Q5_1 or Q8_0 down) and on llama.cpp's MMQ kernels for the rest (STRATA_PF_FUSED_KQ=0 gives all of them back to MMQ)

and where it is false the earlier line, byte for byte.  generate.cpp asks every visible card and says it if any of them takes the kernels.
The line is printed as before: only when STRATA_MMQ_KQ was set by this default.  src/core/nv_defaults_test.cpp checks both texts and the
card answer for the named cards, the way-back switches and the opt-in.

docs/QUANTS.md, row "Q4_K (gate/up)", column "CUDA prompt" (the Q5_K and Q5_1 rows say "as Q4_K"): names the fused kernels and the way back.
docs/SETTINGS.md is generated from the register and is not regenerated here.

Evidence for the 40 to 79 SM clause (RTX A4000, sm_86, 48 SMs, one layer of Flash-Next's shape, the staged 128-row tile the rule picks, MMQ ms /
fused ms at 300 / 1,000 / 2,048 / 4,096 / 8,192 / 20,000 tokens): Q4_K / Q5_1 1.67 1.44 1.49 1.35 1.05 0.97, Q4_K / Q8_0 1.79 1.61 1.67 1.46
1.08 0.98, Q5_K / Q8_0 1.72 1.59 1.60 1.45 1.05 0.99; the 64-row tile is slower at every size (0.60 to 1.37); the output bits hash is equal at
every tile.  No end-to-end row exists on a card of 40 to 79 SMs with a K-quant set.
2026-11-12 19:09:03 +01:00
Niko1221 8ce488608d Small-card prompt path: keep the switch helper out of the CUDA kernel headers
small_card_kernels_on() moves from core/sm120_series.hpp to
prefill/pf_fused_override.hpp (strata::prefill), next to the other reader of the
small-card override. sm120_series.hpp is byte-identical to its state before the
previous commit again, so none of the CUDA kernel translation units under src/kernels/cuda sees
a changed header. Behaviour is unchanged: same rule, same defaults, same way back
(STRATA_PF_SMALL_FUSED=0). generate.cpp and the unit test call the function in
its new place.
2026-11-12 17:29:24 +01:00
Niko1221 6d7a183f0c Small-card prompt path: the native fused expert kernels run by default (CUDA)
On one CUDA card whose expert cache is small (default prompt chunk under 8,192
tokens, native pack) the prompt path reads in MMQ's buffer layout so that the
layer-major walk runs. Inside that layout the native fused expert kernels
(the layer-major walk's groups and the streamed chunks) now run too, instead of
MMQ's kernels, by default.

On that path an unset STRATA_PF_FUSED reads as 1 in fused::native_supported
and fused::requested() (pf_fused_env_effective), so the kernels take every
format they cover on the card; K-quant, Q8_0 and the other formats keep their
own switches. The reading applies only while the small-card rule has fired in a
CUDA build (pf_fused_override() == kPfFusedKernelsOnly); a card where the rule
does not fire, a HIP build, and a user who named STRATA_PF_FUSED behave as
before.

STRATA_PF_SMALL_FUSED=0 is the way back (MMQ's kernels on that path, as
before); STRATA_PF_SMALL=0 still turns the whole rule off. The log line says
"so prompts are read the way that suits a card with little memory" in place of
"with the unfused experts". Unit test over the card sizes of the measured
grid; register entry STRATA_PF_SMALL_FUSED with status rollback.
2026-11-12 15:34:50 +01:00
Niko1221 466626cbb7 Merge f-int-tidy 4e9dde87e into f-p4-int (conversation tests in the CPU check preset, packer probe without bytecode, a per-architecture spill-guard baseline, a log line for a driver GPU pause between requests on AMD under Linux)
f-int-tidy = bb1bdb4da + 46b3013f9 (conversation cache and park pool tests ON in the cpu-check preset, +8 tests), ab38d9298 (the packer's import
probe writes no bytecode, +3 tests), 02020478b (a dead "multi" check removed from serve/server.py), 6f1613cc1 (tools/cuda_spill_baseline.json: the
known spill violations per architecture, +24 tests), f55afa152 and 4e9dde87e (the owner-approved log line "the graphics driver paused the GPU for
N ms between requests ..." on AMD under Linux, gpu_pause_time.hpp and three call sites in generate.cpp). Merged with the integrated-graphics
arrival before it; generate.cpp merged without a conflict, nothing changed by hand.
2026-11-12 11:38:55 +01:00
Niko1221 0ee2639926 integrated gfx11 on Linux: the engine gives the model files' cached pages back while and after it reads the expert arena
On a Radeon 780M (gfx1103) under Linux the expert arena (31.6 GiB of the Q2_0 pack) is filled with buffered reads of experts.bin and registered
with the driver (a KFD userptr). The GPU's own buffers take about 12 GiB of the same RAM, and the file cache of the model files the start read
fills most of the rest: MemFree 1.6-2.4 GiB and Cached 6.9-7.6 GiB at READY. With that little free memory, broken into small blocks, the
kernel's proactive compaction (kcompactd, fragmentation score above its high mark) scans and migrates the node's pages in passes: one right
after the fill and, when a pass made no progress, the next one 32 s later (500 ms << COMPACT_MAX_DEFER_SHIFT). A pass that moves pages of the
registered arena makes KFD evict the process's queues, and the gc 11 MES firmware never answers the eviction while a dispatch sits in a barrier:
the late stalls of an 8K prompt (30-50 s after READY) that the wait before READY does not reach.

Passive starts (no request) under a g++ load, settle build, 100 s of idle after READY, the daemon's scan counters read once a second: late
compaction passes in 3 of 8 starts (one of them evicted the idle engine's queues, evicted_ms +434 ms); the three have compact_daemon_migrate_scanned
moving with compact_stall, compact_daemon_wake and the kswapd counters flat (proactive compaction). In the failing starts of the 8K prompt
arm (b) the first late pass came 31-34 s after the end of the fill, in all four.

The engine now asks the kernel to drop the cached pages of the model files: posix_fadvise(DONTNEED) on each 8 MiB chunk of experts.bin right
after it has been copied into the arena (drop behind), and once per file after the load: the arena's expert files, the pack's dense.bin and
embd.bin, the GGUF shards of --native except the PLE table's (its rows are read directly). It is advice for clean pages: a file that is still
mapped keeps its mapped pages, a failed call is ignored, nothing is written or deleted. Nothing reads these files after the load but the
session fingerprint (the first and last 2 MiB of each model file) and an engine restart, which reads them from the drive again. Automatic on the
class of the huge-page and wait-before-READY rules (igpu_cache_drop_default: integrated gfx1103 / gfx1150 / gfx1151 under Linux); Windows,
discrete cards and every other device are unchanged. STRATA_NO_ARENA_CACHE_DROP=1 turns it off (research / A-B only, registered as research). One
[DRAFT] log line after the load says how much was given back and how long the final call took.

The harness version of the final call (posix_fadvise DONTNEED on experts.bin, dense.bin, embd.bin and the native shard right after the line
"expert arena read"), same passive starts: late passes 0 of 8, MemFree at READY 8.4-9.3 GiB (1.6-2.4 GiB without), free 2-4 MiB blocks at
READY 0.8-3.3 GiB (0.01-0.25 GiB without), READY 23.8-24.6 s (23.7-26.4 s without), the call 0.51-0.55 s. Loaded starts of the finished change
(g++ load beside the start, first request at READY + 0 s, 2K and 8K prompts, early in a boot, one Radeon 780M box): 9 of 9 passed with the
give-back, 10 of 14 with STRATA_NO_ARENA_CACHE_DROP=1.

Tests: tests/core/page_cache_drop_test.cpp (the flag and the switch, a range and a whole temporary file, every error path ignored, the final
call over a mixed list, the meminfo reader, the draft line) and the device rule in src/core/arch_defaults_test.cpp; settings register: one
hand-added entry (STRATA_NO_ARENA_CACHE_DROP, research).
2026-11-12 11:13:18 +01:00
Niko1221 8f6393a373 integrated AMD GPU under Linux: wait until the kernel has stopped moving the registered arena before READY
On a Radeon 780M (gfx1103) under Linux the engine registers its 31.6 GiB expert arena with the driver (a KFD userptr). The load
that fills it keeps the kernel moving pages (compaction, reclaim) for about two seconds after the engine is up. Every move inside a
registered range makes KFD evict the process's GPU queues, and the gc 11 MES firmware never answers the eviction while a dispatch
sits in a barrier: the driver resets the GPU and the first prompt ends in "unspecified launch failure" (60 s hang). The kernel log
of every failed start shows the same sequence (MES failed to respond to REMOVE_QUEUE, Failed to evict queue, Failed to quiesce KFD
in most, GPU reset begin).

Before it prints READY the engine now waits until its own KFD eviction counter (/sys/class/kfd/kfd/proc/<pid>/stats_*/evicted_ms,
the milliseconds the process's queues spent evicted) has not moved for 2 s, at most 10 s. Where the counter cannot be read (no such
file, another kernel, a container with its own pid namespace) it waits nothing and prints nothing. No user setting and no line a
person sees. The device class is the one of the huge-page rule: an integrated gfx1103 / gfx1150 / gfx1151 under Linux
(igpu_kfd_settle_default); Windows, discrete cards and every other device are unchanged. STRATA_NO_KFD_SETTLE=1 turns it off (a
research switch for A/B runs, registered as research).

Measured on one Radeon 780M box (Q2_0 pack, Linux kernel 7.0, one engine at a time, setup's environment, 2K and 8K prompts):
- g++ load beside the start, first request right after READY: 3 of 10 starts passed (5 failed in the first seconds after READY).
- the same load, the harness sending the first request 30 s after READY: 5 of 5; waiting until the counter had been quiet for 2 s
  (waits 2.0-3.4 s, mean 2.4 s): 8 of 10; the failures of the first seconds went from 5 of 10 to 0 of 15. The counters show the
  movement ending within about 2 s of READY and nothing after.
- the engine's own wait, quiet, build with and without STRATA_NO_KFD_SETTLE=1: READY 23.0-23.5 s against 21.1-21.3 s (+2.1 s), speed
  unchanged within the spread; quiet starts with the wait: 9 of 9 passed.
Late stalls inside a long prompt (layer 17-25 of an 8K pass, 30-50 s after READY) are a different class and are not addressed here.

Tests: tests/core/kfd_settle_test.cpp (the counter file missing, unreadable, garbage, a counter that moves, a counter that is quiet, the
cap; the folder reader on a temporary folder; the engine's call with the flag down) and the device rule in
src/core/arch_defaults_test.cpp; tools/check cmake-cpu on a Linux CPU runner: 75 passed, 0 failed (kfd_settle_test, arch_defaults_test and
stream_watch_test among them); tools/test_settings_register.py 8 OK, settings_register.py --check clean (one hand-added entry).
2026-11-12 11:13:17 +01:00
Niko1221 0a17fb99e2 integrated gfx11 on Linux: the registered expert arena asks for no transparent huge pages
On a Radeon 780M (gfx1103) under Linux the engine registered its 31.6 GiB expert arena and asked for transparent
huge pages on it whenever enough free 2 MiB blocks existed. Huge-page compaction and collapse inside a registered
range invalidate it; KFD then evicts the process's queues, and the gc 11 MES firmware resets the GPU when a dispatch
sits in a barrier. The prompt then ends in "unspecified launch failure". One Radeon 780M box (Q2_0 pack, Linux kernel 7.0), one engine at a
time: huge pages requested in 9 starts, 8 failed in the first prompt; not requested in 3 starts, 3 ran.

Setup already wrote STRATA_NO_ARENA_THP=1 for its 780M opt-in. This makes it the engine's own rule, detected from
the device (integrated, and gfx1103, gfx1150 or gfx1151), on Linux only. No new setting: STRATA_NO_ARENA_THP unset
lets the engine decide (this rule, and every other device as before); any value but 0 skips the request as before;
0 now asks for the huge pages, also on these GPUs (it used to skip them like any other value). The SYCL arena reads
the variable the same way. Windows and discrete cards are unchanged. The arena line's new ending is a [DRAFT] for
the owner's wording. Unit test: arch_defaults_test (the device rule and the variable's three states).
2026-11-12 11:12:08 +01:00
Niko1221 f55afa1521 serve: log a driver GPU pause that happens between requests (AMD on Linux)
The paused-GPU counter of the AMD driver was read only when a request began and when
it ended, so a pause between two requests, or while the engine sat idle after READY,
showed in no line. The engine now also reads the counter at READY and when each request
ends (whichever way it ends), and when the next request begins it prints one line if
the counter moved by 100 ms or more in between:

  strata serve: the graphics driver paused the GPU for N ms between requests while Linux moved memory the GPU uses

The bar is the one the per-request line uses. A failed read leaves no mark, so two
unrelated counters never make a gap, and a counter that went back prints nothing. The
begin-of-request read is the one that was already there; the other builds (no HIP, not
Linux) read nothing. Diagnostic only: no new setting, no change to any existing line.

gpu_pause_time_test gains the line's cases and a sequence test of the bookkeeping
(GpuPauseIdle).
2026-11-12 10:44:10 +01:00
Niko1221 62b6a47ea4 [Engine] Tesla P100: the rule for the FP16 prompt path with few-row experts as the default (not switched on yet)
On a Tesla P100 (compute capability 6.0, the STRATA_EXPERIMENTAL_SM60 build) the
prompt experts will take the FP16 path instead of MMQ, with the few-row experts
of the previous commit on the quantized grouped kernels. The rule is in
include/strata/prefill/gp100_prompt_default.hpp (gp100_prompt_default_test): only
with STRATA_PREFILL_MMQ unset (an explicit value keeps its old meaning), every
visible CUDA card compute capability 6.0, and none of STRATA_MMQ_WS=1,
STRATA_EXPERT_NIBBLE=1 and --peer-device (the prompt peer computes on MMQ only;
generate.cpp records the flag). prefill.cpp gp100_fp16_default() evaluates it
once; mmq_plan() takes it and the manifest names the reason; the few-row switch
STRATA_PF_FEWROWS takes it as its default.

kGp100Default in the header is false in this commit, so nothing changes yet: the
next commit sets it true. Settings register: STRATA_PREFILL_MMQ's read sites.
2026-11-12 08:57:08 +01:00
Niko1221 07f611c755 Merge f-agent-cap 33648fef1 into f-p4-int (STRATA_SERVE_STOP_SKIP, default on: a decode window that finishes after the server's STOP is dropped whole)
One commit on 5aa7f1d88 (in this branch). Owner: OK to take it (11-12). Lane gates as relayed: cmake-cpu 78 / 0 / 4, device code 3,852 functions
identical on sm_86, decode speed ratio median 0.998, stop turns left with unreturned tokens 49 of 56 -> 37 of 56, cap rows 0 of 19, pipelined
stop turns identical 18 of 18 on / off. No conflict, nothing changed by hand.
2026-11-12 08:33:02 +01:00
Niko1221 33648fef1e serve: a decode window that finishes after the server's STOP is dropped whole
When the server ends a pass (a stop string, a client that left, a repeat or loop stop) it sends STOP and throws away every token that comes after it. The engine
sees STOP only at the end of a window, so the window that was running had already committed its rows: the session ended one or two windows past the tokens the
client was sent, and the next request of the conversation could not continue from it (the state is recurrent and cannot be cut back) and fell back to the newest
checkpoint, reading the cut reply again.

A window that finishes with STOP already set is now neither committed nor printed, in the serial loop and in the pipelined loop (a front stage that the speculative
window ran on goes back to the snapshot taken before the dropped window, with no replay). Not dropped: a merged window, the request's first window, and a window
whose state the one-token path advanced itself (Verifier::commit_deferred()). A request that ends by its cap or by EOS never sets the flag and takes the path it
took before; the cost in the loop is one flag read per window. The tokens a client receives do not change: the rows dropped were never sent.

STRATA_SERVE_STOP_SKIP=0 turns it off (research switch, on by default; register entry added). The decision is a pure function in serve_stop_bound.hpp with a unit
test (decision table and a ledger of the loop).

Part of lane AGENT-CAP (candidate C).
2026-11-12 05:52:51 +01:00
Niko1221 a46c667cc0 Merge f-park-pool ef371eba8 into f-p4-int 2026-11-12 02:36:27 +01:00
Niko1221 ef371eba84 park pools: the segment pool is min(2 GiB, a quarter of the cache) (measured: 55K-token park 283 ms with 1 GiB, 117 ms with 2 GiB)
l620, 11-12, three runs per arm: with the arena at min(1 GiB, B / 8) the park of a
new 55K-token conversation beside three older parked ones stays at 283-291 ms
(K/V resize 205-213 ms: the arena is full of the older images, 47 misses of 372
allocations); with 2 GiB (a 16 GiB cache) it is 117-118 ms (K/V resize 41-44 ms).
Parks up to 20K are the same with either (35-59 ms).

Sizes now (park_pool_policy.hpp): segment pool min(2 GiB, B / 4) in 64 MiB steps,
none under 128 MiB; ready checkpoints as many as fit in B / 12, at most 4. At the
automatic cache sizes: ~8 GiB free RAM -> 2 GiB cache -> 512 MiB + 1 ready;
~12 GiB -> 3.75 GiB -> 960 MiB + 2; ~20 GiB -> 7 GiB -> 1792 MiB + 4; 40 GiB or
more -> 8 GiB -> 2048 MiB + 4. At most a third of the cache is held idle (30% at
8 GiB, 2.4 GiB); it is given back first (before any parked conversation is
evicted, before the RAM floor), and filled only while the cache budget and the RAM
floor plus 1 GiB leave room. Unit tests: the sizes at 8 to 200 GiB free and small
explicit caches.
2026-11-12 00:57:11 +01:00
Niko1221 01e21ef20e engine: the park pools are on by default (a diagnostic switch turns each off), sized from the conversation cache
Owner's go 11-11: the segment pool and the checkpoint pool with ready
checkpoints are on unless switched off. No user setting: STRATA_PARK_SEGPOOL_MIB=0
and STRATA_CKPT_POOL=0 are diagnostic switches, a value you set is kept.

Sizes (park_pool_policy.hpp, from the conversation cache's budget B): segment
pool min(1 GiB, B / 8) in 64 MiB steps, none under 128 MiB; ready checkpoints
as many as fit in B / 12, at most 4. At the automatic cache sizes: ~8 GiB free
RAM -> 2 GiB cache -> 256 MiB arena + 1 ready; ~20 GiB free -> 7 GiB cache ->
896 MiB + 4; 40 GiB or more free -> 8 GiB cache -> 1 GiB + 4. At most 21% of the
cache is held idle. Cache off: no pool.

Idle memory is accounted in the cache's budget (arena resident bytes no image
uses, plus the kept checkpoints) and given back before any parked conversation
is evicted (ConversationCache::make_room), before the park's physical-RAM
checks refuse or skip (shrink, then release_free_heap, then evict), before a
session save or load, and the top-ups run only while the budget and the RAM
floor plus 1 GiB leave room.

What the default means per OS and build (not the same everywhere, on purpose):
  * Linux CUDA / HIP: both pools on.
  * Windows CUDA / HIP: the checkpoint pool on; the segment pool is NOT created
    (its OS layer, VirtualAlloc + pre-touch, is not written; reserve() returns
    nothing and the arena is inert) until that exists.
  * macOS (Metal build): neither is on by default (not gated there).
  * A layer-split serve (several stages): the checkpoint pool is not on by
    default (as READY never applied to it); the segment pool is.

Tests: park_pool_policy_test (sizes at 8, 12, 20, 40, 200 GiB free and small
explicit caches), the existing pool and cache tests.
2026-11-11 23:40:35 +01:00
Niko1221 291b91025e Merge f-agent-turn b92075d92 into f-p4-int 2026-11-11 21:55:57 +01:00
Niko1221 8f4a2e0af8 engine: STRATA_PARK_SEGPOOL_MIB, a research switch for the segment pool (off unless set)
With STRATA_PARK_SEGPOOL_MIB=N and a conversation cache, the serve loop reserves
min(N MiB, an eighth of the cache) once, installs it as the process-wide segment
pool, hooks it into the cache's budget (idle bytes counted, given back first)
and starts the background filler, which makes the arena resident while the cache
budget and the RAM floor plus 1 GiB leave room. The park's physical-RAM check
shrinks the pool before it releases the heap or evicts a parked conversation, and
every park kicks the filler to top the pool up again. Unset: no pool is created,
no thread is started, the code path is the one before. Trace lines only under
STRATA_PARK_TRACE. Registered as "research" in data/settings-register.json.
2026-11-11 21:55:53 +01:00
Niko1221 9b7a1d84ff Merge f-ok-reader 4c8faae99 into f-own-int
One conflict, CMakeLists.txt: both sides add a ctest block at the same spot of the
STRATA_BUILD_TESTS list (main's gpu_pause_time_test, f-ok-reader's reader_room_test).
Resolved by keeping both blocks, the existing one first.
2026-11-11 21:30:14 +01:00
Niko1221 436ff36438 Merge f-repeat-default 6e4afbbc9 into f-own-int
One conflict, data/settings-register.json: two "line" values of generated read sites
(STRATA_MTP_BATCH_F16 in src/prefill/prefill.cpp, STRATA_SERVE_STOP_BOUND in
src/program/generate.cpp, whose backend field on the other side was still the old "hip",
before the stop bound went to every backend). Both resolved to the f-own-int side; the file is
not regenerated (the register's line numbers are informational; tools/settings_register.py
--check passes on the merged tree).
2026-11-11 21:30:00 +01:00
Niko1221 01d0646fdb Merge f-agent-turn 77c344bdd into f-own-int 2026-11-11 21:28:51 +01:00
Niko1221 b92075d924 serve: the thinking budget's hold on --batch engines (BGEN slots)
P2 ended the budget's first pass exactly at the budget for a solo request; a --batch engine kept the old behaviour (the server sent no hold to it), so there the second pass still read the whole reasoning again in 8-9 of 21-24 budget turns (p1004, --batch 2: base 9 of 24, head 8 of 21, PERF-AUDIT's R9700 and l620 runs the same shape).

Engine (src/program/generate.cpp, include/strata/core/serve_stop_bound.hpp): a slot carries the hold (SlotHold: on / n / id). BGEN hold=N:ID is parsed by the GEN path the admission runs; at the handover the slot takes the hold unless the admission's one token was </think>, and an admission whose hold is that one token ends there (DONE hold, no slot). In the slot windows the rows a window may commit stop at the hold (slot_cap(), in the MTP window, the pipelined MTP window's proposal count and the DFlash2 draft count), a slot ends with BDONE hold after exactly N emitted tokens unless ID was emitted first, and its sessions then hold exactly the tokens it fed, as in the solo case. The cap is the conservative one for a window that might emit ID: it stops at the hold and the next window goes on. READY says "stop hold holdb"; "holdb" is a protocol token only (no user-visible line, no setting).

Server (serve/server.py): the budget sends the hold to a --batch engine only when its READY says holdb (can_hold_batch); generate_batched adds the key per leg with the tokens the pass has already sent taken off (a solo leg promoted to a slot continues with hold=N-k, none once </think> was sent), and a leg that ends with finish "hold" ends the pass.

Tests: tests/core/serve_stop_bound_test.cpp (slot windows of changing width against a per-token reference over a whole reply: 75,360 cases; same tokens, same finish, no row committed past what was emitted, the hold ending at exactly N unless ID came first); serve/test_thinking_hold_batch.py (a fake --batch engine with the hold: solo path, a request admitted into a slot, a solo leg promoted to a slot with the count falling, first-N tokens of the unheld reply for N = 1 ... 53, hold ended by its token); serve/test_thinking_hold.py (stub engine with holdb).

The slot-model case failed on its first run (first=0 hold=1 max_new=3 id_at=0: got 7777 101 103, reference 7777 101 102). The test model was wrong, not the engine: it read a window's rows with `produced`, which it increments while the window is emitted, so it skipped a row; the engine emits from fixed arrays (outb[first + j]). Fixed in the test with a base index; the engine code was not changed by that run.

Mixed versions, both covered: new server + old engine (an engine without hold, and one with hold but no holdb, get no key when they run --batch; the budget cuts and STOPs as before) in test_thinking_hold.py, and old server + new engine (the extra READY tokens change nothing it reads, a request without a key runs as before through the solo path and through a slot) in test_thinking_hold_batch.py. Real-engine cross runs of P2 (head engine + base server, base engine + head server) were done on p1004 before this commit.

Lane AGENT-TURN, P2b.
2026-11-11 21:22:34 +01:00
Niko1221 f7ea7005c1 Merge f-spark-s2 a5104df5b into f-own-int 2026-11-11 20:13:43 +01:00
Niko1221 4c8faae99d engine: keep the picture reader's room in the reserve in the resident RAM mode
In the resident RAM mode (--resident-experts, --resident-budget-gib, which
setup writes for Unsloth's UD-Q4_K_XL below about 71 GB of RAM and for the
low-RAM mode, or the start's own fallback when RAM is short for the arena)
the expert cache refuses the server's VRAM command ("VRAM: not with the
resident low-RAM mode"). With the on-demand reader and only setup's 700 MiB
reserve, the reader then found about 425 MiB free and every picture went to
the processor reader: 7.67 / 6.15 / 1.49 / 1.43 s against 2.06 / 0.93 /
0.41 / 0.37 s with the room held back (l620, IQ3_S, card held to 32 GB,
--resident-budget-gib 40).

The engine knows that mode before it sizes the cache, so there it keeps the
reader's 2,048 MiB in the reserve (strata/core/reader_room.hpp, applied
once after the arena / file pass loop, before the cache is sized; the mode
is not entered later). Only an engine with --vision, --vram-elastic,
--serve and the resident RAM mode changes; a larger reserve is never
lowered. One engine log line says it; no setting, nothing for the user.

Gate on l620 (same setup, 3 starts each, alternating):
- new default with the rule: the reader on the card in 3 of 3 starts
  (1,509 MiB), 12,068 slots, pictures 2.06-2.45 / 0.91-1.08 / 0.39-0.59 /
  0.37-0.55 s, text 1,714-1,722 / 3,867-3,882 tok/s at 2K / 8K;
- old default: the reader on the card in 3 of 3, 12,068 slots, pictures
  2.07-2.37 / 0.91-1.09 / 0.39-0.59 / 0.37-0.55 s, text 1,719-1,740 /
  3,873-3,889 tok/s.
Without the resident mode nothing changes: the same 12,719 slots, the same
answers to the same prompts and pictures, the shrink path as before, the
rule's line absent (one start each, engine before and after).

Test: reader_room_test (ctest; the rule's eight input combinations and the
larger-reserve case).
2026-11-11 17:04:23 +01:00
Niko1221 9a56a36250 generate: name the CPU expert pool on arm64 in the start log line
On arm64 every x86 CPU test is false, so the line read "ggml-cpu (older-CPU
build)" even when the pool is the Strata quant layer. Print, on arm64 only,
"[DRAFT] CPU expert kernels: the Strata quant layer (NEON)" when
STRATA_OWN_CPU_QUANT is defined and "[DRAFT] CPU expert kernels: ggml-cpu
(NEON)" otherwise. The x86 expression is unchanged. The wording stays [DRAFT]
until the owner words it (par/OWNER-WORDING-1111.md, ARM POOL).
2026-11-11 16:45:09 +01:00
Niko1221 fefaa985c1 Merge main c1ff07f1a into f-own-int 2026-11-11 16:44:44 +01:00
Niko1221 77c344bdd0 serve: the picture guard inside the replaced-reply rule; its log line marked [DRAFT]
live_tail_is_replaced_reply() takes the live branch's picture positions and answers "park as before" when one is at or past the resume point (unit case picture_at_or_past_checkpoint_parks in reply_branch_test, 16 cases); generate.cpp passes live_imgs' starts instead of checking them beside the call. Same behaviour: a chat request's reply holds no picture, so the guard does not fire from the chat API.
The engine log line of P3 now starts with "[DRAFT] " until the owner words it (par\OWNER-WORDING-1111.md).

Lane AGENT-TURN, P3 follow-up.
2026-11-11 16:27:28 +01:00
Niko1221 be101072ba serve: the thinking budget's hold (GEN hold=N:ID), so the wrap-up pass continues from the live session
At the thinking budget the server cut the stream, STOPped the engine and sent a second engine request: the same prompt + the tokens it kept + the wrap-up. The engine sees STOP only at a window's end and commits each window before sending it, so it often held one or more tokens past the cut; its live session was then not a prefix of the second request, which fell back to the checkpoint before the assistant turn, parked the live branch and read the whole reasoning again (lane PERF-AUDIT, R9700 0.1.59: 4 of 9 budget turns, 535 tokens, 849-1000 ms against 85-96 ms).

Engine: GEN key hold=N:ID ends the request after N emitted tokens unless token ID (</think>) came first; the commit is capped there (serve_hold_remaining() + serve_stop_bound(), tested against the emission loop in serve_stop_bound_test), DONE finish "hold", READY says "stop hold". Without the key nothing changes; an older engine skips the key.
Server: sends hold=<budget - thought>:<</think> id> (HOLD_KEY, its own key, never a client's) only to an engine that says hold in READY, has no --batch slots and is not a multi engine, and only when </think> is one token. At DONE hold it wraps up if the point is clean; if not (a character split across tokens, a tag held back) one more pass from the live session with a hold of the tokens left (at least one). The second pass then reads the last token and the wrap-up only. Tested with a windowed stub engine in serve/test_thinking_hold.py: the answer is the same with and without the hold for every budget; an engine that does not say hold gets no key; one that says it but ignores it gives the same answer.
--batch engines (BGEN slots) are a separate path: not covered here, no hold is sent to them.

Lane AGENT-TURN, P2.
2026-11-11 16:18:59 +01:00
Niko1221 a5104df5bf engine: the shared-memory page drop only in a Linux CUDA build, its line only when pages were given back
The block that gives the GGUF's cached expert pages back (generate.cpp, after the prompt path is set up) was under no
backend guard. cudaDevAttrIntegrated is true on AMD APUs under HIP (hipDeviceAttributeIntegrated) and on every Mac under
the Metal layer, the gfx906 layer has no such attribute, and Windows has no page drop, so on those builds the block either
ran ungated on a class it was not measured on, printed its line with nothing freed, or did not compile. The whole block
(call and log line) is now inside #if __linux__ && !STRATA_USE_HIP && !STRATA_HIP_GFX906 && !STRATA_GPU_METAL, and the
[DRAFT] line prints only when pages were actually given back. tools/test_uma_drop_guard.py checks that the call, the
setting's reads and the line all sit inside that guard. The register's two read lines follow the move.
2026-11-11 15:45:26 +01:00