Commit Graph
989 Commits
Author SHA1 Message Date
Niko1221 ef5ceb9e91 Inkling: the conversation cache writes a file only when the conversation leaves memory, and keeps one file per chat (0.2.25 item 1, part 4; REPROC's e2e findings)
Design (3 lines): with a RAM park cache (--slot-cache-mib) a park writes no file; a conversation goes to a file when the RAM cache drops it, when it does not fit there, and when the engine stops
(the slots' conversations are parked, then everything in RAM is written, most recently used first, at most one cap's worth); with no RAM park cache it is still written when its slot is overwritten
(the only place it can go). ConvDisk::save removes the earlier turns of the same chat (tokens a strict prefix of the new file's, same pictures) right after the write, and covered() lets the serve loop skip a
conversation that a file (its own or a longer turn of the chat) already serves. Restore, identity checks, the cap and the near-cap handling are unchanged.

Why: REPROC's real app e2e (restart 25 s -> 3.8 s at 43K) found that every park also wrote about 770 MiB in 0.5 s per title or summary request (doubling its cost, many GB per hour of agent chat, SSD wear) and that one
chat left 3 files (2.3 GB). ink_serve.h: disk_write() (serialize + save + log) used by park_make_room (drop), park_current (does not fit; no RAM cache) and the stop pass; ink_conv_disk.h: covered(),
superseded(), the removal; docs/DETAILS.md.
Tests: unit (ink_conv_disk_test): a longer turn removes the shorter file at once and a restart sees one file per chat, covered() (own file, a prefix of a longer turn, not a longer turn, not with another picture);
mock (test_shared_prefix.py, real serve loop, 4 new): with a RAM cache a park writes no file and the stop writes the chat and the helper, a conversation dropped from the RAM cache is written and read back
(reuse 39 of 40), only the newest file of a chat stays (2 files, not 3, and the newest serves the next turn), another chat's file is kept. 4 host tests pass on p1006 (mock suite 51 tests). Not run: the app e2e (REPROC reruns e2e_chain3.sh).
2026-12-02 17:57:54 +01:00
Niko1221 5c9cbf644a Inkling CUDA: the K/V planner can reserve the drafter's context rings of every slot, STRATA_INK_DF2_RING_PLAN (0.2.25 item 25, host part; default off until the 5090 A/B)
Design (3 lines): the planner (df2_total_mib) reserves the DFlash 2 context rings of the first 8 slots only; the rings of slots 8 and up are taken lazily and only while 1 GiB stays free, so on an
RTX 5090 at 64 slots (1,910 MiB free after start-up, 11-27 bench logs rel0223/bench71: "no GPU memory for slot 25's context ring") slots 25 to 31 of the drafter's 32 had no drafter. With
STRATA_INK_DF2_RING_PLAN=1 the planner counts the rings of every slot the drafter serves (32 on 24 GB and more, 16 below), so the K/V split leaves their room and the 1 GiB rule stays for the rest.
Default OFF: byte-identical reserve and the same refusals as before (up to 8 slots nothing changes either way); the switch flips on the 5090 C64 e2e A/B (1,193 / 1,576 tok/s reference).

ink_df2_budget.h (new, host-only): the ensure_slot room rule (df2_ring_room, now used by InkDFlash2::ensure_slot itself), the drafter's slot count, the planned ring count, a replay of the lazy sequence.
ink_dflash2_path.cuh: df2_total_mib(v, slots, ring_slots = -1) and df2_planned_rings_here; ink_runner.cuh: the two reserve sites pass it. Register entry (opt-in) + docs/SETTINGS.md.
Test ink_df2_budget_test: the rule's edges (slot 1: 170 MiB, slot 8: 1,066 MiB), the 5090 logs reproduced (1,910 MiB free, other lazy buffers 160 MiB: slots 8..24 fit, 25..31 do not; 80 MiB: 27 and up
do not), with the rings in the plan all 24 of slots 8..31 get one also with 800 MiB of other buffers, the ring counts, the switch. Not measured: speed (no 5090 yet); drafting is exact, the tokens do not depend on it.
2026-12-02 17:10:56 +01:00
Niko1221 99a51c046e Inkling: the conversation cache on disk handles files near its cap (0.2.25 item 1, part 3)
Design (3 lines): ConvDisk::save made room AFTER writing the new file, so a folder at its cap held the old files and the new one at once, and the chat's own earlier turns stayed next to the
turn that extends them. Now room is made before the write: the file of the same key is replaced, then files this conversation supersedes (their tokens are a strict prefix of it, same pictures),
then the least recently used. The pass at engine stop writes at most one cap's worth (with many slots the later files would only evict the earlier ones).

Why now: Inkling's default context is moving to 128K and a 128K conversation file is about 2.4 GB against the 8 GB default cap (the owner made the cache default ON in the launcher).
ink_conv_disk.h: make_room(), written_bytes(); ink_serve.h: the shutdown loop stops after one cap; docs/DETAILS.md. Test (host-only, ink_conv_disk_test): two 60 KB files under a 100 KB cap leave
one file and never more than the cap on disk, a file replacing itself near the cap, a file larger than the cap refused with the stored one kept and no .tmp left, turn 1 (used last) goes before turn 2
when turn 3 needs room, a different chat is only evicted by use.
2026-12-02 17:10:55 +01:00
Niko1221 efafdee952 Inkling: conversation cache on disk, CUDA (0.2.25 item 1, part 2): --conversation-cache-dir, serialize / parked_from_bytes / conversation_identity
Design (3 lines): a conversation parked because another request overwrites its slot, and every idle slot's conversation when the engine stops, is also written as a file (ink_conv_disk.h: identity
string, prefix tokens, pictures, hash; capped, LRU); the first request that continues it, also after a restart, reads it back through the same unpark path as #7620. The backend exports its
ParkedState as bytes (CUDA: the checkpoint plus the global K/V of [0, seq_len), bounds-checked on read) and states what the bytes mean (K/V type and layout, window, drafter state); a file of another
engine build, model, layout, a damaged or cut file is refused and removed (the turn reads cold). No file with a layer split, the elastic 1M tiers, or a backend without the hooks (one log line).

