Commit Graph
139 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 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 6d6e9064ef settings register regenerated after the late merges (STRATA_PF_SYNC_DEBUG, STRATA_INK_DFLASH2_F32 / _SCREEN, the picture reader names); table test: the 5090 row holds TC_ATTN 2026-11-27 00:03:02 +01:00
Niko1221 ddeafea876 sm120: the row's drafting numbers (beam, cost, plain margin) apply in fast mode only; a table test pins that no row's exact set holds DSPARK_OPT or any other part that changes tokens or the drafting policy 2026-11-26 23:59:24 +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 e62e8448d8 feat(inkling2): one picture-reader rule for every backend (the Qwen rule): CPU reader under 24 GB, the card's from 24 GB, Mac always GPU, --vision-reader
ink_vision_policy.h holds the rule: NVIDIA and AMD under 23.5 GiB reported read pictures on the CPU so the experts keep the card; 23.5 GiB or more uses the
card's encoder; Metal always the GPU; Intel Arc the CPU unless asked (as Qwen); unified-memory machines apply the same number to the pool they report.
--vision-reader auto|gpu|cpu (and STRATA_INK_VISION_READER) wins, with a note on a small card; --vision-idle-s sets the NVIDIA idle time.
ink_serve.h asks the backend's encoder only when the rule says GPU, prints the choice, and says vision_reader=gpu|cpu|off in the INFO line;
--info says vision_reader=1 so Control passes the flag only to an engine that knows it.  While no request runs the serve loop gives an idle GPU reader back.
HIP and SYCL report the main card's memory alone.  ink_vision_policy_test covers every backend and card size.
2026-11-26 23:06: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 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 50487788a9 merge f-tailskip (opt-in router tail skip, --turbo / --turbo-max) into f-0223-int 2026-11-26 21:13:12 +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 71c8110cb2 feat(inkling2): --turbo and --turbo-max presets (STRATA_INK_TAIL_SKIP=turbo | turbo-max), a notice where a backend has no tail skip, HIP set_tail_skip, parser test 2026-11-26 18:28:43 +01:00
Niko1221 382dd7d551 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 14:22:50 +01:00
Niko1221 c0f99749c1 wip: fast mode default on the two measured rows (table, tests) 2026-11-26 14:00:15 +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 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 c25b0fdddd inkling2 CPU backend: AVX2 / AVX-512 / NEON dense dot, and matmul parallel over the weight rows
The q / k / v / o / gate projections of the CPU backend (matmul_f32) were `parallel for` over the activation rows with `if (M * N >= 4096)`: a one-token decode step
ran most of them on ONE thread, and a prompt read every weight row M times from memory. They are parallel over the weight rows now (threshold on M * N * K), each row is
read once and reused for all M activation rows from L1; every y[m][n] is the same dot call as before, so the result does not depend on the thread count.

The dot itself (CPU backend, attention scores, inkling2_loop.cpp's helpers) is strata::quant::sk::dot_f32, one more function of the run-time tiers: 4 accumulators of the
tier's vector width (AVX-512 / AVX2 with FMA / NEON), plain 4-accumulator C++ in the base tier (bit-identical to the sum it replaces: sk_tier_test checks it). The vector
tiers sum in lane order, so a CPU-only run differs from 0.2.20 by float rounding (SQ-10 teacher-forced KL(old||new) 4e-4, repeatable run to run).

Measured, CPU backend, SQ-10 prefill 128 / decode 8, alternating pairs: Apple M5 Max prefill 3.2 -> 7.7 ppts, decode 1.6 -> 2.5 tok/s (spread under 1 %);
Zen 4 16 threads, UD-Q2_K_XL: prefill 11.1 -> 13.0, decode 2.7 -> 4.3.
2026-11-23 20:09:19 +01:00
Niko1221 accfd7ace3 inkling2: AVX-512 for the fast lane's CPU experts, and run-time AVX2 / AVX-512 tiers for the S_K / SF4 / MX8 codecs
1. CUDA fast lane (cold experts computed on the CPU): new ink_host_avx512.cpp has the three host kernels (SF4 row, MX8 row, S1.5..S8_K sub-group) for
   AVX-512 F/DQ/BW/VL (no VNNI, so Skylake-X runs it too). The file is built with the AVX-512 flags and nothing else is; its gate, host_avx512::available(),
   is in ink_host_avx512_gate.cpp, a baseline-flag file (a compiler may use AVX-512 anywhere in a file built with -mavx512f, so the gate cannot live there):
   caps().avx512, closed by STRATA_FORCE_ISA=avx2. ink_hybrid.cuh tries AVX-512, then AVX2, then plain C++.
   ink_host_avx2.cpp unpacked the S2_K / S3_K / S5_K / S6_K fields with scalar loops (0.7 to 1.1 GB/s of weights per thread): shuffles now, integer sums exact.

2. The CPU backend and the HIP / SYCL CPU-expert lane (eval_inkling2_expert_batch -> sk_codecs.cpp) ran plain x86-64 C++: strata_quant builds sk_codecs.cpp with
   no ISA flag (its AVX2 / AVX-512 code is selected by __AVX2__ at build time). It is now compiled three times (sk_codecs_base.cpp, x86/sk_codecs_avx2.cpp,
   x86/sk_codecs_avx512.cpp) into strata::quant::sk::{base,avx2,avx512} and sk_dispatch.cpp picks the tier from caps() (AVX-512 needs VNNI there, as strata_quant's
   own tier does). A CPU without AVX2 never executes an AVX2 instruction of it, and a -march=native host cannot leak wide code into the base tier. Tier files are
   -ffp-contract=off: the integer sums are exact and the float steps are the base tier's, so every S_K result is bit-identical across tiers (the aarch64 path and the
   builds that compile sk_codecs.cpp themselves (hy4flash, Metal, the SYCL script) are unchanged). AVX2 gets vector unpackers and an abs/sign int8 dot.
   SF4 / MX8 sum in lane order, so they differ from the scalar tier by float rounding.

