Commit Graph
180 Commits
Author SHA1 Message Date
Niko1221 12982f239d sm120 table: the measured Ada / Ampere part sets (no PACK), the RTX 4060 Ti 16 GB and RTX 3060 12 GB rows measured but not default, the big-card guard
Measured on rented cards (SQ-20 v2, DFlash 2 on; RTX 3060 12 GB, RTX 4060 Ti 8 GB and 16 GB, RTX 3090 24 GB; rel0223/nv-ada-ampere/RESULTS.md):

- The small-card set (COMPACT, COMPACT_HYBRID on 12 GB and less, PLD, CORE_GRAPH, C64_SPEC, TC_ATTN) loses PACK: no gain with every expert resident and
  -30% at 9K on a hybrid load. PF_ATTN stays out (+14-18% prefill at 9-12K, but -16% at 16K and -39% at 32K on the 16 GB compact card).
- Rows "4060ti-16" and "3060" are measured (STRATA_INK_SM120=1 uses them without STRATA_INK_SM120_ROW) and default_on = false: KL against the old path is
  0.0055-0.0107 on four corpora (floor 0.0287), the FASTQ subset passes except the agent suite on the 16 GB card (5/10 against 7/10). No Ada / Ampere row is the default.
- DENSE_OPT, DSPARK_OPT and MOE_OPT allocate the 5090's big-card scratch and die on a 16 GB card next to COMPACT (79 MiB free). A row's set never turns them on for
  an Ada / Ampere card of 16 GB or less; only an explicit STRATA_INK_SM120_<PART>=1 does.
2026-11-27 05:19:28 +01:00
Niko1221 f78e234a2c engine: the drafter rule's context threshold: 2048 tokens on hybrid cards, 3072 on resident sm < 80 cards
kDraftPlainCtxHybrid = 2048 (was the provisional 3072), from RTX 5070 12 GB (SQ-20 v2, 3 rounds, DFlash 2 against --draft off, plain = no drafting):
- prompts of 33-62 tokens: compact hybrid load: prose 76.2 (DFlash 2) vs 86.0 (plain), code 86.3 vs 80.7, tool 98.8 vs 84.9; old path: 47.0 vs 62.6, 52.0 vs 57.7, 57.4 vs 63.3
- a 4096-token document: hybrid 34.5 vs 59.2 tok/s (-42%), old path 22.1 vs 44.1; acceptance 1.9 tokens per step
- 32K: level (30.5 / 30.5 hybrid, 26.4 / 26.7 old path)
NV-OLDER (V100 / P100 / 2080 Ti): DFlash 2 is also below plain on a 4K document (V100 -7% at 4K, -10% at 8K with all experts resident; its draft step is emulated), so a fully resident card
below sm_80 goes plain from kDraftPlainCtxSlowArch = 3072 tokens. Resident sm_80 and newer: unchanged (the 5090 and the PRO cards win at 4K with the window governor).
ink_draft_plain_step takes the compute capability (default 90, no effect for callers that do not pass it); the CUDA hook passes the device's. Unit test covers the measured cases.
2026-11-27 02:20:25 +01:00
Niko1221 04c94cbe32 feat(inkling2-cuda): below sm_80 a hybrid load never gets the default drafter (principle 1b of the drafter rule), for .strata and .gguf
The residency-first rule (ink_draft_rule.hpp) vetoes the default DFlash 2 only when it would move a fully resident model to a hybrid one or cut the tier by 10 % or more. On the cards below
sm_80 (V100, RTX 20, GTX 10, P100) that left hybrid cases with a drafter that loses decode speed. SQ-20 v2, decode tok/s on prose, plain against DFlash 2: RTX 2080 Ti 11 GB 23.5 / 16.3,
P100 16 GB 25.1 / 22.1, GTX 1080 Ti 11 GB 12.7 / 9.2; the GSQ-RCO IQ3_S file on the 2080 Ti (DFlash 2 was loaded, the veto did not fire): prose 32.4 / 23.1, chat 35.9 / 29.1, code 36.0 / 30.3.
Every draft window reads more host experts than a plain step.

- InkDraftLoadIn::below_sm80 and principle 1b: below_sm80 && !full_without (some experts live in host memory, with or without the drafter) -> not loaded, the same veto line, `--draft on`
  (or STRATA_INK_DRAFTER=dflash2, STRATA_INK_DFLASH2_FORCE=1) loads it anyway, `--draft off` wins. A fully resident card below sm_80 (a V100 32 GB) keeps drafting.
- The backend applies the rule to a .gguf on those cards too (it was .strata only): the expert bytes are the file size minus the dense trunk (1.4 GiB compact GGUF trunk, 3.4 GiB otherwise).
- Unit test: the cases of the new principle (hybrid, the same load above sm_80, --draft on, --draft off, fully resident); `ink_draft_rule_test: ok` (g++ -std=c++17).

Proof on the Tesla P100 16 GB (sm_60, one binary built from this commit, 1 start per arm, default / `--draft on` / `--draft off`):
  SQ-20 v2 (hybrid, 2313 experts in VRAM / 759 host): default prints "[InkCUDA] DFlash 2 not loaded: it would move part of the model off the card (the experts need 14.6 GiB, 9.8 GiB fit with the
  drafter's 728 MiB, 10.5 GiB without it) ... `--draft on` loads it anyway." and runs with no drafter (decode 23.2 tok/s, ids identical to --draft off); `--draft on` loads DFlash 2 ("drafter on",
  2154 / 918 experts, decode 17.4); `--draft off` 22.7.
  IQ3_S (GSQ-RCO; all 3072 experts resident on the P100, so no hybrid load): default and `--draft on` load DFlash 2, `--draft off` does not, ids identical in all three: the rule does not
  fire on a fully resident card, as intended.