ink_backend.h: ParkedState::serialize, InkBackend::parked_from_bytes / conversation_identity (defaults: cannot). ink_cuda_backend.cu: CudaParked serialize / from_bytes, the identity, and a fix that
unpark_slot grows the global K/V to the conversation's length first (an engine that has just started has not grown it; 8,189 tokens fit the initial capacity, 16K and 32K did not: "could not be
put back"; the in-memory park of #7620 never hit it because the K/V had grown in the same session). ink_serve.h: the disk layer in park_current (write), the park block of prepare_req (read, after the
in-memory store), the shutdown save, ServeConfig conv_cache_dir / conv_cache_bytes; ink_main.cpp: the two flags. docs/DETAILS.md has the section.

Tests: 8 new mock tests (restart reads back and answers as cold, a request that overwrites the slot writes a file and it comes back, another identity ignored and removed, damaged file, larger than the
cap, a backend that cannot export, a picture conversation after a restart only for the same picture) + the unit test of the file layer (47 mock tests pass). Real card, RTX A6000, SQ-20 v2, --draft off,
turn 2 = turn 1 + its answer + a follow-up, first token after an engine restart / the same engine warm / a fresh engine reading it cold: 8K 0.34 / 0.15 / 3.44 s, 16K 0.48 / 0.09 / 7.23 s, 32K 0.78 / 0.11 /
15.79 s (files 218 / 350 / 613 MB, written at stop in 0.6 to 1.1 s). The restored turn's tokens equal the cold read's in 5 of 6 runs (3 sizes, default and STRATA_INK_EXACT=1); the sixth (8K, default mode)
is a pass in which turn 1 itself differed between two identical runs.
2026-12-02 15:25:30 +01:00
Niko1221 343a68356e Merge nx-r25-park (#7620: park and restore a slot's conversation, REPROC) into f-ink-025
One history for the Inkling conversation work of 0.2.25: items 2 (pictures), 6 (governor) and the disk layer of item 1 on top of REPROC's park / unpark hooks (21699a4c08, tip 85cad3f51c).

Conflicts: ink_prefix_mock.cpp and test_shared_prefix.py only (both lanes extended them); resolved by keeping both sides. The mock's global K/V is int64 (a picture row is 1<<40 | a hash
of its embedding row), so MockParked stores int64 too. ink_serve.h merged without a conflict, plus one addition so the two features meet: a parked conversation now records the pictures
inside it (the SHA-256 spans of ink_pic_reuse.h), the search for a parked conversation and the "already parked" test compare them, and the pictures come back with the checkpoint.
Without it the same ids behind another picture could have been matched to a parked conversation.

Tests (mock, real serve loop, 39 pass on p1006): the two new ones are a parked picture conversation coming back for the same picture only, and the same ids with another picture not getting
it (that one fails when the picture comparison is removed from the park match: negative control).
2026-12-02 14:57:28 +01:00
Niko1221 f773a83ec0 Inkling: the drafting governor pauses longer after consecutive failed windows (0.2.25 item 6); STRATA_INK_GOV_BACKOFF=0 restores the fixed 40
Design (3 lines): the window governor (--draft-adapt, passed by the Terminal) measures 12 speculative steps and, when the gain is below 0.93, runs plain steps before probing again;
the pause was always 40 steps, so at 65K to 131K tokens of context, where every probe loses, about one step in five was a losing speculative step for the whole reply. The pause now
grows 40, 80, 160, 320 with consecutive failed windows and returns to 40 as soon as a window pays. Drafting is exact, so the output is the same; only when drafting runs changes.

