Commit Graph
128 Commits
Author SHA1 Message Date
Niko1221 e3a920f4df engine: native_mmvq.hpp includes <cstdint> (#6837)
The header uses int8_t and included only <cstddef>, so a translation unit that
reaches it before anything pulls in <cstdint> does not compile (GCC 15 on Arch
and Fedora 42+ with the test suite on: q8_gemv_bench).

Checked on p2006 (g++ 13.3, a translation unit whose first include is the
header, -fsyntax-only): fails with "int8_t does not name a type" without the
include, compiles with it.
2026-11-23 19:49:50 +01:00
Niko1221 ed8c942ab8 rc1: merge f-0221-inkspeed-amd (d290efcde: HIP hybrid decode splits every CPU expert over the pool, #6727 #6729) 2026-11-23 19:01:39 +01:00
Niko1221 eeb2325b9e rc1: merge f-0221-dspark (6ef0b4693: an unreadable drafter is dropped with one message; 540f3b3df governor) 2026-11-23 18:51:24 +01:00
Niko1221 6ef0b4693b fix(inkling2): a drafter file in a layout the engine cannot read is dropped with one message; it never stops the model
2026-11-23 14:54 UTC unsloth/Inkling-2-Mini-GGUF re-uploaded dspark-Inkling-2-Mini-Q8_0.gguf (402,278,560 -> 503,889,952 bytes) in llama.cpp
mainline's "dflash" layout (commit 19bf97a66719d0165f6f8082a9d59581912a3863 "Support mainline llama.cpp"; the old file stays in the repo as
dspark-Inkling-2-Mini-Q8_0_Old.gguf). Same drafter (3 blocks, 2304 wide, block 8, taps 5 / 23 / 41 / 48, Markov head), written differently:
fuse_weight and the per-block dflare_norm became per-block ctx_mix / ctx_norm, the Markov head's hidden_out projection is folded through the
output head into markov_w2 (+ bias) over the real 200058-token vocabulary, mask_embd has 7 rows, token_embd_norm was added. The engines asked
for the old names and ended the whole start: "missing tensor 'dspark.markov_head.hidden_out.weight'".

strata/core/ink_dspark_layout.hpp: ink_dspark_layout_check() on the plain tensor names a loader collected; the GGUF loader (drafter GGUF and an
external mtp.safetensors) and the official-folder safetensors loader drop the drafter when it fails (drafting off for this start, the arena
space given back), print ink_dspark_layout_message() once (it names the file, what is missing and which files the engine reads), and the model
starts normally. Test ink_dspark_layout_test uses the real tensor lists of the old (54) and the new (58) file.
2026-11-23 18:45:04 +01:00
Niko1221 54b2ffd848 rc1: merge f-0221-inkplace (1999e3e82) 2026-11-23 18:30:26 +01:00
Niko1221 57c933376b rc1: merge f-0221-inkcuda (6bdebbedf)
# Conflicts:
#	engine/CMakeLists.txt
#	terminal/setup.py
2026-11-23 18:27:49 +01:00
Niko1221 87a2efcbc7 feat(inkling2): hot-expert policy of the Qwen engine's adaptive tier, as pure host code with a test
InkExpertPolicy (strata/core/ink_expert_policy.hpp) keeps a usage count per expert (every routed expert adds 1; the looped middle layers run
three times per token, so their experts count up to three times), and a round swaps the hottest experts that are not in the card with the
coldest ones that are: usage floor, minimum gain, a cap on swaps per round, pinned experts, decay. It only plans; the caller moves the bytes.
Settings follow phaseA-tests/rel0221/inkplace/sweep2_v1.py on routing traces of real chats (no pinned share, decay 0.95, gain 1.0, 16 swaps
per round of 4 tokens: hit rate 0.65 / 0.82 / 0.89 / 0.94 at 2 / 4 / 6 / 8 GB of experts, against 0.32 / 0.50 / 0.67 / 0.81 for a static fill
with a 256 MiB ring). Test: ink_expert_policy_test.
2026-11-23 16:03:49 +01:00
Niko1221 d528772fc3 fix(inkling2): a BF16 / F16 mtp.safetensors drafter had its norm weights, biases and fuse_weight read as F32 garbage (0 percent of the drafted tokens accepted)
The CUDA drafter reads dspark.*norm*.weight, the biases and dspark.fuse_weight as F32 (the Q8_0 GGUF path widens them while loading).
The safetensors paths (an external mtp.safetensors beside a GGUF, and the official Inkling-2-Mini folder) copied them as the file stores
them, BF16, so the drafter read the BF16 bytes as floats. Measured on an RTX 3090, UD-Q4_K_XL with the BF16 mtp.safetensors:
0 of 1592 drafted tokens accepted on code, 45 tok/s against 85 with the drafter off; with the Unsloth Q8_0 drafter 44 percent accepted.

Both loaders now widen BF16 / F16 vectors (rank 1, "norm", "bias", "fuse_weight") to F32 as they are placed in the trunk section;
2-D weights stay BF16. Header strata/core/ink_widen.hpp, test ink_widen_test (no GPU).
2026-11-23 15:40:24 +01:00
Niko1221 e9134a8c06 rc0: merge f-0221-inkcuda 2026-11-23 14:43:38 +01:00
Niko1221 86b1a4c50b rc0: merge f-0221-perf 2026-11-23 14:42:10 +01:00
Niko1221 b608200cb8 rc0: merge f-0221-setupmgpu 2026-11-23 14:40:58 +01:00
Niko1221 8c2afbc2bf fix(inkling): the GGUF loader gives the mapped pages of a tensor back once it is copied, halving peak RSS (UD-IQ4_XS 28 -> 14 GiB, UD-Q4_K_XL 32 -> 15 GiB)
The GGUF is mmapped read-only (strata::GgufFile) and every tensor is copied out of the mapping: the trunk into the arena, each expert into a
VRAM upload buffer or the host expert arena. The mapped pages stayed in the resident set after the copy, so the file (15.7 GB UD-IQ4_XS,
17.6 GB UD-Q4_K_XL) sat next to the copies. Peak RSS was 28-36 GiB with 7-13 GiB of experts in RAM, which does not fit a 32 GB machine.

- strata/core/mapped_pages.hpp: release_mapped_pages(p, n) drops the whole pages inside [p, p + n) from the process (madvise MADV_DONTNEED on
  Linux, VirtualUnlock to trim the working set on Windows; rounded inward so a neighbour's page is never dropped). The pages stay in the OS
  page cache, reclaimable, and fault back in on a later read, so only the double count goes. STRATA_INK_KEEP_MAPPED_PAGES=1 turns it off.
- ink_gguf_loader.h: read_expert_body releases the gate/up/down source ranges after copying them (both the NVFP4 -> SF4 repack and the GGUF_RAW
  copy); the trunk, drafter and vision tensors (every tensor without _exps) are released once sec1_arena holds them.
- tests/core/mapped_pages_test.cpp: a 64 MB mapping touched in full drops from 67 MB to 3.5 MB resident, unaligned ends round inward, and the
  data reads back unchanged (Linux, -O0 and -O2).
- The .strata and safetensors loaders read with fread / ifstream and never map the file: SQ-10 / SQ-20 peaked at 3.3 / 13.5 GiB on the 12 GB
  card, which is the plan's RAM share plus the trunk and the CUDA runtime.

Measured on an RTX 3060 12 GB (planner-sized plans, ctx 32768, drafter off, same plan before and after): UD-IQ4_XS peak RSS 28.4 -> 13.8 GiB,
UD-Q4_K_XL 31.8 -> 15.5 GiB; first-prompt, 128-token, 8000-token tokens identical on every step; decode 11.5 / 7.7 -> 11.4 / 7.9 tok/s and
8.2 / 6.2 -> 8.3 / 6.2 tok/s (unchanged), prefill 217 -> 216 and 195 -> 195 tok/s.
2026-11-23 14:38:15 +01:00
Niko1221 ec46ef3b13 fix(inkling): capability checks are per device, so a mixed-architecture split runs each card's own kernels (#6808 #6796)
On a layer or expert split ink_has_int8_tc(), ink_has_wmma_f16() and sm120::available() cached their answer in one process-wide static, filled
on the first call, which happens on stage 0. A later stage on a different architecture then ran stage 0's kernel path: an sm_86 stage ran the
sm_120 FP4 MoE kernels (corrupted prompt states, malformed tool calls, #6808), an sm_60 stage the INT8 tensor-core kernels (wrong logits, #6796).
Decode (M < 24) uses other kernels, which is why short answers still looked right.

- strata/core/ink_caps.hpp: PerDeviceFlag (one cached answer per device index) and the pure capability rules, so a test can feed two capability sets.
- ink_moe_cuda.cuh / ink_moe_fp4_sm120.cu: the three checks index their cache by cudaGetDevice(); the WMMA shared-memory carveout is set per device.
- ink_runner.cuh: the loop-controller GEMM took TF32 / the FP16 tensor-core path from the FIRST card's compute capability (m.sm_cc); it now uses the
  capability of the stage that runs it (the static analysis in #6796 pointed at exactly this).
- tests/core/ink_caps_test.cpp: sm_120 then sm_86, sm_86 then sm_60 and the reverse, Volta/Turing/Ampere; each device is asked once.

The cache-per-device approach and the three call sites come from the report and tested patch in #6808 by markie1006; #6796 by Darkstarrd-dev
found the loop-controller use of m.sm_cc. Single-card behaviour is unchanged: same greedy tokens as before on an RTX 3060 Ti (sm_86) and on an
RTX PRO 5000 (sm_120, sm120_tc=1 in the load line).
2026-11-23 14:10:21 +01:00
Niko1221 d290efcdec hip hybrid decode: split GGUF_RAW experts too (quantized-dot kernels and the dequantize fallback)
The first change split SF4, MX8 and S_K experts over the CPU pool. The Unsloth files use other layouts:
UD-Q4_K_XL has NVFP4 experts in layers 0-19 (lossless SF4) and Q8_0 experts in the last four layers (the coda layers
are placed last, so on a 12-16 GB card they are the RAM experts), UD-Q2_K_XL mixes IQ1_S/IQ2_* with NVFP4/MXFP4.

expert_m1_gu_rows / expert_m1_dn_rows now also cover SkCode::GGUF_RAW, with the same 4-row grouping and the same
dot kernels as eval_inkling2_expert_batch, and the same dequantize-then-float-dot code for the types without a
quantized dot (Q8_0, F16, BF16). ink_expert_split_test checks Q4_K, Q5_K, Q6_K, Q8_0, Q3_K, Q2_K, IQ4_XS, Q4_0 and
IQ4_NL gate/up with Q8_0, Q4_0 and IQ4_NL down, interleaved and split layout, bit for bit against the whole expert.
2026-11-23 13:58:05 +01:00
Niko1221 f871210582 engine: drop superseded conversation snapshots instead of spilling them to the SSD tier (#6833)
From PR #6833 by @mnott, unchanged.

A coding agent parks one whole snapshot per turn and each older one is a strict
prefix of the newest, so it can never serve a resume the newest cannot. Until now
only entries whose deepest checkpoint the outgoing chain held were dropped; an
agent that only appends left its older snapshots to the oldest-first eviction,
which spilled them to the SSD tier (reported: 176 snapshots, 170.9 GB written in
60 minutes, two agents on one engine). Now a snapshot whose live tokens are a
prefix of the incoming ids (same pictures, same steering, no pinned shared
prefix) is dropped in RAM and on the SSD tier (file and index file), with one log
line each.

Own addition: conversation_spill_test.cpp churn test. Two agents appending 40
turns each (80 parked snapshots) never pass the tier's cap, leave one entry per
conversation (two files each) that the next turn's lookup finds, and forty
unrelated conversations keep the tier under the cap with the oldest-used removed
with their files.
2026-11-23 13:51:49 +01:00
Niko1221 6cb548ffb1 hip hybrid decode: split each RAM expert over the CPU pool; keep unplaced GGUF experts in RAM
A hybrid decode step (some experts in RAM) routes 8 experts, so only 1-4 of them are RAM experts per layer, and the
CPU pool ran each of them as ONE job on ONE thread. With 10-24 pool threads most cores sat idle while the GPU waited
(per token on a Radeon AI PRO R9700, SQ-10 with 38% of the experts in RAM: 52 ms of CPU wait out of 70 ms).

- expert_m1_gu_rows / expert_m1_act / expert_m1_dn_rows (inkling2_loop.cpp): the same per-row code as
  eval_inkling2_expert, callable on a row range, so every output element is computed in the same order and any split
  gives the same bits (SF4, MX8, S2_K..S8_K; GGUF_RAW experts keep the old path). Test: ink_expert_split_test
  (whole-expert result vs six slicings, slices run in reverse order, bitwise).
- The pool splits every single-token job over ceil(threads / jobs) slices in three phases (gate/up rows, SITU, down
  rows) and adds the expert outputs in job order. The old code added per-thread buffers whose content depended on which
  thread took which job, so the sum order changed from run to run. STRATA_HIP_CPU_SPLIT=0 turns the split off.
- STRATA_HIP_HYB_PROF=1 prints the time split of the hybrid decode step.
- A GGUF whose experts need a transcode (IQ1_S, IQ2_*, IQ3_S: no HIP kernel) grows when it is transcoded to S_K, so the
  planner's file-size budget (--vram-experts-gb 7.26 --ram-experts-gb 0 for UD-Q2_K_XL) left experts that fit neither
  VRAM nor RAM; they were re-read and re-transcoded from the file on every token (0.3 tok/s, prefill 3.9 tok/s on
  gfx1201). They now stay in RAM when MemAvailable allows (a line says so), otherwise a warning says why decode is slow.
- INK_LOGITS_HASH=1 (direct generation mode) prints an FNV hash of the logits of every step.

Measured on p620 (gfx1201, Threadripper PRO 3975WX), SQ-10, --vram-experts-gb 5.2 --ram-experts-gb 3.2 --draft off,
bench 128/128, three alternating rounds: 12.8 / 13.0 / 12.9 tok/s before, 32.2 / 32.6 / 32.9 after (all experts in
VRAM: 73.6). UD-Q2_K_XL with the flags of #6729: 0.3 -> 28.8 tok/s (64 tokens, includes warm-up).
2026-11-23 13:48:26 +01:00
Niko1221 724bbbed72 engine: the Track 6A tiny-cache rules are opt-in (STRATA_TINY_CACHE=1) (#6782, #6799)
0.1.66 turned two rules on whenever the VRAM expert cache holds less than 15% of the
experts (every 12 GB card with a 3-bit file, and a 16 GB one with a bigger file): the default
--adapt-swaps is cut from 96 to 16, and the top quarter of the profile experts is pinned
against eviction. The rules were written on "a 96-swap default costs 14-26% on 8 and 12 GB
cards". Measured on an RTX 5080 (sm_120, 16 GB, Qwen3.8-Flash-Next IQ2_XS, the cache set to
3,000 slots = 12.2% of the experts, same cuda13 0.1.66 binary, one engine start per arm and
round, arms alternating, 5 rounds, greedy), decode against 0.1.65:
  rules on (0.1.66 default)          code -22%, chat -18%, 8K document -13%
  --adapt-swaps 96 given             -10%, -10%, -3%
  STRATA_CACHE_PIN_FRAC=0 + swaps 96 -5.5%, -6.4%, -4.4%
With a 7.6% cache (1,800 slots, 2 rounds so far): -25%, -18%, -18% with the rules on, -10%,
-8%, -5% with 96 swaps. So the 12 GB reports (#6799: 75 -> 52 tok/s on an RTX 3080 Ti,
#6782: RTX 5080) have a measured cause. Both rules now run only with STRATA_TINY_CACHE=1;
STRATA_CACHE_PIN_FRAC=<f> still pins by itself and an explicit --adapt-swaps always wins.
The remaining -5% to -8% with both rules off is not explained yet.

Unit test: low_vram_rules_test (the gate function). Registered in the settings register and
described in DETAILS.md. Numbers: phaseA-tests/rel0221/RESULTS-0221-PERF.md.
2026-11-23 13:36:39 +01:00
Niko1221 af9bf52f8c engine: the #4870 mid-coverage curve stays on for the CUDA build, off for HIP; STRATA_ADAPT_MID=1 / 0 forces it (#6791)
The measurement that follows the previous commit: on the z440's RTX A4000 (CUDA, sm_86, Qwen3.8-Flash-Next
IQ2_XS, 30% of the experts in VRAM, one engine start per arm and round, arms alternating, 3 rounds) the
curve (every 2, 192 swaps, decay 0.92) is faster than the old three values given explicitly: code +5.7%,
chat +6.7%, 8K document +9.0%. On the RX 7900 XT (HIP) it was slower in 10 of 13 cells (worst -7.8%).
So the default now follows the build: on for CUDA (as in 0.1.66), off for HIP (as in 0.1.65).
STRATA_ADAPT_MID=1 turns it on and STRATA_ADAPT_MID=0 off in either build; --adapt-every / --adapt-swaps /
--adapt-decay still win over all of it. The rule stays a pure header; the unit test checks both defaults
(also compiled with -DSTRATA_USE_HIP). Settings register and DETAILS.md updated.
2026-11-23 12:33:20 +01:00
Niko1221 a8371d27fa fix(inkling2, hy4): say plainly when the binary has no GPU code for the card, before anything loads (#6759)
A CUDA engine binary is built for a list of architectures (the CUDA 13 packages: sm_75 and newer; the CUDA 12 ones also
sm_60/61/70). On a card it holds no code for, the weights load and the first kernel fails; strata-inkling then ended with a
misleading "CUDA error 2 (out of memory)" in the loader, and a binary that gets past that (lazy module loading, as under
volta-forever) leaves the logits at 0 and answers token id 0 forever, with no error.

strata/core/arch_probe.hpp builds the message; strata-inkling (ink_cuda_backend.cu) and strata-hy4 (hy4_main.hip.cpp, CUDA
builds, serve and CLI, every GPU named) ask CUDA for the attributes of a probe kernel (cudaFuncGetAttributes), which answers
for the whole binary, and end with: "this strata-inkling has no GPU code for <card> (compute capability X.Y): <cuda error>.
<way out>" (a Pascal / Volta card: the CUDA 12 engine package or a CUDA 12.x build with -DSTRATA_EXPERIMENTAL_SM60=ON; else
the package made for the card or a rebuild for that architecture). strata (generate.cpp, the Qwen engine) already did this
(device_code_error()).

Test arch_probe_test (no GPU): the message names engine, card, compute capability, CUDA error and the way out; the Volta
text appears only below 7.5.

Measured on an RTX 4090 (sm_89) with binaries built for sm_120 only (no SASS for the card, PTX compute_120 cannot run on it):
- strata-inkling, origin/main: "strata-inkling CUDA error 2 at ink_runner.cuh:322: out of memory", exit 1.
- strata-inkling, this change: "init: this strata-inkling has no GPU code for NVIDIA GeForce RTX 4090 (compute capability 8.9):
  invalid resource handle. Use the engine package made for this card ... -DCMAKE_CUDA_ARCHITECTURES=89", exit 1, nothing loaded.
- strata-hy4, origin/main: no mention of the card (it goes on to read the model); this change: the same message, as an
  "ERR ..." line in --serve and on stderr in the CLI, exit 1.
2026-11-23 12:20:56 +01:00
Niko1221 1e800fd204 fix(inkling2/cuda): grow the global K/V when the net growth fits, not only when the whole new K/V fits (#6770 #6755)
ensure_global_kv_cap() compared the free memory with the WHOLE new K/V (global visits x slots x new capacity), as if
the old K/V were not already in the card. When the plan leaves room for the full context, that check refuses at about
half of it; the request then fails (and on a fatal path the engine ends) with gigabytes still free.

The 8 global visits grow one at a time (allocate the new buffer, copy, free the old one), so the card needs the net
growth of every visit plus the one old visit that is still held: strata/core/ink_kv_grow.hpp
(ink_kv_next_cap / ink_kv_grow_peak_bytes / ink_kv_grow_fits / ink_kv_grow_target), used by the runner.

Test ink_kv_grow_test (no GPU) models the growth loop with room planned for 131072 tokens: the old rule stops at
73728, the new one reaches 131072; also a card with room for 3/4 of the context, and the full / tight / none targets.

Checked on an RTX 4090 with 9.8 GB held back (SQ-10, --kv fp16 --kv-offload off --max-context 131072, planned context
51584, prompts of 20000, 30000, 45000 tokens):
- origin/main: the K/V stops growing at 32768 tokens (63% of the plan): "VRAM exhausted growing elastic global KV cache
  to 33071 tokens", the engine ends, the 45000-token request is lost.
- this change: the K/V grows 8192 > 16384 > ... > 49152, the 45000-token request is answered; prompts above the planned
  51584 get "prompt length out of range" and the engine stays up.
2026-11-23 12:20:55 +01:00
Niko1221 878ee1a358 engine: the #2090 prompt-chunk RAM guard counts half of the extra loan without pinned experts (#6687)
The guard that steps the gfx11 / gfx12 / NVIDIA auto chunk ceiling down (32768 -> 16384 ->
8192) counted every extra lent cache slot as RAM held during the prompt. That is the
--resident-experts case it was written for (#2090). Without pinned experts the lent slots'
experts come from the expert arena or from file pages that are already resident or
reclaimable, and the estimate was far too high:
- RX 7900 XT (gfx1100, IQ2_XS, whole arena in RAM): a 32K-chunk plan lowered MemAvailable by
  0.46 GiB against 8K chunks, while the guard counted 11.3 GiB (log of a run with
  --memory-limit-mib 44000: "32768 would lend 7843 more cache slots (11297 MiB)").
- the report (RX 7900 XTX, 125B IQ3_XXS, 62 GiB host): 3.95 GiB measured, 9.4 GiB counted.
Half of the estimate stays counted without pinned experts (the worst measured ratio is 0.42),
all of it with --resident-experts; the reserve (STRATA_PREFILL_RAM_RESERVE_MIB, 3 GiB / 6 GiB)
is unchanged. With the report's numbers (7,830 MiB available) the ceiling now stays at 32768;
it stepped down to 8192 before 94e1fc4fb and to 16384 after it.

What the chunk is worth, same card, 32K prompt (31,817 tokens), 3 rounds: 8K chunks 1,648
tok/s, 16K chunks 1,946 tok/s (+18%). prefill_loan_ram_mib() is a pure function with
checks in gfx12_extra_test.
2026-11-23 11:46:09 +01:00
Niko1221 ddac45d0da engine: the #4870 mid-coverage adaptive curve is opt-in (STRATA_ADAPT_MID=1) again (#6791)
0.1.66 started every engine whose VRAM expert cache holds 15% to 65% of the routed
experts with --adapt-every 2 --adapt-swaps 192 --adapt-decay 0.92 instead of 4 / 96 / 0.70,
claiming +8% hit rate and +10% decode. On an RX 7900 XT (gfx1100, Qwen3.8-Flash-Next
IQ2_XS, same card, one engine start per arm and round, arms alternating, greedy, 4-5 rounds)
the hit rate rises but the decode speed does not: against the same 0.1.66 binary with the old
three values given explicitly (which equals 0.1.65 in every cell) it is slower in 10 of 13
cells, worst at 15-25% coverage (the 24 GB card with a 3 MB-expert file of the report):
chat -7.8%, agent -7.8%, code -2.8% / -4.2%; at 32.5% 8K document -4.8%, code -3.6%; at
46.8% -0.2 to -2.0%. Faster in 3 cells (+2.8%, +0.4%, +0.3%).

The curve stays available with STRATA_ADAPT_MID=1; --adapt-every / --adapt-swaps /
--adapt-decay on the command line win over both. The rule is a pure header with a unit test
(adapt_coverage_rules_test); the three call sites in generate.cpp use it. Registered in the
settings register and in DETAILS.md. Numbers: phaseA-tests/rel0221/RESULTS-0221-PERF.md.
2026-11-23 11:46:00 +01:00
Niko1221 4285678952 feat(engine): layer split auto says when fewer cards would be faster, and names the setting to use (#6758)
From PR #6768 by @D-Ogi: after the auto layer-split search the engine asks the same
cost model for the chosen placement without its first stages. When the predicted
decode window is at least STRATA_SPLIT_FEWER_PCT percent (default 20, 0 = off) shorter,
it prints one FEWER CARDS line. The placement and the tokens do not change; the model
predicts decode only. (RTX 4090 x16 + RTX 3060 x4: K=10 predicted 27.0 ms, the 4090
alone 17.5 ms; measured 62 tok/s alone against 25-44% less with the split.)

Added here: the line is built by split_rules::fewer_cards_advice and names the exact
setting to try: `--gpu N` without `--layer-split` for one kept card; for several, the
other cards hidden (CUDA_VISIBLE_DEVICES=...) with `--layer-split auto` kept; and in the
Terminal the card roles (`strata launch --gpu-roles`). Nothing is dropped for the user.
split_rules_test checks both wordings. The settings register has the new name
(status rollback) and docs/SETTINGS.md and docs/MULTI_GPU.md are regenerated / extended.

Compile-checked as the Qwen engine target on CUDA sm_86 (z440).
2026-11-23 11:17:51 +01:00
Niko1221 de3cb634a0 fix(inkling2): put the "dspark." prefix on drafter tensors from a GGUF or mtp.safetensors (#6762 #6784 #6717)
A drafter that comes from Unsloth's dspark-Inkling-2-Mini-*.gguf or from mtp.safetensors
carried plain tensor names ("layers.0.self_attn.o_proj.weight", "fuse_weight", ...), while the
CUDA, SYCL and Metal runners ask for "dspark.<name>" (the .strata spelling). The engine
stopped at load with: missing tensor 'dspark.layers.0.self_attn.o_proj.weight'.

The two loaders now name every drafter tensor "dspark.<name>"; the GGUF name map moved to
strata/core/ink_names.hpp (ink_dspark_name / ink_dspark_plain_from_gguf), so a test can
check all 54 tensors of the real dspark GGUF against what the runners look up
(ink_names_test, no GPU). CPU, HIP and the dual-GPU backend already strip the prefix.

Checked on an RTX 3060 12 GB (sm_86), Unsloth UD-Q2_K_XL + dspark Q8_0: origin/main stops with the
error above, this build loads, answers, and gives the same tokens as with --draft off.
2026-11-23 10:56:59 +01:00
Niko1221 b63d30af53 fix(inkling): size the HIP expert arena from the free VRAM and the Windows host pool from the commit left (#6711, #6748)
#6711: the HIP backend sized the expert arena from the card's total memory minus
what this engine holds. Other programs also hold VRAM (3 GB on the reporter's
R9700 with 29 GB free), so the single arena allocation failed "out of memory"
before any model line. The budget is now also bounded by the free VRAM at that
point (the trunk is already in it), and when the one contiguous allocation still
fails on a discrete card the coldest GPU-planned experts move to the RAM or SSD
tier in 5% steps and it is tried again.

#6748: on Windows the HIP backend had no cap on the RAM experts at all, and the
CUDA backend read only the free RAM. Pinned and private memory is charged to the
commit limit, which can be smaller (16.2 GiB of RAM free, 9.3 GiB of commit left:
"host malloc failed for layer 16"). Both now use min(free RAM, commit left) through
platform::host_ram_budget (commit.hpp), tested in host_limits_test.

Not run on a Windows card; the HIP change is compile-checked on boxia (gfx1100 +
gfx1031).
2026-11-23 10:46:35 +01:00
Niko1221 759ccf6c68 fix(engine): harden hy4 vcache headroom, inkling2 Metal/HIP/SYCL/CUDA guards, GGUF layout, and CMake checks 2026-11-23 01:10:33 +01:00
Niko1221 9e3ad2778f Accelerate Unsloth quants and NVFP4 across Metal, SYCL, and HIP RDNA2-4
Add first-class Unsloth quant (Q2_K, Q3_K, Q4_K, Q5_K, Q6_K, Q8_0, IQ4_XS, IQ3_XXS) and NVFP4 (type 40) support and optimizations across Apple Silicon Metal, Intel Arc SYCL, and AMD RDNA2/3/3.5/4 HIP backends:

- Metal (engine/metal/): Add T_IQ3_XXS, T_Q2_K, T_Q3_K, T_Q8_0, and T_NVFP4 across quant, units (incl. STRATA_METAL_F16), mma, dense_mm, gemv, gemvu, gr (BF16+F32 inject), moe, moeu, and moe_mm (v1/v2/v3/v4/v6 ragged tiles + halved-load W8 for IQ4_XS/IQ4_NL), plus host dispatch (window.cpp, prompt_chain.inc, moe_tiles.h, ref_quant) and parity suites.
- SYCL (engine/sycl/): Add full NVFP4 (40) decode/dequant/combine with exact s_gate/s_up/s_down tail scales in all branches, hoisted Split<TY>/KqSplit<TY> across all Unsloth/NVFP4 types, opt-in SYCL EXP_MODE=8 with had_block==0 guard, SG16 XMX SLM decoders for Q4_K/Q5_K/Q6_K/IQ4_XS/NVFP4, and expanded parity suites.
- HIP (engine/include/strata/kernels/hip_unsloth_*.hpp, engine/src/kernels/hip/): Add clean-room RDNA2/3/3.5/4 Wave32 DP4A + hoisted HipSplit<TY> + fused EXP_MODE=8 (had_block==0 guard, 65535-safe grid striding, exact NVFP4 tail scales) and unified gfx11/gfx12 Wave32 WMMA FP16/BF16/INT8 + fused dequant-to-LDS prefill kernels with standalone 5-arch verification harness.
2026-11-22 19:51:03 +01:00
Niko1221 53f59c0640 engine: fix Windows WDDM VRAM paging, sm_89 defaults, gfx1200/RDNA4 crashes & NaNs, sm_70 V100 kernels, and MSVC CUDA LNK2005
- Windows WDDM VRAM safety floor & post-cache shrink (#6128, #5915): join warm_gemm_libraries before sizing, enforce per-tier WDDM discrete free-VRAM floors (>=1280 MiB >=16 GB, >=960 MiB 10-12 GB, >=640 MiB 6-8 GB, >=448 MiB 4 GB; opt-out STRATA_WDDM_VRAM_FLOOR=0), raise legacy --vision --vram-reserve-mib 700, reserve 384 MiB late-alloc headroom on WDDM, and include mtp_bind + prefill_mib + late_alloc in both sized_slots and post-memset shrink with 0 slack so Driver 595+/621.01 never pages VRAM to host RAM.
- Prefill chunk cap & sm_89 / multi-GPU tiny-cache fixes (#5199, #6509, #6208, #6431, #6583): keep bare --prefill auto at 8192 on <=16.5 GiB NVIDIA GPUs so prompt loans do not cannibalize hot expert slots; remove regressive STRATA_L2_PF=1 and conflicting STRATA_QFUSE=1 from sm_89 Ada defaults; extend tiny-cache (<25% resident) swap dampening and 25% Zipf-head pinning to multi-GPU layer splits.
- RX 9060 XT / gfx1200 RDNA4 fixes (#6254, #6526, #5162, #6127, #5649, #5718): serialize warm_gemm_libraries on Windows HIP to avoid amdhip64_7.dll/rocblas.dll cold-boot 0xC0000005; default DEBUG_HIP_DYNAMIC_QUEUES=0 before first HIP call (opt-out STRATA_HIP_DYNAMIC_QUEUES=1); use __builtin_memcpy in RDNA4 load_int_b2 and hoist Q6KTraits scales into registers to avoid gfx1200 NaNs; add STRATA_VERIFY_TIMEOUT_S (30s HIP default) with one-shot flag re-publish grace.
- Volta sm_70 opt-in bitwise kernels (PR#6603 STRATA_GR_V70, PR#6604 STRATA_Q8_V70) + PR#6505 cudaGetDevice error checks.
- Windows MSVC CUDA LNK2005 fix: default CMAKE_CUDA_RUNTIME_LIBRARY=Shared on MSVC across engine/cmake/backends/cuda.cmake and engine/src/inkling2/CMakeLists.txt so strata.exe and strata-inkling.exe link cleanly without cudart_static.lib/cudart.lib collisions.
2026-11-22 17:22:37 +01:00
Niko1221 adab4d45e0 Merge branch 'f-0220-new-issues' into f-0220-int 2026-11-22 16:24:45 +01:00
Niko1221 e3ef567e35 Merge branch 'f-0220-8g12g-qwen' into f-0220-int 2026-11-22 16:00:41 +01:00
Niko1221 63b73ba73f Merge branch 'f-0220-multigpu' into f-0220-int 2026-11-22 15:59:06 +01:00
Niko1221 d28c053e67 perf(low-vram): optimize 8 GB & 12 GB consumer GPUs and unlock 4 GB 0-slot mode 2026-11-22 15:57:43 +01:00
Niko1221 cc62949293 engine: fix multi-GPU usage race (#6560), PHB peer fault, SYCL stage_dev, #6427/#6501/#6504, and Win HIP split-2 2026-11-22 15:52:07 +01:00
Niko1221 40fa01b31e hy4flash: enable multi-GPU across CUDA, AMD HIP, Intel SYCL, and DGX Spark (#6562, #6565, #6568) 2026-11-22 15:52:06 +01:00
Niko1221 99ee215756 Merge branch 'f-0220-ink-gguf-ep2' into f-0220-int 2026-11-22 15:22:40 +01:00
Niko1221 a8e30004ab inkling2: native CUDA GGUF (unsloth + ggml-org), full on-GPU cuda-ep2, PR #6586 & #6571 2026-11-22 15:19:45 +01:00
Niko1221 dceb034d57 mtp: support native GGUF experts (Q4_0, IQ4_NL) in drafter (#6582) 2026-11-22 15:11:30 +01:00
Niko1221 a727ce5d1b sm_86: fix 2-GPU lend-slot mismatch and QFUSE decode regression (#6583), add STRATA_SM86_DOWN_WS (#6581) 2026-11-22 15:08:21 +01:00
Niko1221 ddca992850 Merge branch 'f-0220-nextgen' into f-0220-int
# Conflicts:
#	engine/src/hy4flash/run/hy4_gpu_model.hip.h
#	engine/src/hy4flash/run/hy4_main.hip.cpp
#	engine/src/inkling2/cuda/ink_hybrid.cuh
#	engine/src/inkling2/cuda/ink_runner.cuh
#	engine/src/inkling2/hip/ink_hip_backend.hip.cpp
#	engine/src/program/generate.cpp
2026-11-22 15:05:59 +01:00
Niko1221 1f6bd2d34b feat(ssd-stream): add 3-tier NVMe streaming and first-class GPU+SSD & CPU+SSD modes 2026-11-22 14:51:40 +01:00
Niko1221 1a2b551ea4 Merge branch 'f-0220-ink-msycl-gguf' into f-0220-int 2026-11-22 14:26:52 +01:00
Niko1221 7031ccaf95 inkling2+hy4: auto-default L0-V1 for Arc B70 oneMKL & native GPU GGUF/safetensors loading on Metal/SYCL/HIP 2026-11-22 14:24:41 +01:00
Niko1221 44710df59b engine: fix #6489 sm_86/89 staged 128-row prefill tile, #6487 warmup error masking, and update settings register 2026-11-22 13:43:00 +01:00
Niko1221 14618d7d2f Merge branch 'f-0220-eng-q36' into f-0220-eng-fixes 2026-11-22 13:39:01 +01:00
Niko1221 3319f9e272 q36: support per-layer head_count_kv arrays (#6522) and staging headroom
Accept qwen35moe.attention.head_count_kv (and head_count) as either a scalar or a per-layer integer array of length block_count in both check_architecture_qwen35moe and geometry_from_gguf, resolving the non-zero full-attention head count (never blindly reading entry 0), tolerating feed_forward_length == 0 and optional nextn_predict_layers. Add optional headroom to OneSessionInput and HybridIn for card-0 driver/pinned-mapping overhead, plus CPU unit test q36_metadata_test wired into cpu-check.
2026-11-22 13:37:40 +01:00
Niko1221 64363f6809 Merge branch 'f-0220-eng-sycl' into f-0220-eng-fixes 2026-11-22 13:23:14 +01:00
Niko1221 534802c8dc engine: integrate #6406, #6529, #6550, #6523 and fix #6515, #6431, #6462, #6423, #6417, #6493, #6533, #6470 2026-11-22 13:23:13 +01:00
Niko1221 7aaa789a94 feat(nextgen): apply NextGen integration across engine, qwen35, hy4flash, and inkling2 2026-11-22 13:12:57 +01:00
Niko1221 f44ed40b8d sycl: Battlemage grouped routed-expert prefill and weight reuse (PR #6567) 2026-11-22 13:06:10 +01:00
Niko1221 1f1057b3f3 sycl: preserve message-boundary checkpoints for branching follow-ups (PR #6534, #6533) 2026-11-22 13:05:20 +01:00