Commit Graph
100 Commits
Author SHA1 Message Date
Niko1221 d877f150a0 prefill: scale the research switch-point rule per card
The floor from STRATA_SWITCH_POINT=1 now takes the cache mean blob, the
start-up link probe and the SM count (copy terms by blob / link, compute
terms by 1 / SM); the floor is the real crossing rounded down to the 256 grid,
and the CPU share limit of a card whose floor moved is floor x 1.6. An unknown
card (no probe) keeps 1,024. Research only, default off.
2026-11-13 02:29:07 +01:00
Niko1221 e84392acc0 prefill: research switch STRATA_SWITCH_POINT, the walk of a chunk by estimated cost
With STRATA_SWITCH_POINT=1 (CUDA builds, default off) the chunk size from
which a prompt chunk streams every expert the card does not hold is taken from
a cost estimate of the staged and the streamed walk, from the card's share of
non-resident experts, instead of the fixed 1,024. A card that holds every
expert keeps 1,024 exactly. STRATA_PREFILL_STREAM_MIN, the CPU share's limit
and the Windows gfx1151 floor keep precedence; the small-card walk is not
touched.

The rule is a pure header (switch_point_rule.hpp) with a unit test; the card's
counts reach it through Prefill::set_card_expert_share, called before the
first lend. Register entry: research.
2026-11-13 02:27:27 +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 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 27cf035e5c Merge f-amd-f16 8d7f997d4 into f-p4-int (the Radeon 780M on Linux reads its 16-bit prompt GEMMs FP16 in and out by default; the hyper-connection up-mix kernel has an FP16 path)
Three commits on 662e72ac2. With STRATA_HIP_PROMPT_F16=1 the fused hyper-connection up-mix (STRATA_HC_UPMIX, on by default on the 780M under Linux and in the Windows Strix Halo set) read the
FP16 activation images as BF16: forced-token KL 166 times that of the MMQ path, top-1 68.7%. The up-mix kernel now has an FP16 variant (new test hip_gr_upmix_parity: 20 BF16 and 6 FP16-io
sizes up to 8,192 tokens, error against FP64 1.6e-7 to 3.6e-7 of the largest value for the fused kernel, 6.2e-5 to 1.2e-4 for the FP16 pair), and a Radeon 780M (gfx1103, integrated, Linux)
now runs the prompt's 16-bit GEMMs FP16 in and out with nothing set. STRATA_HIP_PROMPT_F16=0 is the way back; =1 still works on any card. Every other chip, every discrete card and
Windows are unchanged, and nothing is printed for the default.

Measured on a Radeon 780M (Q2_0, 24 prompts of 2K tokens, 64 forced tokens each, the draft-cost table fixed): forced-token KL against the FP16 path, ratio to the MMQ path 1.091 [0.968, 1.231]
with FP16 io, top-1 97.5%; prompt speed ratio to nothing set 1.11 / 1.15 / 1.19 / 1.25 at 300 / 1,000 / 2,048 / 8,192 tokens (with the fused prompt kernels on top: 1.11 / 1.15 / 1.63 / 1.45).

The branch changes include/strata/core/arch_defaults.hpp and src/core/arch_defaults_test.cpp, which the earlier fused-default merge also changed at the same place; both sides are kept (the
fused-default declaration and test block first, the FP16-io ones after). The settings register is regenerated by its tool on the merged tree, with the hand-kept status (default) and note
of STRATA_HIP_PROMPT_F16 from the branch.
2026-11-13 00:08:40 +01:00
Niko1221 336b8089f4 docs: the DGX Spark's table sets six speed defaults, with the K-quant fused kernels; the QUANTS.md row and the register note name the Spark
DGX_SPARK_LINUX.md: the defaults table gets a sixth row for STRATA_PF_FUSED_KQ=1 (UD-Q4_K_XL prompt 1.10x at 2K, 1.26x at 4K, 1.18x at 8K, 1.53x at 20K, median of 10 paired runs), the heading and first line say six, and the paragraph on what the switches do to the answers gives the forced-token KL of the K-quant switch (0.895 times that of MMQ, interval 0.81 to 0.99; top-1 agreement 96.3% against 95.7%; the same text twice, byte for byte).

QUANTS.md: the Q4_K (gate/up) row says the Spark's defaults table sets the switch.

settings-register.json: the hand-kept note of STRATA_PF_FUSED_KQ names the DGX Spark (12.1); the generated fields follow the register tool.
2026-11-13 00:04:10 +01:00
Niko1221 75d91db5e2 prefill: the staged group entry for layers with no MMQ tile is the default on Windows gfx1151
On Windows, one gfx1151 card, with 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 the
long-prompt floor takes the staged walk's fused group entry with nothing set: only the routed experts stream and run on the fused kernels, instead of a
dequantize and two FP16 GEMMs per routed expert. STRATA_PF_STAGED_FO=0 turns it off (the previous floor rule of 64 tokens then applies again);
STRATA_PF_STAGED_FO=1 still asks for it on any card.

The floor rule now only decides between the staged entry and the long path: with the entry on the floor stays 1,024, with it off the class floor is 64
as before. The entry writes FP32 down rows (bit-identical to the long path run with STRATA_PF_DM16=0 at 256 and 768 tokens).