ink_gov.h (the schedule as a pure function) + ink_gov_test.cpp; ink_serve.h uses it per request (gov_fail); the register has STRATA_INK_GOV_BACKOFF.
Measured (SQ-20 v2, one slot, product arguments --draft dflash2 --draft-beam 1 --draft-adapt, 768 new tokens, 2 alternating rounds, greedy tokens identical in every arm):
RTX A6000 (CUDA) decode tok/s, backoff / fixed 40 / --draft off: 33K 111.1 / 108.3 / 58.0; 65K 47.1 / 46.8 / 49.4 (a second run 48.8); 131K 36.0 / 34.9 / 38.2 (second run 36.5).
Radeon AI PRO R9700 (HIP), 384 tokens: 33K 95.6 / 95.2 / 56.4; 65K 49.7 / 49.5 / 47.6 (tokens identical in all arms and rounds).
The gain is small (+0.6 % at 65K, +3.2 % at 131K on CUDA) and the product still runs about 4.5 % under --draft off at 131K there, from the probe windows that remain. Not the cause:
the drafter's tap ingest on plain steps (an experiment that skips it on governor-plain steps gave 47.7 / 36.7 tok/s against 48.8 / 36.5 with it). The Olares 128K gap (9.8 vs 11.05)
is not reproduced by this change; it needs a card with host-offloaded K/V.
2026-12-02 14:34:14 +01:00
Niko1221 0233739920 Inkling: the disk layer of the conversation cache (0.2.25 item 1, part 1: file format, identity, cap, LRU; no engine wiring yet)
Design (3 lines): one file per parked conversation: a header (identity string built by the backend: model files, engine build, K/V type and layout, window; the prefix
token ids; the pictures inside it with their SHA-256), then the opaque payload a backend exports. A file of another identity, with a wrong hash, or cut short is refused and
removed (the turn reads cold); writes go to a temporary name and are renamed; the total is capped and the least recently used files go first. The hash is for accidental
damage (not cryptographic): only files this engine wrote are restored.

