mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-05 07:48:45 +00:00
d877f150a06f4fdfd3a7e01acfe7be4dde844ca4
1024
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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. |
||
|
|
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. |
||
|
|
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. |
||
|
|
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
|
||
|
|
27cf035e5c |
Merge f-amd-f16 8d7f997d4 into f-p4-int (the Radeon 780M on Linux reads its 16-bit prompt GEMMs FP16 in and out by default; the hyper-connection up-mix kernel has an FP16 path)
Three commits on
|
||
|
|
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. |
||
|
|
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. |
||
|
|
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 |
||
|
|
8d7f997d41 |
The Radeon 780M on Linux reads its 16-bit prompt GEMMs FP16 in and out by default
On a Radeon 780M (gfx1103, integrated) under Linux the engine now runs the prompt's 16-bit GEMMs FP16 in and out when the user has not set STRATA_HIP_PROMPT_F16: "1" still turns it on on any card, any other set value (0) is the way back, and every other architecture, every discrete card and Windows stay opt-in as before. The rule is prompt_f16_resolve (include/strata/core/arch_defaults.hpp), used by prompt_f16() in src/prefill/gemm.cu; it needs integrated, not Windows and a gcnArchName of exactly gfx1103 (the :sramecc / :xnack suffix forms included). Nothing is printed at start for the default; the "FP16 in and out" line still appears when the variable is set to 1 and the gfx103x tip is unchanged. Not flipped elsewhere: a Radeon AI PRO R9700 (gfx1201) is slower with it on (dense GEMMs x0.70 to x0.72), gfx103x has no run of ours on real activations, the other gfx11 chips have no number. It needs the two commits before it on this branch: with the FP16 prompt path the fused hyper-connection up-mix (on by default on this card) read FP16 activations as BF16, which made the first measurement of this default wrong (forced-token KL 166 times the MMQ path's); that is fixed and the up-mix now has an FP16 variant. Measured on a Radeon 780M (Q2_0 pack, 3 interleaved rounds, prompt tok/s medians, nothing set -> FP16 io): 300 tokens 124.3 -> 138.5 (x1.114), 1,000 157.7 -> 181.7 (x1.152), 2,048 208.7 -> 248.9 (x1.193), 8,192 270.0 -> 337.8 (x1.251). Beside STRATA_PF_FUSED=1: x1.111 / x1.152 / x1.628 / x1.450 against nothing set. Quality, same card: forced-token KL against the FP16 path (24 prompts of 2,048 tokens, 64 forced tokens each, draft-cost table fixed, repeat arms equal their first run byte for byte): 0.00593 against 0.00543 for MMQ (ratio 1.091, 95% CI 0.968 to 1.231), top-1 agreement with the FP16 path 97.46% against 97.27%, no non-finite value. Not run: any other card; no second model. This commit also updates the settings register entry of STRATA_HIP_PROMPT_F16 and the rows of docs/AMD_HIP.md and docs/RADEON_780M.md. |
||
|
|
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. |
||
|
|
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. |
||
|
|
ab1917985e |
Merge f-strix-short f33e9fa7b into f-p4-int (Windows Strix Halo reads prompt pieces of 64 to 1,023 tokens on the fused kernels for a set whose layers have no MMQ tile)
On Windows with one gfx1151 card and a layer set in which every layer has no MMQ tile and the fused kernels take it (UD-Q4_K_XL: STRATA_MMQ_KQ is opt-in), a prompt piece below stream_all_min() (1,024 tokens) took the staged walk, which has no fused entry for such layers and ran every routed expert on the dequantize-to-FP16 path: about 1.6 s a prompt whatever its length. The default floor for that set on that device class is now 64 (include/strata/prefill/stream_floor_rule.hpp, a pure rule with its own unit test, tests/prefill/stream_floor_rule_test.cpp), so pieces of 64 to 1,023 tokens take the long prompt path. Every other device class and layer set keeps 1,024, and a piece of 1,024 tokens or more is unchanged. STRATA_PREFILL_STREAM_MIN set to any value replaces the floor; STRATA_PREFILL_STREAM_MIN=1024 is the way back. The engine says so once: "prefill: prompt pieces of N tokens or more read on the fused kernels, as long prompts do. STRATA_PREFILL_STREAM_MIN=1024 keeps the old rule." Measured on Windows gfx1151, UD-Q4_K_XL, fixed draft-cost table, 3 rounds, prompt ms before / after: 128 tokens 1,754 / 421, 256 2,266 / 515, 512 2,780 / 665, 768 3,141 / 838, 1,000 3,629 / 1,015; 1,100 and 2,048 unchanged (1,110 / 1,107, 1,765 / 1,753). Both branches changed data/settings-register.json; nothing was changed by hand. |
||
|
|
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. |
||
|
|
00807c9b30 |
[Engine] Strix Halo: the RAM cap with several requests at once has a way back and speaks only when it cuts
The cap on the pinned RAM copy of experts (--batch 2 or more, Windows HIP, integrated GPU) printed its line at 2 and 3 slots too, where the whole copy (12.47 and 16.40 GiB) is under the cap and nothing is cut: "18.1 GiB of experts are kept in RAM" was wrong there. Now the line comes after the pin and only when the RAM copy reached the cap (4 slots at 131,072 tokens: 15.0 GiB). STRATA_UMA_PIN_CAP=0 keeps the RAM budget as set (any other value, or unset, leaves the cap on); the line names it: "(STRATA_UMA_PIN_CAP=0 keeps the RAM budget as set)". The register entry is now status rollback with the measured points in its note, and docs/BATCHING.md has one sentence where the memory per slot is described. |
||
|
|
3a25581693 |
[Engine] Strix Halo: cap the pinned RAM copy of experts when --batch slots pin their K/V
With --batch 4 at 131,072 tokens on a Strix Halo (UD-Q4_K_XL, the usual 38 GiB RAM budget) the engine stopped inside the prompt path's allocation, and with an 18 GiB budget the OS ran out of page-locked memory. Every session (the main one and each slot) pins its streamed K/V for the whole context, 1.55 GiB at 131,072 tokens, and the RAM copy of experts is pinned on top of that. Now, with --batch 2 or more on this path, the RAM copy is cut to what leaves the RAM copy plus the sessions' pinned K/V at 22.75 GiB, the level of the largest 4-slot start that worked (15 GiB of experts, 7.75 GiB of K/V). The experts left out are read from the SSD when needed. Context, slot count and the 16,384-token prompt chunk are untouched; --batch 1 does not enter the code. The engine says so in one line, and after a real init failure with 2 or more slots it names --batch N-1. Measured on the box (4 slots, 131,072 tokens, 15 GiB): starts and serves, 49.2 tok/s inside the batch windows against 56.4 with the whole copy at a 65,536 context; the 2,067-token prompt reads at 837 against 1,054 tok/s. 3 slots and below are not changed: their RAM copy plus K/V is at or under the level. The constant and its measured starts are in include/strata/core/uma_cache.hpp. STRATA_UMA_PIN_CAP (test only, register status research) turns the cap off. |
||
|
|
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. |
||
|
|
4d958fbdbf |
nv_defaults, docs: the start-up line about K-quant experts says what happens on the card; the QUANTS.md row names the fused kernels
The line apply_nv_kq_default prints at every NVIDIA start of compute capability 8.0 and up said that a model with K-quant experts reads its prompt on llama.cpp's MMQ kernels. With the previous commit that is no longer true on the cards the fused K-quant default takes. The call now gets one more argument: whether Strata's own kernels read the K-quant experts on a visible card, from the new nv_kq_fused_here(major, minor, SM count), which is fused_tile::kq_takes with the switches the engine reads (STRATA_PF_FUSED=0, STRATA_PF_FUSED_KQ, STRATA_PF_FUSED_SM40, STRATA_PF_FUSED_SM86). Where it is true the line reads strata: a model with K-quant experts (Unsloth UD-Q4/Q5/Q6_K_XL) reads its prompt on Strata's own kernels where they cover the layer (Q4_K and Q5_K gate/up with a Q5_1 or Q8_0 down) and on llama.cpp's MMQ kernels for the rest (STRATA_PF_FUSED_KQ=0 gives all of them back to MMQ) and where it is false the earlier line, byte for byte. generate.cpp asks every visible card and says it if any of them takes the kernels. The line is printed as before: only when STRATA_MMQ_KQ was set by this default. src/core/nv_defaults_test.cpp checks both texts and the card answer for the named cards, the way-back switches and the opt-in. docs/QUANTS.md, row "Q4_K (gate/up)", column "CUDA prompt" (the Q5_K and Q5_1 rows say "as Q4_K"): names the fused kernels and the way back. docs/SETTINGS.md is generated from the register and is not regenerated here. Evidence for the 40 to 79 SM clause (RTX A4000, sm_86, 48 SMs, one layer of Flash-Next's shape, the staged 128-row tile the rule picks, MMQ ms / fused ms at 300 / 1,000 / 2,048 / 4,096 / 8,192 / 20,000 tokens): Q4_K / Q5_1 1.67 1.44 1.49 1.35 1.05 0.97, Q4_K / Q8_0 1.79 1.61 1.67 1.46 1.08 0.98, Q5_K / Q8_0 1.72 1.59 1.60 1.45 1.05 0.99; the 64-row tile is slower at every size (0.60 to 1.37); the output bits hash is equal at every tile. No end-to-end row exists on a card of 40 to 79 SMs with a K-quant set. |
||
|
|
492adfcbac |
Merge f-p4-small-default 8ce488608 into f-p4-int (small CUDA cards take Strata's fused expert kernels inside the small-card prompt path)
On one CUDA card with a native pack and a default prompt chunk under 8,192 tokens, the prompt path reads in MMQ's buffer layout so that the layer-major walk runs. Inside that layout the native fused expert kernels now run too, instead of MMQ's kernels, by default: an unset STRATA_PF_FUSED reads as 1 on that path only (pf_fused_env_effective), so the kernels take every format they cover on the card (the i-quant gate/up formats with their covered downs, the Q2_0 pair); K-quant, Q8_0 and the other formats keep their own switches. STRATA_PF_SMALL_FUSED=0 is the way back (MMQ's kernels on that path, as before); STRATA_PF_SMALL=0 still turns the whole rule off. A card where the rule does not fire, a HIP build, and a user who named STRATA_PF_FUSED behave as before. The log line of the rule says "so prompts are read the way that suits a card with little memory" in place of "with the unfused experts". The second commit moves the switch helper out of the CUDA kernel headers so the kernel translation units under src/kernels/cuda see no changed input. Measured (RTX A4000 held to 8,000 and 9,000 MiB free, IQ2_XS): prompt speed fused / MMQ 1.000 to 1.050 from 300 to 20K tokens at 8,000 MiB, 1.000 to 1.042 at 9,000 MiB; forced-token KL fused / MMQ 1.024 (CI 0.929 to 1.156) at 2K and 1.105 (0.964 to 1.305) at 8K against a floor of 1.000. Byte identity of the 2K set (24 prompts, draft-cost table fixed): nothing set equals the opt-in arm, STRATA_PF_SMALL_FUSED=0 equals the old default, and a card where the rule does not fire (12,000 MiB) is unchanged. Merged onto this head. Both sides changed data/settings-register.json, src/core/arch_defaults_test.cpp and src/prefill/moe_fused_iq.cu in different places; git merged them without a conflict and nothing was changed by hand. |
||
|
|
a58453a54e |
Merge f-amd-paths 69394994a into f-p4-int (integrated Radeon GPUs on Linux read long prompts on Strata's own int8 expert kernels by default)
On an integrated gfx11 GPU under Linux (Radeon 780M / 760M gfx1103, 890M / 880M gfx1150, Strix Halo gfx1151) the engine now sets STRATA_PF_FUSED=1 at start when the user has not set it, so the prompt experts run on Strata's fused int8 kernels instead of llama.cpp's MMQ. Nothing is printed at start; the prefill's own "prompt experts on the fused int8 kernels" line appears once the kernels are taken. STRATA_PF_FUSED=0 is the way back to MMQ (a value the user set is always kept). Discrete cards, computers that also hold a discrete card, and Windows are not touched: the rule is igpu_fused_prompt_default (include/strata/core/arch_defaults.hpp, src/core/arch_defaults.cpp), the same device class as the arena and settle defaults, and it returns false for any non-integrated device and for Windows (the Strix Halo on Windows already has the switch in its own set). Measured on a Radeon 780M (gfx1103, Q2_0 pack, 3 interleaved rounds, prompt tok/s medians, nothing set -> STRATA_PF_FUSED=1): 300 tokens 124.3 -> 124.3, 1,000 159.4 -> 159.5, 2,048 208.8 -> 270.4 (x1.295), 8,192 270.3 -> 304.2 (x1.125). The fused kernels are not taken below the chunk size they need, so short prompts are unchanged. Quality, same card: forced-token KL against the FP16 path, 24 prompts of 2,048 tokens, 64 forced tokens each, draft-cost table fixed, repeat arms equal their first run byte for byte: mean 0.00595 with the fused kernels against 0.00543 with MMQ (ratio 1.096, 95% CI 0.926 to 1.367), top-1 agreement with the FP16 path 97.85% against 97.27%, no non-finite value. Positions 2 to 16 sit at 1.20 times MMQ's (CI 1.01 to 1.38), driven by one prompt. Not run: gfx1150 and gfx1151 (they follow by the class rule). 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. |
||
|
|
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. |
||
|
|
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. |
||
|
|
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
|
||
|
|
8ce488608d |
Small-card prompt path: keep the switch helper out of the CUDA kernel headers
small_card_kernels_on() moves from core/sm120_series.hpp to prefill/pf_fused_override.hpp (strata::prefill), next to the other reader of the small-card override. sm120_series.hpp is byte-identical to its state before the previous commit again, so none of the CUDA kernel translation units under src/kernels/cuda sees a changed header. Behaviour is unchanged: same rule, same defaults, same way back (STRATA_PF_SMALL_FUSED=0). generate.cpp and the unit test call the function in its new place. |
||
|
|
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. |
||
|
|
9187ef658b |
WIP, not gated: integrated gfx11 on Linux takes the fused int8 prompt experts by default
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. |
||
|
|
6d7a183f0c |
Small-card prompt path: the native fused expert kernels run by default (CUDA)
On one CUDA card whose expert cache is small (default prompt chunk under 8,192 tokens, native pack) the prompt path reads in MMQ's buffer layout so that the layer-major walk runs. Inside that layout the native fused expert kernels (the layer-major walk's groups and the streamed chunks) now run too, instead of MMQ's kernels, by default. On that path an unset STRATA_PF_FUSED reads as 1 in fused::native_supported and fused::requested() (pf_fused_env_effective), so the kernels take every format they cover on the card; K-quant, Q8_0 and the other formats keep their own switches. The reading applies only while the small-card rule has fired in a CUDA build (pf_fused_override() == kPfFusedKernelsOnly); a card where the rule does not fire, a HIP build, and a user who named STRATA_PF_FUSED behave as before. STRATA_PF_SMALL_FUSED=0 is the way back (MMQ's kernels on that path, as before); STRATA_PF_SMALL=0 still turns the whole rule off. The log line says "so prompts are read the way that suits a card with little memory" in place of "with the unfused experts". Unit test over the card sizes of the measured grid; register entry STRATA_PF_SMALL_FUSED with status rollback. |
||
|
|
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. |
||
|
|
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. |
||
|
|
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)
|
||
|
|
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. |
||
|
|
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 = |
||
|
|
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). |
||
|
|
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). |
||
|
|
0a17fb99e2 |
integrated gfx11 on Linux: the registered expert arena asks for no transparent huge pages
On a Radeon 780M (gfx1103) under Linux the engine registered its 31.6 GiB expert arena and asked for transparent huge pages on it whenever enough free 2 MiB blocks existed. Huge-page compaction and collapse inside a registered range invalidate it; KFD then evicts the process's queues, and the gc 11 MES firmware resets the GPU when a dispatch sits in a barrier. The prompt then ends in "unspecified launch failure". One Radeon 780M box (Q2_0 pack, Linux kernel 7.0), one engine at a time: huge pages requested in 9 starts, 8 failed in the first prompt; not requested in 3 starts, 3 ran. Setup already wrote STRATA_NO_ARENA_THP=1 for its 780M opt-in. This makes it the engine's own rule, detected from the device (integrated, and gfx1103, gfx1150 or gfx1151), on Linux only. No new setting: STRATA_NO_ARENA_THP unset lets the engine decide (this rule, and every other device as before); any value but 0 skips the request as before; 0 now asks for the huge pages, also on these GPUs (it used to skip them like any other value). The SYCL arena reads the variable the same way. Windows and discrete cards are unchanged. The arena line's new ending is a [DRAFT] for the owner's wording. Unit test: arch_defaults_test (the device rule and the variable's three states). |
||
|
|
4e9dde87eb |
gpu_pause_time: the comment above the between-requests line states its wording as approved
Comment only; the string and the code are unchanged. |
||
|
|
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). |
||
|
|
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 = |
||
|
|
0d6308de65 |
[Engine] Tesla P100: the FP16 prompt path with few-row experts is the default instead of MMQ
kGp100Default = true (gp100_prompt_default.hpp): on a Tesla P100 (compute capability 6.0, STRATA_EXPERIMENTAL_SM60 build, every visible card cc 6.0) with STRATA_PREFILL_MMQ unset, no MMQ_WS, no STRATA_EXPERT_NIBBLE and no --peer-device, the prompt experts take the dequantize + FP16 path with the few-row experts on the quantized grouped kernels, and MMQ is not used. STRATA_PREFILL_MMQ=1 keeps MMQ; STRATA_PF_FEWROWS=0 turns the few-row route off. What a P100 user gets, IQ3_XXS, prompt speed against MMQ's (3 rotated rounds, committed tree): 300 tokens 0.967, 1,000 0.913, 2K 0.930 (up to 2K at 0.91-0.97 of MMQ's speed), 4K 0.997 (level), 8K 1.041, 20K 1.035. Plain FP16 without the few-row route was 0.850 / 0.869 / 0.912 / 0.956 / 1.025 / 1.009. Gate (11-11 / 11-12), all on the P100: - device code: the flip changes no function (3,674 / 3,674 and 3,749 / 3,749, libstrata_kq.so 256 / 256, 0 differing); the previous commits add only fewrows_record_kernel; with the switch unset the outputs equal 5a9d6f559's (plain FP16 KL 0.00000, tokens identical 16 of 16, routing 100%). - teacher-forced per-position KL against the FP16 path (32 prompts of 300 to 20,000 tokens, 256 forced tokens, 8,192 positions): few-rows / MMQ 0.835 [0.760, 0.918] (MMQ again / MMQ 1.042 [0.972, 1.118]); mean KL 0.00613 against MMQ's 0.00735; top-1 equal to FP16's 98.30% against 97.78%. - robustness on this default with nothing set: small chunks (300 / 1,000 / 1,100 / 2,048 ids) all answered; agent run (4K turn + 8 follow-ups, prompt cache on) 9 of 9 turns answered. - default against the gated arm with the draft-cost table fixed (--draft-costs, round-18 engines): 16 of 16 prompts bit-identical (KL 0.00000, tokens identical, routing 100.000%), default again and gated again likewise; with the route off the default equals plain FP16 bit for bit. Without a fixed table, runs on this box shifted by 0.001-0.005 KL between starts (timing-learned verify windows), which is why the check was repeated that way. |
||
|
|
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. |
||
|
|
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. |
||
|
|
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). |
||
|
|
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
|
||
|
|
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
|
||
|
|
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
|
||
|
|
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
|
||
|
|
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. |
||
|
|
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). |
||
|
|
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 |
||
|
|
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). |
||
|
|
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
|