On the Strix Halo (HIP, unified memory, tier A) some engine starts decoded a different greedy text with the MTP sidecar than without it: the app's warm-up 'Say hello.' (temperature 0) ran 32 tokens instead of 12 in two of three starts of the same package, with 2 of 912 drafts accepted; every other platform and the MTP-off Strix runs give 12. Exact speculative decoding must not change greedy text, so --mtp-auto now declines the sidecar there until that is understood: 'MTP sidecar (--mtp-auto): not loaded: unified-memory HIP (0.2.25 safety)'. --mtp FILE still forces it.
Scope: compiled only under STRATA_USE_HIP and only when the device is integrated; CUDA, Metal and SYCL builds and every discrete HIP card (R9700) keep the existing rule.
On Windows the first plan cuts the RAM tier to what the GPU driver can pin (about half of the system RAM, "the RAM tier is planned within 15.3 GiB"), in a copy of the options (plan_opts). When --mtp-auto then decides that the sidecar does not pay, the plan was made again from the plain options and the cap was lost: a 32 GB RAM B70 PC pinned 16.9 GiB and every device allocation after the tier store failed with UR_RESULT_ERROR_OUT_OF_DEVICE_MEMORY, then DEVICE_LOST ("strata-ling32: cudaMemset: SYCL runtime error" at Load). Without the MTP flags there is no second plan and the cap held (12.4 to 13.4 GiB pinned: Load fine).
The replan now starts from plan_opts (hoisted next to win_pin_cap) with only the sidecar removed (mtp_file cleared, spec off), so it keeps the RAM budget of the first plan. The change is inside _WIN32: Linux, macOS and aarch64 compile the same code as before.
The 0.2.25 engine, Inkling and Ling packages are rebuilt from changed sources, so they carry a new version: with 0.1.72 the feed would not offer them to anyone
who already has the 0.2.24 packages (same version, same file names, different sha256). The version is the project line of engine/CMakeLists.txt (Ling and the
packaging scripts read that line; Control prints it as strata_cli.version()). Also stamped: the Metal STRATA_VERSION, the standalone Inkling project line,
INKLING_VERSION and the serve banner, the HIP Linux package default, the About example, AGENTS.md, the bug form placeholder, and the pins of
test_tui2_023_versions.py. Historic "0.1.72" comments and fixtures stay.
vram_guard.cpp is compiled into the static library strata_inkling_core. The HIP backend (47c22697cc) calls VramGuard::report_applied but did not link that
library, and GNU ld read core before hip on the link line, so the Linux HIP build of strata-inkling ended with an undefined reference. One link line makes the
dependency explicit. MSVC never showed it (it does not care about link order). Built for gfx1201 on p620 with the line: strata-inkling links, and
ink_hip_promote_policy_test passes.
The one-token-order side projections cost --turbo decode 1-5% on SQ-20 and SQ-10 (4K 199.8 vs 211.1 tok/s). The fast set now runs the original kernel again
(--turbo exactly as the owner measured it); only the default uses the new order, which is what makes the Q8_ROW XMX window bit-consistent.
L32-SMALL's make_room (default off: STRATA_L32_ALLOC_MARGIN_MB=0), the Windows NVIDIA planner headroom (STRATA_L32_WDDM_HEADROOM_MB, 1536), L32-METAL's decode commits already present. Only conflict: terminal/data/settings-register.json: three-way merge of names and hand-kept fields, regenerated (check clean, no empty status, no status lost or changed against 269e35441b, 3 new names all 'research'), docs/SETTINGS.md regenerated.
L32-SMALL's Linux gate (RTX 5070, tier B, chunk 2048): margin 256 cost 1-3 % of prefill (16K 1199 against 1240 tok/s, 4K 945 against 958) and decode 39.5 against 40.3, and the check never fired on the owner's Windows card (the over-commit is at load, not at an allocation). STRATA_L32_ALLOC_MARGIN_MB keeps the guard as an opt-in; STRATA_L32_REGROW_TRACE=1 still prints the checks. Register note regenerated.
- Windows (WDDM), discrete card, any tier except --tier vram: the planner plans against the card's free memory minus 1.5 GiB. A 12 GB RTX 5070 was planned to 10.52 of 10.53 GiB and showed "GPU memory 11.54 / 11.91 GiB used" at ready; WDDM pages allocations beyond the dedicated memory into shared system memory instead of failing them, so the prefill scratch, the graphs and the desktop's own use lived in shared memory and a 33,784-token prompt took 620 s instead of 100 s (regrow off or a 9.6 GiB budget: 100 s / 116 s). 0 switches the headroom off. A card that only just fits tier A may now plan tier B; HIP and the integrated GPUs are not touched.
- make_room prints its first four checks (allocations of 8 MiB and more: size, card free / total as cudaMemGetInfo gives them, margin, whether it released) and every check with STRATA_L32_REGROW_TRACE=1, so a log shows what the driver reports.
The side projections of the fused QKVRG XMX kernel (sinks, k/v conv taps) now sum in the one-token sub-group order. SQ-10 passes --spec-check with the XMX kernel on,
which wins back most of the decode speed the gate of 1df20c491f cost. STRATA_INK_NO_Q8_XMX=1 stays as the rollback. No new setting.
On the B70, a 4096-token prompt (first tokens of long_16k) teacher-forced against the long_16k_fp64 golden: the split scan gives top-1 99.878 %, mean KL 2.7e-4, 127 positions above KL 1e-3 starting at position 2717; the old scan with the same MLA gives top-1 100 %, mean KL 2.2e-7, none above 1e-3. The register note of STRATA_L32_KDA_SEQ is updated (opt-in).
The release-and-retry path of the lazy KV and the scratch regrow relied on cudaMalloc failing when the card is full. Where the driver over-commits (Windows WDDM pages the allocation into shared system memory instead of failing) the release never ran: on a 12 GB RTX 5070 in tier C at chunk 2048 the big prefill scratch was paged, the pool stayed at its full size, and a 33,784-token prompt took 622 s with regrow on against 99 s with it off.
make_room(bytes) asks cudaMemGetInfo before the allocation and, when free < bytes + margin (STRATA_L32_ALLOC_MARGIN_MB, default 256), makes the store release whole chunks of pool slots for the shortfall. It runs before every allocation of the engine's stage context once a tier store is attached (alloc_bytes) and before each latent-cache growth (grow_kv); the failure retry stays as the backstop. Without a tier store or without lazy KV nothing changes.
L32-HIP 523e9b4c11 (no adaptive-K calibration on HIP without a tier store; Strix gate passed) and L32-PREFILL's packed S8 trunk GEMM 2754fa02c8 (gfx12, default on, bit-identical, STRATA_L32_W2_PACK=0 turns it off). Conflicts: docs/SETTINGS.md and terminal/data/settings-register.json (generated): three-way merge of names and hand-kept fields, regenerated (check clean, no empty status), docs regenerated with --docs.
Pure renames, no behaviour change: LING32_SY_KDA_SEQ -> STRATA_L32_KDA_SEQ (0 old scan, 4 / 8 split scan, default 8), LING32_SY_MLA_EXP -> STRATA_L32_MLA_EXP_MODE, LING32_SY_MLA_ORIG -> STRATA_L32_MLA_FD_ORIG, LING32_SY_MLA_FD_NS / _PVU / _RB -> STRATA_L32_MLA_FD_NS / _PVU / _RB, LING32_SY_MLA_EXP_ABS (test) -> STRATA_L32_MLA_EXP_ABS. Register entries (rollback for the switches, research for the tuning knobs; STRATA_SY_PROF_TOP of the profiling hook too), docs/SETTINGS.md regenerated, tools/settings_register.py --check clean and test_settings_register OK on this commit (based on the scratch merge 8c8ed5cd0b of int f9f533c65f + MLA efff44d494 + KDA c7f2967a16).
The trunk GEMMs (every S8 matrix: KDA / MLA / dense / shared expert / lm_head) read their weights as one 8-byte dword group per lane from a different weight row (about six small loads per k16 step); in the exact-path ablation the weight loads were 37 % of the trunk kernel time
(no weight loads 812 ms vs 1,285 ms at 4K). Each GEMM call now first rewrites its S8_K matrix (a 262-byte superblock per row: fp16 D, 4 group-scale bytes, 256 q) into a scratch laid out for the A fragments: one 16-byte load per lane (512 contiguous bytes per wave) delivers two k16 steps,
and the 32 group scales of a 32-row wave tile come precomputed as floats (Dh * u / 255, the same expression as the unpacked kernel). Same bytes, same fragments, same MMA order, same group epilogue: the logits are bit-identical.
- gemm_sk_w2p_kernel + w2_pack_q_kernel + w2_pack_eff_kernel in ling32_wmma2.inc (HIP only), 128 MB repack scratch per stream (taken in w2_reserve with the other scratch, before the KV cache; a matrix larger than it goes through in row blocks; no room = the unpacked kernel).
- Used for S8, tc-mode 2, 64-token tiles, N >= 128 (prefill chunks). Decode, experts, other codes and the MTP sidecar are untouched.
- Default on for gfx12 only (engine, HIP block); gfx11 / Strix and every non-WMMA AMD target keep the unpacked kernel (the packed kernel is written for the 8-half fragments). STRATA_L32_W2_PACK=0 or the config part pack0 turns it off (pack1 on). Registered (rollback), docs/SETTINGS.md regenerated.
- SYCL: g_w2_pack link definition next to g_w2_nt / g_w2_etn (shared ling32_main.cpp references it). Metal has its own main.
Measured on the R9700 (gfx1201, p620, tier B, SQ-96, fast-jobs, 4K and 16K prompts, pack0 / pack1 interleaved in one process, last-logit md5 equal in all four runs):
4K : 1,162.8 / 1,180.8 tok/s (pack0) vs 1,318.3 / 1,315.9 (pack1): +12.4 %, md5 38659685acd2
16K: 1,162.2 / 1,145.0 tok/s (pack0) vs 1,373.4 / 1,356.7 (pack1): +18.3 %, md5 b5f1798919c9
Kernel time at 4K (rocprofv3): trunk GEMM 1,281 ms -> 677 ms (647 GEMM + 30 repack), total kernel time 3,211 -> 2,589 ms.
Teacher-forced dumps, pack1 vs pack0: all 17 short-set files and the 4K file have equal md5 (short 6cb0eca7932d..., 4K cdac903e4abd), so the fp64 goldens are exactly those of the unpacked path.
Timeline: with the packed GEMM the 4K prompt is bound by the expert uploads (21,021 copies, 3.09 s, about 25 GB/s on this PCIe 4.0 platform), not by the kernels.
The serial scan of a head over the chunks of 8 tokens ran as one work-group per head with one value column per lane and the 128-float state column in registers (spills on Xe). The state update is independent per value column, so the scan now runs as HD / 32 work-groups per head (32 columns each), G sub-groups per work-group, each owning HD / G key rows of the state in registers (lanes are the columns); the partial sums over d of kE s and qE s are exchanged through shared memory per chunk, U and the output row are computed redundantly per sub-group, the next chunk's tiles are prefetched into registers and stored into the other shared-memory buffer (two barriers per chunk). The gated RMS norm needs the whole row, so the scan writes the raw output into out and launch_chunk_norm normalises it in place (same expressions). Mode switch LING32_SY_KDA_SEQ: 0 the old scan, 4 / 8 the new one with 4 / 8 key-row groups (default 8); the decode / verify / snapshot path (launch_step, N <= 16) is untouched, state layout and final state are the same.
ling32_sy_kda_test: chunk scan modes against the sequential recurrence (hd 64 / 128, N 40 / 100, and 32 heads x 2048 tokens: max rel error <= 2.9e-5, gate 2e-4) and timings. A750: pre + scan for 32 heads, hd 128, 2048 tokens 141.6 ms (old) -> 77.3 ms (4 groups) -> 44.0 ms (8 groups). Forward tests f32 / q8 / wide with --kda-seq 4 pass in every mode (top-1 12 / 12, KL 4.3e-12 vs 4.2e-12 old).
On the Strix Halo (Windows, gfx1151, tier A, all experts resident) the adaptive controller never reached the speculative path: with the calibration (spec_calibrate: synthetic requests, forced K, random 40-token prompt) it ended on the plain path or on drafts that were all rejected (1.00 tokens / verify, acceptance 0.000, 29.5 tok/s at 4K, also with K_max 1). The calibration cycles of 2..5 verify rows cost 141..146 ms (a real 2-row cycle: 43.5 ms), or did not run as that length at all (table 2:0.0(1)).
With the same adaptive controller and the calibration off (--spec-sweep block=4,adaptive=1,calibrate=0) the request picks K from the cost model and its own acceptance: 42.1 tok/s, 109 verifies, 2.28 tokens / verify, acceptance 0.633 (fixed K=1 / K=2: 41.4 / 42.1 tok/s).
spec_init now sets sp.mtp_calibrate = false for such a run and prints one line.
SCOPE: only when STRATA_USE_HIP is defined and there is no tier store (tier A, every expert resident), integrated or discrete device (the cost model is the path proven to work; the calibration is the path proven broken). CUDA and every HIP tier-store run (tier B / C, e.g. the R9700 pool: adaptive acceptance 0.80-0.85) keep the calibration exactly as before.
ESIMD dense GEMM on by default on Battlemage builds (STRATA_DENSE_GEMM_ESIMD=0 turns it off), gated by QFN-B70: 8 of 8 identical token ids on the B70 (ESIMD on vs off vs the first build). Not taken: d8f2977968 (the Windows packaging script, no engine file; coordinator to say). Only conflict: docs/SETTINGS.md (generated), regenerated with tools/settings_register.py --docs; register merged cleanly, check clean, no empty status.
The loader refuses to start when the free card memory is below trunk + reserve_bytes, and the reserve counted the chunk's logits buffer (chunk x 157,184 x 4 B = 1.3 GiB at 2048) plus its share of the latent cache. With scratch regrow in a tiered run only decode_rows rows of scratch stay resident (the chunk-sized set is allocated by the first prefill, the store gives pool chunks for it), so the reserve counts min(chunk, decode_rows) rows there. Every other run (tier A, regrow off, no lazy KV) computes the same expression as before: reserve_rows = o.chunk.
SYCL-only block in ling32_main.cpp next to the CUDA / HIP defaults: every prefill chunk above kda_seq_max_n tokens (mla_exp_min_n 32) takes the expanded form when the device has XMX; --mla-prefill still wins.
Test-only: ling32_forward_test sets kda_seq_max_n and graph_max_n to K (the expanded MLA needs N above both). A750, plain-loop mode, wide fixture: prefill of layer 2 differs from the decode figure (the expanded path ran), top-1 12 / 12, KL 4.15e-12 against 4.24e-12 of the absorbed control. tools/fwd_exp_a750.sh runs the control and --mla-exp variants.
Ling32Engine::init no longer switches the expanded-form MLA prefill off on SYCL when the device has XMX (mla_exp_ok); the conversion of the projection weights keeps buffers valid for models with other head dimensions. One line in ling32_engine.cu (the SYCL block of Ling32Engine::init).
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.
QFN on B70: Windows build of engine/sycl (icx, no oneMKL, own XMX dense GEMM), Windows free-RAM fix, Intel --spec 2 default for one Arc B-series card without a draft layer, opt-in --vram-reserve-floor-mib. Not taken: 1109ad7b3e (ESIMD GEMM on by default, not gated). Conflicts: docs/SETTINGS.md and terminal/data/settings-register.json (generated): three-way merge of names and hand-kept fields from both sides, regenerated (check clean, no empty status), docs/SETTINGS.md regenerated with --docs. Open gate for QFN-B70: B70 token-identity of the --spec 2 default against spec off on their 7-prompt set; if it fails they send a one-line commit reverting the default.
joint_matrix_apply crashes ocloc / IGC on bmg_g31 in the projection and attention kernels (every use, also a trivial scale), so the kernels only fill, mad and store accumulators and do the combination of the main and cross products and the online-softmax rescale in plain code on stored tiles. Attention work-group is now 32 rows / 8 sub-groups (shared memory 59 KB, fits 64 KB devices), projection groups 16 keys. B70 (joint_matrix path): all cases of ling32_sy_mla_exp_test within 1.6e-6 of the absorbed original kernel (gate 2e-5 of max |ref|); 2048-token chunk at 16384 context, 32 heads: 283 ms per layer. devlink.sh / devlink2.sh / jm_probe.* are the seconds-long AOT crash checks used to find it.
Standalone bench, Arc Pro B70, bf16 in / fp32 out, 4096 tokens: the ESIMD kernel (2D block loads straight from global memory, the weights
as transposed 32-bit words = the VNNI-packed B operand, no SLM, no barriers) reaches 64-72 TFLOP/s on the GDN / QSA projection and
square shapes (2.4 ms for N=8192 K=2560, 71 TFLOP/s) against 29-31 for the packed-B SLM kernel and 22-25 with large-GRF mode; max
relative error against a double reference below 1e-5 on every shape. The tile is 16 rows x 32 columns per hardware thread (a 32 x 32 tile
is slower: register pressure); the prefetch two K steps ahead is kept. Shapes it does not take (N < 16, T < 32, K % 16 != 0, bases not
64-byte aligned, ldy % 4 != 0) fall back to the packed-B kernel. The register entry for STRATA_DENSE_GEMM_ESIMD moves to rollback.
The group selection is done by rank on 8 threads (the k-th kept group is the one
with k groups ahead of it: a higher score, or the same score and a lower index,
the order of the former serial loop) and the candidate ranks are counted by four
threads each over a quarter of the candidates (integer counts, any order is
exact). Used for up to 4 rows; L32_ROUTE_W=0 selects alflb_route2.
Profile: 7.5 -> 5.4 us per layer (alone). Interleaved A/B (5 pairs, ctx 131072):
1-row step 12.320 -> 12.227 ms (-0.75 %), faster in 5 of 5 pairs. Gates: the
teacher-forced logit files of the short set (17 prompts) and of long_16k_fp64
with the MTP sidecar are byte-identical with and without; only the gen.json
timing fields differ.
f-ling32-int 7c04fb2161 (Metal 1024-thread kernels, mla_qabs_d, opt-in --skip-tau) and the register statuses of the 15 Ling SYCL env names. Only conflict: docs/SETTINGS.md (generated): regenerated with tools/settings_register.py --docs; the register merged automatically, regenerated, check clean, no empty status.
One simdgroup per (row x head, tile of 128 latent dims), 4 consecutive latent
dims per lane (one 8-byte load per weight row) and the weight loads of 8 rows
in flight; every output dimension keeps its own sequential sum over the 128
nope dims, so the result is bit-identical. Used for up to 4 rows; prefill
keeps mla_qabs. L32_QABS_D=0 selects the old kernel.
Profile: 24.9 -> 8.0 us per MLA layer (alone), the MLA layer 323 -> 299 us in
sequence. Interleaved A/B (5 pairs, ctx 131072): 1-row step 12.486 -> 12.326 ms
(-1.3 %), faster in 5 of 5 pairs. Gates: short set (17 prompts) and
long_16k_fp64 with the MTP sidecar give identical tables, and only the
gen.json timing fields differ between the two output folders.
Port of the CUDA elastic pool (52954a6a09, 993666eef9) to the HIP backend, which is built differently from the CUDA runner:
- The global K/V pools (VisitKvPool, one per global visit) reserve their whole address range once and map 2 MiB chunks as pages are needed: no realloc and copy, no 3x peak, the base never moves.
Chunks come from free memory above a 256 MiB floor (R9700: the 768 MiB headroom it already used), else from the expert pool. A pool that cannot get chunks spills to host-mapped pinned
memory as before. STRATA_INK_KV_VMM=0, HIP without virtual memory (STRATA_HIP_VMM=0, ROCm older than 6, gfx906) and UMA cards keep the old allocation byte for byte.
- When every expert fits, the expert arena is an InkElasticSec4Pool range (same offsets, packed in load order). An expert that leaves is copied to a pinned host arena, its table entry
gets body == nullptr and the layer leaves layer_all_gpu_. A decode visit (B == 1) of such a layer keeps the fast path: a small prepare kernel reads the router's picks, copies the cold
ones from the pinned arena into staging slots and hands the MoE kernels a step table, so the same kernels read the same bytes (graph capture included). Other visits take the
host-copy path of the hybrid layers (batched GPU compute after a copy-in). STRATA_INK_ELASTIC_EXPERTS=0 keeps the single hipMalloc arena.
- reset_slot / free_slot: the K/V returns to its start size and the freed chunks map behind the experts, which are copied back from the host.
- core/vmm.cpp is compiled into the HIP backend object (include at the end of the file), so the HIP packages and release scripts need no extra object.
- xmx_dense_gemm.dp.cpp: a second XMX kernel for T >= 128 and K % 32 == 0 (STRATA_DENSE_GEMM_PK=0 turns it off): BM=128 x BN=64, 256
threads, weights written to SLM in the VNNI-2 packed order and read with joint_matrix layout ext_intel_packed, the same pattern as the
Inkling B70 BM=128 GEMM. Bit-identical to the first own kernel (first-token logits max |diff| 0) and KL 1.2e-4 against oneMKL (top-1
the same). Coder IQ1_M, B70, 4K prompt, GPU timeline: first own kernel 4.54 s, this one 3.82 s, oneMKL 2.94 s (GDN projections 826 /
652 / 229 ms); 32K prompt: 32.3 s / 27.7 s / 19.2 s. Standalone bench (xmx_dense_gemm_bench.cpp): about 31 TFLOP/s on the big shapes
(BK=32, no large GRF is the best of four variants; all shapes within 1e-5 of a double reference). Only the Windows build (no oneMKL)
uses it by default; with oneMKL it runs only when STRATA_DENSE_XMX=1. An ESIMD variant (2D block loads, no SLM) is in the file but
off (STRATA_DENSE_GEMM_ESIMD=1): its numbers were not in when this was committed.
- generate.cpp: the free RAM came from /proc/meminfo only, so on Windows the engine saw 0 bytes: no pinned host mirror of the experts that
do not fit the card and no RAM test for KV streaming. host_avail_bytes() reads the available physical memory on Windows, and the mirror
keeps 8 GiB free there (Linux: 4 GiB, unchanged). Coder-class packs are unchanged (everything resident). IQ2_XS on the B70 (4K / 32K
prompts): prompt 396 -> 927 and 587 -> 880 tok/s with the mirror (9.0 GiB pinned), decode 36.9 -> 37.6 and 41.0 -> 42.4. IQ3_S with the
old 4 GiB rule (17.8 GiB pinned) ran a 32 GB PC out of RAM; the 8 GiB rule is not yet measured on IQ3_S.
A decode / verify token's routed experts whose share of its routing weight is below T are dropped (the top expert is always kept, the kept
weights are scaled to the original sum, the dropped slot repeats the top expert with weight 0 so the tier store fetches nothing for it);
prefill and the MTP layer are untouched. Off (T = 0, the default) the engine path is unchanged. Quiet RTX 3090, tier B, plain decode:
T 0 / 0.03 / 0.05 / 0.08 = 53.0 / 53.5 / 58.0 / 70.8 tok/s, H2D per token 331 / 324 / 299 / 240 MB; teacher-forced against the unpruned
engine: top-1 100 % / 98-100 % / 97.5-98 %, mean KL 1e-4 / 1e-3 / 1.6e-2 (T 0.08 max KL 0.7). ling32_bench decode checks the prune kernel
against a CPU reference (bit-identical). STRATA_L32_LA_KS (bit mask of the lookahead lists a tier run computes) with STRATA_L32_PF_K: with
both lists computed the k=2 list as the prefetch driver is +3 % on the 3090 (ABAB x3). Register entries for both and for the HIP
ROUTE_EARLY / PROBE_ALLOC / GPU_CAP_GIB settings that had no status.