The pool layout (every card byte is a dynamic slot, no hot prefix) now plans lookahead_k = 2 instead of 4. The main program then loads and evaluates only the k=2 predictor (lookahead_ks bit 0) and the tier store prefetches from the k=2 list. The old layout (--tier-pool off) and tier C keep k=4.
Measured (quiet host, ABAB, plain decode, same job file, output ids identical on all 22 jobs against the k=4 arm and against plain):
- RTX 3090 (PCIe 4.0): k=2 54.3 against k=4 53.0 tok/s, +2.0 %.
- RTX 5090 (PCIe 5.0, 47 GB/s): k=2 110.2 / 110.3 / 110.1 against k=4 107.5 / 107.5 tok/s, +2.6 %.
- Recall of the true top-8 experts: k=2 64.6 %, k=4 54.0 %; the k=2 lead is 0.8 ms against 1.7 ms for k=4, and the better recall wins.
Env STRATA_L32_LA_KS and STRATA_L32_PF_K still override the choice. The tier planner test expects lookahead_k 2 for the pool layout.
The first version (link >= 32 GB/s AND >= 4500 card experts) would switch MTP off on the AMD R9700 (about 5958 slots, 24-26 GB/s
link), where it was measured winning: L32-PREFILL 4K decode 38.6 against 33.8 plain, 32K 36.3 against 32.8; L32-HIP short set about
58 with K=1. All measured cards agree with the pool size alone: RTX 5090 5466 slots +4..11 %, R9700 5958 slots +11..14 %, RTX 5070 Ti
2413 slots -0.7 %, RTX 3090 / 4090 about 4000 slots never (forced K=1: 1.83 tokens per verify at 48.0 tok/s against 49.0 plain). With the
pool size known the rule is: pool >= 4500 and link >= 16 GB/s (PCIe 3.0 x16 measures about 12 GB/s and has no measurement with a big
pool); without it (-1) the old link-only rule (>= 32 GB/s) stays. Tests: planner table (R9700, 3090, PCIe 3.0, unmeasured link rows),
ling32_mtp_auto_regress legs (3090-like small pool not loaded, R9700-like big pool loaded, 12 GB/s not loaded, 46 GB/s both ways).
z440 CTest planner + mtp_auto pass. To be A/B-checked on the R9700 by L32-HIP (auto against forced-on against plain, 4K and 32K).
A verify batch of 2 tokens needs the experts of both tokens and consecutive tokens share only about 19 % of
their expert uses, so with an LRU pool the misses of a 2-row verify are 2.0x those of one row (cache simulation
on 2810 real decode tokens, L32-MID2): 1.8 tokens per verify then run at 0.90x on a link-bound card. Measured:
RTX 5090 (PCIe 5.0, 5466 slots) +4..11 %; RTX 5070 Ti 16 GB (PCIe 5.0, 2413 slots) -0.7 %, 12 GB emulation
(1485 slots) -2.4 %; RTX 4090 and 3090 (PCIe 4.0, about 4000 slots): forced MTP never gains (K=1: 1.83 tokens per
verify at 48.0 tok/s against 49.0 plain; the adaptive controller runs plain). No measurement between 2413 and
5466 slots on a fast link: 4500 (22 % of the 20480 routed experts) is the conservative side of the cut.
mtp_auto_pays takes the card expert count (-1: unknown, rule unchanged); tier A and unified memory ignore it.
Tests: ling32_tier_planner_test table, ling32_mtp_auto_regress (pool cut off / small pool legs); z440 CTest 19/19 apart
from this leg's first version (the fixture's pool holds many fixture experts: the leg moves the cut by hand).
Measured (2026-12-02, L32-TABLE / L32-MID / L32-SMALL, real Ling-3.2-Air, plain vs MTP, greedy): the drafter pays on an RTX 5090 (PCIe 5.0 x16: +4..11 % decode,
115.8 tok/s with it at ctx 131072 on our 5090 box) and where everything is resident or memory is unified; on tiered cards over PCIe 4.0 x16 or narrower
(3090: 1.00 tokens per verify, prefill 947 vs 1042 tok/s at 4K, 89 fewer pool slots; 4090: acceptance 0; 5080 16 GB -3.4 %; 5060 Ti -3 %) it never does, yet
the sidecar still costs prefill and pool slots.
--mtp-auto FILE (with --spec mtp --spec-adaptive; --mtp FILE stays the forced 'on'): after the memory plan, tier A / unified memory: loaded; tier C: not loaded;
tier B: one pinned 256 MiB host-to-device copy (3 repeats, median) and loaded only from 32 GB/s (kMtpAutoMinLinkGbps, between PCIe 4.0 x16 = 24.4 GB/s measured
and PCIe 5.0 x16 = 45+; 53.5 GB/s measured on the 5090 box); an unmeasured link: not loaded. When it is not loaded the sidecar, --spec mtp and the speculative loop
are dropped and the plan is made again without the sidecar's bytes. The rule is the pure function mtp_auto_pays (planner header, rows in its comment), table-tested in
ling32_tier_planner_test; ling32_mtp_auto_regress runs the wiring on the wide fixture (link by STRATA_L32_H2D_GBPS: 24.4 -> not loaded and plain ids, 46 -> loaded and
speculation on, --mtp forced -> loaded, tier A -> loaded; ids equal to the plain run in every leg).
Also: the measured link is printed ('tier store: host-to-device link moved N GB/s (pinned 256 MiB copies, median of 3)') whenever a tier store is planned, the serve INFO line
carries h2d_gbps=N (before images=), and --info FILE --kv says mtp_auto=1 so the launcher can tell old engines apart.
- tier store (SYCL build only): hot prefix, warm prefix and dynamic slots are lists of allocations cut at slab ends (ChunkSet / ChunkPtr), split reads and copies at chunk borders; pinned refusal falls back to one ordinary-pages block
- sycl_compat: cudaHostAlloc via aligned_alloc_host (64 KiB), staged enqueue copy from small pageable sources, opt-in relaxed allocation limits switch
- ling32_sy_tier_check: drives the store without engine kernels, compares every table slab on the host and with a SYCL kernel
- l32sy_probe.cpp, l32sy_tierbox.sh: memory / copy probe and tier check box script
The planner counted the latent KV for the whole context up front (ctx * MLA layers * 576 * 4: 2.1 GiB at the
128K default), which cost dynamic expert slots on every card in tier B / C (L32-MID, 16 GB RTX 5080: 1671 slots /
38.1 tok/s at ctx 131072 against 2104 / 41.2 at ctx 8192; 4090: -4 %; 5090: 4875 vs 5307 slots, -2 % decode).
Now, with a tier store, the engine starts with min(ctx, 16384) rows per MLA layer (the planner counts only those;
--kv-init N sets it, STRATA_L32_LAZY_KV=0 or --kv-init 0 reserves everything up front as before). When the
position + chunk + 512 rows of margin reaches the capacity (forward_mm, forward_span, spec_cycle), every cache is
re-allocated at twice the size (clamped to ctx), the rows are copied on the device, the old buffer is freed and the
captured graphs are dropped. When cudaMalloc fails the tier store gives dynamic slots back (the small pool is
allocated in chunks of 64 slots; the tail chunks are freed, their slots get state 4 and are never picked,
alloc caps follow the live count; ExpertProvider::release_bytes). Tier A (all resident, CUDA graphs capture the
cache pointers) is planned again with the whole context and keeps the full reservation.
The attention kernels keep receiving max_ctx as their plan bound, so the split plan and therefore the bits do not
depend on the capacity; the same positions hold the same values. The 512-row margin keeps a tile of over-read
inside the buffer.
Tests: ling32_kv_grow_regress (wide fixture, 1200-token prompt, --kv-init 64, ctx 4000: growth 64 -> 1024 -> 2048;
dump and ids byte-identical to --kv-init 0 in tier B, tier B with a pool chunk freed at every growth step
(STRATA_L32_KV_FORCE_RELEASE=1), tier C and MTP speculation); z440 CTest 18/18, compute-sanitizer memcheck clean on
the growth + release legs (plain and speculative). Also merged: L32-MID's logits-buffer sizing (cced9a40a1).
The engine allocated chunk x vocab floats of logits (644 MB at chunk 1024) although a chat or serve run asks for the last token of a prompt chunk and at most block + 1 rows of a speculative verify batch. EngineOptions::logits_rows (default 0 = a whole chunk, so the library, the fixture tests and the teacher-forced modes are unchanged) sizes it; strata-ling32 sets 32 for --serve and --genjobs (--logits-rows N overrides, 0 = a whole chunk), and the tier planner's activation estimate follows (TierSizes::logits_rows), so the freed memory becomes expert slots. forward() / forward_span() refuse a request for more rows than the buffer holds, and spec_init refuses a buffer smaller than a verify batch.
RTX 5080 16 GB (tier B, ctx 131072, plain, 5 x 256 greedy): pool 1671 -> 1807 slots (fixed 7.72 -> 7.14 GiB), decode 37.9 / 38.1 -> 39.0 tok/s, greedy ids identical on all 5 prompts.
Conflicted files and how each was resolved:
- engine/include/strata/kernels/mla_latent_attn.hpp, engine/src/kernels/cuda/mla_latent_attn.cu, mla_latent_attn_tc.inc, engine/tests/kernels/mla_latent_attn_bench.cu: both lines carry the same kernel from two histories; the Ling side is a strict superset of main's (checked by diffing the two trees: only main's older versions of lines the Ling side extends), so the Ling side is kept
- terminal/serve/server.py: main's config-arch hint for Inkling (self._shape_inkling) plus the Ling engine fields; the picture check keeps main's gguf_images flag and the Ling in-process reader; set_family knows hy4, inkling2, ling32 and hy4-flash
- terminal/serve/frontend.py: main's dict(_OFF_KWARGS) for the thinking-off case, the Ling thinking-on case kept after it
- terminal/strata_cli/launch/runner.py: main's is_hy4 test (Hy4 GGUF excluded) with the Ling is_ling32 and the widened is_native_strata; model_shape() returns None for a Hy4 GGUF, then the Ling shape; drafting_plan_line() has both the Ling and the Hy4 GGUF lines
- terminal/strata_cli/launch/cmd.py: the Ling --mtp help text and main's --drafting choices (dfly added)
- terminal/tools/strata_tokenizer.py: the ling32 family first, then main's deepseek test with DEEPSEEK3_PRES
- tools/docker/Dockerfile.src: the Ling CMake flags and main's -DSTRATA_BUILD_HY4_FLASH=ON
- terminal/data/settings-register.json and docs/SETTINGS.md: the Ling side kept for the hand-kept fields, then regenerated with tools/settings_register.py (1656 settings) and its --docs
RTX 5090 (32 GB, PCIe 4.0, tier B, 5 prompts x 256 greedy tokens, ids identical in all arms):
plain 42.5 / 36.2 tok/s with --tier-pool off, 54.4 / 73.2 with the pool; MTP (plain path +
sidecar in the pool) 38.9 / 48.5 off, 60.1 / 76.3 on; 4K prompt 46.3 -> 66.0 decode.
pool_auto_max defaults to 32.5 GiB (as the HIP build already had); the HIP-only override in
ling32_main.cpp is gone. Cards above 32 GiB (not measured) keep the static prefix.
Planner test: 32 GiB card is pool mode by default, --tier-pool off is static, a 48 GiB card is
static unless the line is raised.
--tier-pool auto switches the pool layout on for cards whose budget is at most TierRequestOpts::pool_auto_max. The default stays 30 GiB (CUDA: measured on 12-24 GB cards);
a HIP build sets it to 32.5 GiB in make_request so a 32 GB R9700 (budget 31.4 GiB, experts do not fit) gets the pool: L32-HIP measured tier B plain 29.4 -> 37.5 tok/s
and MTP 39.7 -> 58.0 tok/s with identical ids. Planner test: a 32 GiB card is not a pool plan by default, is one with pool_auto_max raised (planned <= budget),
and --tier-pool off still gives the static layout.
The adaptive warm tier (decayed use counts, promotion of SSD-resident experts from the ring into spare
RAM-tier slots, quarantined demotion) is now on by default where the RAM tier is read in place
(zero-copy, Windows iGPU). Spare slots 8 per size class, quarantine 24, queue 16; knobs
STRATA_L32_AD_Q / AD_SPARE / AD_QUAR; STRATA_L32_ADAPT=0 / 1 still overrides.
It is only used for single-token decode: promotion and use counting are skipped for MTP verify
batches, and main sets StoreOptions::adaptive_default = false when --mtp is given (the first
default-on build cost -10 % with MTP: the copies and the spare slots taken from the warm prefix
buy nothing there). Drop-reason counters (ring slot gone / no spare / not hotter / queue full)
are printed with the PF_COV statistics.
Strix Halo (gfx1151), 48 short prompts, greedy ids identical to the switched-off runs in every arm:
plain 23.6 tok/s vs 22.9-23.0 off (+2.6 %, SSD wait 45 s vs 55 s); MTP default 31.2 vs 31.4 off
(parity, ids identical).
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.
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.
New cache format LatentFmt::F16X2 / MlaCacheType::kF16x2: every cache value as two fp16 numbers, hi = fp16(x), lo = fp16((x - hi) * 2048), row = [hi[576] | lo[576]]
(the bytes of an fp32 row, fp32-class accuracy like the CUDA tensor-core split path: three WMMA 16x16x16 f16 per product, cross terms in a second accumulator added with 1/2048).
mla_prep writes the planes; the kernel (mla_latent_attn_wmma.inc, AMD only) computes S^T = C Q^T with the key tile as the A operand, online softmax over the accumulator
elements, O += P C with the key tile read against its layout for the B operand; dense visibility, one block per (token, head tile, chunk), the same split-K / merge machinery.
CUDA builds reject f16x2. mla_latent_attn_long: --fmt f16x2, relative error against the f32 cache of the same data, --ntok.
gfx1151 (Strix), one layer, decode, vs the scalar fp32 kernel on the same data: 128K 1.59 vs 2.89 ms, 256K 3.22 vs 5.81 ms (187-192 GB/s of cache, the memory floor of this
box); relative L2 error 1e-6 .. 2.2e-6 over 39 cases (contexts 1 .. 262144, one and several chunks, verify batches of 1 .. 16 tokens).
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.
`--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.
- pool mode no longer adds a free-standing bonus to the pool: with an auto budget it uses a 256 MiB reserve instead of 600 MiB, a 1 % margin instead of 2.5 %
and an activation estimate 512 MiB lower (all three measured on 4 cards: 1.7-2.1 GiB were left free), so vram_total_planned <= vram_budget holds by construction;
an explicit --vram-budget-gib stays a hard cap.
- the MTP sidecar bytes (+200 MiB of buffers) are taken out of the pool's memory.
- ling32_tier_planner_test: the 24 GiB case asserts the pool default (no static prefix, many slots, planned <= budget), the old layout is checked with --tier-pool off,
and a 1 GiB sidecar must shrink the pool.
Two conflicts: ling32_engine.cu (the older-copy preparation of the age-mix study comes right after mla_prep, then the AMD / CUDA expanded-form call sites, which stay off when the age mix is on) and ling32_main.cpp (the new --latent f32|f16|q8, --age-mix, --latent-emul, --mla-kernel parsing plus --mla-prefill expanded and --mla-exp-slab). The expanded-form conditions use the LatentFmt enum (fp32 cache only) instead of the removed latent_fp32 flag; ling32_mla_exp_test uses LatentFmt::F32.
- The tiers' lookahead predictor runs on the compute stream only on HIP (Windows iGPU, R9700: the separate stream with its
event pair cost 11 ms per decode token there). On CUDA the separate lookahead stream stays (an RTX 4090, tier B, plain
decode: 58.5 tok/s with the stream, 54.8 with the compute-stream form). STRATA_L32_LA_INLINE=0/1 overrides.
- The compute-stream predictor writes its ranked list straight into pinned host memory (device alias of the buffer): one
op less per layer.
- STRATA_L32_PF_COV=1 statistics: coverage of the experts outside the card prefix by the previous forward of the layer and by
the union of the predicted lists of a batch (1 / 2-3 / 4-16 tokens); the ceiling of an adaptive warm tier (usage-counted set
of the size of the static RAM tier, decays 0.99 / 0.998, and the share of SSD uses that were used twice within 64 / 256 /
1024 tokens). Demand SSD reads per layer group in the tier report.
- Opt-in adaptive warm (RAM) tier, STRATA_L32_ADAPT=1 (default off): the RAM tier is a set of exact-size slots; an often-used SSD-resident
expert is copied from the ring into a spare slot of its size class by the worker thread, the least used resident of the class is
demoted (slot quarantined for 80 layer steps). Same bytes, same kernels.
The two conflicts (ling32_main.cpp, ling32_tier_store.cu) are resolved as in L32-PREFILL's trial merge 732329ea3b; the tree equals that trial merge plus the __align__(16) fix of 11154bde5e.
- Reserved contexts of 64K and more decode with the tensor-core split MLA kernel where it exists (sm_80+) unless --mla-kernel is given: 1.13x at 256K on a PRO 6000
(f32 cache), golden top-1 / KL and batch invariance unchanged (checked with a 128K reservation: base == scalar kernel to the digits, invariance 9/9 at 4400 / 131072 / 262144).
- Study switches on the engine, all opt-in and off by default: --latent-emul / configs el-<fmt> ep-<fmt> (including Hadamard-rotated block quantisation, codes 8-10),
--age-mix N / config ageN (the newest N positions exact, older ones through the rounding; a second fp32 cache read by the shared MLA kernel through lat_old / recent),
configs mlasimt / mlatc (decode kernel per config), --jobs rows {"fake_ctx": N} (decode steps at position N with zeroed caches, no prefill: cost only), jobs field "tail".
- MLA kernel: lat_old / recent in MlaLatentArgs and the f32 loader (inert unless set).
- mla_latent_attn_long: host-wall timing and a checksum of the result per row (the HIP event times of the first row of a group are not reliable).
- the dynamic pool has two size classes: slots of the largest slab below max_slab (4.36 MiB, 98.8 % of the experts) and a small arena of max_slab slots (the 256
S8 experts, 2 % of the uses). 32 % more slots in the same card memory. STRATA_L32_BIGSLOTS=0 goes back to one slot size.
- pool mode takes 1.1 GiB of the slack the plan used to leave (1.7-2.1 GiB were free at the end of the start-up on all four cards); the MTP sidecar bytes
(+200 MiB of buffers) come out of that slack, so --mtp does not push the card over its limit.
- stage groups count free slots per size class.
- DemandSink::wants_prediction(n): the engine skips the lookahead predictor for forwards the store makes no use of
(speculative verify batches of 2..127 tokens). R9700 tier B with MTP: prefetch on 30.9 -> 39.7 tok/s (off: 39.6).
- Tiers: the predictor runs on the compute stream and the compute thread hands the predictions to the store after the
next router sync (Impl::pend / flush_predictions). The second lookahead stream with its event pair cost 11 ms per
decode token on the R9700 although it did almost nothing (bisect with STRATA_L32_LA_DBG / STRATA_L32_LA_TIME).
Plain tier B decode with prefetch on: 25.0 -> 29.3 tok/s (off 36.6; the remaining gap is open).
- The routing capture copies (two small D2H copies per MoE layer) are only made for the statistics and capture modes.
- Optional prefetch of the union of a verify batch (STRATA_L32_PF_VERIFY=N experts per layer, default 0: measured slower).
- Windows iGPU planner: explicit RAM budget = free RAM - 8 GiB floor, at most half of the system RAM - 0.5 GiB (GPU-visible
pinned memory above half of the system RAM stalls the card fill); the planner's 6 GiB headroom no longer applies.
Strix tier C: RAM tier 8.8 -> 12.5 GiB, 20.7 -> 21.8 tok/s, same greedy tokens. Fail-fast check of the free Windows RAM
before the warm prefix is allocated; progress lines for the start-up fill.
- tier planner: pool mode (--tier-pool on|off|auto, auto up to 30 GiB of card): no static prefix, every card byte for experts is a dynamic slot;
the store preloads the pool with the best-ranked experts from the warm RAM prefix (STRATA_L32_PRELOAD=0|1 overrides). Same tokens as before;
decode on a 24 GB card 36.7 -> 49 tok/s (5 prompts x 256 tokens, greedy).
- ling32_cpu_expert: the S4/S5/S6 row dot unpacks a superblock with vector shifts instead of 256 scalar steps (same q values, same fma order,
bit-identical to the scalar kernel and to the GPU: ling32_cpu_expert_test 24 of 24); 10-12x faster per thread. STRATA_L32_CPU_KERNEL=ref selects the old one.
- tier store: STRATA_L32_ROUTE_TRACE=FILE writes the true routing of every decode layer (measurement only).
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).
The worker slept 40 us in a loop while lead-gated prefetch requests were queued. On Windows a
sleep of that size lasts a timer tick (1-15 ms), so the completions of demand SSD reads were only
seen at tick boundaries: plain tier C decode on the Strix 5.7 tok/s with the prefetcher on against
20.6 with --prefetch off (demand read latency seen by the worker 12 ms vs 7 ms). The worker now
waits on the completion port (2 ms timeout) and the compute thread wakes it when the layer advances.
Also: read-latency and handler-time counters in the tier report, and experiment switches
STRATA_L32_PF_LEAD / PF_SCAN / PF_SSD_INFLIGHT / PF_SSD_IDLE / PF_NOSSD / PF_NOPROMOTE.
- Deleted: the DFly drafter model code (five-layer drafter forward, screen head, D-cut, taps, load_dfly, DflyWeights, the manifest drafter fields), the DFly flags (--spec dfly,
--spec-cut / ctx / rerank / tap / tc / q8 / split / fuse / diag, --dump-taps, --dump-taps-jobs, --dump-cache), its unit tests, python references and fixtures.
The engine no longer loads model.dfly.* or dfly_screen_head (about 320 MB of VRAM); the file layout is untouched, the engine skips those tensors.
- Kept: the shared speculative infrastructure in the new ling32_spec.{hpp,cu} (cycle record, on-GPU accept / rejection sampling, KDA rollback, position advance, the MTP
drafting helpers, top-K), the verify graph, the per-token KDA snapshots, the adaptive controller; --spec mtp --mtp FILE is the only way to speculate (--spec dfly answers
with a pointer to it). ling32_spec_test (the sampling kernel's KL gate) builds and passes.
- ling32_dev.cuh: Sk<2>, Sk<3> (70 / 102 B superblocks, half 1.5 / 3.5), load_w8 for the 2-bit planes (+ the S3 high-bit plane); layers.cu / kernels.cu dispatch the
codes 2 and 3 (per-pair gate/up, act, down, the fused-decode experts, gemv_sk); the grouped tensor-core path is skipped for MTP experts below S4.
- manifest.hpp: Fmt::S2_K / S3_K and their superblock sizes (sidecar tensors and expert directory entries).
- MTP draft head: the sidecar may carry mtp.draft_head.weight (S2..S4_K copy of lm_head); the chain picks its top-64 candidates from it and k_pick re-scores them with the
exact S8_K head rows (same pick / q records as before), so the drafts equal the exact head's. Offline: the exact top-1 is inside the S2 head's top-16 in 1285 of 1285 rows.
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.
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'.
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.
Conflicts only in CMakeLists.txt and ling32_main.cpp: both sides kept (vision sources / tests next to the tier, spec and HIP ones; --mm-runs, --image and the vision hold report next to --serve and the spec options).