Tests: tests/core/ink_host_simd_test.cpp (all formats, scalar reference, AVX2 and AVX-512, F8_E4M3 decode on all 256 codes), tests/quant/sk_tier_test.cpp (tiers
against each other: S_K bit-identical, dispatcher = reported tier), benches ink_host_simd_bench / sk_tier_bench. Run on Zen 4 and Zen 5 (AVX-512 + VNNI), Zen 2 and under
qemu -cpu Nehalem / SandyBridge / IvyBridge (gates closed, nothing executed above the CPU's level), tools/check --only cmake-cpu: 160 passed.

One thread, S_K gemm of a 2304 x 2304 expert matrix, one token, base -> avx2 (Zen 4): S2_K 10x, S3_K 13x, S4_K 2.9x, S5_K 9x, S6_K 8x, S8_K 2.7x. AVX-512 over AVX2: 1.0x on
Zen 4, 1.0 to 1.7x on Zen 5 (ink_host kernels: SF4 1.57x, MX8 1.69x, S3_K 1.35x, S5_K 1.5x).
2026-11-23 19:30:30 +01:00
Niko1221 ed8c942ab8 rc1: merge f-0221-inkspeed-amd (d290efcde: HIP hybrid decode splits every CPU expert over the pool, #6727 #6729) 2026-11-23 19:01:39 +01:00
Niko1221 eeb2325b9e rc1: merge f-0221-dspark (6ef0b4693: an unreadable drafter is dropped with one message; 540f3b3df governor) 2026-11-23 18:51:24 +01:00
Niko1221 6ef0b4693b fix(inkling2): a drafter file in a layout the engine cannot read is dropped with one message; it never stops the model
2026-11-23 14:54 UTC unsloth/Inkling-2-Mini-GGUF re-uploaded dspark-Inkling-2-Mini-Q8_0.gguf (402,278,560 -> 503,889,952 bytes) in llama.cpp
mainline's "dflash" layout (commit 19bf97a66719d0165f6f8082a9d59581912a3863 "Support mainline llama.cpp"; the old file stays in the repo as
dspark-Inkling-2-Mini-Q8_0_Old.gguf). Same drafter (3 blocks, 2304 wide, block 8, taps 5 / 23 / 41 / 48, Markov head), written differently:
fuse_weight and the per-block dflare_norm became per-block ctx_mix / ctx_norm, the Markov head's hidden_out projection is folded through the
output head into markov_w2 (+ bias) over the real 200058-token vocabulary, mask_embd has 7 rows, token_embd_norm was added. The engines asked
for the old names and ended the whole start: "missing tensor 'dspark.markov_head.hidden_out.weight'".

strata/core/ink_dspark_layout.hpp: ink_dspark_layout_check() on the plain tensor names a loader collected; the GGUF loader (drafter GGUF and an
external mtp.safetensors) and the official-folder safetensors loader drop the drafter when it fails (drafting off for this start, the arena
space given back), print ink_dspark_layout_message() once (it names the file, what is missing and which files the engine reads), and the model
starts normally. Test ink_dspark_layout_test uses the real tensor lists of the old (54) and the new (58) file.
2026-11-23 18:45:04 +01:00
Niko1221 265e92abc2 rc1: merge f-0221-inkspeed-cuda (f42a9aa71, GPU top-K; with the exact one-pass sampler and the opt-in prompt cap) 2026-11-23 18:31:37 +01:00
Niko1221 79cdce32af rc1: merge f-0221-inkspeed-k (c60259fa6, int8 dense Q8_0; replaces 440fd2b2c) 2026-11-23 18:30:49 +01:00
Niko1221 54b2ffd848 rc1: merge f-0221-inkplace (1999e3e82) 2026-11-23 18:30:26 +01:00
Niko1221 492575bbe1 rc1: merge f-0221-inkother (9b61b6918) 2026-11-23 18:28:33 +01:00
Niko1221 57c933376b rc1: merge f-0221-inkcuda (6bdebbedf)
# Conflicts:
#	engine/CMakeLists.txt
#	terminal/setup.py
2026-11-23 18:27:49 +01:00
Niko1221 c60259fa6a perf(inkling2/cuda): a GGUF's Q8_0 dense matrices stay Q8_0 and run on the int8 tensor cores, one exact GEMM for every batch size
The Unsloth UD-Q4_K_XL file stores the attention matrices (q, k, v, gate, output, rel) and the embedding as Q8_0 (int8 plus an fp16 scale per
32 weights). The loader expanded all of them to BF16: 2 bytes per weight, rounded (int8 x fp16 scale does not fit BF16), about twice the bytes
read per step, and weights that were not the file's.

- Loader (CUDA, one GPU with compute capability 8.0 or newer, no layer split; STRATA_INK_Q8_0_DENSE=0 goes back to BF16): the attention matrices
  become format 105, packed on the host (ink_q8f_pack.h) in the order the int8 mma reads: per 16-row tile and 32-wide block one 16-byte A
  fragment per lane, then the block scales. The embedding becomes format 104 (as stored, row by row) and its kernel decodes a row exactly.
  The unembedding and the sink projection stay BF16; other backends and the CPU backend never set the switch.
- One GEMM (k_ink_gemm_q8f) for decode (1..64 slots) and prefill chunks: the activations are quantized per token and 32-wide block like Q8_1
  (k_ink_quant_x_q8f), every output is the sum over the K/32 blocks, in block order, of the exact int32 block dot times (weight scale x
  activation scale) in fp32 FMA. Nothing depends on M or on the other tokens, so a token gets the same bits whether it is read in a prefill chunk,
  decoded alone or decoded in a batch. The q/r/gate/k/v matrices go in one launch with one activation quantization, at any M; short matrices
  (the output projection) split the tokens over more blocks to keep the card busy.
- Diagnostics: STRATA_INK_PROF=1 prints the per-phase decode time every 100 steps (events only, no sync per phase, eager) and the MoE sub-phases
  (router, bin, gate/up, down); INK_DUMP_CHUNK=n makes --dump-ref feed n tokens at a time.

RTX A6000, UD-Q4_K_XL, all resident, same binary, alternating arms, 3 rounds (spread under 1%), fp8 KV, --draft off, CUDA graph decode:
decode 47 / 4,096 / 63,981 token prompts: 76.2 / 71.7 / 52.3 -> 83.7 / 78.2 / 55.8 tok/s (+10% / +9% / +7%).
prefill: 263 / 919 / 816 -> 269 / 892 / 796 tok/s (+2% / -3% / -2%).
Eager step time by number of slots (bench, tok/s): M=1 59.9 -> 64.0, M=8 216 -> 228, M=32 222 -> 225, M=64 314 -> 319.
Load line trunk=: 3.29 GB -> 2.25 GB. The answers change on purpose (the BF16 rounding of the weights is gone); greedy tokens repeat
bit-identically in every round, and the 5-run logits fingerprint gives one hash for prefill and one for single-token decode.
Tests: engine/tests/cuda/ink_q8f_gemm_test.cu is bit-exact against a host emulation of the same arithmetic and gives identical values at
M = 70, 64, 33, 9, 8, 7, 1 (compute-sanitizer memcheck 0 errors, racecheck 0 hazards); the engine under compute-sanitizer memcheck: 0 errors.
Against strata-ik2 as the oracle on UnbiasedStrata's ledger / museum cases the mean KL stays about 0.01 in prefill, decode and 7-token chunks,
as with BF16 (the oracle is llama.cpp-style arithmetic, not an fp32 reference).
2026-11-23 17:17:39 +01:00
Niko1221 1999e3e822 fix(inkling2/hip): placement reserves the K/V of every slot and the batch scratch before the card is filled with experts (INKOTHER boxia: --bench --parallel 32)
The auto budget capped the K/V estimate at a quarter of the card (32 slots at 4096 tokens need more than that) and left the batch scratch out,
so every expert was placed first and ensure_batch_scratch ended with "[ink-hip] scratch alloc: out of memory". ink_batch.h gets
estimate_batch_scratch_bytes (the allocation list of ensure_batch_scratch as a formula) and plan_expert_vram_budget; the HIP budget uses
them. Test ink_batch_budget_test: the formula equals the buffer list one by one, the boxia case (20 GiB card, 32 slots) fails with the old rule and fits with
the new one. Not built on HIP here (no HIP box in this session): the change in ink_hip_backend.hip.cpp is the six lines at the budget.
2026-11-23 16:56:35 +01:00