Commit Graph
1328 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 5bc07c47a0 tests: include <initializer_list> in the loan rule test 2026-11-13 01:14:03 +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 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 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 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 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 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 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 b5dfe5beaf [Terminal] A start that stopped for lack of memory with several requests at once says what to lower
When the engine ends a start with "N requests at once do not fit in this PC's memory", the
Terminal now says: "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." Before, the
step was the generic "Run it again; if it repeats, report the log." On a PC whose graphics chip
shares the RAM, the saved settings with a fixed expert cache and a RAM budget also got the
advice about the expert cache for this failure; the new step now wins over it.

One entry at the end of KNOWN_CAUSES, a one-line change in explain_engine_exit, and
tests/terminal/test_batch_memory_words.py (the step, the step against the shared-memory advice
with a control, another failure keeps its own step).
2026-11-12 20:00:00 +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 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 2248e63619 prefill: Flash-Next's K-quant pairs take the 128-row tile on sm_86-class cards with 80 to 99 SMs, and the two Q8_0-down pairs on sm_120 cards with 100 to 149 SMs
The tile rule (fused_tile_rule.hpp, pick) gets a trailing argument kq: 0 for every pair as before, 1 for a Q4_K / Q5_K gate/up with a Q5_1
down, 2 with a Q8_0 down (kq_flash_kind; UD-Q4_K_XL: Q4_K / Q5_1 in 43 layers, Q4_K / Q8_0 in 4, Q5_K / Q8_0 in 1).  The call site in
moe_fused_iq.cu passes it; the Qwen3.6 copy of the kernels does not, so its rule (wide_pair, the 128-row tile above 112 rows an expert) is
byte for byte as it was, and so is every other class: the 40-79 SM cards (the staged rule already takes 128 rows at every size), sm_121, the
A100 and RTX 40 class (108 SMs and up, not measured), the other sm_120 cards, HIP.  The tile only groups routed rows: the output bits hash
is equal at 64, 128 and the default at every size measured.

New lines of the rule, both from 5.8 rows an expert up (300 tokens x top 10 over 512 experts = 5.86; nothing smaller was measured):
- sm_86-class card with 80 to 99 SMs, kq 1 or 2: 128 rows.
- sm_120 card with 100 to 149 SMs, kq 2 only: 128 rows (the rule already gave 128 from 56 rows an expert there; this moves 5.8 to 56).

Evidence, one layer of Flash-Next's shape (512 experts, top 10), MMQ ms / fused ms (above 1: fused faster), tests/cuda/prefill_fused_iq_test
--no-ref with STRATA_PF_FUSED_TILE unset / 64 / 128:
- RTX A6000 (sm_86, 84 SMs, CUDA 13.1), median of two repetitions, spread 0.01 or less, 300 / 1,000 / 2,048 / 4,096 / 8,192 / 20,000 / 32,768
  tokens.  Today's pick: Q4_K / Q5_1 1.28 1.26 1.28 1.29 0.88 0.79 0.73, Q4_K / Q8_0 1.25 1.30 1.32 1.40 0.83 0.72 0.67, Q5_K / Q8_0 1.10 1.15
  1.10 1.31 0.67 0.58 0.53.  Tile 128: 1.65 1.49 1.52 1.29 1.04 0.97 0.88, 1.83 1.73 1.72 1.40 1.07 0.98 0.91, 1.79 1.69 1.69 1.33 1.04 0.98
  0.89.  128 is the best tile at every size, on all three pairs.
- RTX PRO 5000 (sm_120, 110 SMs, CUDA 13.2), three repetitions, 300 / 1,000 / 2,048 tokens, today's pick against tile 128: Q4_K / Q8_0 1.18 1.43
  1.47 against 1.52 1.51 1.56, Q5_K / Q8_0 0.94 1.20 1.35 against 1.46 1.44 1.49 (the ranges of the repetitions do not overlap).  The Q5_1-down
  pair, 43 of 48 layers, is faster in the 64-row tile there below 56 rows an expert (1.64 1.71 1.67 against 1.50 1.52 1.58), so it keeps it.
