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.
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.
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.
STRATA_HIP_PROMPT_F16 leaves "Switches you can turn on" (273 to 272) because the Radeon 780M on Linux has it on by default now, and STRATA_PF_STAGED_FO joins "Switches that go back to earlier behaviour" (65 to 66). Only docs/SETTINGS.md changes; a second run of the tool changes nothing.
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).
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.
STRATA_PF_FUSED_KQ moves from "Switches you can turn on" (274 to 273) to "Switches that go back to earlier behaviour" (64 to 65) and its documented-in column now lists DGX_SPARK_LINUX.md. Only docs/SETTINGS.md changes; a second run of the tool changes nothing.
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.
Old FP16 short path, the way back (STRATA_PF_STAGED_FO=0) and the default were all measured on the same build, medians of 3 rounds, 96 to 1,000 token pieces:
old path / default 3.76x (1,000 tokens) to 5.24x (128 tokens), old path / way back 3.60x to 4.48x.
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.
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.
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.
One commit on 662e72ac2. On a GB10 (sm_121) the speed defaults table sets STRATA_PF_FUSED_KQ=1 next to STRATA_PF_FUSED=1, so the K-quant experts of
UD-Q4_K_XL (Q4_K / Q5_K gate/up with a Q5_1 or Q8_0 down) are read by Strata's fused prompt kernels instead of llama.cpp's MMQ. STRATA_PF_FUSED_KQ=0 is the
way back (a value you set is kept; STRATA_SM121_PERF=0 or STRATA_DEFAULTS=026 still turn the whole table off). The start line lists six switches instead of five.
Measured on a DGX Spark (UD-Q4_K_XL, 15,283 of 24,576 experts resident, 48 real-text prompts of 2,048 and 4,096 tokens, 256 forced tokens each): forced-token KL
against the FP16 prompt path's text, fused / MMQ 0.895 [0.808, 0.989] (top-1 96.31% / 95.74%), the same text twice byte for byte on both sides; prompt speed
fused / MMQ, median of 10 per-round ratios 1.10 / 1.26 / 1.18 / 1.53 at 2K / 4K / 8K / 20K tokens (the rounds scatter 0.5 to 2.0).
The branch changes src/core/nv_defaults.cpp and src/core/nv_defaults_test.cpp, which the previous merge also changed (a different table and a different block of the
test); git merged both without a conflict. The settings register is not changed by the branch.
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.
python tools/settings_register.py --docs, one generated file. STRATA_PREFILL_STREAM_MIN and STRATA_UMA_PIN_CAP are ways back now, so they move into
the table "Switches that go back to earlier behaviour" (the first with its first release, v0.1.40.1; the second as a new row), and the platform cell
of STRATA_PF_FUSED_Q50 reads "NVIDIA and AMD". Counts: 274 and 64. Run again, the tool changes nothing.
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.
The previous commit skipped the fused up-mix (STRATA_HC_UPMIX) whenever STRATA_HIP_PROMPT_F16=1, which is correct but gives up
its speed. gr_upmix_kernel now has an FP16 path, taken when the activation image is FP16 (g_act_f16, set by Prefill::init with
Gemm::set_f16_io): the lo16 fragments are read as FP16 and multiplied on __builtin_amdgcn_wmma_f32_16x16x16_f16_w32, the BF16
W_up rows are converted to FP16 while they are staged in LDS (bf_to_hf_conv, the conversion the FP16 GEMM route applies; a BF16
value is exact in FP16 above 6e-5), FP32 accumulate in the same K order as the BF16 kernel. The guard of the previous commit
is removed again. With FP16 io off the kernel takes the BF16 path it took before (one uniform branch).
New test hip_gr_upmix_parity (src/prefill/gr_upmix_parity.cu on HIP; exit 77 off gfx11): the BF16 cases against the default
pair (the 20 sizes from T = 1 to 8192 pass on a Radeon 780M) and six FP16-io cases (T = 33 to 8192) against an FP64 reference and
against the FP16 pair: the fused kernel's error against FP64 is 1.6e-7 to 3.6e-7 of the largest value, the pair's (its GEMM
output rounded to FP16) 6.2e-5 to 1.2e-4.
Radeon 780M, Q2_0 pack, 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), STRATA_HIP_PROMPT_F16=1: fused experts beside it 0.00598 (ratio
to the MMQ arm 1.101, 95% CI 0.954 to 1.248, top-1 97.53% against 97.27%); alone 0.00593 (ratio 1.091, CI 0.968 to 1.231, top-1
97.46%). Before this change with the up-mix skipped: 1.075 and 0.914; before either: 166 and 171 times. Prompt tok/s medians of 3
rounds, ratio to nothing set: fused + FP16 io 300 tokens x1.111, 1,000 x1.152, 2,048 x1.628, 8,192 x1.450; FP16 io alone
x1.114 / x1.152 / x1.193 / x1.251 (with the up-mix skipped: x1.087 / x1.113 / x1.569 / x1.389 and x1.088 / x1.113 / x1.161 / x1.207).
Without STRATA_HIP_PROMPT_F16=1 nothing changes: the nothing-set arm is byte-identical to the old default.
One line, printed the first time the entry takes such a layer, naming the floor below which it applies. Only with the research switch on; nothing is printed or changed otherwise.
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.
On a GB10 (sm_121, 48 SMs) the speed table now also sets STRATA_PF_FUSED_KQ=1, so the
K-quant experts of Unsloth's UD-Q4_K_XL files (Q4_K / Q5_K gate/up, Q5_1 / Q8_0 down)
read their prompt on Strata's fused int8 kernels instead of llama.cpp's MMQ tiles.
STRATA_PF_FUSED_KQ=0 puts them back on MMQ; STRATA_SM121_PERF=0 still turns the whole
table off, and a value the user set is kept. The engine's start line lists the new
switch by name with the others.
UD-Q4_K_XL on one Spark with an expert cache budget of 12000 (15,283 of 24,576 experts
resident, the box above 16 GiB available), against the FP16 prompt path's text over 48
real-text prompts (24 at 2,048 and 24 at 4,096 tokens, 256 forced tokens, 12,288
positions): forced-token KL fused K-quant / MMQ 0.895 [0.808, 0.989], top-1 agreement
with the FP16 path 96.31% against 95.74%; two starts of each arm gave byte-identical
output (repeat floor 0). Prompt speed over 10 interleaved pairs: median of the per-round
ratios 1.10 / 1.26 / 1.18 / 1.53 at 2K / 4K / 8K / 20K tokens.
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.
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.
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.
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.
docs/SETTINGS.md is written by tools/settings_register.py --docs from data/settings-register.json and had not been regenerated since the register
last changed. This commit is that regeneration and nothing else: the counts of the two tables follow the register (switches you can turn on 277 -> 275,
switches that go back to earlier behaviour 58 -> 62), STRATA_PF_SMALL_FUSED, STRATA_PF_FUSED_IQ2X, STRATA_PF_FUSED_Q50, STRATA_MTP_BATCH_F16 and STRATA_SYCL_BF16_DET
appear in the second table, STRATA_SPEC_FIXED and STRATA_SPEC_FIXED_TABLE in the first, and five entries that the register no longer lists as switches
(STRATA_GDN_TC, STRATA_HC_Q8, STRATA_HIPBLASLT_TABLE, STRATA_METAL_F16, STRATA_GDN_CHUNKED) leave the page; the platform column of
STRATA_LOGITS_DUMP now says "NVIDIA and AMD, Intel Arc".
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.
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).
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.
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.
The line apply_nv_kq_default prints at every NVIDIA start of compute capability 8.0 and up said that a model with K-quant experts reads its
prompt on llama.cpp's MMQ kernels. With the previous commit that is no longer true on the cards the fused K-quant default takes. The call
now gets one more argument: whether Strata's own kernels read the K-quant experts on a visible card, from the new nv_kq_fused_here(major,
minor, SM count), which is fused_tile::kq_takes with the switches the engine reads (STRATA_PF_FUSED=0, STRATA_PF_FUSED_KQ, STRATA_PF_FUSED_SM40,
STRATA_PF_FUSED_SM86). Where it is true the line reads
strata: a model with K-quant experts (Unsloth UD-Q4/Q5/Q6_K_XL) reads its prompt on Strata's own kernels where they cover the layer (Q4_K and
Q5_K gate/up with a Q5_1 or Q8_0 down) and on llama.cpp's MMQ kernels for the rest (STRATA_PF_FUSED_KQ=0 gives all of them back to MMQ)
and where it is false the earlier line, byte for byte. generate.cpp asks every visible card and says it if any of them takes the kernels.
The line is printed as before: only when STRATA_MMQ_KQ was set by this default. src/core/nv_defaults_test.cpp checks both texts and the
card answer for the named cards, the way-back switches and the opt-in.
docs/QUANTS.md, row "Q4_K (gate/up)", column "CUDA prompt" (the Q5_K and Q5_1 rows say "as Q4_K"): names the fused kernels and the way back.
docs/SETTINGS.md is generated from the register and is not regenerated here.
Evidence for the 40 to 79 SM clause (RTX A4000, sm_86, 48 SMs, one layer of Flash-Next's shape, the staged 128-row tile the rule picks, MMQ ms /
fused ms at 300 / 1,000 / 2,048 / 4,096 / 8,192 / 20,000 tokens): Q4_K / Q5_1 1.67 1.44 1.49 1.35 1.05 0.97, Q4_K / Q8_0 1.79 1.61 1.67 1.46
1.08 0.98, Q5_K / Q8_0 1.72 1.59 1.60 1.45 1.05 0.99; the 64-row tile is slower at every size (0.60 to 1.37); the output bits hash is equal at
every tile. No end-to-end row exists on a card of 40 to 79 SMs with a K-quant set.
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.
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). The merge also carries 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.
Merged onto this head; nothing changed by hand.
The engine line printed when a fused-only layer set takes the lower chunk floor now reads: "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." The STRATA_PREFILL_STREAM_MIN row of docs/STRIX_HALO.md says that a
UD-Q4_K_XL set on Windows takes 64 by itself, other sets keep 1,024, and a smaller N is opt-in. No behaviour change.
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.
With STRATA_HIP_PROMPT_F16=1 the prompt's activation images are written as FP16 bits (gr_silu writes lo16 through act16). The
fused hyper-connection up-mix (STRATA_HC_UPMIX=1, on by default on a Radeon 780M under Linux and on a Strix Halo under
Windows) reads the same lo16 buffer as BF16 on the matrix cores, so the two switches together give wrong
activations (measured on the 780M, the Strix Halo takes the same code): no overflow and no non-finite value, but the forced-token KL against the FP16 path was 0.90 against 0.0054 for
the MMQ path (166 times, top-1 agreement 68.7% against 97.3%; Radeon 780M, 24 prompts of 2,048 tokens, 64 forced tokens each).
Setting STRATA_HC_UPMIX=0 beside the FP16 switch brought it back to 0.00584 (ratio 1.075, 95% CI 0.926 to 1.233, top-1 97.27%);
no other switch of the matrix-core prompt set changed it.
The call site now has no up-mix when the stage runs FP16 io (m.f16_io); the projection and the mix then take the ordinary
bf16_proj + gr_mix_r pair, which reads the FP16 image correctly. Nothing changes without STRATA_HIP_PROMPT_F16=1: the
condition is false there, so every default path is byte-identical.
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.
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.
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.
small_card_kernels_on() moves from core/sm120_series.hpp to
prefill/pf_fused_override.hpp (strata::prefill), next to the other reader of the
small-card override. sm120_series.hpp is byte-identical to its state before the
previous commit again, so none of the CUDA kernel translation units under src/kernels/cuda sees
a changed header. Behaviour is unchanged: same rule, same defaults, same way back
(STRATA_PF_SMALL_FUSED=0). generate.cpp and the unit test call the function in
its new place.
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.
f-q36-default is two commits on 4e1e5f248. 3860b43a4: in CUDA builds the Qwen3.6 engine reads its prompt experts with the fused int8 kernels with nothing set,
on the cards fused_tile::takes_by_default takes (sm_86 class and sm_120 with 80+ SMs; 40-79 SMs only for staged launches); STRATA_PF_FUSED=0 turns it off, =1 keeps the
opt-in on every card that covers the pair; the two log lines lose their draft mark. 9e491df8e: fused_tile::wide_pair, so the staged K-quant pairs take the 128-row tile
above 112 rows an expert on sm_86-class cards with 80+ SMs (host code only). The branch sits on this head, so the merge is a fast-forward in content; nothing changed by hand.
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.
Work in progress, not gated. The rule: an integrated gfx1103 / gfx1150 / gfx1151 GPU under Linux (the class of the arena
and settle defaults) sets STRATA_PF_FUSED=1 at start when the user has not set the variable; STRATA_PF_FUSED=0 is the way
back to MMQ. Nothing else changes: no new log line (the prefill's own line about the fused kernels appears once they are taken).
Measured on a Radeon 780M (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).
Still to do before this is a default: forced-token KL against the FP16 path with the repeat-arm floor, cmake-cpu and the
settings register check, nothing-set byte-identical to the opt-in arm, STRATA_PF_FUSED=0 byte-identical to the old default,
a 3-start confirmation block on the 780M.
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.
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.
b1db4ab8e is one commit on a269d4c82 adding metal/src/engine/stubs_prompt_f16.cpp with Metal stubs for fused::want_dm_f16 and fewrows_record, which the shared prompt
path calls since two commits of the day before; without them the Mac engine did not link. One new Metal-only file, no shared source touched. The branch sits on this
head, so the merge is a fast-forward in content; nothing changed by hand.
2fdee4aeb is one commit on a269d4c82: s86_class() in fused_tile_rule.hpp (8.0, 8.6, 8.9), one statement in moe_fused_iq.cu that takes the class from it, the unit
tests and three register notes. Rule only: no kernel, tile table, log line or setting. STRATA_PF_FUSED_SM86=0 puts the whole class back on MMQ. The branch sits on
this head, so the merge is a fast-forward in content; nothing changed by hand.
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.
The staged prompt walk (3feffd597) calls fused::want_dm_f16, and the few-row
expert path (af5803e4b) calls fewrows_record. Both are defined only in the
CUDA / HIP sources. Prefill::run_impl is linked into the Metal engine but never
runs there, so every entry point it calls needs a stub, and these two had none:
strata failed to link with two undefined symbols.
stubs_prompt_f16.cpp holds both: want_dm_f16 does nothing (the build has no
fused kernels), fewrows_record stops the engine with its name like the other
stubs (it is only reached with the research switch STRATA_PF_FEWROWS set). No
shared source is touched.