Strix Halo, UD-Q4_K_XL, prompt ms, median of 3: 96 tokens 1,601 -> 320, 256 2,293 -> 446, 768 3,189 -> 799, 1,000 3,646 -> 980; the long path takes 395 / 507 / 836 / 1,012.
The default needs the staged walk's resident-group gather and its group entry (STRATA_PREFILL_GROUP_GATHER, STRATA_PF_FUSED); without them the class keeps the floor of 64.
2026-11-12 22:39:59 +01:00
Niko1221 c77b8ef08e settings register: regenerated after the two K-quant merges
python tools/settings_register.py on the merged tree: the git stamps of the entries the two branches touched (the regeneration at the first merge ran before that
branch's commits were in the history), the new default read of STRATA_PF_FUSED_KQ in the GB10 table (engine_defaults: value 1, sm_121), and the line numbers
that moved when nv_defaults.cpp grew by seven lines. No hand-kept field changes. Run again, the tool changes nothing.
2026-11-12 22:19:06 +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 8d7f997d41 The Radeon 780M on Linux reads its 16-bit prompt GEMMs FP16 in and out by default
On a Radeon 780M (gfx1103, integrated) under Linux the engine now runs the prompt's 16-bit GEMMs FP16 in and out when the user
has not set STRATA_HIP_PROMPT_F16: "1" still turns it on on any card, any other set value (0) is the way back, and every other
architecture, every discrete card and Windows stay opt-in as before. The rule is prompt_f16_resolve
(include/strata/core/arch_defaults.hpp), used by prompt_f16() in src/prefill/gemm.cu; it needs integrated, not Windows and a
gcnArchName of exactly gfx1103 (the :sramecc / :xnack suffix forms included). Nothing is printed at start for the default; the
"FP16 in and out" line still appears when the variable is set to 1 and the gfx103x tip is unchanged. Not flipped elsewhere: a
Radeon AI PRO R9700 (gfx1201) is slower with it on (dense GEMMs x0.70 to x0.72), gfx103x has no run of ours on real activations,
the other gfx11 chips have no number.

It needs the two commits before it on this branch: with the FP16 prompt path the fused hyper-connection up-mix (on by default on
this card) read FP16 activations as BF16, which made the first measurement of this default wrong (forced-token KL 166 times the
MMQ path's); that is fixed and the up-mix now has an FP16 variant.

Measured on a Radeon 780M (Q2_0 pack, 3 interleaved rounds, prompt tok/s medians, nothing set -> FP16 io): 300 tokens 124.3 ->
138.5 (x1.114), 1,000 157.7 -> 181.7 (x1.152), 2,048 208.7 -> 248.9 (x1.193), 8,192 270.0 -> 337.8 (x1.251). Beside
STRATA_PF_FUSED=1: x1.111 / x1.152 / x1.628 / x1.450 against nothing set.
Quality, same card: forced-token KL against the FP16 path (24 prompts of 2,048 tokens, 64 forced tokens each, draft-cost table
fixed, repeat arms equal their first run byte for byte): 0.00593 against 0.00543 for MMQ (ratio 1.091, 95% CI 0.968 to 1.231),
top-1 agreement with the FP16 path 97.46% against 97.27%, no non-finite value. Not run: any other card; no second model.

This commit also updates the settings register entry of STRATA_HIP_PROMPT_F16 and the rows of docs/AMD_HIP.md and
docs/RADEON_780M.md.
2026-11-12 21:26:16 +01:00
Niko1221 37f0d8c688 prefill: research switch STRATA_PF_STAGED_FO=1, the staged walk's group entry for layers with no MMQ tile
A prompt chunk below the long-prompt floor runs the staged walk. For a layer that has no MMQ tile for its formats but that the fused kernels cover (UD-Q4_K_XL on
gfx1151 without STRATA_MMQ_KQ, and every layer of a build without llama.cpp's MMQ kernels) it has no fused entry: each routed expert runs a dequantize and two FP16
GEMMs. With STRATA_PF_STAGED_FO=1 such a layer takes the same batched group entry (fused::group_bounds + experts_native on the routed experts, each where it is) as a layer
with an MMQ tile does: fz_staged accepts a fused-only layer, the group-bounds block runs for it, and the staged ring is the grouped one (group_resident).

Off unless set, so nothing changes by default. The rule is a pure function in include/strata/prefill/staged_fo_rule.hpp with a unit test (staged_fo_rule_test);
register status research.
2026-11-12 21:15:00 +01:00
Niko1221 3c561badeb settings register: git stamps of STRATA_UMA_PIN_CAP
The register was regenerated while resolving the merge of f-strix-c4, before that branch's commits were in this branch's history, so the first/last
commit and date of STRATA_UMA_PIN_CAP were empty. Regenerated with tools/settings_register.py now: four generated fields, nothing else moves.
2026-11-12 20:31:02 +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 ab1917985e Merge f-strix-short f33e9fa7b into f-p4-int (Windows Strix Halo reads prompt pieces of 64 to 1,023 tokens on the fused kernels for a set whose layers have no MMQ tile)
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: STRATA_MMQ_KQ is
opt-in), a prompt piece below stream_all_min() (1,024 tokens) took the staged walk, which has no fused entry for such layers and ran every routed
expert on the dequantize-to-FP16 path: about 1.6 s a prompt whatever its length. The default floor for that set on that device class is now 64
(include/strata/prefill/stream_floor_rule.hpp, a pure rule with its own unit test, tests/prefill/stream_floor_rule_test.cpp), so pieces of 64 to
1,023 tokens take the long prompt path. Every other device class and layer set keeps 1,024, and a piece of 1,024 tokens or more is unchanged.
STRATA_PREFILL_STREAM_MIN set to any value replaces the floor; STRATA_PREFILL_STREAM_MIN=1024 is the way back. The engine says so once:
"prefill: prompt pieces of N tokens or more read on the fused kernels, as long prompts do. STRATA_PREFILL_STREAM_MIN=1024 keeps the old rule."

Measured on Windows gfx1151, UD-Q4_K_XL, fixed draft-cost table, 3 rounds, prompt ms before / after: 128 tokens 1,754 / 421, 256 2,266 / 515,
512 2,780 / 665, 768 3,141 / 838, 1,000 3,629 / 1,015; 1,100 and 2,048 unchanged (1,110 / 1,107, 1,765 / 1,753).

Both branches changed data/settings-register.json; nothing was changed by hand.
2026-11-12 20:27:48 +01:00
Niko1221 d1ec6f0397 prefill: the staged 40-79 SM class takes Flash-Next's K-quant experts on the fused kernels by default again (STRATA_PF_FUSED_SM40=0 and STRATA_PF_FUSED_KQ=0 give MMQ back)
This puts the 40-79 SM cards back into kq_takes for an unset switch, as the default commit had them: takes_by_default with its staged-launch clause (the K-quant
gate/up is a weight-staging instance and its Q5_1 / Q8_0 down is one the staged kernels were measured with).  The commit before this one took the class out because
its one-layer table is below MMQ at 20,000 tokens; the rule for a default here is that our own kernels take over where quality is kept, also when they are a little
slower at the largest size.  The evidence for the class:

- One layer of Flash-Next's shape on an RTX A4000 (sm_86, 48 SMs, CUDA 12.9, 128-row tile, one repetition), MMQ time / fused time at 300 / 1,000 / 2,048 / 4,096 /
  8,192 / 20,000 tokens: 1.67 / 1.44 / 1.49 / 1.35 / 1.05 / 0.97 (Q4_K / Q5_1), 1.79 / 1.61 / 1.67 / 1.46 / 1.08 / 0.98 (Q4_K / Q8_0), 1.72 / 1.59 / 1.60 / 1.45 / 1.05 /
  0.99 (Q5_K / Q8_0): ahead up to 8,192 tokens, 1 to 3% behind at 20,000.
- The staged K-quant fused path runs end to end on that A4000 in the Qwen3.6 engine.
- No end-to-end run of Flash-Next on a card of that size; the Qwen3.6 engine runs the same staged path there.

The commit undoes the one before it (kq_takes takes its SM40 argument again, the grid test, the start-up-line test, the register note and the docs/QUANTS.md row name the
RTX A4000 and RTX 5070 class again) and adds the numbers above to the comment of kq_takes.  Host code only.
2026-11-12 20:21:48 +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 df723eb5a1 prefill: the K-quant default stays on the cards with 80 or more SMs; the 40-79 SM cards keep MMQ unless STRATA_PF_FUSED_KQ=1
The previous commit let the 40-79 SM cards take the K-quant fused kernels with nothing set (through takes_by_default's staged-launch clause).  The only
measurement on such a card is one layer of Flash-Next's shape on an RTX A4000 (sm_86, 48 SMs, CUDA 12.9, one repetition, 128-row tile, which is what the
rule picks there): MMQ time / fused time 1.67 / 1.44 / 1.49 / 1.35 / 1.05 / 0.97 (Q4_K / Q5_1), 1.79 / 1.61 / 1.67 / 1.46 / 1.08 / 0.98 (Q4_K / Q8_0) and
1.72 / 1.59 / 1.60 / 1.45 / 1.05 / 0.99 (Q5_K / Q8_0) at 300 / 1,000 / 2,048 / 4,096 / 8,192 / 20,000 tokens: below MMQ at 20,000 tokens, and no end-to-end
run exists on a card of that size.  A default goes only where it was measured, so kq_takes now answers "80 or more SMs on an sm_86-class or sm_120 card" for an
unset switch and drops its SM40 argument; STRATA_PF_FUSED_KQ=1 still sets the kernels up on every sm_80+ card and =0 still turns them off.

Host code, a comment, the rule's grid test (now 4,824 combinations of the switch, the card flags and 0-200 SMs against its oracle, none yes below 80 SMs), the
start-up-line test, the register note and the docs/QUANTS.md row, which no longer names the RTX A4000 or RTX 5070 class.
2026-11-12 19:16:04 +01:00
Niko1221 492adfcbac Merge f-p4-small-default 8ce488608 into f-p4-int (small CUDA cards take Strata's fused expert kernels inside the small-card prompt path)
On one CUDA card with a native pack and a default prompt chunk under 8,192 tokens, the prompt path reads in MMQ's buffer layout so that
the layer-major walk runs. Inside that layout the native fused expert kernels now run too, instead of MMQ's kernels, by default: an
unset STRATA_PF_FUSED reads as 1 on that path only (pf_fused_env_effective), so the kernels take every format they cover on the card
(the i-quant gate/up formats with their covered downs, the Q2_0 pair); K-quant, Q8_0 and the other formats keep their own switches.
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. A card
where the rule does not fire, a HIP build, and a user who named STRATA_PF_FUSED behave as before. The log line of the rule says "so
prompts are read the way that suits a card with little memory" in place of "with the unfused experts". The second commit moves the switch
helper out of the CUDA kernel headers so the kernel translation units under src/kernels/cuda see no changed input.

Measured (RTX A4000 held to 8,000 and 9,000 MiB free, IQ2_XS): prompt speed fused / MMQ 1.000 to 1.050 from 300 to 20K tokens at 8,000
MiB, 1.000 to 1.042 at 9,000 MiB; forced-token KL fused / MMQ 1.024 (CI 0.929 to 1.156) at 2K and 1.105 (0.964 to 1.305) at 8K against a
floor of 1.000. Byte identity of the 2K set (24 prompts, draft-cost table fixed): nothing set equals the opt-in arm, STRATA_PF_SMALL_FUSED=0
equals the old default, and a card where the rule does not fire (12,000 MiB) is unchanged.

Merged onto this head. Both sides changed data/settings-register.json, src/core/arch_defaults_test.cpp and src/prefill/moe_fused_iq.cu
in different places; git merged them without a conflict and nothing was changed by hand.
2026-11-12 19:03:20 +01:00
Niko1221 9e3a36714d prefill: Flash-Next's K-quant experts are read by the fused kernels by default on the NVIDIA cards the i-quant default takes (STRATA_PF_FUSED_KQ=0 turns it off)
The owner's standing word of 11-12: our own kernels become the default wherever quality is kept.  Until now the fused K-quant path
(Q4_K / Q5_K gate/up with a Q5_1 or Q8_0 down: UD-Q4_K_XL's 48 layers) was opt-in with STRATA_PF_FUSED_KQ=1 and every such layer went to
llama.cpp's MMQ.  With nothing set a CUDA build now sets the K-quant kernels up on the cards fused_tile::takes_by_default takes, the rule the
i-quant default already uses: compute capability 8.0 / 8.6 / 8.9 (the sm_86 class) and 12.0 with 80 or more SMs, and the launches with a
weight-staging gate/up on 40 to 79 SMs unless STRATA_PF_FUSED_SM40=0 (the K-quant gate/up is such an instance, and its Q5_1 / Q8_0 down is one
the staged kernels were measured with).  Under 40 SMs, sm_121 alone (the DGX Spark keeps its own defaults table), compute capabilities below 8,
8.7, 9.0, HIP and the other formats (Q6_K, Q8_0 gate/up, Q5_0 downs, trellis) are as before.

The way back is STRATA_PF_FUSED_KQ=0 (a value that does not start with '1' counts as 0, the way STRATA_PF_FUSED is read); STRATA_PF_FUSED=0 and
STRATA_PF_FUSED_SM86=0 turn the layers back to MMQ as for every fused layer; STRATA_PF_FUSED_KQ=1 keeps taking every sm_80+ card.  The rule is
one more pure function in fused_tile_rule.hpp, kq_takes(kq_env, card, sm40_env), which dev_info calls where it used to ask for the switch.
The Qwen3.6 engine sets STRATA_PF_FUSED_KQ=1 itself and keeps its own rule (q36_takes), so its cards and bits are unchanged.  Host code only:
no kernel, tile or prompt-path file is touched.  The tile for these launches is the previous commit's.

tests/prefill/fused_tile_rule_test.cpp: 14,472 combinations of the switch (unset / 0 / 1), the SM40 switch, the three card flags and 0-200 SMs
against an oracle written from the sentence above (0 wrong; 2,178 yes at 80+ SMs and 480 at 40-79 with the switch unset), the named cards
(A6000, A40, A100, RTX 4090, PRO 5000, RTX 5090 on; A4000 and RTX 5070 on and off with the SM40 switch; GB10, 20 SMs, Turing, Hopper off),
the compute capabilities, and the same answer as takes_by_default for a staged gate/up with a staged down.

data/settings-register.json: the STRATA_PF_FUSED_KQ entry is a rollback switch now, with the new note.  The log line of nv_defaults.cpp and the
documentation rows that say the K-quant experts read their prompt on MMQ follow in a separate commit once their words are settled.
2026-11-12 19:02:03 +01:00
Niko1221 6239e233a8 prefill: fused-only layer sets read chunks of 64 tokens or more on the streamed walk (Windows gfx1151)
A chunk below stream_all_min() (1,024 tokens) takes the staged walk. For a layer set in which every layer has no MMQ tile and the fused kernels take it (UD-Q4_K_XL on
gfx1151: STRATA_MMQ_KQ is opt-in), the staged walk has no fused entry (fz_staged needs use_mmq) and runs every routed expert on the dequantize-to-FP16 path: about
1.6 s a prompt whatever its length. Measured on Windows gfx1151, UD-Q4_K_XL, head 4e1e5f248, fixed draft-cost table, 3 rounds, prompt ms before / with the streamed walk
(STRATA_PREFILL_STREAM_MIN=64): 128 tokens 1,754 / 421, 256 2,266 / 515, 512 2,780 / 665, 768 3,141 / 838, 1,000 3,629 / 1,015; 96 tokens 1,581 / 393; 1,100 and 2,048
unchanged (1,110 / 1,107, 1,765 / 1,753).

The default floor for that set on that device class is now 64 (include/strata/prefill/stream_floor_rule.hpp, pure and unit tested; the class test and the layer-set
test are separate so the rule can be widened by one line). STRATA_PREFILL_STREAM_MIN set to any value replaces the floor, 1024 restores the old rule. Every other
device class and layer set keeps 1,024. The settings register entry of STRATA_PREFILL_STREAM_MIN is now a rollback.
2026-11-12 18:54:49 +01:00
Niko1221 69394994a9 Integrated Radeon GPUs on Linux read long prompts on Strata's own int8 expert kernels by default
On an integrated gfx11 GPU under Linux (Radeon 780M / 760M gfx1103, 890M / 880M gfx1150, Strix Halo gfx1151) the engine now
sets STRATA_PF_FUSED=1 at start when the user has not set it, so the prompt experts run on Strata's fused int8 kernels instead
of llama.cpp's MMQ. Nothing is printed at start; the prefill's own "prompt experts on the fused int8 kernels" line appears
once the kernels are taken. STRATA_PF_FUSED=0 is the way back to MMQ (a value the user set is always kept). Discrete cards,
computers that also hold a discrete card, and Windows are not touched: the rule is igpu_fused_prompt_default
(include/strata/core/arch_defaults.hpp, src/core/arch_defaults.cpp), the same device class as the arena and settle defaults,
and it returns false for any non-integrated device and for Windows (the Strix Halo on Windows already has the switch in its own set).

Measured on a Radeon 780M (gfx1103, Q2_0 pack, 3 interleaved rounds, prompt tok/s medians, nothing set -> STRATA_PF_FUSED=1):
300 tokens 124.3 -> 124.3, 1,000 159.4 -> 159.5, 2,048 208.8 -> 270.4 (x1.295), 8,192 270.3 -> 304.2 (x1.125). The fused
kernels are not taken below the chunk size they need, so short prompts are unchanged.

Quality, same card: forced-token KL against the FP16 path, 24 prompts of 2,048 tokens, 64 forced tokens each, draft-cost table
fixed, repeat arms equal their first run byte for byte: mean 0.00595 with the fused kernels against 0.00543 with MMQ (ratio 1.096,
95% CI 0.926 to 1.367), top-1 agreement with the FP16 path 97.85% against 97.27%, no non-finite value. Positions 2 to 16 sit at
1.20 times MMQ's (CI 1.01 to 1.38), driven by one prompt.

Not run: gfx1150 and gfx1151 (they follow by the class rule). This commit also fixes the settings register entry of
STRATA_PF_FUSED (reads, defaults, doc lines) and the rows of docs/AMD_HIP.md, docs/RADEON_780M.md and docs/STRIX_HALO.md.
2026-11-12 17:31:37 +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 2fdee4aeb1 fused prompt kernels: the sm_86 rule class takes compute capability 8.0 and 8.9 as well
The CUDA fused prompt kernels' default rules were keyed on one flag that was true only for compute capability 8.6 (and 12.0 for the sm_120 part):
the 80+ SM default for the i-quant formats (IQ2_XXS, IQ2_XS, IQ2_S, IQ3_XXS, IQ3_S, IQ4_XS), the staged default of the 40-79 SM cards, the staged and
wide tile lines of pick(), and the Gyro-S default. A100-class (8.0) and RTX 40-class (8.9) cards run the same source as the 8.6 and 12.0 cards those
rules were gated on, and took MMQ instead.

s86_class(major, minor, off) in fused_tile_rule.hpp is true for 8.0, 8.6 and 8.9 (false for everything else, 8.7 and 9.0 included; false for all
when STRATA_PF_FUSED_SM86=0), and DevInfo::s86 in moe_fused_iq.cu comes from it. Nothing else moves: the 40-79 SM rule and its STRATA_PF_FUSED_SM40=0
way back, cards under 40 SMs and the small-card rule (MMQ as before), K-quant / Q6_K / Q8_0 / Q5_0 / Qwen3.6 fused (opt-in on every class), HIP
builds, sm_60 / 6.1 / 7.0 / 7.5. No kernel, tile table, log line or setting changes; the device code is the same.

No card of compute capability 8.0 or 8.9 has run these kernels here. The evidence is the 8.6 and 12.0 gates plus the same source compiled for sm_80
and sm_89 (the release packages carry sm_89 in both CUDA variants and sm_80 in the CUDA 12 variant).

The unit test fused_tile_rule_test gets the compute capability as an input: 12 capabilities x STRATA_PF_FUSED x STRATA_PF_FUSED_SM40 x
STRATA_PF_FUSED_SM86 x STRATA_SM120_PERF x 0-200 SMs x staged x down x 13 formats against an oracle written from the decision, the tile rule and the
Gyro-S default over the same capabilities, and the old rule against the new one for every capability but 8.0 and 8.9. Register notes of
STRATA_PF_FUSED_SM40, STRATA_PF_FUSED_SM86 and STRATA_PF_FUSED_TQ name the new class.
2026-11-12 13:06:33 +01:00
Niko1221 6d8e42886e integrated gfx11 on Linux: the owner's wording is final, the [DRAFT] marks come off the two log lines and the register note
The wording of the two engine lines and of the STRATA_NO_ARENA_THP register note is approved as it stood. This commit removes the
"[DRAFT] " marks and changes nothing else:
- the arena line's ending is "; huge pages not requested on this graphics chip";
- the give-back line reads "strata generate: the model files' cached pages were given back after the expert load: <X> GiB asked back
  during the read, <Y> GiB by the call after it (<N> ms); the file cache is <Z> GiB now (STRATA_NO_ARENA_CACHE_DROP=1 keeps it)";
- the STRATA_NO_ARENA_THP register note starts at "unset: the engine decides ...".
tests/core/page_cache_drop_test.cpp checks the new start of the give-back line; one comment in page_cache_drop.hpp lost its
reference to the wording list.
2026-11-12 11:44:41 +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 d59dc3e6fc Merge f-p4-fb-gate 0d6308de6 into f-p4-int (Tesla P100: the FP16 prompt path with few-row experts is the default instead of MMQ)
f-p4-fb-gate = 482c6beea + af5803e4b (few-row experts on the quantized grouped kernels, research switch), 62b6a47ea (the rule as the default, not switched
on yet), 56a659967 (test include) + 0d6308de6 (the flip: kGp100Default = true; owner approved dropping MMQ on Pascal with the remedy, 11-11). The lane's three
conflict resolutions against an earlier integration head are inside the branch; against this head (with f-p4-sm-s3 and f-p4-sm-default merged) the merge
needed none: settings-register.json auto-merged, CMakeLists.txt, fewrows.hpp, gp100_prompt_default.hpp, kernels.hpp / kernels.cu, prefill.cpp, generate.cpp and the
two new unit tests came in as the lane wrote them. Nothing changed by hand.
2026-11-12 10:26:57 +01:00
Niko1221 ef0fb17abf prefill: the staged fused path is the default on sm_86 / sm_120 cards with 40-79 SMs (STRATA_PF_FUSED_SM40=0 turns it off)
The owner said yes on 11-12 to the staged fused path as the default on 40-79 SM NVIDIA cards.  Until now it was opt-in
(STRATA_PF_FUSED_SM40=1, a research switch).  It acts exactly where the opt-in acted: CUDA builds, a card with the sm_86 or
sm_120 flag and 40 to 79 SMs, a gate/up kernel that is a weight-staging instance (IQ3_XXS / IQ3_S / IQ4_XS, sw_on) with an IQ4_NL
or Q2_0 down.  Everything else keeps today's behaviour: HIP builds (the branch is inside #if !defined(__HIPCC__)), cards under 40
SMs, cards with 80+ SMs (always on, as before), cards without either flag (sm_60, sm_80, sm_89, AMD), IQ2_XXS / IQ2_XS / IQ2_S
gate/up below 80 SMs, a down outside IQ4_NL / Q2_0, and the K-quant / Qwen3.6 pairs (the K-quant fused path stays opt-in).
STRATA_PF_FUSED=0 gives MMQ, =1 keeps its meaning.  The staged-blob fallback is unchanged.

The way back is STRATA_PF_FUSED_SM40=0 (a diagnostic like STRATA_PF_FUSED_SM86=0); unset and =1 both mean on.  No new setting,
no new log line.  The rule is two more pure functions next to takes_by_default / default_takes in fused_tile_rule.hpp: sm40_on(env)
and default_takes_env(env, card, sm40_env, gate_staged, down_ok, gu_type), which native_supported calls.  Host code only: no kernel,
tile pick or prompt-path change.  tests/prefill/fused_tile_rule_test.cpp: 752,544 combinations of STRATA_PF_FUSED (unset / 0 / 1),
the switch (unset / 0 / 1), the three card flags, 0-200 SMs, gate_staged, down_ok and 13 gate/up format ids against an oracle written
from the decision (0 wrong; 2,880 yes below 80 SMs, 52,272 yes at 80+), and the named cards (RTX A4000, RTX 5070: on, off with the
switch at 0; 39 SMs, a card without a flag, IQ2_XXS / IQ2_XS / IQ2_S, a non-staged down, Q4_K / Q5_K / Q6_K: off).  The register note
of STRATA_PF_FUSED_SM40 is rewritten as a diagnostic.

Evidence (RTX A4000, sm_86, 48 SMs, IQ3_XXS set, the 19 staged-pair layers on the fused kernels and 29 on MMQ, experts streamed over
PCIe at 11 GB/s, 5 interleaved rounds, fresh engine per arm): prompt time MMQ / fused 1.0004 / 1.0025 / 1.0278 / 1.0121 at 2K / 4K /
8K / 20K (fused faster in 5 of 5 rounds at 8K and 20K); teacher-forced per-position KL against the FP16 prompt path, fused / MMQ
0.930 [0.881, 0.988] at 2,048 ids and 0.973 [0.898, 1.057] at 8,192 ids (20 prompts x 256 positions; MMQ against itself 1.015 and
1.040).  One layer, real routing, MMQ / fused 1.59 / 1.34 / 1.19 / 1.07 (IQ3_S / IQ4_NL) at 2K / 8K / 20K / 32K.  The staged
kernels give the same output bits as the unstaged ones.  No end-to-end row exists below 48 SMs.
2026-11-12 09:46:49 +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 af5803e4be [Engine] Prompt FP16 path: few-row experts on the quantized grouped kernels (research switch, off)
On the FP16 prompt path every routed expert is dequantized to FP16 before its
two GEMMs, at about 104 us an expert on a Tesla P100 whatever its row count; a
short piece routes only a few rows to most experts and pays it for nothing.
With STRATA_PF_FEWROWS set (research switch, off unless set, "0" off) an
expert with 1..12 rows of a native pack (no APR) runs on
native_expert_grouped, the quantized kernels the verify window uses, on its GGUF
blob with q8_1 activations and no dequantize. A one-block kernel writes the
expert's plan record on the device. The rule and the switch are in
include/strata/prefill/fewrows.hpp (fewrows_rule_test); the streamed and staged
walk takes it, the layer-major walk is unchanged.

With the switch unset nothing changes except one added kernel
(fewrows_record_kernel) that nothing launches. No default and no user-visible
text; settings register entry STRATA_PF_FEWROWS, status research.

Tesla P100 (sm_60), IQ3_XXS, STRATA_PREFILL_MMQ=0 with the switch on, from the
screen build (3 rotated rounds; prompt tok/s, ratio to MMQ):
  prompt  MMQ    FP16 path  few-rows  ratio few-rows / MMQ   plain FP16 / MMQ
  300     171.3  144.9      162.8     0.954                  0.846
  1,000   248.4  215.6      226.6     0.911                  0.868
  2K      291.1  264.5      270.7     0.931                  0.909
  4K      304.5  290.5      303.5     0.997                  0.954
  8K      343.6  352.1      358.3     1.044                  1.025
  20K     332.7  335.8      344.4     1.035                  1.009
First-token KL 2K / 8K (mean): few-rows vs plain FP16 0.0168 / 0.0048, vs MMQ
0.0065 / 0.0085 (plain FP16 vs MMQ 0.0155 / 0.0078, MMQ again 0.0012 / 0.0006).
Gate on the committed tree follows (lane P4-FALLBACK, phaseA-tests/par).
2026-11-12 08:56:51 +01:00
Niko1221 0651d7846b Merge f-own-4x-2bit df485b41c into f-p4-int (IQ2_XXS / IQ2_XS gate/up: the fused kernels are the default on sm_86 / sm_120 cards with 80+ SMs)
One commit on 15dfa3324 (merge 18 of this branch). Owner: YES to the 2-bit fused kernels as the default on 80+ SM NVIDIA cards (11-12).
default_takes in include/strata/prefill/fused_tile_rule.hpp, src/prefill/moe_fused_iq.cu, the unit test and the settings-register text, as the lane wrote
them. Lane gates as relayed: unit test 12,864 combinations, cmake-cpu 80 / 0 / 3, device code host-only on sm_86, IQ3_XXS nothing-set = yesterday's
opt-in arm 24 of 24 tokens and logits, IQ3_S unchanged 24 of 24 against the base's second run. No conflict, nothing changed by hand.
2026-11-12 08:33:17 +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 df485b41c0 prefill: the fused kernels are the default for IQ2_XXS / IQ2_XS gate/up on sm_86 / sm_120 cards with 80+ SMs
The owner said yes on 11-12 ("2-bit fused kernels as the default on 80+ SM NVIDIA cards"), on the decision table of lane OWN-4X
(RESULTS-OWN-4X.md, "IQ3_XXS 2-bit cell on 80+ SM cards").  Until now native_supported's default branch (CUDA, STRATA_PF_FUSED unset) took only
IQ2_S / IQ3_XXS / IQ3_S / IQ4_XS gate/up and kept MMQ for IQ2_XXS / IQ2_XS ("until measured"); the IQ3_XXS set has 19 such layers (9 IQ2_XXS,
10 IQ2_XS) of 48, and the IQ2_XS sets have their own.  They join the list; the card rule is the one the i-quant default already uses
(fused_tile::takes_by_default: sm_86 / sm_120 with 80+ SMs; STRATA_PF_FUSED_SM86=0 turns the sm_86 default off), nothing changes below 80 SMs
(the sm40 research switch only takes the weight-staging gate/up instances, sw_on, which IQ2_XXS / IQ2_XS are not), nothing for AMD (its own rule
in native_supported, the HIP branch), no new setting.  STRATA_PF_FUSED=0 gives MMQ again, =1 keeps its meaning.

The rule is now a pure function (include/strata/prefill/fused_tile_rule.hpp): default_gate_format(ggml type id) and
default_takes(env, card, sm40, gate_staged, down_ok, gu_type); moe_fused_iq.cu static_asserts that the ids are GGML_TYPE_*.  Host code only:
the kernels, the tile pick and the prompt path (prefill.cpp) are untouched.  tests/prefill/fused_tile_rule_test.cpp: IQ2_XXS / IQ2_XS over
both card flags x sm_121 x 0-200 SMs x the sm40 switch x down kinds (12,864 combinations): yes exactly for sm_86 / sm_120 with 80+ SMs (80 yes,
79 no, 48 no, AMD and sm_89 without a flag no), STRATA_PF_FUSED=0 off, =1 not by default; the formats already in the list keep their rule.

Evidence (RTX A6000, sm_86, 84 SMs, Boston GPU 0, IQ3_XXS set, frozen shipped expert profile, MTP on; fused = STRATA_PF_FUSED=1 = what this
commit makes the default, against nothing set before):
- prompt speed, 5 interleaved rounds, fresh engine per arm: tok/s fused / default 1.030 / 1.040 / 1.035 at 4K / 8K / 20K, 5 of 5 each (e93);
  on the integration head 9f81b8b67, prompt ms fused / default 0.874 to 0.976 from 300 to 8,193 tokens, fused slower in 0 of 5 rounds at every
  length (below 1,024 tokens the head runs the staged fused groups; on e93 800-1,024 tokens were 1.03x slower, not on the head)
- teacher-forced per-position KL against the FP16 prompt path, 48 prompts x 256 positions, paired bootstrap over prompts, fused / default
  [95 %]: 512 ids 0.965 [0.912, 1.021], 1,000 ids 1.062 [0.995, 1.137], 2,048 ids 1.072 [1.020, 1.123], 8,192 ids 1.008 [0.939, 1.101]; the
  floor (default again) 0.974 / 1.012 / 1.006 / 1.003
- one layer against FP32 (19 layers, real blobs, real routing): fused and MMQ equally far (ratio 1.0001 at 2K, 0.9998 at 8K)
- robustness: small chunks, agent run, first 8K read (24 engines, 0 of 24 over 2x), forced-slow-layer backstop with its designed error, no hang
Not covered: any card other than the A6000 (sm_120 with 80+ SMs follows by the class rule, not measured on a 2-bit set), the IQ2_XS sets end
to end, multi-GPU, Windows, tool-call agent runs.

data/settings-register.json: the STRATA_PF_FUSED_SM86 note names the default list.  No user-visible text changes.
2026-11-12 07:16:54 +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 d25e2f9b70 Merge f-own-4x 93834ddf8 into f-p4-int 2026-11-11 23:23:12 +01:00
Niko1221 93834ddf89 prefill: the fused Gyro-S trellis kernels are the default on compute capability 8.6 cards with 80+ SMs (HELD for the owner's word, not merged)
Branch commit only, written ahead of the owner's answer on the A6000 Gyro-S table (RESULTS-OWN-4X.md, "GYRO-S ON THE RTX A6000").  Not for
any integration branch until he says yes; one confirming run is owed on this exact commit (unset against STRATA_PF_FUSED_TQ=1: same bits,
same speed row).

The rule (include/strata/prefill/fused_tq_default.hpp, a pure function, pinned by tests/prefill/fused_tq_default_test.cpp):
  STRATA_PF_FUSED_TQ unset  Gyro-S's TQK6 / TQK7 pair takes the fused kernels on a compute capability 8.6 card with 80+ SMs
                            (RTX A6000 / A40 84, RTX 3090 Ti 84, RTX 3090 82, RTX 3080 Ti 80); every other card stays on MMQ
  STRATA_PF_FUSED_TQ=1      as before: any sm_80+ card, and Gyro-M's TQ2_T / TQ2_T pair (no gate series, so never by default)
  STRATA_PF_FUSED_TQ=0      MMQ again (a diagnostic for bug reports)
STRATA_PF_FUSED_SM86=0 (DevInfo::s86 false) turns the trellis default off together with the i-quant default; STRATA_PF_FUSED=0 still turns
every fused kernel off.  Host code only: DevInfo::tq is set from fused_tq::on(env, s86, sms) in dev_info(), native_supported() asks
fused_tq::gyro_m_on() for the TQ2_T pair; the kernels, the tile pick and the prompt path (prefill.cpp) are unchanged, so the default path is
the STRATA_PF_FUSED_TQ=1 path the gates measured.

Gates (RTX A6000, 84 SMs, Boston GPU 0, Gyro-S, e86 = 454305361, MTP, frozen shipped expert profile; fused = STRATA_PF_FUSED_TQ=1 against
the MMQ default):
| gate | result |
|---|---|
| prompt speed, 5 interleaved pairs | fused / MMQ 1.203 / 1.166 / 1.116 at 4K / 8K / 20K, 5 of 5 each |
| first-token KL vs the FP16 prompt path, 2,048 x 48 | MMQ 0.00867 / again 0.01060, fused 0.00658 (below both); top-1 46 / 46 / 47 |
| same, 8,192 x 48 | 0.00335 / 0.00317, fused 0.00328 (between); top-1 48 / 48 / 47 |
| same, 20,000 x 96 | 0.00827 / 0.00666, fused 0.00952 (above the higher run, level by the paired interval 1.151 [0.799, 1.775] and within twice MMQ's own gap 0.00161); top-1 91 / 91 / 92 |
| forced tokens, 48 x 128, FP16-written text | MMQ 1.69 / 1.79 %, fused 1.56 / 1.64 %, fused minus MMQ -0.18 [-0.45, +0.08] and -0.10 [-0.35, +0.14] points, events 0 / 0, pass |
| forced tokens, MMQ-written text (llama.cpp cannot read the trellis types) | MMQ 1.14 / 1.04 %, fused 1.62 / 1.79 %, +0.53 and +0.70 points, inconclusive (biased toward MMQ) |
| small chunks, agent, first 8K read (12 engines per arm), backstop | all answered; first read median 3,425-3,429 ms MMQ vs 2,970-2,975 ms fused, 0 of 12 over 2x; designed clear error |
Not covered: any card other than the A6000, Gyro-M, Gyro-L, prompts below 1,024 tokens (both paths are MMQ), multi-GPU, Windows.

data/settings-register.json: the STRATA_PF_FUSED_TQ note ("research", a diagnostic switch for bug reports, not a user setting; goes with MMQ in
release C).  No user-visible text changes: no new line in the engine, setup, the Terminal or the docs.
2026-11-11 22:04:40 +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 112a7a23f7 Merge f-own-4h e14d4e370 into f-p4-int 2026-11-11 21:48:18 +01:00
Niko1221 ac3df5b55b Merge f-p4-sm f73297a96 into f-p4-int 2026-11-11 21:48:01 +01:00
Niko1221 aff3a132f5 Merge f-ds-out ac306afb2 into f-own-int
Nine conflicts, one hunk each, all of the kind "ds-out removes DeepSeek next to a line that
main's fixes bundle (c1ff07f1a) or f-agent-turn changed". Resolved by keeping the other side's
addition and ds-out's removal (resolutions a-i accepted by the coordinator):
- apps/host/src/lib/native-fit.ts FitInput, apps/host/src/lib/native.ts NativeSize: ds-out's line
  (no DeepSeek fields or note) plus main's context_fit field.
- apps/host/src/components/GuidedSetup.tsx, NativeModels.tsx imports: contextCacheGb kept,
  deepseekContexts / OLD_DEEPSEEK_CONTEXT out.
- apps/host/tests/ui-r3.test.mjs: ds-out's first assert, main's second (context_fit).
- serve/server.py READY line: f-agent-turn's can_hold kept, the DeepSeek self.multi read out.
- strata_cli/launch/cmd.py: ds-out's suppressed --speed / --full-quality, main's new --gpu help.
- strata_cli/launch/screens.py: ds-out's STEP_LABELS, main's middle_shorten kept,
  speed_choice_available out.
- data/settings-register.json: the 39 STRATA_DS4_* entries out.
The register's stale "line" values are not regenerated here.
2026-11-11 21:33:30 +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 6249bb0fa1 Merge f-p4-fallback 5a9d6f559 into f-own-int 2026-11-11 21:28:50 +01:00
Niko1221 d4eac2ca39 Merge f-own-5b e93b90250 into f-own-int 2026-11-11 21:28:10 +01:00
Niko1221 f73297a96a prefill: research switch STRATA_PF_FUSED_SM40=1 (off): sm_86 / sm_120 cards with 40-79 SMs take the fused kernels by default for the staged-gate pairs
native_supported()'s default rule took sm_86 / sm_120 cards with 80+ SMs only. It is now a pure function in fused_tile_rule.hpp, takes_by_default(card, sm40, gate_staged, down_ok), with a unit test; with STRATA_PF_FUSED_SM40=1 the cards with 40-79 SMs also take the launches whose gate/up kernel is a weight-staging instance (IQ3_XXS / IQ3_S / IQ4_XS) with an IQ4_NL or Q2_0 down. IQ2_S / Q2_0, IQ2_XXS / IQ2_XS and the other formats stay on MMQ; 39 SMs and below stay on MMQ; the switch is read once and is OFF unless set. Unset: the rule is exactly what it was (the unit test compares every card flag set, SM count 0-200 and launch kind with "sm_86 / sm_120, 80+ SMs"), and the change is host code only (the device code of the object does not change).

Evidence for the later flip (not part of this commit): RTX A4000 (sm_86, 48 SMs), one layer, real routing, MMQ / fused with the staged 128-row tile at 2,048 / 8,192 / 20,000 / 32,768 tokens: IQ3_S / IQ4_NL 1.594 / 1.337 / 1.190 / 1.070, IQ3_XXS / IQ4_NL 1.645 / 1.373 / 1.223 / 1.097, IQ4_XS / IQ4_NL 1.621 / 1.326 / 1.176 / 1.055, IQ3_S / Q2_0 1.563 / 1.338 / 1.195 / 1.078. The output bits of these kernels are the same on every card (A4000, RTX PRO 5000, the previous kernels). No end-to-end row exists below 80 SMs; nothing below 48 SMs is measured.

data/settings-register.json: the new entry (status research, note marked [DRAFT]).
2026-11-11 20:55:34 +01:00