- RTX A4000 (48 SMs): the staged rule picks 128 rows at every size already; unchanged.
Not measured: any sm_86-class card other than the A6000 (the A40 and RTX 3090 have the same SM range), end to end with the real set (the
following commits' gates), launches under 300 tokens.

tests/prefill/fused_tile_rule_test.cpp: kq_flash_kind over every pair of type ids; the whole grid of card flags x 0-200 SMs x launch sizes x
staged x wide x kq against an oracle written from the sentence above (12,638,880 combinations, 0 wrong; 61,680 launches move to 128 rows on
sm_86 and 16,800 on sm_120); named cards at the measured sizes, the card and size edges; the existing blocks (the Qwen3.6 wide class, the
previous-rule comparisons) pass unchanged.  Host code only: no kernel changes.
2026-11-12 18:57:20 +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 662e72ac20 Merge f-fp16-bench b9bd40181 into f-p4-int (a test tool that times one prompt layer of experts on every prompt path, and the dense prompt GEMMs with FP16 io off and on)
b9bd40181 adds tests/cuda/prefill_expert_paths_bench.cpp and one CMake block each in cmake/backends/cuda.cmake and cmake/backends/hip.cmake, with a --quick ctest smoke
entry for CUDA and HIP. Test side only: no product code. Merged onto this head; nothing changed by hand.
2026-11-12 17:19:34 +01:00
Niko1221 9e491df8e7 prefill: the Qwen3.6 K-quant pairs take the 128-row tile from 112 rows an expert up on sm_86 cards with 80+ SMs
The tile rule picked 64 rows for the staged K-quant pairs of UD-Q4_K_XL (Q4_K / Q5_K gate/up with a Q5_K / Q6_K down) above 112 rows an expert on an sm_86
card with 80+ SMs, which is every prompt chunk of 4,096 tokens (the chunk the engine uses when the experts are resident: 32,768 routed rows over 256
experts). The staged 128-row kernels are faster there. One layer of Qwen3.6's shape (256 experts, top 8), MMQ ms / fused ms at 2,048 / 4,096 / 8,192 /
20,000 tokens, two repeats, the output bits hash equal at every tile:

  RTX A6000 (84 SMs), tile 64:   Q4_K / Q5_K 0.91 0.85 0.71 0.65   Q4_K / Q6_K 0.82 0.73 0.61 0.53   Q5_K / Q6_K 0.71 0.63 0.52 0.46
  RTX A6000 (84 SMs), tile 128:  Q4_K / Q5_K 1.42 1.08 0.95 0.91   Q4_K / Q6_K 1.47 1.17 1.02 0.91   Q5_K / Q6_K 1.37 1.14 0.98 0.86
  RTX PRO 5000 (110 SMs, sm_120), tile 64:   0.99 0.85 0.72 0.63   0.92 0.77 0.66 0.58   0.83 0.70 0.60 0.52
  RTX PRO 5000 (110 SMs, sm_120), tile 128:  1.28 1.07 1.02 0.87   1.33 1.12 0.99 0.96   1.23 1.08 0.93 0.90

On the sm_120 card the rule already picks 128 there, so its default row equals the forced-128 row. At 2,048 tokens (64 rows an expert) both rules pick 128
already.

fused_tile::wide_pair names the pairs of the existing wide class (a Q6_K or Q8_0 gate/up) and now also a Q4_K / Q5_K gate/up with a Q5_K / Q6_K down;
experts_native_ext in the Qwen3.6 copy of the kernels passes it as the launch's wide argument. Flash-Next's K-quant gate/up (Q5_1 / Q8_0 down), the
i-quant pairs, sm_120 cards, cards under 80 SMs (staged rule) and HIP are unchanged. The output bits are the same at either tile. No kernel changes;
the unit test pins wide_pair over the type grid and the rule at the engine's chunk sizes on 84-, 108-, 128-SM sm_86 cards, the 48-SM staged card and
the sm_120 cards, with a grid oracle for staged + wide on sm_86 cards.
2026-11-12 16:53:04 +01:00
Niko1221 3860b43a4a prefill: the Qwen3.6 engine takes the fused prompt kernels by default on the cards the Flash-Next default rule takes
strata-q36 used the fused int8 prompt-expert kernels only with STRATA_PF_FUSED=1 and read the prompt's experts with MMQ otherwise. Now an unset
STRATA_PF_FUSED takes them for every layer whose gate/up and down pair the kernels cover, on the cards fused_tile::takes_by_default takes (reused as
it is, no second class test): sm_86-class (compute capability 8.0 / 8.6 / 8.9) and sm_120 cards with 80+ SMs, and on 40-79 SM cards the staged
launches (a staged gate/up with a staged down) unless STRATA_PF_FUSED_SM40=0. STRATA_PF_FUSED=0 (or any value not starting with 1) keeps MMQ,
STRATA_PF_FUSED=1 stays the opt-in on every card that covers the pair. HIP builds, cards under 40 SMs, sm_121 and compute capability below 8
are unchanged (MMQ). The rule is fused_tile::q36_takes, a pure function with a unit test over the whole grid (switch, SM40 switch, card flags,
SM count, format flags) against an oracle; moe_fused_iq_q36.cu gets the host function native_layer_ext that feeds it the device's flags.
No kernel changes.

The engine's log line loses its draft mark: "strata-q36: prompt experts on the fused int8 kernels" (and the "(N of M layers), the rest on MMQ (int8)" form).

Measured (UD-Q4_K_XL, RTX A6000 84 SMs, every expert in VRAM): prompt speed fused / MMQ 1.034 at 2K, 0.964 at 4K, 0.966 at 8K, 0.970 at 20K,
decode equal; teacher-forced KL fused / MMQ over all positions 1.047 [0.924, 1.195] at 2K and 0.836 [0.727, 0.969] at 8K against the
non-MMQ writer's logits, 1.060 [0.893, 1.240] and 0.941 [0.700, 1.199] against the FP32 reference engine; both arms repeat bit for bit.
RTX A4000 (stream-bound, experts partly in RAM): speed equal, KL 0.880 [0.682, 1.098] at 2K and 0.704 [0.537, 0.904] at 8K.
2026-11-12 15:31:06 +01:00
Niko1221 b9bd40181b tests: time one prompt layer of experts on every prompt path, and the dense prompt GEMMs with FP16 io off and on
prefill_expert_paths_bench (CUDA) and hip_prefill_expert_paths_bench (HIP) time one layer of routed experts on synthetic weights, no model file:
MMQ where the build has it, the dequantize + FP16 GEMM path (the library calls of prefill.cpp's FP16 branch, in its order), the same with the few-row
experts on the quantized grouped kernels, one grouped call for the whole layer (the Qwen3.6 engine's fallback), and the fused kernels where the card has
them. Median of N repeats after a warm-up, speed ratios against MMQ, error against a CPU FP32 reference on a sample of pairs, an output hash per path,
VRAM used, one machine-readable RESULT line per cell. Runs on cards without fused kernels and in builds without MMQ.

--dense times strata::prefill::Gemm at the dense prompt shapes of the compiled geometry (the call sites in prefill.cpp) with set_f16_io off and on
(STRATA_HIP_PROMPT_F16), with the error against the CPU reference.

Test and CMake wiring only (a ctest smoke entry for each backend); no product source is touched.
2026-11-12 14:07:09 +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 a1bbe27b47 Merge f-gfx11-arrival 6d8e42886 into f-p4-int (the owner's wording is final: the [DRAFT] marks come off the two log lines and the register note)
6d8e42886 is one commit on 0ee263992, which is already in this branch: string and comment text only in src/core/pinned.cu, include/strata/core/page_cache_drop.hpp,
tests/core/page_cache_drop_test.cpp and data/settings-register.json (6 lines out, 6 in). Nothing changed by hand.
2026-11-12 11:45:03 +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 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 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 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 ab38d9298a package_terminal: the import probe writes no bytecode into the bundle
The probe that imports the runtime packages with the bundled interpreter ran with
the caller's environment, so unless the caller had set PYTHONDONTWRITEBYTECODE a
__pycache__ folder appeared beside every module it loaded and went into the archive:
the archive's file set depended on who built it. The probe now runs through
run_probe(), which sets PYTHONDONTWRITEBYTECODE=1 for the child and starts it with -B.

Tests: the probe leaves no __pycache__ or .pyc in the folder it runs in, with the
variable unset or set to empty by the caller; a plain import in the same setup does
leave one, so the check can see it. With the fix taken out, the two probe tests fail.
2026-11-12 09:43:13 +01:00
Niko1221 56a659967b [Engine] gp100_prompt_default_test: include <initializer_list>
The braced list in the explicit-setting loop needs the header on this
toolchain; the test did not compile without it.
2026-11-12 08:57:08 +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 482c6beeab Merge f-p4-small-nv 0471cc10b into f-p4-int (the batched group entry for prompts under 1,024 tokens: default on in CUDA builds, off in HIP builds)
One commit on 15dfa3324 (merge 18 of this branch). Owner: YES for NVIDIA only (11-12); the HIP build keeps it opt-in (staged_group_entry_default).
include/strata/prefill/staged_group_rule.hpp, src/prefill/prefill.cpp, CMakeLists.txt (the new unit test) and tests/prefill/staged_group_rule_test.cpp,
as the lane wrote them. Lane gates as relayed: HIP device code 0 of 3,938 differing, CUDA nothing-set ids and logits hashes identical, cmake-cpu 81 / 0 / 3.
No conflict, nothing changed by hand.
2026-11-12 08:33:17 +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 0471cc10b2 prefill staged walk: the batched group entry is the default on CUDA builds, opt-in on HIP builds
Owner, 2026-11-12: "8 yes for nvidia". The staged walk (prompt chunks below stream_all_min(), 1,024 tokens) runs a layer's MMQ groups through the batched group entry
(fused::group_bounds + experts_native, prefill.cpp fz_staged) where the card's own fused rule takes the layer's formats (fused::native_supported). A HIP build now
takes that entry only with STRATA_PF_FUSED=1 named; with nothing set it keeps MMQ's staged walk, as before the entry existed. STRATA_PF_FUSED=0 turns the entry off
in both builds (native_supported already answered false then).

The line that decides it: prefill.cpp, the fz_staged condition (staged_group_entry_on()), which reads strata::prefill::staged_group_entry_default
(include/strata/prefill/staged_group_rule.hpp): STRATA_PF_FUSED set and non-empty -> on only when its first character is '1'; unset or empty -> on in a CUDA build,
off in a HIP build (STRATA_USE_HIP, __HIPCC__ or STRATA_HIP_GFX906).

What changes: HIP builds, where native_supported answers true by default - gfx12 (R9700: IQ3_S, IQ3_XXS, Q2_0 gate/up) and the other HIP classes the group entry
reached: they run the staged walk on MMQ again with nothing set. CUDA builds: nothing changes (the entry stays on wherever native_supported takes the formats: sm_120 and
sm_86 cards with 80 or more SMs by default, any sm_80+ card with STRATA_PF_FUSED=1). The layer-major walk's fused groups (lm_fused_layer) are CUDA-only already.
No new variable.

tests/prefill/staged_group_rule_test.cpp (ctest staged_group_rule_test, header-only, no GPU): CUDA default on, HIP default off, STRATA_PF_FUSED=1 / =0 both ways in both
builds, empty = unset, any other non-empty value = off.
2026-11-12 07:14:13 +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 2a7a851261 Merge f-p4-q36 6d10d61e7 into f-p4-int (K-quant downs in the Qwen3.6 weight-staging rings; f-p4-sm 98e21c171 is contained)
f-p4-q36 6d10d61e7 brings a96d13e1a (the Q5_K / Q6_K down projections of the Qwen3.6 fused kernels join the weight-staging rings)
and the lane's merge of f-p4-sm 98e21c171, so f-p4-sm 98e21c171 comes in through it: a failed weight-staging check
(check_staged_blobs / staged_blobs_ok) no longer ends the process, the launch takes the unstaged kernel (launch_ww, used by
experts_native_ext and by the Qwen3.6 copy).

One conflict, src/prefill/moe_fused_iq.cu, two adjacent hunks after pick_ww: this branch (f-own-4h) closes the decode-only guard
and the anonymous namespace there ("#endif / }  // namespace / #if !defined(STRATA_FUSED_DECODE_ONLY)"), the lane inserts launch_ww,
the namespace close and staged_blob_fallbacks. Resolution: launch_ww stays in the anonymous namespace before the "#endif", the
namespace close and the guard reopening are kept as in this branch, staged_blob_fallbacks follows the reopened guard (it reads
g_staged_mu and g_staged_fallbacks, which sit inside the guard). Nothing else is changed by hand.
2026-11-12 05:37:53 +01:00
Niko1221 6d10d61e74 Merge f-p4-sm 98e21c171 (a failed weight-staging check takes the unstaged kernel instead of ending the process); the staged K-quant downs go through launch_ww too
The merge is textually clean. On top of it, in the merge commit:

- experts_native_ext (moe_fused_iq_q36.cu) takes its ww from launch_ww(b, g, n, n_expert, staged, wide) instead of pick_ww plus the old check_staged_blobs
  call (which the merge renamed to staged_blobs_ok). staged and wide are what the K-quant down commit passed: staged = sw_on(gu_type, true) ||
  sw_on(d_type, false) (the Q5_K / Q6_K downs are staging instances, K = 512), wide = the gate/up is Q6_K or Q8_0 (false for the Q4_K / Q5_K gate/up of
  this path). A staged K-quant launch whose expert blobs are not device memory at 2-byte aligned addresses now takes the unstaged 64-row kernel, sticky for the
  process, one log line, no exit, like every other launch of the copy.
- prefill_fused_q36_test takes --host-blobs=N [--expect-fallback | --expect-no-fallback] (the first N experts' blobs in pinned, mapped host memory; timing
  part; MMQ is not run for those pairs), as prefill_fused_iq_test does; moe_fused_q36.hpp declares the copy's staged_blob_fallbacks(); ctest entry
  prefill_fused_q36_test_hostblobs (Q4_K / Q5_K, 2,048 tokens).

Checked on RTX A6000 (sm_86, CUDA 13.1): the five pairs' output bits hashes at tile default / 64 / 128 and 2048 / 4096 / 8192 / 20000 tokens are the
ones of the K-quant down commit (20 of 20, three tiles); the three K-quant pairs with --host-blobs=1 take the unstaged kernel (one log line, 346 to
1,198 launches counted over the pairs, no exit), at the default tile and with STRATA_PF_FUSED_TILE=128 forced, and their hashes are the all-device
run's (6 of 6, both).
2026-11-12 04:59:03 +01:00
Niko1221 17522cb0c4 Merge f-p4-sm f68943534 (weight staging for Q6_K / Q8_0 gate/up and Q8_0 / Q5_0 down) into f-p4-q36
The merge itself is textually clean. One change on top, in src/prefill/moe_fused_iq_q36.cu: experts_native_ext calls pick_ww with the
staged / wide arguments the merged moe_fused_iq.cu takes, computed the way experts_native computes them (sw_on(gu_type, true), and
gu_type is Q6_K or Q8_0). Both are false for the Q4_K / Q5_K gate/up of the K-quant down path, so the launch is the one before the merge.

Checked on the merged tree before this commit (scratch merge, same content): tests-ON CUDA build for sm_120 (l620) and sm_86 (z440),
prefill_fused_q36_test parity on both, output bits of the five pairs equal at tile 64 / 128 / default, cuda_spill_guard with the fused_q36
entry of 77e1dd777 (no fused_q36 instance among the violations).
2026-11-12 03:54:02 +01:00
Niko1221 98e21c1713 prefill: a failed weight-staging check takes the unstaged kernel for that launch instead of ending the process
check_staged_blobs ended the process with std::exit(1) when an expert blob was not device / managed memory, or a row size or offset was odd.
No default configuration reaches it (the prompt path passes expert-cache slots and stage-ring slots), but the engine must not exit there.

The check is now staged_blobs_ok (bool) and launch_ww combines it with pick_ww: a launch that fails it gets ww = 4 (fused_tile::kUnstagedWw),
the 64-row instances, which no weight-staging instance shares, also when STRATA_PF_FUSED_TILE=128 forces the 128-row tile. The output bits
are the same (the identity tables of RESULTS-P4-SM.md: tile 64, 128 and the default hash equal). The first failing launch of a process logs one
line to stderr. The check still runs on the first 256 launches only (a pointer query is a driver call); the decision is sticky: once one launch
failed it, every later launch of the process takes the unstaged kernel without asking, because after the first launches nothing is checked any
more and a call site that gave one bad blob will give more.

The decision is a set of pure functions and a small state struct in fused_tile_rule.hpp (staged_geometry_ok, staged_blob_ok, StagedGuard),
tested on the host in fused_tile_rule_test (blob memory kinds x addresses, the 16 odd / even geometries, the 256-launch budget, the sticky
fallback, one log line). moe_fused_iq.hpp declares staged_blob_fallbacks(), the number of launches that took the fallback (0 in a HIP build).
prefill_fused_iq_test takes --host-blobs=N (the first N experts' blobs in pinned host memory, timing part) with --expect-fallback /
--expect-no-fallback; ctest entry prefill_fused_iq_test_hostblobs.

moe_fused_iq.cu is also compiled a second time for the Qwen3.6 shape (moe_fused_iq_q36.cu includes it under a renamed namespace): the new
names are inside the included source and carry no `fused` token outside namespaces, the state is per copy. A dispatch of that copy that
launches staging instances itself (experts_native_ext) takes its ww from launch_ww(b, g, n, n_expert, staged, wide) instead of pick_ww.
2026-11-12 03:16:52 +01:00
Niko1221 9f81b8b67c Merge f-p4-q36 77e1dd777 into f-p4-int (with 7bc09fadf), with lane P4-Q36's pick_ww resolution
After f-p4-sm f68943534, pick_ww takes (n, n_expert, staged, wide); the Qwen3.6 copy's call in src/prefill/moe_fused_iq_q36.cu
becomes, as lane P4-Q36 compiled it on sm_120 in its scratch merge (7bc09fadf + f68943534 + e14d4e370; one-layer parity passed on
the RTX PRO 5000; the line is byte-equal in its scratch trees src-g1m.tgz and src-g2.tgz):

    const int ww = pick_ww(n, n_expert, sw_on(g.gu_type, true), g.gu_type == T_Q6_K || g.gu_type == T_Q8_0);

The merge itself had no conflict; this one line is the only change beyond the two branches.
2026-11-12 03:08:49 +01:00
Niko1221 a85134dc8d Merge f-p4-sm f68943534 into f-p4-int 2026-11-12 03:07:21 +01:00
Niko1221 f689435345 prefill: weight staging for the Q8_0 gate/up and down, the Q6_K gate/up and the Q5_0 down kernels, and the 128-row tile for the Q6_K / Q8_0 gate/up class on sm_86 with 40+ SMs
The staging mechanism of the IQ3_S pack's kernels (cp.async copies of each row's slot into a two-slot shared-memory ring, the product's own loaders on the shared-memory address, three activation stages) now also covers, per instance at compile time (sw_on), 512-thread 128-row, non-F16, CUDA sm_80+: gate/up Q8_0 and Q6_K, down Q8_0 and Q5_0.
- Q8_0 (gate/up and down) and Q5_0 (down): a slot is four 32-value blocks (two stages), 136 B / 88 B, 10 / 7 chunks of the aligned window; the decode is load_unit on the shared-memory address as for IQ4_NL.
- Q6_K gate/up: a slot is half a super-block gathered from three windows (ql 64 B, qh 32 B, scales + d: 10 chunks, 160 B a row in the ring); the 14 words of kq_lean_load<T_Q6_K> are rebuilt from the windows at the same offsets, kq_lean_expand and the arithmetic are unchanged.
Rings at 128 rows: Q8_0 and Q6_K 40,960 B, Q5_0 28,672 B; the largest instance is 96,768 B of shared memory against the 101,376 B a block can get (static_assert per staged instance). The kernels of the previous staging commit (IQ3_XXS / IQ3_S / IQ4_XS gate/up, IQ4_NL down) are byte-identical in device code. Unstaged: Q5_1 down and Q2_0 (staged they lose), Q4_K / Q5_K, IQ2_*, the trellis types, WW 4, NT 256, F16, HIP.

Tile rule (fused_tile_rule.hpp): the staged rule (gate/up staged: 128 rows at every size on sm_86 / sm_120 cards under 80 SMs) now takes the Q8_0 / Q6_K launches too. The "wide" line stays, widened to sm_86 with 40+ SMs: a Q6_K or Q8_0 gate/up above 112 rows an expert takes 128 rows (Why::kS86Wide); below 80 SMs the staged rule already covers it, the line moves the 80+ SM cards. Evidence for the 80+ SM class, from lane P4-Q36 (RTX A6000, Qwen3.6 UD-Q6_K_XL, every expert in VRAM, end to end, ratio to MMQ at 2K / 8K / 20K): today's rule 0.95 / 0.90 / 0.92, tile 128 0.95 / 0.98 / 0.99; no staged-kernel row exists on an 80+ SM card. The i-quant pairs keep the rule gated by lane OWN-4X on that class. Unit cases at 84 SMs on both sides of 112 rows and a sweep of card flags x SM counts x staged x expert counts x rows (the unit test compares wide = false with the previous rule, 20,945,664 combinations, only the line's cells move, 64 -> 128).

Gate, RTX A4000 (sm_86, 48 SMs), one layer, real routing (UD-Q4_K_XL / UD-IQ4_XS ids), ms, tile 128 staged against the same tile unstaged, MMQ beside it (base and head interleaved in one job):
| pair | 2K | 8K | 20K | 32K |
| Q8_0 / Q8_0, MMQ / head | 1.882 | 1.412 | 1.143 | 1.030 |
| same, head against base at 128 rows | +26.0% | +22.2% | +19.4% | +20.2% |
| Q6_K + Q8_0, MMQ / head | 1.499 | 1.188 | 0.998 | 0.918 |
| same, head against base at 128 rows | +24.2% | +22.7% | +20.1% | +22.4% |
| IQ3_S / Q8_0, MMQ / head | 1.708 | 1.379 | 1.211 | 1.060 |
| same, head against base at 128 rows | +11.7% | +11.6% | +13.4% | +14.3% |
| IQ4_XS / Q5_0 (no MMQ tile), head against base at 128 rows | +12.2% | +13.2% | +13.6% | +15.1% |
The unstaged 64-row ratios MMQ / base 64 were Q8_0 / Q8_0 1.326 / 0.955 / 0.783 / 0.649 and Q6_K + Q8_0 1.059 / 0.787 / 0.638 / 0.547. Controls unchanged: IQ3_S / IQ4_NL +5.6 / +8.0 / +9.6 / +11.4% (its kernels are the previous commit's), IQ2_S / Q2_0 0.0 / 0.0 / -0.2 / +0.1%; head 64 against base 64 within 1.3% everywhere.
Output bits: 84 of 84 hashes equal to the previous kernels (Q8_0 / Q8_0, Q6_K + Q8_0, IQ3_S / Q8_0, IQ4_XS / Q5_0, IQ3_S / IQ4_NL, IQ2_S / Q2_0; tile 64 / 128 / default; 2K / 8K / 20K real ids + 32K uniform; blob bases shifted by 2 and 14 bytes). Device code of moe_fused_iq.cu.o (sm_86, 70 functions): against the previous staging commit 4 functions differ (native_kernel<14,true>, <8,true>, <8,false>, <6,false> at 128 rows / 512 threads), against the unstaged base 8, base against base rebuilt 0.
2026-11-12 01:53:20 +01:00
Niko1221 7bc09fadf0 prefill: Q5_K and Q6_K down projections on the fused kernels for Qwen3.6 (UD-Q4_K_XL's 41 layers), behind the same opt-in
UD-Q4_K_XL's expert downs are Q5_K (38 layers) and Q6_K (3 layers); the fused decoders covered Q5_1 / Q8_0 downs only, so with STRATA_PF_FUSED=1 the file stayed on
MMQ layer by layer. With K = n_ff = 512 a K-quant down row is exactly two 256-value super-blocks, which native_kernel's gate/up already walks (unit(s) = block s / 4,
sub(s) = 2 (s & 3) + uj); the decode (load_unit / convert for Q5_K and Q6_K, golden-covered) and the minimum term from the H code sums the Q4_K / Q5_K gate/up
epilogue writes (has_min) are the gate/up's too.
 - src/prefill/moe_fused_iq.cu: ONE line, GU256 also true for a Q4_K / Q5_K / Q6_K down whose K (D_ROWS_K) is a multiple of 256. False for every existing instance:
   no K-quant down instance existed, and Flash-Next's n_ff 640 is not a multiple of 256.
 - src/prefill/moe_fused_iq_q36.cu (the second copy only): the two down instances' own set-up (setup_one<T_Q5_K, false> / <T_Q6_K, false>), native_supported_ext
   (the pair rule of the K-quant gate/up, native_supported(gu, T_Q5_1), plus that set-up) and experts_native_ext (the K-quant launch of experts_native with the new
   down; every other pair forwards to the copy's own functions). Declared in moe_fused_q36.hpp; the Qwen3.6 engine and the one-layer test call the _ext names.
 No new setting: it comes with STRATA_PF_FUSED=1 (the K-quant switches the engine already sets). With the opt-in off nothing changes.

RTX A4000 (sm_86, CUDA 12.9), z440-20261111-2357-e3b0, the one-layer test with the pairs Q4_K / Q5_K, Q4_K / Q6_K, Q5_K / Q6_K (five shapes each, MMQ beside them,
the K-quant rule of the file): passed. Fused against the int8 model rel RMS <= 2.6e-6, worst row <= 5.7e-3 (limits 2e-3 / 3e-2); fused against FP32 equal to MMQ's
distance (Q4_K / Q5_K 9.004e-3 against 8.990e-3); fused against MMQ rel RMS 4.3e-4 to 7.5e-4 (Q4_K / Q5_K), 3.1e-3 to 4.3e-3 (the Q6_K downs). The output hash is the
same at tile 64, tile 128 and the default for every pair at 2048 and 8192 tokens. compute-sanitizer memcheck over all five pairs (--no-ref, 2048): 0 errors. One
layer, MMQ / fused ms, default tile: Q4_K / Q5_K 2048 tokens 7.647 / 8.088, 8192 tokens 18.544 / 26.318; Q4_K / Q6_K 8.132 / 8.167 and 18.992 / 31.883; Q5_K /
Q6_K 8.682 / 9.462 and 19.581 / 38.300 (tile 128 at 8192 tokens: 21.249, 22.415, 24.875). The gap at 8K is the staging / tile question of the other kernels, not
settled here.

Device code, strata-q36 / strata / libstrata_kq.so, base = the tree without this commit, built twice (A/A floor) beside the head:
 - sm_120 (RTX PRO 5000, CUDA 13.2, l620-20261112-0055-be25): floor 0 differing everywhere; base vs head 0 differing, 4 only in the head (strata-q36 2,843 -> 2,847,
   strata 3,666 -> 3,670; libstrata_kq.so 256, 0 / 0): the new down instances.
 - sm_86 (z440-20261112-0018-ebae, strata-q36 2,843 -> 2,847 functions, 4 only in the head, named by z440-20261112-0056-9297: native_kernel<13, false, 2 / 4, 512>
   and <14, false, 2 / 4, 512> of strata::prefill::fused_q36): no existing native_kernel instance differs. The differing functions are native_mmvq_il_pf_kernel
   instances (native_mmvq.cu) and mul_mat_q<ggml_type 149, 16, true>, which also differ between the two base builds (the known sm_86 build-to-build variation, 7
   in the floor, 8 base vs head; native_mmvq.cu includes none of the files of this commit).
 - HIP: strata and strata-q36 compile for gfx1201 (p620-20261112-0048-93b9, compile only, not run).
Not run: UD-Q4_K_XL end to end (the file is not on a box with the commit; z440 would be hybrid and streaming-bound), the clean merge against e14d4e370 / f-p4-sm's tip
beyond a textual one (git merge-tree: no conflicts, not compiled).
2026-11-12 01:30:50 +01:00
Niko1221 f2b41fd290 Merge f-q36-testpad 9f0056e41 into f-p4-int 2026-11-11 23:57:19 +01:00
Niko1221 1ddbb4cedd Merge f-p4-q36 a041fd038 into f-p4-int 2026-11-11 23:34:06 +01:00
Niko1221 d25e2f9b70 Merge f-own-4x 93834ddf8 into f-p4-int 2026-11-11 23:23:12 +01:00