2026-11-27 02:08:44 +01:00
Niko1221 36a42cd914 sm120 table: the 16 GB Ada / Ampere rows (4080, 4070 Ti SUPER, 4060 Ti 16 GB, A4000) carry no COMPACT_HYBRID (with it COMPACT ran at 2..15 slots and a 16 GB card died at the start with 3 MiB free); a table test pins that no row of 15 GiB or more holds it 2026-11-27 01:57:37 +01:00
Niko1221 d6ed7cfa88 fix(inkling2-cuda): the Ada / Ampere small-card candidate rows try COMPACT with COMPACT_HYBRID (compact limit 20 GiB, chunk 256)
The candidate rows for the cards of 16 GB and less carry the compact size limit and the 256-token compact chunk, and COMPACT_HYBRID is in their candidate set,
so that a 12 GB or 8 GB card builds the compact trunk and puts the freed VRAM into the expert tier.
2026-11-27 01:48:23 +01:00
Niko1221 bc5817f17b sm120 table: the DGX Spark's fast set is the default (default_on), after the FASTQ subset
FASTQ subset on the GB10 (SQ-20 v2, DFlash 2), fast against off: needles 16K / 32K 8/8 and 8/8, tools 24/26 and 24/26, agent 7/10 and 6/10, code 11/11 and
11/11: not worse than off anywhere. Speed (default row, no switch): C1 decode prose 78 / chat 94 / json 99 / code 115 / count 184 / tool 113 tok/s against
off 55 / 69 / 81 / 78 / 97 / 81, C4 109 against 66, C32 305 against 186, prefill 2.5-2.8x; exact = off = the previous release build on every prompt.
Known: with the IQ3_S GGUF the fast set is mixed (prefill +12-17%, C1 chat +35%, json / code slower, C32 at the default 64 drafting slots 167 against 190);
STRATA_INK_SM120=0 is the old path. Table test: the default case of the Spark.
2026-11-27 01:46:24 +01:00
Niko1221 6f9b779ef9 sm120 table: the GB10 row is measured; drafting numbers cost 5 / plain 0, an empty exact set
Measured on a DGX Spark GB10 (Vast, SQ-20 v2 and IQ3_S, DFlash 2 as the drafter). The 5090's drafting numbers (spec_cost 8, plain margin 1.02) made
fast mode decode at the plain rate (53 tok/s) on prose and chat, below off (55 / 69). With spec_cost 5 and plain 0 the C1 decode is prose 79,
chat 94, json 99, code 115, count 183, tool 112 against off 55 / 69 / 81 / 78 / 97 / 81 (mean 113.6 against 76.8), prefill 2.5-2.8x. Dropping
MOE_OPT or the FP8 trunk lost speed, TC_ATTN lost at C1, PDL and SPEC_ADAPT changed nothing, so the fast set stays the 5090's big set.
The exact set is empty (kSm120SparkExact): DSPARK_OPT replaces the window numbers and the verify tree, and exact tokens then differed from off with a
drafter on (json, tool); without it exact = off on every prompt, with and without a drafter. default_on follows from the FASTQ subset.
Table test updated (measured count 3, the Spark cases).
2026-11-27 01:46:08 +01:00
Niko1221 017b6b8651 engine(cuda): the Turing (sm_75) kernel series is on by default; STRATA_SM75_PERF=0 turns it off (#7041, #7076)
Until 0.2.22 the bitwise Turing kernels (PRs #2069-#2072, #2081, #2091-#2093, #2145-#2146, #2220-#2223, #1821) were on only with STRATA_SM75_PERF=1, because
nobody on the team had an sm_75 card.  #7041 measured them on 2x RTX 2080 Ti: +4.7% to +21% cold prefill from 32K to 207K tokens, decode level.

Our own check, a rented RTX 2080 Ti, Qwen3-30B-A3B UD-Q4_K_XL, one binary, STRATA_SM75_PERF unset against =1, 7 interleaved pairs:
- the same ids on 12 prompts at temperature 0 (10 short, 16K, 32K), and in every pair (decode short and 4K, prefill 16K and 32K);
- cold prefill 16K / 32K level (B/A 0.999 / 0.999), 4K level (1.000); decode after a 4K prompt B/A 1.042; short decode B/A 0.967 with a spread of 49.4 to
  57.2 tok/s in the A arm alone, so within run-to-run noise (2 of 7 pairs faster);
- no warning or error line only in one arm.
The reporter's prefill gain did not show on that model (a different pack and card count), so this is "no change measured", not a confirmed speed-up.

STRATA_SM75_PERF unset or non-zero: on for a compute capability 7.5 card; =0: off (the 0.2.22 default).  Only 7.5 cards are ever affected (is_sm75; under
STRATA_EMULATE_CC=75 an sm_86 card runs the series for tests); each kernel keeps its own switch, which wins in both directions; the numerics-changing Turing
options (SELECT_SIMT, PA_V2T, PF_FUSED_SM75, BF16_TC) stay opt-in.  sm75_series_test covers the rule.
2026-11-27 00:34:45 +01:00
Niko1221 f96e8c096c sm120 table: the RTX PRO 4000 row is default on (FASTQ equal or better than off on every suite) 2026-11-26 23:55:17 +01:00
Niko1221 402cd017e4 engine: the ONE drafter on/off rule: residency first at load, plain steps by context on hybrid cards
strata/core/ink_draft_rule.hpp (host-only, unit-tested by ink_draft_rule_test) states two principles for every backend:
1. Residency first. A default drafter is not loaded when its weights and rings would move the model from full residency (every expert in VRAM) to a hybrid load, or cut the
   expert tier by 10% or more. One line is printed, with the sentence start the HIP backend uses ("DFlash 2 not loaded: it would move part of the model off the card (the experts
   need X GiB, Y GiB fit with the drafter's Z MiB, W GiB without it) ... `--draft on` loads it anyway."). `--draft on` (BackendOpts::draft_forced), STRATA_INK_DFLASH2_FORCE=1 and
   STRATA_INK_DRAFTER=dflash2 ask for it by name and are never vetoed; `--draft off` stays off.
2. Plain steps by context. On a hybrid card (experts in host memory) a step from kDraftPlainCtxHybrid tokens of context on is a plain step, per step, so it follows every request.
   With all experts resident the existing window governor decides alone. The rule never turns drafting on.
CUDA: the backend compares the load plan with and without the drafter against the free VRAM, the trunk and the expert section (the COMPACT path keeps its own accounting) and sets
df2_residency_veto(), which df2_requested() reads. Tested on an RTX PRO 4000 24 GB with SQ-20 and a VRAM ballast: ballast 2600 MiB keeps full residency with DFlash 2 loaded (no line);
3000 MiB is the flip (3072 experts resident without DFlash 2, 3034 with it): the line is printed and DFlash 2 stays out, `--draft on` loads it (38 experts to host); 3400 and 3800 MiB
(hybrid either way, tier cut below 10%) load it. BackendOpts::draft_forced and its `--draft` parsing are the same lines the HIP backend adds.
2026-11-26 23:55:17 +01:00
Niko1221 9188799840 sm120 table: measured rows for the RTX 5080, 5070 Ti, 5070 (12 GB), 5060 (8 GB) and the RTX PRO 6000 / 5000 / 4500 / 4000
Measured on rented Vast boxes and l620 (SQ-20 v2, f-sm120-rows / f-0223-int builds, C1 on 6 prompts, C4, C8, 4K and 32K prefill and decode, 2-3 rounds), FASTQ off against fast.
- RTX PRO 6000 / 5000 / 4500 / 4000: the 5090 set plus TC_ATTN (kSm120ProFast). With the 5090 row alone these cards decode slower than off at 32K (PRO 5000 72 GB: 150 off, 111 fast;
  with TC_ATTN 186); the 4K numbers and the prefill do not move; teacher-forced KL of fast + TC_ATTN against off equals the fast set's (0.006-0.011). Default on for the first three
  (FASTQ equal or better); the 4000 stays off until its FASTQ is in.
- RTX 5070 12 GB and RTX 5060 8 GB: COMPACT_HYBRID (kSm120HybridFast: compact trunk, FP16 KV, tensor-core small-M kernels; no PACK / PREFILL / PLD / CORE_GRAPH, which made these cards slower).
  The 5070 is default on (FASTQ within noise, KL at the engine floor); the 5060 stays off until its FASTQ is in.
- RTX 5080 and 5070 Ti (16 GB): measured, fast = compact with the Bk128 MoE variant (+8% steps/s), default OFF: 32K prefill and decode lose with the K/V in host memory.
- the table test is updated (10 measured rows) and checks the new defaults.
2026-11-26 23:55:17 +01:00
Niko1221 a37566893c sm120: TC_ATTN joins the 5090 default set (FASTQ tools 24/26 and 24/26, code 11/11, math 146/150 and 148/150, needles 20/20 with and without it; 128K decode 84 to 238 tok/s); STRATA_INK_SM120_TC_ATTN=0 takes it out; the other big rows keep the big set 2026-11-26 23:27:58 +01:00
Niko1221 5bafbe3bcd engine(cpu): the 4-row dot kernels are the default from two tokens per expert call, off for one token (#7075, #6552)
0.2.21 made the dot_x4 kernels of the native CPU expert path opt-in
(STRATA_DOT_X4=1) because a single-thread cold bench showed them slower on a
DRAM-bound row.  #7075 measured the other side (2x RTX 5090, PCIe-streamed
NVFP4, 4 slots): without them warm batched decode lost ~15% and short prompt
reads ~8% against 0.1.66, and STRATA_DOT_X4=1 recovered both, while solo
decode (one token per expert) was better with them off.

The default now follows the call, as the reporter suggested and the reply on
the issue promised: on from kDotX4MinTokens = 2 tokens that share the expert in
one call, off for one token.  STRATA_DOT_X4=1 forces them on for every call,
STRATA_DOT_X4=0 off for every call (exactly the 0.2.21 / 0.2.22 default),
STRATA_NO_DOT_X4 (any value) still wins.  The two forms give the same bits:
dot_x4_test, and cpu_dispatch_dump hashes of every nt 1..8, whole and off-vector
row ranges, both arithmetics, identical for off / default / on / NO_DOT_X4
(zz_x4_proof.sh); pool_determinism passes in all three modes.

dot_x4_policy.hpp: dot_x4_mode() (read once) and dot_x4_enabled(mode, nt);
dot_x4_policy_test covers every case.
2026-11-26 23:04:57 +01:00
Niko1221 b60a5d2d0b fix(inkling2-cuda): table rows for RTX 40 (sm_89) and RTX 30 / A-series (sm_86) with a per-family part mask
The sm_120 table now matches a row by architecture family (120, 89, 86) as well as name, SM count and VRAM. The Ada and Ampere rows are
unmeasured candidates (old path unless STRATA_INK_SM120_ROW names one). The parts whose kernels need sm_120 (FP4 tensor cores: TC_SMALLM,
PREFILL, L2PF, FP8_INPLACE) or sm_89 (the cublasLt FP8 trunk) are masked on the families that lack them, with one stderr line when a named part
is dropped. COMPACT no longer requires cc >= 12.0 in the loader (the decision already refuses other families).
2026-11-26 22:46:01 +01:00
Niko1221 c8a525ab17 sm120: COMPACT_HYBRID for 8 and 12 GB cards, probe-derived CPU/PCIe split, compact refuses 2-15 slots, default_on per row
- New part COMPACT_HYBRID (STRATA_INK_SM120_COMPACT_HYBRID): when COMPACT cannot hold every expert (8 / 12 GB cards) the loader no longer refuses; it builds the
  compact trunk (Q8_ROW attention and head, mapped host embedding, about 2.3 GiB less than the BF16 trunk) and gives the freed VRAM to the adaptive expert tier, the rest
  of the experts stay in RAM. The KV stays FP16 unless COMPACT_KV is named (teacher-forced KL on the TAILSKIP screen: the FP8 KV is the costly part).
- The split of the batched (verify) cold experts between the CPU lane and PCIe comes from this box's own launch probe: 0.75 x t_cpu / (t_cpu + t_copy). Set only while
  COMPACT_HYBRID is on; every other path keeps the fixed 0.55 / 0.65. STRATA_INK_DEC_PCIE_SHARE still overrides it.
- COMPACT now refuses before it converts anything when the run asks for 2 to 15 slots (--parallel 4 on a 16 GB card died at start with "not enough free GPU memory");
  the old path runs. One slot and 16 or more slots are unchanged.
- Row field default_on: a measured row runs its fast set by default only when default_on is set (5090 and 5060 Ti 16 GB: true).
2026-11-26 22:45:44 +01:00
Niko1221 6a121e1ea0 sm120 table: a DGX Spark (GB10, cc 12.1) row, matched by name + SM count + memory + cc minor; a placeholder until measured
The table knew cc 12.0 only and refused any switch on a GB10 ("not an sm_120 card"). Now a row carries the cc minor it is for (default 0), the
matcher takes cc 12.0 and 12.1 and a row never matches the other minor, so the 5090 row cannot be taken by a GB10 and the GB10 row cannot be taken
by an RTX card. The new row "gb10" (name GB10, 44..52 SMs, 100..128 GiB) carries the 5090's "big" set (FP8 trunk cache, NVFP4 MoE, PF_ATTN,
DSPARK_OPT, C64 bspec; exact = DSPARK_OPT) and the 5090's numbers. It is not measured and not default: with no switch the old path runs; the fast
set is reached with STRATA_INK_SM120=1 STRATA_INK_SM120_ROW=gb10 until the lane's measurements flip measured / default_on.
Table test: the Spark cases (placeholder note, ROW=gb10 fast and exact, a part off, =0 silent, no RTX row on cc 12.1, an unknown cc 12.1 card).
2026-11-26 22:23:11 +01:00
Niko1221 885941f495 sm120: the 5090 exact set is empty: exact must not change the drafting policy against off (DFlash 2 verify batches differ otherwise) 2026-11-26 22:23:11 +01:00
Niko1221 34cf13848e fix(file tier): keep the GGUF stage pool when the start-up unbuffered reads end
Since 0.1.67 begin_startup_unbuffered also takes the GGUF shards read in
place (it said "experts.bin only" before). Its end step then ran for GGUF
packs too and cleared the stage pool and set stage_blob_ to 0. The GGUF
tier needs that pool for the rest of the run: blob() assembles every expert
the RAM copy lacks into a stage buffer. With stage_blob_ == 0 the next
claim_stage allocated a zero-byte buffer and fill_stage copied a whole
blob (about 1.5 MB) into it: a heap overrun, seen on Windows CUDA as a
memcpy access violation, 0xC0000374 or a fault in a new thread's TLS
allocation, right after the first window starts (#7131, #7155, #7206,
and the copy_from_files crash of #7123).

- end_startup_unbuffered: the stage-pool step is release_startup_stage(),
  which only runs for experts.bin (and now also frees the stage events
  like close() does).
- begin_startup_unbuffered: the failure path no longer zeroes stage_blob_
  for the GGUF in place.
- claim_stage refuses to make a buffer when no buffer size is known.
- expert_layout_test: a cross-platform check (release_startup_stage, then
  blob() on the GGUF in place) and a Windows check of the begin/end steps.
  Before the fix the first one is an AddressSanitizer SEGV in
  copy_from_files; after it, clean.

(cherry picked from commit d40f3fd8b8d8ac01fadd7aa0635aed6674f747bc)
2026-11-26 21:17:40 +01:00
Niko1221 350f9feb1d Merge branch 'f-perflong' into f-0223-int 2026-11-26 21:13:20 +01:00
Niko1221 6c7a7804dd merge f-perfstep (sm_120a build, PDL, M=1 down prefetch, INT8 head screen) into f-0223-int; the 5090 row keeps its default_on flag and takes spec_cost 8 2026-11-26 21:09:53 +01:00
Niko1221 ce9240236a inkling cuda: SPEC_ADAPT, the draft window follows the measured step cost per row and the measured acceptance (fast only, off by default; the exact form keeps the static model) 2026-11-26 20:46:24 +01:00
Niko1221 b78860cbd3 fix(inkling2-cuda): the 5060 Ti exact set is L2PF only (C64_SPEC's memory plan needs COMPACT: 64 slots died without it) 2026-11-26 19:07:19 +01:00
Niko1221 a5d6d5c31e fix(inkling2-cuda): COMPACT refuses for 2..15 slots and the old path runs (from the SM120-ROWS lane, f-sm120-rows); a row's default is its own flag 2026-11-26 19:05:50 +01:00
Niko1221 a5aa58b1ba perfstep 1c: PDL is on by default on the RTX 5090 row; the 5090 row's spec_cost goes from 12 to 8
PDL: default on for compute capability 12.x cards with 160..192 SMs (the 5090, the only card measured); STRATA_INK_PDL=1 forces it on any sm_90+ card, =0 off.
Measured on the 5090, plain decode, 3 rounds, tokens identical: fast 171.3 -> 179.5 tok/s (+4.8 %), exact 138 -> 139.6 (+1.2 %).

spec_cost 12 -> 8 (the 5090 row; ink_sm120_table.hpp): the tree-size model of the DSpark drafter prices an extra verify row too high for this card
(a 12-row verify step is 2x a plain step, the model said 7.5x). C1 tok/s, fast, spec_cost 12 -> 8 (3 rounds): chat 315 -> 319, code 402 -> 458, count 404 -> 628,
json 266 -> 268, prose 222 -> 227, tool 414 -> 404. Exact mode (the row applies to it too): tokens identical to off (9/9 at 30, 3000 and 9000 tokens).
2026-11-26 18:55:57 +01:00
Niko1221 6ad0c00004 inkling cuda: tensor-core split-K decode attention for the global visits (TC_ATTN, fast only, off by default)
New kernel k_ink_attn_tc (ink_attn_tc.cuh): one block per (KV head, key slice, group of up to 16 verify rows), K/V tiles read once for the whole group,
converted to FP16 in shared memory (FP8 E4M3 and FP16 KV, host-tail cells included), mma.m16n8k16 for QK and PV, probabilities x 2^15 with the V scale
folded in, FP32 denominator, the verify tail (the row's own ancestors) exact in FP32 with the sink. It changes rounding, so it is a fast-mode part
(STRATA_INK_SM120_TC_ATTN, bit 16), in no default set and in no exact set until the long-context A/B and the KL check are done.

Kernel test (ink_attn_tc_test.cu) against the old scalar kernel on synthetic KV: relative L2 4-8e-4 (FP8) / 2.9e-4 (FP16); on an RTX 5070 at 128K, M=16:
0.96 ms against 9.99 ms per visit (10x), 5-10x from M=5 up.

Design inspired by the long-context decode attention of Basalt (https://github.com/jesdga95/basalt, MIT, Copyright (c) 2026 Jesus Gulfo): tensor-core
split-K, 32-key tiles, FP16 probabilities scaled by 2^15, FP32 denominator. No code copied; the licence is kept in notices/basalt-MIT.txt.

Also brings in LCTX's one-read verify kernel and attention probe (f-lctx 1cb531beb, both off by default) as a cherry-pick.
2026-11-26 14:50:42 +01:00
Niko1221 dccdac2320 wip: docs, decide reads through env_get literals 2026-11-26 14:03:57 +01:00
Niko1221 c0f99749c1 wip: fast mode default on the two measured rows (table, tests) 2026-11-26 14:00:15 +01:00
Niko1221 c609f64302 fix(inkling2-cuda): the 5060 Ti exact set is C64_SPEC + L2PF (PLD and CORE_GRAPH change tokens)
Measured on a 5060 Ti with the new SQ-20 (off against exact variants, 2 rounds, gen:30, gen:9000, gen:12000): PLD changes the tokens at gen:9000, CORE_GRAPH
at gen:30 from token 67 when combined with the other parts. C64_SPEC + L2PF: identical at all three, speed equal to off.

Builds on the RTX 5090 and RTX 5060 Ti hand-over branches.
2026-11-26 13:23:43 +01:00
Niko1221 5e140c8d98 fix(inkling2-cuda): the 5060 Ti exact set loses PACK and PREFILL (they change tokens on a hybrid SQ-20 load)
Bisect on a 5060 Ti with the new SQ-20 (off against exact minus parts, gen:30 and gen:9000): PACK moves experts between the CPU and the GPU lane and
PREFILL changes the prefill numerics; with both off, tokens are identical to off at 30 and 9000 prompt tokens.

Builds on the RTX 5090 and RTX 5060 Ti hand-over branches.
2026-11-26 12:50:40 +01:00
Niko1221 298de5d4eb feat(inkling2-cuda): one FP8 trunk for every RTX 50 card (the 5090 cache engine); the 5060 Ti in-place FP8 is explicit-only
FASTQ on the 5060 Ti failed with its in-place FP8 trunk (tool calls 6/26 against 23/26 off; 24/26 with FP8_TRUNK=0), the 5090 FP8 trunk passed every
suite. The table rows of the small cards now use the 5090 FP8 cache engine (it does not start when the card has no room for the copy, and the BF16 /
Q8_ROW GEMMs run); the 5060 Ti row reserves the 5090's 768 MiB for it in the K/V sizing as a placeholder. The in-place engine stays in the tree behind
STRATA_INK_SM120_FP8_INPLACE=1 only, in no fast set, until its defect is found.

Builds on the RTX 5090 and RTX 5060 Ti hand-over branches.
2026-11-26 12:22:27 +01:00
Niko1221 476f38d25c feat(inkling2-cuda): COMPACT leaves the 5060 Ti fast set; its FP8 KV and MX8->SF4 transcode get their own switches
FASTQ on the 5060 Ti failed with COMPACT on (tool calls 6/26 vs 23/26, MATH 27/50 vs 46/50), the 5090 fast set passed. COMPACT is no longer
in the small-card fast set (it comes back after a FASTQ pass); STRATA_INK_SM120_COMPACT=1 still asks for it by name. COMPACT_XCODE and COMPACT_KV
switch the layer 20-23 transcode and the FP8 KV cache apart; both are on when COMPACT=1 and not named. Table test and docs updated.

Builds on the RTX 5090 and RTX 5060 Ti hand-over branches.
2026-11-26 12:10:16 +01:00
Niko1221 22f73e018a merge(inkling2-cuda): RTX 5060 Ti engine into the shared sm_120 base; one switch set, one card table, one hook, one MoE dispatch
Merges the engine part of the owner's handoff/gpu-rtx5060ti-1126 (44ee318f3, 1ddeb5b99; a959b2715) into the RTX 5090 import
(handoff/gpu-rtx5090-1126, 70b0b0a9e) and unifies the two. The reader parts of both branches are not taken (f-reader16k replaces them).

One switch set (strata/core/ink_sm120_table.hpp, no CUDA dependency, unit test ink_sm120_table_test):
  STRATA_INK_SM120=1 (fast), STRATA_INK_SM120_EXACT=1, STRATA_INK_SM120_<PART>=0|1, STRATA_INK_SM120_ROW=<id>;
  the old names STRATA_INK_RTX5090[_EXACT], STRATA_INK_RTX5060TI[_EXACT], STRATA_INK_5060TI_<x> are aliases (the new name wins).
  The default is ONE constant (kSm120FastDefault, false): the flip after the FASTQ lane is a one-line change.
  A switch on a card that is not sm_120 (cc 12.0) is refused with one stderr line; a cc 12.0 card without a measured row (only the 5090 and the
  16 GB 5060 Ti are measured) keeps the old path; the 5070 and 5050 rows are placeholders for the rentals.
  The card is matched by name, number of SMs and VRAM (the 5090 hand-over matched every cc 12.0 card, the 5060 Ti one no card at all).
One card table: per card the parts that run, how the FP8 trunk is held (cache beside the BF16 trunk / in place), which multi-user drafting
  implementation sits behind the hook, MoE tile sizes and kernel variant per batch range, chunk sizes, workspace reserves, drafting numbers.
One multi-user drafting hook in ink_backend.h (supports_batched_dspark / dspark_spec_step_batched_greedy / batched_dspark_prefill_first /
  max_macro_prefill_tokens / prefers_candidate_rows); the CUDA backend dispatches to the 5090 Mode-3 batched spec or the 5060 Ti K8V4 chain verify.
One MoE dispatch (ink_moe_fp4_sm120.cu): sm120::moe_*_tc take the card's variant per batch range; the two hand-overs' kernels are kept as variants
  (Base, Bk128, Direct, Tr128, Tr128Small, Tr128Bk128) until the A/B runs decide per card and range; STRATA_INK_SM120_MOE_FORCE forces one for A/B.
One VRAM sizing function pair at the top of ink_cuda_backend.cu (plan_vram_reserve / plan_prefill_chunk) for the long-context lane to change.

Review findings fixed here: the 5060 Ti workspace reserve (all-VRAM branch) that moved the K/V split 4352 -> 4096 on an A4000 now applies only with
the compact part on; kInkMaxTreeDepth is 8 again (deep trees use the 5090's 32 x 32 table, kInkDeepTreeDepth = 24, also for the PLD graft);
raw __dp4a replaced by dp4a_i8 (cuda12 sm_60 release build); sm_61 Q8_ROW INT8 predicate restored to the shipped one; the elastic KV/SSD tier is on
its own switch (STRATA_INK_ELASTIC_1M) and no longer part of the fast mode; the SSD file gets O_EXCL|O_NOFOLLOW in a private per-user directory, a
free-space check, loud failure on a write/read error, and a locked page_written map; the cold-store 16 KiB changes are opt-in only; the per-forward
token copy is gated; the --bench loop reads no environment; one cublasLt loader (CUDA 13 name first, an already-loaded library wins, no PATH
search on Windows) and ${CMAKE_DL_LIBS}.
2026-11-26 11:10:36 +01:00
Niko1221 0420a656e1 fix(artifact): read the 16 KiB-aligned .strata v1.1 layout (SQ-20 re-adjusted), keep the 4 KiB one exactly as before
The re-adjusted Inkling-2-Mini-SQ-20 and Vision files have their section table at 0x20 (a u16 tile_layout_id
at 0x10), sections 16 KiB aligned and Section 3 padded to 16 KiB. Every reader of 0.2.22 reads the table at 0x10, so
it sees six empty sections and an empty manifest: StrataFileReader::open succeeds and the loader fails later with
"manifest parse error: JSON: unexpected char", with a Vision file refused as profile 2.

strata_layout.hpp (new, header only) is the one place that tells the layouts apart: both section tables are checked
(section_id equals the index, 4 KiB / 16 KiB alignment, inside the file, no overlap) and a header that is neither, or
both, is refused with a message that says why. A u64 below 4096 at 0x10 is not used for the decision. Section 3
of the 16 KiB layout takes its entry count from the manifest (top-level num_physical_layers x num_experts_per_layer,
found by walking the JSON, with each factor capped so the arithmetic cannot wrap), so a padded length that happens to be a
multiple of 34 is not miscounted, and a nested key or a chat template that spells the key is not taken for it.

Callers: StrataFileReader (CUDA, HIP, CPU Inkling, Hy4 CUDA/HIP/SYCL/CPU), the no-zstd Mac reader, the Metal and SYCL Inkling
loaders (header, Section 3 count), the Metal and SYCL vision loaders, the Hy4 CPU expert directory. The Inkling
Vision shard is recognised by header profile 3 or by arch inkling2_vision in the manifest (the new file has profile 2).

Test: engine/tests/quant/strata_reader_layout_test.cpp (CMake: strata_reader_layout_test), with the real 0.2.22 headers of
SQ-20, SQ-10 and Vision as golden frames.
2026-11-26 10:30:41 +01:00
Niko1221 2aed34d4e6 fix(engine): the layer split's lend reservation stays whole by default; STRATA_SPLIT_LEND_RESERVE=0 / a percent is the opt-in (#7089, owner decision)
From PR #7091 by @svonolfen (the switch and the measurements).

The first version of this fix reserved half of the lend regions on a drive that reads 3 GB/s or more. Measured on 2 x RTX A6000 made RAM-tight
like the reporter's PC (9 interleaved rounds, same 2170-slot / 6.3 GiB lend regions): no decode gain at 50% (median ratio 0.996 and 1.012,
run-to-run spread about 5%), cold 18K-token prefill 5 to 7% slower in every round. At 0% decode +5.5% (4 of 4 rounds) and cold 18K prefill
-17%. The reporter's own table has the same shape (decode +9%, prefill at 18K -4.6%, at 36K -0.8%). A half-way default has a cost and no
measured gain, so the default is back to the whole reservation (0.1.66 / 0.1.67 behaviour) on every drive, and the drive probe is gone.

STRATA_SPLIT_LEND_RESERVE stays as an opt-in: 0 fills the expert complement first (the order before #6583, the reporter's PR), 1..99 reserves
that percent of the borrowed slots' bytes counted from the highest slot of each stage, unset / full / 100 / anything else reserves all. The
reserved first part of every region is appended first, so the reserved slots are certain to be kept and the stages stay balanced; with the
default nothing in the placement changes. The startup line names the percent when it is not 100.

Answers do not change in any setting (the same experts are read from RAM or from the file; gate on 2 x A6000: KL 0, identical ids, noise floor 0).

docs/DETAILS.md describes the setting and the measured trade; the settings register entry is rollback / off by default; the unit tests
cover the rule (unset / auto / full / 0 / percent / bad values) and the fixture at full / 50 / 0.
2026-11-25 12:48:56 +01:00
Niko1221 7ab0d923c2 fix(engine): the layer split's lend reservation takes half of its RAM on a fast drive, so decode gets its 9% back (#7089)
From PR #7091 by @svonolfen (the STRATA_SPLIT_LEND_RESERVE switch, the bisect to 307ccd1ba and the measurements of #7089).

#6583 reserves RAM for the stages' prompt-path lend regions before the coldest tail of the expert complement is filled. The RAM budget is
fixed, so the reservation is paid out of the complement, the copy decode reads. On a RAM-tight 2-GPU layer split (reporter: RTX 4090 + 3090,
--resident-budget-gib 47 of 64 GiB, UD-Q4_K_XL, NVMe) the full reservation (2115 slots, 6.22 GiB) cost 9% decode (82.6 against 90.1 tok/s)
and bought no prefill (flat at 18K / 36K / 72K), because the borrowed slots read from a fast drive.

What it was for (#6583): 2 x RTX 3090 on Windows lost 9% prefill to 315 lend slots with no RAM copy, each re-read unbuffered every chunk.
There the drive is what makes the reservation pay, so it stays whole there.

Now STRATA_SPLIT_LEND_RESERVE decides how much of the lend regions' bytes the budget reserves first, counted from the highest slot of each
region (the slots a short prompt borrows):
  0 none (PR #7091: the complement first, as before #6583), full / 100 all, 1..99 that percent, auto or unset by the drive.
  auto: half when the drive's measured random 1 MiB O_DIRECT read rate is 3 GB/s or more (the probe the file tier's choice already uses,
  Linux), all when it is lower, and all where nothing measures it (Windows, macOS): the 0.1.67 behaviour stays wherever the drive is not
  known to be fast.
The reserved first part of every region is appended first, then what is left of the regions while the budget lasts, so the reserved
slots are certain to be kept and the two stages stay balanced. The startup line says the percent and why.

Answers do not change: the same experts are read from RAM or from the file, only which ones differ.

Tests: split_lend_complement_test learns the percent rule (unmeasured, slow, fast, the setting, bad values) and the fixture at full / 50 / 0.
Settings register entry for STRATA_SPLIT_LEND_RESERVE (rollback).
2026-11-25 11:11:50 +01:00
Niko1221 8699881aeb fix(inkling cuda): the K/V window reserve is v0.2.20's again (UNMERGED safe option, owner decides)
759ccf6c6 raised the runner's reserve for the workspaces it allocates after the global K/V from 640 MiB (+160 with a drafter) to 768 (+256), more than the loader
leaves for the same workspaces on a card of up to 13 GB (512 MiB, +224 with a drafter). The engine keeps 3/4 of what fits as the window of the K/V that stays on
the card, so on a 12 GB card the window fell (RTX 3060 12 GB, 32K context, 1 slot): SQ-10 7168 -> 2304 positions, UD-Q4_K_XL 5120 -> 0. Everything past the window is
read over PCIe at every decode step: GRID's final cells, SQ-10 at a 4K prompt 39.5 -> 29.2 tok/s (-26 %), UD 10.2 -> 8.9.

ink_kv_reserve.hpp holds v0.2.20's numbers and nothing else changes: for this reserve the engine behaves exactly as 0.2.20 did (the drafter's 160 MiB is counted when the file
carries a drafter, as before). Inkling CUDA only; Hy4 and the other backends are untouched.

RTX 3060 12 GB, decode tok/s at short / 4K / 16K / 30K tokens, K/V window, free MiB after the runner starts (the engine's own `memory:` line), prefill tok/s normal in every cell:
 SQ-10, drafter off  before 43.3 / 29.8 / 10.0 / 5.4  window 2304, 517 free   after 43.5 / 40.8 / 13.9 / 6.5  window 7168, 391 free   (0.2.20: 42.5 / 40.2 / 13.8 / 6.5, 7168)
 SQ-10, drafter on   before 31.9 / 29.0 / 6.9 / 3.7   window 2304, 439 free   after 31.5 / 45.8 / 9.9 / 4.4   window 7168, 313 free
 UD-Q4_K_XL, off     before 22.7 / 21.3 / 9.0 / 5.1   window 0, 439 free     after 23.9 / 35.8 / 10.8 / 5.8  window 3328, 311 free  (first 4K request, cold: 17.6 -> 27.6)
 UD-Q4_K_XL, on      after 12.1 / 30.4 / 7.0 / 4.2    window 3328, 233 free after the drafter's 78 MiB; no start-up OOM
ink_kv_reserve_test pins the values and the two measured windows (7168 and 2304) of the engine's sizing arithmetic.
2026-11-24 07:52:01 +01:00
Niko1221 f4365a62ea rc1: merge f-0221-inkcuda (751d55647 K/V-aware auto chunk, 479b9bcf5 #6905 no fatal K/V growth, e06542eea slot-fit; the candidate-row step and the K/V-growth handling combined in ink_serve.h) 2026-11-23 22:55:52 +01:00
Niko1221 479b9bcf5e fix(inkling cuda): growing the global K/V never ends the engine; the host tail is the whole rest of the context (#6905)
#6905 (RTX 5060 Ti 16 GB, SQ-10, 64K, vision): another program took VRAM after the start, the K/V could not grow in the card, the engine spilled a host tail
sized to just the request that hit the limit, and the next, longer request ended the engine ("VRAM exhausted growing elastic global KV cache to 40961 tokens").

- ensure_global_kv_cap maps the WHOLE rest of the context to pinned host RAM when the card cannot grow (ink_kv_host_tail_full); only when that does not fit in
  host memory it falls back to the request's own size (ink_kv_host_tail_need).
- When the K/V cannot grow at all (K/V offload off, no host RAM), ink_serve ends only the requests whose positions are past the K/V's capacity (reason
  "length") and goes on; every other forward failure is still fatal.
- Planner: on CUDA with K/V over 1 GB and offload auto, the K/V stays in the card only with 0.5 GB to spare (KV_CARD_HEADROOM_GB); the reporter's plan
  (SQ-10, 15.9 GiB, 64K, vision: 0.4 GB to spare) now keeps all experts in the card and puts the K/V on the host.
- test_no_debugger_children: setup.py has one more listed process (vm_stat, added by 7a1467e21 without the count).

RTX 4090, SQ-10, max context 131072, a hog takes all but 1100 MiB after the engine is ready, requests of 20K / 45K / 60K / 100K tokens:
  before: 20K answered, 45K "ERR fatal GPU error: VRAM exhausted growing elastic global KV cache to 36383 tokens", engine gone (spill 20224 + 12544 host)
  after:  all four answered, then a short one again (spill 18432 + 112640 host = 131072)
Tests: ink_kv_grow_test (host tail), test_inkling_kv_headroom, 158 planner/launch tests on p2006.
2026-11-23 22:53:14 +01:00
Niko1221 751d55647f fix(inkling cuda): the auto prefill chunk leaves room for the K/V that still has to grow (regression fix for faceebb50)
faceebb50 chose the chunk from the memory left after the experts only. On a 24 GB card with UD-Q4_K_XL at 32K the 1024 chunk took the room the
global K/V needs to grow, so the K/V tail went to host RAM and decode at 30K tokens fell with 2 slots from 80.9 to 36.0 tok/s (3 slots 14.7).

The chunk now also has to leave slots x (context - the window allocated at start) x bytes per position free (none when K/V offload is on).
RTX 4090, UD-Q4_K_XL, 32K, decode tok/s at 30K tokens, 1 / 2 / 3 slots:
  faceebb50          87.7 / 36.0 / 14.7
  this change        86.6 / 79.8 / 24.0
  STRATA_INK_CHUNK_AUTO=0 (chunk 512, the old default) 87.7 / 80.9 / 25.4
3 slots spill by the engine's own auto host-offload decision, not by the chunk (the same with the old default).
ink_chunk_test covers the three cases.
2026-11-23 22:52:54 +01:00
Niko1221 5df92e6901 rc1: merge f-0221-inkcuda (faceebb50: auto prefill chunk on CUDA, 2048 / 1024 / 512 by free memory and slots) 2026-11-23 21:38:24 +01:00
Niko1221 faceebb50c perf(inkling2/cuda): the prefill chunk is picked from the memory left after the experts (2048 / 1024 / 512) when --chunk is not given
The chunk (prompt tokens per forward step, default 512) limited prefill: RTX 5090, strata-inkling --bench, one stream, 4K prompt, SQ-20: 512 -> 8.1K tok/s,
1024 -> 9.5K, 2048 -> 10.5K, 4096 -> 10.7K (16K prompt 7.0K -> 8.9K at 2048, 32K 6.1K -> 7.5K); UD-Q4_K_XL 4.07K -> 4.47K at 2048, flat after; nothing
is lost up to 8192. A bigger chunk costs working memory: the runner and K/V took 1460 / 1822 / 2710 / 4558 MiB at chunk 512 / 1024 / 2048 / 4096 on an
RTX 4090 (SQ-20 all resident, 5255 MiB free after the experts; the engine caps max_batch at 4096) and 1440 / 1804 MiB at 512 / 1024 on an RTX 3060 Ti
8 GB, where 2048 did not fit and the halve-on-fail retry (859276060) brought it back to 1024.

- strata/core/ink_chunk.hpp: ink_auto_chunk(free_after_load_mib, slots): the largest of 2048 / 1024 that fits (the memory the runner takes at that chunk
  + 1500 MiB margin for K/V growth, the drafter and the desktop), else 512; capped by the slot count: 2048 for 1-3 slots, 1024 for 4-15, 512 from 16.
  The experts are placed first, with their reserve computed for chunk 512, so a bigger chunk never displaces an expert: a hybrid card with little left
  keeps 512, a card whose experts are all resident gets 2048. Test ink_chunk_test (the 4090 and 3060 Ti ledgers, the cap, monotone in memory).
- InkCudaBackend::init resolves the chunk after the experts are placed and logs "[InkCUDA] prefill chunk N (auto: M MiB free after the experts, S slot(s);
  --chunk N sets it)"; effective_chunk() reports what the runner really got; ink_serve (token_budget) and --bench use it. --chunk N still wins,
  STRATA_INK_CHUNK_AUTO=0 keeps 512. HIP, SYCL, Metal and CPU keep 512 (BackendOpts::chunk_auto is read only by the CUDA backend).
- The slot cap comes from the mixed-work case, 32 slots, a 16K prompt arriving among 31 decoders, longest wait of a decoding slot at chunk 512 / 1024 /
  2048: RTX 3060 Ti 8 GB (SQ-10 hybrid) 2322 / 2210 / 43,424 ms (the long prompt read in 91 / 56 / 218 s); RTX 4090 (SQ-20 resident) 2096 / 3974 ms with the
  long prompt at 108 / 110 s; RTX 3060 12 GB 3897 ms at 512, 2804 ms at 1024. Throughput of 32 requests of 512 tokens at once (prompt + output tok/s):
  8 GB 55 (512) / 83 (1024) / 125 (2048); 12 GB 65 / 95; 4090 43 / 51. These ran on boxes whose CPUs were loaded by other jobs: relative numbers only.
- Equivalence: RTX 4090 SQ-20 (resident): greedy tokens identical between the auto chunk (2048) and --chunk 512 for prompts of 15, 200, 3000, 16000 and 30000
  tokens; serve prefill 3000 / 16000 / 30000 tokens 2788 / 2979 / 4608 -> 3088 / 3247 / 5053 tok/s. Hybrid SQ-10 (8 and 12 GB): identical up to 3000
  tokens, different at 16K (and 30K on the 8 GB card) between the two chunks, with the 512 runs of the two cards also differing from each other (expert
  promotion of the hybrid path); a same-chunk repeat is queued.
- No OOM and no retry in any gate run (8 / 12 / 24 GB, 1 and 32 slots).
2026-11-23 21:37:28 +01:00
Niko1221 1a7a944992 rc1: merge f-0221-inkplace (2612ae5c0: Windows pinned host arena cap raised, default on, STRATA_INK_PIN_GB) 2026-11-23 21:34:11 +01:00
Niko1221 2612ae5c0e perf(inkling2/cuda): Windows pins the host expert arena up to min(16 GiB, 35% of the available RAM) (was 8 GB), with an 8 GiB floor and STRATA_INK_PIN_GB
A pinned arena lets the card read the cold experts itself: the exact lane stages inside the CUDA
graph instead of copying through a pageable arena + bounce ring with one host sync per visit. On the
owner PC (RTX 5070, x16) SQ-10 at an 8 GiB plan goes from 30 to 49 tok/s in that lane, SQ-20 from
8 to 15; the launch probe still picks the lane (pinned exact against the CPU lane).

The rule is a pure function (core/ink_pin_rule.hpp, tested by ink_pin_rule_test): Windows cap
min(16 GiB, 35% of the available RAM), and an arena that would leave under 8 GiB of RAM available is
not pinned; STRATA_INK_PIN_GB=<n> sets the cap in GiB (both platforms), =0 turns pinning off; Linux
keeps its rule (under 45% of the available RAM). When the rule says no, or cudaHostAlloc fails, the
arena is pageable as before, with one INFO line saying why; the start never fails on this.
2026-11-23 21:27:07 +01:00
Niko1221 8ada71145d rc1: merge f-0221-qperf (66f2ee2b0: the 4-row dot kernels of the native expert path are opt-in, #6552) 2026-11-23 21:21:21 +01:00
Niko1221 66f2ee2b0a perf(cpu): the 4-row dot kernels of the native expert path are opt-in (#6552)
4414c2988 (0.2.20) put the dot_x4 kernels in front of the 1-row dots in native_gu_rows /
native_down_rows (Q4_K, Q5_K, Q6_K, Q8_0, IQ4_XS, IQ3_XXS ...), on by default. They give the
same bits (dot_x4_test) and share the activation loads, which pays with the weights in cache.
A cold expert is read from DRAM, and there the 4-row form is slower. New dot_x4_bench (one
thread, 512 MiB of rows, n = 2560), x4 speed against four 1-row calls:
  Ryzen 7 255 (Zen 4, AVX-512 VNNI)  Q4_0 0.77  Q8_0 0.42  Q4_K 0.26  Q5_K 0.33  Q6_K 0.24  IQ4_XS 0.27  IQ3_XXS 0.52
  Ryzen 5 5600X (Zen 3, AVX2)        Q8_0 0.85  Q4_K 0.29  IQ4_XS 0.32
  i9-13900K (AVX-VNNI)               Q8_0 1.20  Q4_K 0.86  IQ4_XS 0.80
  (cache-resident: 0.8 - 1.3 everywhere)
This is the #6552 reporter's Ryzen 7 7700 (STRATA_NO_DOT_X4=1 brought the old speed back).

dot_x4_enabled() (strata/quant/dot_x4_policy.hpp): STRATA_DOT_X4=1 turns the kernels on,
STRATA_NO_DOT_X4 (any value) still turns them off and wins. The answers are the same bits either
way. dot_x4_policy_test covers the rule; dot_x4_bench is registered as an executable only.
2026-11-23 21:21:03 +01:00
Niko1221 960cdbc84f rc1: merge f-0221-qperf (6e45f7fbd: WDDM late-allocation pricing, #6836 #6887 #6509 #6846) 2026-11-23 20:52:02 +01:00
Niko1221 e187fff726 rc1: merge f-0221-inkcpu (c25b0fddd: AVX-512 host kernels for the CUDA fast lane, run-time SIMD tiers for the S_K codecs, dense dot tier; ink_host_avx2.cpp is INKPLACE's) 2026-11-23 20:21:23 +01:00
Niko1221 6e45f7fbd3 fix(cuda): the expert cache on Windows WDDM prices what the load really allocates after it (#6836 #6887 #6509 #6846)
0.1.66 priced 384 MiB for "what is allocated after the cache" on WDDM (256 before) and added
a shrink-after-write loop that wanted reserve + draft head + 384 MiB free once the slots were
written. Since 0.1.65 the BF16/FP16 GEMM warm-up (about 180 MiB of cuBLAS workspace) runs
BEFORE the cache is sized, so only the verifier's buffers and graph captures come after it.
Measured on an RTX 5070 12 GB (Windows, IQ3_S pack, MTP, spec 4): 134 MiB at --vram-reserve-mib
300, 110 MiB at 700, 126 MiB at 1536. The card ended with 606-620 MiB free (reserve 300) and
the cache lost 0.36 GiB against 0.1.65 (2287 -> 2099 slots, 4.40 -> 4.04 GiB): the 886 -> 562
experts of #6836 on an 8 GB laptop, 3598 -> 3204 slots in the #6713 table, 7.63 vs 8.38 GiB
of #6846.

kWddmLateAllocMib 384 -> 192 (measured plus 50-80 MiB for a wider window), and the shrink loop's
slack under WDDM 0 -> 32 MiB (the slot count rounds down, so the free figure is a few MiB under
the need by construction: 902 against 904 MiB cost a 64 MiB shrink and a second cache write).
Result on the same card: 2232 slots (4.29 GiB), 360 MiB free at the end (the engine's own
paging threshold is 256 MiB; the 8 GB laptop's 0.1.62 ran at 336 MiB, a forced 250 MiB paged).

The start-up now prints what the load took after the cache against what was priced ("after the
expert cache was written N MiB were free; M MiB were taken since ..."), so the price can be
checked on any card from one log.

Tests: low_vram_rules_test (the price, and that it never exceeds the plain rule's).
2026-11-23 20:20:09 +01:00
Niko1221 76da036b43 rc1: merge f-0221-qperf (dca06a36d: #6747 sm_70 GDN split yields to the lookup window; #6861 watchdog limits) 2026-11-23 20:19:41 +01:00
Niko1221 dca06a36df fix(serve): the watchdog's limits are parsed without undefined behaviour and its message prints the real wait (#6861)
STRATA_WATCHDOG_S and STRATA_WATCHDOG_IO_S were read with std::atoi. The #6861 logs show
"no progress for -1195029860 s" and "no step finished for -1907795513 s ... waiting up to
2079576072 s": a negative or garbage limit makes the first silent second count as stuck and
shortens the file-tier allowance (the engine was stopped after about 10-19 s instead of 60).

watchdog_seconds() (strata/core/watchdog_limits.hpp) parses with strtol: an unparsable or
out-of-range value (negative, past a week, past long) falls back to the default and the
engine says so. The "no progress" line prints the seconds actually waited.
watchdog_limits_test covers the values atoi turned into garbage.

This does not cure a real stall: the reporter's later runs with a limit of 60 also stop at
layer step 1 of the last prompt chunk. That hang was not reproduced on an RTX 5070 (sm_120,
WDDM) with his flags, a control vector, --slots 2 and --adapt-async 1.
2026-11-23 20:09:27 +01:00