Commit Graph
290 Commits
Author SHA1 Message Date
Niko1221 f1780b1e5a ling32 sycl: argmax, Windows build fixes (NOMINMAX), exact u/255 table, prefer Level Zero devices, offload prec div/sqrt flags 2026-12-02 19:32:00 +01:00
Niko1221 b325310b6b ling32 sycl: trunk (S_K GEMV, float GEMV, rmsnorm, embed, quantisers), KDA sequential and absorbed MLA kernels; SpecState host half, vision stub, engine switches off what SYCL lacks 2026-12-02 18:41:46 +01:00
Niko1221 32e1a628b6 ling32 sycl: LING32_SYCL build option, CUDA-runtime-on-SYCL compat header, kernel idiom header, aborting launcher stubs 2026-12-02 18:32:25 +01:00
Niko1221 cd84665c87 Merge origin/main 03bb4f48ba (0.2.24: GUI / Harness, Hy4 GGUF, Inkling) into the Ling integration branch
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
2026-12-02 13:17:26 +01:00
Niko1221 37b89d7de4 Merge f-ling32-small-plainpool (L32-SMALL: MTP sidecar experts as pool slots) into the integration staging line 2026-12-02 00:37:37 +01:00
Niko1221 35e0cd87c8 ling32 tier planner: the --tier-pool auto line covers a 32 GB card on every build (RTX 5090 measured)
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.
2026-12-02 00:36:13 +01:00
Niko1221 3005bbf0ef ling32 MTP sidecar experts as pool slots (pinned RAM -> card on demand): WIP for measurement 2026-12-01 23:25:43 +01:00
Niko1221 b559cb8d16 ling32 tier planner: the pool-mode auto line is a request field; HIP builds raise it to cover a 32 GB card
--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.
2026-12-01 23:11:22 +01:00
Niko1221 0ba14b2611 Merge f-ling32-hip dc10bc0a03 (adaptive warm RAM tier on by default where the RAM tier is read in place, single-token decode only, off with --mtp) into the integration staging line 2026-12-01 22:07:18 +01:00
Niko1221 dc10bc0a03 ling32 tier store: adaptive warm RAM tier on by default for the Windows iGPU plain decode
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).
2026-12-01 22:06:23 +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 1fe5154714 Merge f-ling32-long 9bbf432586 (AMD WMMA MLA decode / verify kernel over the pre-split fp16 hi / lo latent cache, --latent f16x2, default on gfx11 / gfx12; CUDA builds reject f16x2) into the integration staging line 2026-12-01 21:06:28 +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 27dd369432 ling32: WMMA MLA decode / verify kernel for gfx11 and gfx12 over a pre-split fp16 hi / lo cache (--latent f16x2)
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).
2026-12-01 20:36:48 +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 707376f1bc Merge f-ling32-small f720d382d3 (pool sizing within the budget by construction, planner test) into the integration staging line 2026-12-01 19:59:34 +01:00
Niko1221 f720d382d3 ling32 tier planner: pool mode keeps the budget a hard cap, tests follow the pool default
- 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.
2026-12-01 19:59:16 +01:00
Niko1221 58f0586353 Merge f-ling32-long (latent f32 / f16 / q8 options, split cap at 64K and more, token-fastest MLA grid, context-aware MTP controller 7bcd97bf98) into the integration staging line
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.
2026-12-01 19:59:07 +01:00
Niko1221 af99963e40 Merge f-ling32-hip 55e42b3818 (la_inline backend switch, opt-in tier statistics and adaptive warm tier) into the integration staging line
# Conflicts:
#	engine/src/ling32/ling32_tier_store.cu
2026-12-01 19:51:00 +01:00
Niko1221 55e42b3818 ling32 tiers: the compute-stream lookahead predictor is HIP-only, coverage statistics for the lookahead and for an adaptive warm tier
- 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.
2026-12-01 19:49:41 +01:00
Niko1221 a449d64f19 Merge f-ling32-small (tier pool mode, two slot size classes, pool sized from the measured slack) into the integration staging line
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.
2026-12-01 19:38:44 +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 a2e3b93f31 ling32: long-context decode defaults, cache-format study switches, fake-context decode costs
- 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).
2026-12-01 18:45:00 +01:00
Niko1221 967ac817e3 ling32 tier pool: two slot size classes, pool sized from the measured slack, MTP bytes in the plan
- 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.
2026-12-01 18:36:27 +01:00
Niko1221 ff4b0431b0 ling32 tiers: no lookahead work for batches nobody uses, compute-stream predictor, larger RAM tier on Windows iGPUs
- 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.
2026-12-01 18:30:22 +01:00
Niko1221 f6bb2eb723 ling32 small cards: preloaded LRU pool instead of a static hot prefix, vectorised exact CPU expert kernel, routing trace
- 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).
2026-12-01 17:59:25 +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 4c1985f5c1 ling32 tier store: the prefetch worker waits on the completion port while lead-gated requests are queued
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.
2026-12-01 15:25:32 +01:00
Niko1221 889a3da206 ling32: remove the DFly drafter; MTP is the speculative drafter
- 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.
2026-12-01 11:49:53 +01:00
Niko1221 19ea4c3f08 ling32 mtp: S2_K / S3_K decode in the per-pair expert kernels and the GEMV, optional low-bit draft head
- 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.
2026-12-01 10:57:36 +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 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
Niko1221 453e3dd141 Merge f-7310-trial into f-7310-int: PR 7310 (peer_experts direct signal and autonomous window) with the review fix-ups 2026-12-01 06:52:25 +01:00
Niko1221 cec62edda6 Merge f-ling32-int (chunked KDA by device, spec glue, vision) into f-ling32-hip; DFly launch without PDL and hipOccupancy alias under HIP 2026-12-01 05:47:22 +01:00
Niko1221 b30b3fcc63 Merge f-ling32-int into f-ling32-vision (picture input on the integration tree)
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).
2026-12-01 02:26:49 +01:00
Niko1221 ea792ab216 ling32 vision: CPU encoder adds each projection to the residual once (the product is summed on its own); test knobs for the batch runner (noise on the picture embeddings, float64-reference embeddings)
- the old CPU gemm summed every partial product into the residual stream; its few large outlier channels made the CPU encoder 2-3x less accurate than the GPU one (2.3e-5 against 7e-6 from float64 on 448x448) and flipped greedy tokens after 23-41 tokens in two of five real-model prompts; now 1.4e-5 and the CPU and GPU encoders give the same tokens on four of four prompts
- --mm-runs: optional fields noise / seed, backend ref:DIR (embeddings from DIR/<stem>.out.f32)
2026-12-01 02:22:38 +01:00
Niko1221 ce52657a48 integrate P-3: artifact/dequant.hpp from the clean-room header
The old header is replaced (guard renamed), the transition comparison test and the one-off build scripts that compared old and new are removed.
2026-12-01 02:19:19 +01:00
Niko1221 6466dbf2f8 integrate P-2: rope_scaling.hpp (and the SYCL copy) call rope_yarn_math.hpp
The enum and the host/device macro come from rope_scaling_type.hpp; freq_scale, mscale, corr_dims, rope_yarn_ramp and rope_scaled_angle are one-line calls into
strata::kernels::yarn. The comments that named ggml as the contract now name the YaRN paper.
2026-12-01 02:18:37 +01:00
Niko1221 27e86c2b63 integrate P-1: dp4a.hpp (CUDA, SYCL) and the RDNA1 dp4a branch from the clean-room files
dp4a.hpp and its SYCL copy are replaced by the clean-room headers; strata_spin_pause keeps the old behaviour on HIP (sleeps on every target but CUDA below 7.0).
hip_compat/intrinsics.hpp: the gfx1010 / gfx1012 branch calls dp4a_rdna1 (new header).
2026-12-01 02:17:47 +01:00
Niko1221 57274cc902 clean-p2: rope SYCL kernel uses sycl::cos/sin/log (identical to the old SYCL rope on 1M inputs), old/new device comparison tools 2026-12-01 02:15:50 +01:00
Niko1221 c48f8dd80b ling32: --vision-max-pixels (a smaller picture budget on request), a note when a large picture goes to the CPU encoder 2026-12-01 01:12:58 +01:00
Niko1221 486f3204ca clean-p2: rewrite packets P-1 to P-4 from the specs (new files; old files untouched)
P-1  kernels/dp4a_clean.hpp (CUDA), sycl/.../dp4a_clean.hpp, hip_compat/dp4a_rdna1.hpp
P-2  kernels/rope_yarn_math.hpp (+ rope_scaling_type.hpp)
P-3  artifact/dequant_clean.hpp
P-4  vision/own/image_resize.cpp (smart_resize, Pillow-exact bicubic, resize_pad_ceil)