ink_conv_disk.h (host only, no GPU, no backend) and ink_conv_disk_test.cpp (round trip, restart, longest prefix wins, foreign identity, flipped payload byte, cut file, other
picture behind the same ids, cap with LRU order, a conversation larger than the cap, files that are not ours stay). The engine side (a ParkedState serialize / deserialize on
the park / unpark hooks of #7620, --conversation-cache-dir, the restore on the first matching turn) follows once #7620 is in.
2026-12-02 13:06:08 +01:00
Niko1221 21699a4c08 inkling: park a slot's conversation in host RAM before another request overwrites it, and put it back (--slot-cache-mib, #7620)
A slot holds one conversation; a request that continues nothing of it (a title, a summary request, a helper agent) wiped it, and the next step of the chat
read its whole prompt again (RTX 3060, 11K tokens: 30 to 46 s a step). With --slot-cache-mib N (or STRATA_INK_SLOT_CACHE_MIB, 0 = off, the default) the
serve loop parks the slot's conversation first: InkBackend::park_slot(slot, seq_len) copies the global K/V of [0, seq_len) to a host buffer and moves the
slot's prompt-end checkpoint into the parked object; unpark_slot writes the K/V back and restores the checkpoint, so the slot holds the conversation exactly
as it was. The scheduler keeps the parked conversations under a byte budget, least recently used first, parks only conversations of 512 tokens or more,
parks nothing for a normal follow-up, and reads from the start when a put-back fails.

CUDA backend (one GPU, not the layer split): the K/V copy follows the descriptor layout (card part, virtual-memory range or mapped host tail; FP16 K and V,
FP8 / K8V8 / K8V4 also the scale arrays). Other backends keep the default (cannot park). Tests: test_shared_prefix.py (7 new, GPU-free, mock backend that
aborts on a restore over a different K/V).
2026-12-02 13:00:38 +01:00
Niko1221 f69ffe7cf3 Inkling: picture reuse is ON by default (kPicReuseDefault), STRATA_INK_PIC_REUSE=0 turns it off
Decision of 12-02 (coordinator, the owner may still flip it): default ON, because a resumed picture turn differs from the same turn read cold exactly where a resumed
text turn already does (parity table in phaseA-tests/notes-ink-025.md: CUDA A6000 and HIP R9700, text and picture, 40 greedy tokens), a wrong hit is excluded by the
SHA-256 comparison of the pictures' exact pixels, and the gain is clear (time to first token of turn 2 and 3: CUDA 0.63 -> 0.12 s, HIP 0.45 -> 0.16 s).
The default is now one constant in ink_serve.h (kPicReuseDefault); with it false the variable needs STRATA_INK_PIC_REUSE=1. The register note is unchanged (status default).
2026-12-02 12:59:11 +01:00
Niko1221 948cfa5372 Inkling: prompt reuse for chats with pictures (0.2.25 item 2)
Design (3 lines): a resident prefix (the slot's last prompt, or its prompt-end checkpoint) is reused for a prompt with pictures only when the pictures
inside it are the same pictures: each is keyed by a SHA-256 (all 256 bits compared) of the exact encoder input (pixels after resize and padding, grid, size)
and by the position of its pad run; encoded pictures are kept in a byte-capped LRU so a later turn does not run the ViT again; a prompt without pictures takes
the id test it always did. STRATA_INK_PIC_REUSE=0 restores the old behaviour (read whole every turn), STRATA_INK_PIC_CACHE_MB sets the cap (default 256).

ink_pic_reuse.h is new (digest, span test, PicCache). ink_serve.h: the reuse block and the prompt-end checkpoint also run for picture prompts (the tail-role
position only when it is not inside a picture); the shared (pinned) prefix stays text only. ink_prefix_mock.cpp + test_shared_prefix.py: the real serve loop
against the mock backend with a Vision folder: same picture reused and equal to a cold run, another picture behind the same ids never reused (3 of the 7 new tests
fail when the picture check is disabled), prompt-end checkpoint with a picture, a changed second picture, a text turn after a picture turn, the off switch
(greedy tokens identical, no cache), cache cap 0. Both settings are in the register (settings_register --check green).
2026-12-02 12:37:28 +01:00
Niko1221 70ac2f2464 release prep 0.2.24: app and Terminal 0.2.24, Control, strata-engine and strata-inkling 0.1.72, release data and generated pages 2026-12-02 02:30:02 +01:00
Niko1221 7d2352622c Merge opt-in --deterministic for the Qwen-family engine into 0.2.24 2026-12-01 22:23:45 +01:00
Niko1221 afb43ae350 engine, launcher: --deterministic / STRATA_DETERMINISTIC=1 (opt-in, off by default): the same prompt gives the same answer on every run
Which experts of a token run on the CPU and which on the GPU depends on timing (the adaptive tier's copies landing, the prefill's CPU share),
the CPU and GPU kernels do not give the same last bits, and the draft policy picks each verify window's size from live round times (a different
window is a different batch for the verifier), so two runs of one prompt could diverge after a few hundred tokens (ioq-sweep, 2026-12-01:
first differing hidden state between layers 8 and 14, argmax flipped at token 240, 20 percent of same-context window rows differed).

The switch sets --pcie-frac 1 when none is given (every missed expert is computed on the GPU), STRATA_PREFILL_CPU_SHARE=0 when it is not set
(the prompt does not use CPU experts) and STRATA_SPEC_FIXED=1 when it is not set (the engine's fixed window-cost table), and prints one start-up
line. A value the person sets wins and is said. RTX A6000, IQ3_S pack, MTP spec 4, default cache: 6 of 6 runs gave the same tokens (the default
flags: 2 runs, 2 different answers) and two runs with STRATA_LOGITS_DUMP gave byte-identical logits; decode about 3 percent slower (median 49.3
against 50.9 tok/s), prompt speed the same within noise (4K and 16K). With the switch off the logits of the old and the new build are
byte-identical (cache 1500 default flags, and the fixed-flag identity set).

strata launch --deterministic writes STRATA_DETERMINISTIC=1 into the run configuration (the copyable line says --deterministic).
Settings register entry (opt-in), docs/DETERMINISTIC.md, docs/SETTINGS.md regenerated, launcher test.
2026-12-01 22:21:37 +01:00
Niko1221 020b88d18c Merge Inkling COMPACT codec fix for 16 GB RTX 50 (SQ-15 documents) into 0.2.24 2026-12-01 22:18:11 +01:00
Niko1221 ec633396d1 Merge Inkling PR wave 3 (SYCL #7153 #6803 #6718, HIP #7111 #7112, #6967, CUDA #7368) into 0.2.24 2026-12-01 21:50:27 +01:00
Niko1221 04028bfef2 Merge PR #7368 (CUDA RTX 50: prefill attention of the fast mode sums its output in FP32 on the global visits, jun76) 2026-12-01 21:48:37 +01:00
Niko1221 d5026839ff #6770: the global K/V of one slot grows through CUDA virtual memory (no copy), the context is set to what the card holds once the drafter has loaded, opt-in --kv-prealloc
The elastic global K/V grew one visit at a time (new buffer, copy, free the old one), so the card needed one old visit buffer extra and a long request stopped 1.2 to 1.8 GB short of the
context that had been planned ("VRAM exhausted growing elastic global KV cache", 503), and the plan was set before the drafter (DSpark's fused weights, DFlash 2 codebooks and rings)
took its memory.

- ink_runner.cuh: with ONE slot on ONE card (no layer split, no elastic 1M mode, K/V not split to host at the start) every global visit's K, V and scale buffers are address ranges for the
  requested context (strata::core::VmmRange, src/core/vmm.cpp, now also linked into the CUDA backend) and physical memory is mapped behind them as the context grows; the pointers never
  move, so no peak of old + new. A failed mapping falls back to the host tail (kv_spill_tail, the earlier code, now a function) or to a refused request, as before.
  STRATA_INK_KV_VMM=0 takes the earlier growth back.
- ink_dspark.cuh: the classic drafter's global context grows the same way (ctx_vmm).
- ink_cuda_backend.cu: after the drafter has loaded (--kv-offload off), max_ctx is set to what the card holds (ink_kv_reach_ctx, 256 MiB kept free), up or down, never above
  --max-context ("max_ctx A -> B" line); --kv-prealloc / STRATA_INK_KV_PREALLOC=1 maps that whole context at start-up (and refuses to start, with a message, if the mapping fails); a request
  that fails to grow says how much video memory is free now and what to do.
- ink_serve.h + InkBackend::kv_reachable_tokens(): a prompt the card can no longer hold (another program took video memory after the plan, --kv-offload off) is refused at the start with
  a message instead of ending with 0 tokens; the engine stays up.
- strata/core/ink_kv_grow.hpp: ink_kv_reach_ctx() and its test (ink_kv_grow_test). Register: STRATA_INK_KV_PREALLOC (opt-in), STRATA_INK_KV_VMM (rollback); docs/INKLING_KV.md, SETTINGS.md.

Measured (RTX 4090, SQ-20 v2, --kv fp8 --kv-offload off, prompts of 90K / 100K / 110K / 128K tokens; VRAM ballast taken before the first allocation to get the Windows 4090's room;
phaseA-tests/rel0224/ink-kv/RESULTS.md, REPLY-6770.md): no ballast: tokens identical old / new / --kv-prealloc, decode equal; 700 MiB ballast, classic drafter: old ends the 110K request at
100,864 tokens with 0 tokens, new answers it; default drafter: old plans 104,192 and refuses 110K and 128K, new answers both; 1,300 MiB: old plans 74,240, new raises it to 109,568 and
answers a 100K prompt; every answer identical to the unballasted run; short prompts: same tokens, speed within 0.5%; ballast after the start: --kv-offload auto answers (host tail), off
refuses with a message. An RTX A6000 with a 128K prompt: identical tokens. Builds: CUDA sm_86 and sm_89 (Linux), sm_120 (MSVC), HIP gfx1151.
2026-12-01 21:46:58 +01:00
Niko1221 0f1034b4d9 CUDA: refuse COMPACT for non-SF4/MX8 experts before the sizing, not after the load
COMPACT (RTX 50 16 GB rows) reads only SF4 / MX8 experts. The loader checks that and refuses, but only after the backend has planned the run for COMPACT: FP8 K/V, DFlash 2 loaded on the compact budget. On a 16 GB card with SQ-15 the refused run kept that plan (global K/V entirely in mapped host memory) and decoded 4K / 8K documents at 26 / 19 tok/s against 46 / 46 with STRATA_INK_SM120=0 (RTX 5060 Ti 16 GB, rented, quiet box, ABBA, 2 rounds, 7 prompts).

The backend now runs the loader's same conditions (compact on, not the hybrid rows, no explicit expert budget or SSD, card within the row's compact size) over the expert directory before the sizing and calls sm120_compact_refuse there. Result for packs with other experts (SQ-10, SQ-15, IQ3_S, UD-Q4_K_XL): exactly the old path, planned as such. SQ-20 (all SF4 / MX8) and the 12 / 8 GB hybrid rows are unchanged. Compiles for sm_120 (CUDA 13.1).
2026-12-01 21:42:31 +01:00
Niko1221 cb6470cbd2 HIP: print the expert codec class counts per layer at start-up
One stderr line after the layer tables are built: how many layers have S_K, SF4, MX8 or other (GGUF or mixed) gate_up and down experts. The FP8 prompt-row MoE and the K-coalesced decode MoE of the R9700 set run on the SF4 and MX8 layers only, so the line shows the coverage per pack. No behaviour change (p620 build gfx1200 + gfx1201: 0 errors).
2026-12-01 21:42:31 +01:00
Niko1221 0618b0cabc Merge PR #7112 (HIP gfx12: tiled ViT full attention, Delf1n) 2026-12-01 21:19:09 +01:00
Niko1221 f11d217442 Merge PR #7111 (HIP gfx12: hardware FP8 K/V decode, Delf1n) 2026-12-01 21:19:09 +01:00
Niko1221 9033a442c6 Merge PR #6718 (SYCL inkling: register GGUF DSpark tensors under the dspark. prefix, jinsoojinsoo) 2026-12-01 21:19:08 +01:00
Niko1221 9d3af874d7 Merge PR #6803 (SYCL inkling: chunk prefill to the batch cap, maxious) 2026-12-01 21:19:08 +01:00
Niko1221 655ca03216 Merge PR #7153 (SYCL: prompt-end and shared-prefix checkpoints, Jumbomuffin777) 2026-12-01 21:19:07 +01:00
Niko1221 4ce01c3f08 --kv auto, final rule per backend (owner, 2026-12-01): NVIDIA FP8; AMD, Mac and Intel keep FP16; the one rule takes the backend's default and its reason
The measurements (phaseA-tests/rel0224/ink-kv/RESULTS.md) made FP8 a good default where the card likes it and a bad one where it does not:

- CUDA: FP8 on every card and slot count (KL 0.005, top-1 95-98%, FASTQ subset SQ-20 v2 201/213 FP16 against 202/213 FP8, 64 slots +24 to +27% and a 32K
  decode x2.5 on 12 and 16 GB cards because the cache is half the size and stays on the card; -1 to -3% on an RTX A6000 that has no native FP8).
- HIP (AMD): the 0.2.23 rule is back, unchanged: FP16, FP8 from 16 slots on a card of 36 GiB or less, STRATA_HIP_KV_FP8_SMALL and the Strix Halo FP8_KV_C64 set as before.
  On the Radeon AI PRO R9700 FP8 costs 7% decode at 4K and 17% at 32K (prefill -8% at 32K); the retirement of STRATA_HIP_KV_FP8_SMALL is undone.
- Metal (Mac): FP16 ("auto: Mac default"); --kv fp8 (#6983) and the opt-in M5 Max fast set are as they were.
- SYCL (Intel): FP16, FP8 from 16 slots and in the Intel Arc fast set, as before (Arc A750: FP8 decode -6%, KL 0.0044 at 4K and 0.0054 at 32K).

ink_kv_auto_rule() now takes the parallel slots, the card's memory and what the backend's default is (fp8_by_default / fp8_from_slots / card cap / its sentence), so
the rule and its reasons stay in one place; every backend prints "[kv] <backend>: K/V cache <type> (auto: <reason>)". ink_main no longer sets FP8 at 16 slots for every
backend (that made a Mac and an Intel card take FP8 by the back door); the CPU reference keeps its own FP8-from-16-slots rule in its backend. The plan
(inkling_fit.auto_fp8_kv) follows: FP8 for CUDA and an unnamed backend, the 0.2.23 rule for HIP, FP16 for Metal and SYCL. Tests: ink_kv_rule_test (host only),
test_inkling_kv_auto.py, and the planner tests that pinned FP16 numbers pin them with fp8_kv=False.
2026-12-01 20:52:09 +01:00
Niko1221 d1d0f59c7c Metal K/V start-up line follows #6983 (--kv fp8 on any Metal GPU); the doc and the rule header say so
After #6983 an explicit `--kv fp8` is honoured on every Metal GPU (the M5 Max fast set still picks FP8 by itself). `--kv auto` stays FP16 outside the M5 Max set: INK-PR measured
FP8 on an M5 Max at KL 0.0053 / top-1 96% against FP16 with the K/V halved, but decode -10 to -12% at 4K to 16K, so it is a choice there, not a default (the owner decides).
The [kv] line says which of the two happened, and says so when `--kv fp16` meets the M5 Max set's own FP8.
2026-12-01 20:13:00 +01:00
Niko1221 ff17a139fa Inkling 2 Mini: --kv auto is FP8 on every card and slot count; one rule for every backend, a start-up line, and a long-document KL mode
`--kv auto` (the default) now stores the K/V cache as FP8 wherever the backend can (CUDA, HIP; SYCL stays FP16 by default until its A750 / B70
numbers are in, Metal takes FP8 only in the M5 Max set) and FP16 where it cannot. K8V8 and K8V4 are only chosen when asked for (--kv k8v8, --kv k8v4).
An explicit --kv always wins. Before, every backend had its own rule (CUDA: FP16 unless 16+ slots, a card of 13 GB or less with the K/V offload off, sm_89+ with a
context over 16K, three RTX 50 rows; HIP: FP16 below 16 slots; SYCL: FP16).

- engine/include/strata/core/ink_kv_rule.hpp: the one rule (host only) and the one start-up line, "[kv] cuda: K/V cache fp8 (auto: default)"; the CUDA, HIP, SYCL
  and Metal backends call it. Test: engine/tests/core/ink_kv_rule_test.cpp.
- CUDA: plan_vram_reserve() takes the type from the rule; STRATA_INK_ELASTIC_1M + STRATA_INK_KV_K8V4 remains the tester's way to K8V4. HIP: the old small-card
  switch STRATA_HIP_KV_FP8_SMALL is retired (register entry marked retired in 0.2.24).
- ink_main --help: the --kv line says what auto is.
- --dump-ref / --kld-eval: a row-selected form for long documents (INK_KLD_TAIL=N INK_KLD_STRIDE=s keep the logits of every s-th of the last N positions; the file
  then starts with -n_tokens; INK_KLD_CHUNK / INK_KLD_CHUNK_TAIL set the prompt chunk of the head and of the scored part). The old file format and behaviour are unchanged;
  the --kld-eval line gains refPPL and dNLL at its end.
- terminal: the memory plan (inkling_fit.auto_fp8_kv) sizes FP8 for every backend except SYCL and Metal; compute_unified and recommend take fp8_kv like compute does.
  Tests that pinned the FP16 numbers now pin them with fp8_kv=False; test_inkling_kv_auto.py covers the new rule, the launcher's k8v8 / k8v4 clamp and that every backend
  calls the one rule. docs/INKLING_KV.md; docs/SETTINGS.md regenerated.

Measurements (phaseA-tests/rel0224/ink-kv/RESULTS.md): teacher-forced KL of FP8 against FP16 K/V 0.005-0.007 and top-1 95-98% on 4K / 32K / 128K documents
on RTX A6000 (SQ-20 v2), RTX A4000 (SQ-15), R9700 (SQ-15), Arc A750 (SQ-10, 4K), RTX 5070; the needle misses are the same with FP16.
2026-12-01 20:11:36 +01:00
Niko1221 c3529f98f3 Merge PR #6983 (Metal: --kv fp8 takes effect on any Metal GPU, UmiAoi) 2026-12-01 19:19:17 +01:00
Niko1221 afb2f5d7a1 Merge PR #7098 (Metal: fix SWA KV ring overwrite during chunked prefill, Grasseed) 2026-12-01 19:19:17 +01:00
Niko1221 215623941f Merge PR #7009 (HIP: opt-in 8-wave grouped MoE for small prefill chunks, jbox5) 2026-12-01 19:14:53 +01:00
Niko1221 2e295e7977 Merge PR #7100 (CUDA: opt-in pinned expert cache, coderchem) 2026-12-01 19:14:52 +01:00
Niko1221 8ece5d8a51 Merge PR #7499 (CUDA: keep K/V on the card with COMPACT_HYBRID all-resident, ShiQu1218) 2026-12-01 19:14:52 +01:00
Niko1221 a8db6d059b Merge PR #7367 (safetensors: widen BF16 trunk tensors to F32, devlier) 2026-12-01 19:14:52 +01:00
Niko1221 1ccb0848af Merge PR #7571 (CUDA: refuse COMPACT with explicit expert budget, smendola) 2026-12-01 19:14:51 +01:00
Niko1221 1004c68337 Merge PR #7354 (CUDA: refuse RTX 50 COMPACT on multi-GPU and non-.strata, Norhiro) 2026-12-01 19:14:51 +01:00
Niko1221 103314c588 Merge PR #6986 (CUDA: refuse layer split with host experts on a later GPU, GautamtmD) 2026-12-01 19:14:51 +01:00
Niko1221 effcad0cfb Merge PR #7110 (HIP: STRATA_INK_MAX_PREFILL_CHUNK, Delf1n) 2026-12-01 19:14:51 +01:00
Niko1221 d5fd6eaa89 merge fixes: other families behave as on next-0224 again (promise 6 of the PR comment), the Hy4 additions stay scoped
Found by the python suites on the merged tree (next-0224: 0 failures in py-tests / py-serve, 1 known in py-tools; merge: 2 / 1 / 7 + the settings register).
- strata_tokenizer.py: only the Hy4 pre-tokenizer name hy_v4 is added; qwen3 / joyai-llm / hunyuan-dense are refused again as before, and the
  qualified special-id keys are folded in only for hy_v4.
- iq_pack.py: the expert-layout messages say "layer N" as ever; "block N" only where a dense prefix makes the two differ (hy4-flash).
- launch/catalog.py: the 4096 start context is for the GGUF engine (Q4_K_M) only; the native hy4-flash default stays 128K.
- serve/replicas.py, serve/server.py, test_replicas.py: the PR's inference_turn / replica queue-wait rewrite (all families) is not carried over;
  only the hy4-flash shared-arena refusal stays. serve/web/app.js: the expert_slots != null display change is not carried over.
- strata_control/models.py: the mixed-architecture shard refusal (all families) is not carried over; the hy_v4_flash acceptance stays.
- serve/frontend.py: thinking_enabled() counts reasoning_effort no_think only when the family is hy4-flash.
- engine program/generate.cpp: --families keeps the literal printf forms (test_shape_engine) with hy_v4_flash added by STRATA_HY4_FLASH_RUNS.
- tests: test_family_name lists hy4-flash; test_no_debugger_children lists hy4_flash.py (nvidia-smi); terminal/data/settings-register.json gets the 129
  names the Hy4 engine reads (status opt-in where the default is off, else unsure; additions only).
2026-12-01 17:59:24 +01:00
Niko1221 a1901ba2f6 release builds: the NVIDIA (CUDA) builds pass STRATA_BUILD_HY4_FLASH=ON
tools/packaging/build_cuda_linux.sh (x86 cuda12 / cuda13), tools/packaging/build_cuda_windows.py (cuda12 / cuda13), tools/docker/Dockerfile.src
and the cuda-compile preset (the CUDA compile CI job mirrors the release flags). HIP, SYCL and Metal builds are unchanged (OFF), and
STRATA_BUILD_HY4_FLASH_METAL stays OFF; the arm64 DGX Spark build (engine/spark/build_engine.sh) is not touched: Hy4 has not been built or run on arm64.
Owner decision for 0.2.24: Hy4-Flash GGUF for NVIDIA only.
2026-12-01 17:19:20 +01:00
Niko1221 2c104750ad Hy4-Flash GGUF is offered only where the engine has it: families list, a clear refusal, a launcher check
- cmake/hy4_flash_gguf.cmake: the CUDA Hy4 builds define STRATA_HY4_FLASH_RUNS, so `strata --families` lists hy_v4_flash (setup, the feed and
  `strata launch` read that list). Before, nothing defined it and even an ON build stayed silent.
- program/generate.cpp: an engine build without the Hy4-Flash GGUF engine (Metal, HIP, SYCL, CPU-only, a CUDA build with the option OFF) refuses a
  hy_v4_flash file with one message that says where it is (NVIDIA CUDA builds) instead of falling into the Flash-Next path.
- terminal/strata_control/hy4_flash.py: capability "gguf" (the engine's own strings, present only with the engine); defaults() refuses an engine
  without it at plan time and a computer without an NVIDIA card with a message that names the cards found. Tests: 3 new, 18 fake engines now
  carry the marker; 269 tests of the hy4 / launch files pass (p1006).
2026-12-01 17:19:20 +01:00
Niko1221 15a3374a68 cmake: four test programs that pull src/core/pinned.cu out of strata_core link strata_kernels_cpu (they did not link)
pinned.cu (STRATA_NUMA_ARENA, ad4c565e8, 2026-11-22, already on main 8db8753d5) calls kernels::cpu::expert_layout(), which lives in
strata_kernels_cpu. strata-load, strata-concurrent, strata-overlap and pinned_shared_test link strata_core without it, so a CUDA build of
all targets (tests on, z440 sm_86, CUDA 12.9) failed four links with: undefined reference to strata::kernels::cpu::expert_layout().
Same four failures on next-0224 addfdb161 and on the merge before this commit; the strata engine itself was never affected. Not a clean-up
round regression: the call arrived with ad4c565e8 and no earlier gate built all targets.
2026-12-01 16:02:15 +01:00
Niko1221 8cd64bf221 metal cmake: the hy4_quant_gpu_test target links mtl_rt_core again (one line the opt-in block lost)
Found by the m1002 build with STRATA_BUILD_HY4_FLASH_METAL=ON: hy4_quant_gpu_test did not find mtl_rt.h. Default build unchanged.
2026-12-01 15:57:59 +01:00
Niko1221 256aef16c1 Merge f-hy4-e2e (Hy4-Flash GGUF engine, clean-room) into nx-hy4-0224, on next-0224 addfdb161
The Hy4-Flash GGUF engine (f-hy4-clean + f-hy4-mla + the E2E fixes: CPU expert rows equal to the GPU rows bit for bit, the engine's
out-of-memory message, the plan reserve for A40 / RTX A6000), opt-in:
  - CUDA: STRATA_BUILD_HY4_FLASH, OFF by default (configured only with CUDA on and no HIP);
  - Metal: STRATA_BUILD_HY4_FLASH_METAL, OFF by default (the f-hy4-e2e side linked the Hy4 engine into the Metal strata
    unconditionally; here its targets, the strata link and STRATA_HAVE_HY4_FLASH are behind the option).
Conflicts: engine/CMakeLists.txt (f-hy4-e2e had the whole file in CRLF; next-0224's file kept, the Hy4 option and include re-applied by
hand) and engine/metal/CMakeLists.txt (next-0224's ggml handling kept; mtl_rt split into mtl_rt_core + mtl_rt as the merged
gguf_lite.cpp needs, Hy4 targets behind the option).
2026-12-01 15:33:23 +01:00
Niko1221 97509d1877 hy4-flash: a CPU expert row is the same float as the GPU row of the same expert, bit for bit
Which experts of a token run on the CPU and which on the GPU depends on timing (CPU split auto), and the two arithmetics
differed in the last bits (8 lane partials without fused multiply-add and libm's exp on the CPU; 32 lane partials with fused
multiply-adds, an xor butterfly and the CUDA exp on the GPU). The model is sensitive enough that this moved the logits from
run to run with CPU experts on (KL 1e-3 to 3e-2 between two identical runs), while CPU experts off was bit-identical.

The CPU row kernels (scalar, AVX2, VNNI tiers) now follow the GPU decode kernels' reduction contract (own_decode.hpp), and the
SwiGLU exponential is one shared function (own/swiglu_math.hpp, host and device give the same bits) used by the CPU expert
glue and by the GPU decode quantiser. New test hy4_flash_cpu_gpu_rows_parity: the CPU tiers against own::mmvq on the GPU for
Q4_K / Q6_K / Q8_0 (217k outputs), the rule-E quantiser, the exponential over a dense sweep and the clamped SwiGLU image.
cpu_experts_test compares tiers with the production silu.

Measured on an A40 (sm_86), chat-advice and json-raw, 64 rows each: before, two runs with CPU experts on differ (KL 0.00145 and
0.0221) and differ from CPU off; after, the dumps are byte-identical run to run and CPU on equals CPU off.
2026-12-01 09:57:25 +01:00
Niko1221 73c150784d Merge next-0224 (#7310 opt-in) into f-clean-p2i 2026-12-01 08:58:44 +01:00
Niko1221 08e7dba242 hy4-flash: an exception that reaches the top of the engine is reported with what to change, not by std::terminate
A launch failure such as "rope_norm: out of memory" (seen at a 16K prompt with an F16 KV cache and the expert pool the plan had
sized for Q8 KV) left the engine in std::terminate with only the runtime's text. run() now wraps the real body, and a terminate
handler covers exceptions that leave a worker thread: both print the message once, add for out-of-memory failures the list of
what shares the card (expert pool, context, KV format, prefill chunk, prompt length) and end with std::_Exit, since static
destructors can hang on a failed device. Under --serve the "ERR fatal GPU error" line the server reads is printed as well.
2026-12-01 08:44:08 +01:00
Niko1221 0962a447f2 peer autonomous: refused with STRATA_ADAPT_OVERLAP=1 (FORCE does not override), the decision is a pure function with a test
The autonomous window has no host loop, so it would not wait for the adaptive tier's copies to land. peer_autonomous_policy.hpp holds the rules
(overlap, sm_120 with the FORCE override, every expert on a card with the LOSSY opt-in); peer_autonomous_policy_test covers them; the guard in
generate.cpp uses it. SECOND_GPU.md and the register say 'refused', not 'do not combine'.
2026-12-01 08:35:53 +01:00
Niko1221 35b6880d11 Merge next-0224 (R9700 and multi-GPU merges) into f-clean-p2i 2026-12-01 07:24:33 +01:00
Niko1221 de2bb9457a Merge f-7310-int into f-7310-int2: PR 7310 (peer direct signal, autonomous window; opt-in, exact guard) onto 47a993eaf; settings register regenerated 2026-12-01 07:20:05 +01:00
Niko1221 47a993eaff Merge f-mgpu-p0 into next-0224: strata_mgpu phase 0, the shared multi-GPU layer foundation (no engine behaviour change)
Topology probe, device set, planners, transports and the strata-topo program with their tests; the Terminal strata topo command. Nothing in the engine calls it yet.
2026-12-01 06:58:09 +01:00