Tests: tests/clean_p2 (vectors, rope golden, dp4a checks, black-box comparisons with the
current dequant.hpp), tests/data/clean_p2 (spec vectors), image_resize_vectors_test and
image_resize_fuzz.py (Pillow). Written from phaseA-tests/clean/P2-INTERFACES.md,
FORMAT-SPEC.md and public documentation only.
2026-12-01 00:59:46 +01:00
Niko1221 fcf36afd20 ling32: picture input (qwen3_moe_vit encoder on CPU and GPU, picture preparation, M-RoPE in the MLA layers, embedding override)
- ling32_vision: Ling-3.2-Air-Vision.strata loader, smart_resize + Pillow bicubic resize + normalise + patchify (byte-equal to the model's processor on the test set),
  float32 CPU encoder (AVX2/FMA, scalar fallback), 3-axis M-RoPE positions and placeholder expansion (equal to upstream get_rope_index on 7 cases)
- ling32_vision_gpu: float32 CUDA encoder (tiled SGEMM, online-softmax attention), weights uploaded on first use and freed after an idle time (default 120 s)
- engine: Ling32Engine::forward_mm (picture rows replace placeholder embeddings, per-token (T, H, W) rope positions in mla_prep, default path unchanged),
  set_rope_delta for the text after the prompt; strata-ling32 --vision / --image / --vision-device / --vision-encode
- tests: ling32_vision_cpu_test, ling32_vision_gpu_test, ling32_mm_test
2026-12-01 00:56:08 +01:00
Niko1221 6f4425a111 mgpu: strata-topo --force-p2p, a named peer-copy request runs when P2P is proven and exact, chooser reasons for both directions; strata topo child gets the quiet-crash environment and is listed as a spawn site 2026-12-01 00:49:16 +01:00