298 Commits
Author SHA1 Message Date
Niko1221 7be42963e6 Version 0.2.12 / engine 0.1.58: Terminal and app 0.2.12, Control and every engine package 0.1.58 (the 0.2.11 bump list, plus the v0.1.58 line in the setup.py version history) 2026-11-06 19:21:19 +01:00
sergqwer 24c6c2f682 Admit the PCIe share's fetched misses to the GPU cache (opt-in STRATA_ADAPT_FETCH=1|2)
Decode reads missed expert blobs from host RAM three ways; the PCIe share's
blobs cross into VRAM anyway and were dropped after the window. With the
switch set, the share takes each layer's most-routed misses and a fetched
expert routed enough more than the layer's least-routed resident expert that
the window does not route is copied straight into that expert's slot
(fetch_blobs gets an optional dst2 target per blob). =2 leaves the tier's own
swaps out of a layer where an admission ran. STRATA_ADAPT_FETCH_VERIFY=1 reads
every admitted slot back. Off, with a log line saying why, where it cannot run.
Unset changes nothing.

Ported from PR 2964 (sergqwer) onto f-0216-core; the strata generate verify
loop was merged by hand (main's speculative-q lines kept) and the DETAILS.md
note became a row of the opt-in switch table.

l620 (RTX PRO 5000, IQ3_S, 3,896-slot cache, --pcie-frac 0.25): decode =2 +10.2%,
=1 +5.0% (4 rounds); token forcing over 14,167 tokens: mismatch 2.73% vs 2.53% /
2.53% for two unset arms (+0.19 pt, 90% CI -0.02..+0.42), PASS.

(cherry picked from commit b2bfaef906acee4f86bdf9f052aee6a4d295fb4e)
2026-11-06 15:47:43 +01:00
Niko1221 10831eceb2 Metal build: stubs for the f-0216-cpu 512-bit entry points (q2_rows_512_ok, iq512f_supported, iq512_fused_gu_rows, iq512_reference_gu_rows, q50_512_down_rows) 2026-11-06 09:57:08 +01:00
Niko1221 3e8d3b2940 Mac: DFlash2 is the default drafter for UD-Q4_K_XL and UD-IQ4_XS-v31, with Strata's tuned drafter at --draft-conf 0.7
SET_DEFAULTS is the one per-(backend, set) table (Metal only; IQ3_S stays on the MTP). Setup, strata launch and strata drafting fetch fetch the tuned pack through the signed feed
(pinned size and SHA-256, resumable, silent offline, the standard drafter and then the MTP as fallbacks). Apache-2.0 licence and the modified-by-Strata notice ship in
data/dflash2-tuned and are copied beside the file. The Metal 'not tested' line is replaced for these sets.
2026-11-06 07:52:31 +01:00
Niko1221 178d1c74b5 merge f-0215-mac-pp (host-row pipeline, qsa_merge_h, ragged expert tiles) into f-0215-mac-int 2026-11-06 01:25:09 +01:00
Niko1221 2c0ad33f71 Metal prompt: ragged expert tiles on by default for the types that have kernels (STRATA_PROMPT_V6=0 off); drop the unused Mac PLE threading and the tall-tile probes 2026-11-05 21:59:37 +01:00
Niko1221 687a7d79d7 Metal prompt: host rows beside the GPU (embedding + PLE rows of the next chunk on a thread, parallel PLE gather on Macs), qsa_merge_h (merge writes the fp16 operand), ragged expert tiles (mm_gu6/mm_down6/mm_scan6, STRATA_PROMPT_V6), STRATA_PROMPT_KPROF per-dispatch profile, matmul2d probes 2026-11-05 20:36:54 +01:00
Niko1221 830732a33d metal: step profile scales every pass by the cool whole-window time; opt-in screens STRATA_METAL_HCLD=1 (HC loads in flight: -10.9%, off), STRATA_METAL_WPF_MIB (weight prefetch beside gr_up), STRATA_METAL_MOE_GU / MOE_DN (expert tile override) 2026-11-05 19:54:31 +01:00
Niko1221 c4fa1d9e1e metal: STRATA_METAL_STEPPROF=T, the in-situ step profile by part (prefix runs at every barrier group, weight bytes and GB/s per part, distinct experts per layer); run_graph can run the first N dispatches 2026-11-05 18:41:45 +01:00
Niko1221 e2b5378403 Merge f-0214-metal ba5bef2d6 (parity test: IQ4_XS gate/up runs v2) into f-0214-int 2026-11-05 09:42:34 +01:00
Niko1221 ba5bef2d61 moe_mm_parity: IQ4_XS gate/up runs the v2 path (v1 is not an engine path and has no IQ4_XS kernel) 2026-11-05 09:41:13 +01:00
Niko1221 f699fc0a7d Merge f-0214-metal into f-0214-int 2026-11-05 08:53:24 +01:00
Niko1221 9ed3c77899 catalog: Unsloth v3.1 Qwen3.8-Flash-Next sets (UD-IQ1_M, UD-Q2_0, UD-IQ2_XS, UD-Q2_K_XL, UD-IQ3_XXS, UD-Q3_K_XL, UD-IQ4_XS-v31) at d9620119 with a per-model revision; UD-Q4_K_XL's four-shard layout accepted from local files; manual-load refusal lifted (UD-IQ1_S stays refused); mac_fit switch for the Q5_0 down sets; header-only fixtures and tests (about lines pending wording) 2026-11-05 07:23:41 +01:00
Niko1221 cbef1a9ff6 Metal: Q5_0 down experts, decode (moe.metal, moeu) and prompt (moe_mm v1/v2/v3), host tiles, honest gu_qk/d_qk; parity tests take Q5_0 2026-11-05 07:14:30 +01:00
Niko1221 975eaab2bb Version 0.2.11 / engine 0.1.57: Terminal and app 0.2.11, Control and every engine package 0.1.57 (the 0.2.10 bump list: strata_cli, apps/host, apps/desktop, Cargo, CMake, Metal, the build scripts, the version tests, AGENTS.md, the bug-report template) 2026-11-04 23:23:33 +01:00
Niko1221 f457ed7b98 Mac DeepSeek vision tower: the GEMM choice is made by the engine at the first picture (Metal 4 present, the tensor-op library compiles, a small self-test equals the plain kernel), logged once; otherwise the plain kernel. mtl::Context::compile_try (compile that returns instead of exiting) 2026-11-02 20:52:11 +01:00
Niko1221 e483f7835c Mac DeepSeek vision tower: GEMM on the Metal 4 tensor ops (BF16 operands read in place, FP32 accumulation; 798x448 in 93 ms, 1344x1260 in 1.2 s, was 2.6 s and 29 s), DS4_VISION_NO_MPP=1 for the plain kernel, sequential-FMA test GEMM (DS4_VISION_REF_GEMM) 2026-11-02 19:42:56 +01:00
Niko1221 6ca50487ef Mac DeepSeek: the vision tower on Metal (kernels, BF16 GEMM, host side), capability marker STRATA_DS4_METAL_VISION_V1; credit to antirez/ds4 (MIT, 890898cf) 2026-11-02 19:16:42 +01:00
Niko1221 72a0cc1d5e Engine component version 0.1.56 (CMake, Metal, packaging defaults, RAM_KEEP_MIN_ENGINE and its test) 2026-11-02 14:45:39 +01:00
Niko1221 371a28ed11 metal DFlash2 reads the Q4_0 selector codebooks (df2_select_q4; the pack loader keeps them raw rows) and prints 'selector codebooks: Q4_0 rows', the text strata_control/drafting.py looks for in an engine before it uses the converted pack; STRATA_DF2_HEAD=native runs the head over the target's whole head and ignores the draft vocabulary 2026-11-02 11:56:44 +01:00
Niko1221 d0bc95ec5e DFlash2 alone on Metal starts again without <mtp>/draft_vocab.bin: the packaged default subset (data/draft_vocab.bin) is used, as before the merge; CUDA, HIP and SYCL keep the error; a file named with --mtp-draft-vocab that is missing is still an error (draft_vocab_test) 2026-11-02 11:06:29 +01:00
Niko1221 168325418a Metal builds again on the merged DFlash2 line: dflash2.inc follows the drafter header of the ring/mgpu branches (cur_.hist for hist_, bind with head_device, reset/init_ring_log/copy_log_state_from/ring byte counts, plain answers for the batch-slot clone/split calls), and Metal never asks for DFlash2 batch slots 2026-11-02 10:19:23 +01:00
Niko1221 3dfb046bf1 rc1 merge df2-metal (a9df88afc): window_rule.hpp and its test (add/add) and generate.cpp (8 hunks) conflicted; mainline draft_fallback/draft_on/lookup_default kept, Metal's defer_df2 call taken 2026-11-02 09:57:22 +01:00
Niko1221 4fb068a8c1 rc1 merge ds-coder (d6a5a7837) 2026-11-02 09:51:07 +01:00
Niko1221 b509b2fef5 Metal: a request's logit bias reached no sampler (set_logit_bias / set_slot_logit_bias returned early because the Metal window leaves the last-stage layer end at -1), and the window's bias buffer stayed at its 16-byte stand-in 2026-11-02 07:47:29 +01:00
Niko1221 541a2fac2d Slot penalties and logit bias in batch windows: shared slot_row_draw for CUDA/HIP/Metal, server accepts logit_bias with --batch, docs updated 2026-11-02 07:15:58 +01:00
Niko1221 1bdda21126 Metal --parallel slots honour their request's sampling (temperature, top_p, top_k, min_p, seed; penalties are not applied in batch windows, as on CUDA): each slot's row of a batch window is drawn again from the window's logits with its own params, Philox(seed, position) 2026-11-02 07:04:27 +01:00
Niko1221 5a73435898 Metal honours the request's sampling: temperature, top_p, top_k, min_p, repetition / frequency / presence penalties, logit bias and seed on the head rows of every window (Window::sample_rows over lm_, set by Verifier::run through window_set_sampling); greedy requests keep the in-graph argmax 2026-11-02 05:55:39 +01:00
Niko1221 d59ab12fc5 metal: the sampler chain on the GPU (sample.metal samp_part + samp_pick: bias, penalties, top_k, top_p, min_p, temperature, Philox draw at (seed, position)) and sample_chain_parity (greedy == argmax, 1800 rows against the CPU chain with 0 mismatches, determinism, chi-square) 2026-11-02 05:52:27 +01:00
Niko1221 a9df88afc9 metal DFlash2: the lineage row log and the ring rebuild for a restored conversation: the half hidden_norm row of every context position is logged (10.6 MiB a lineage, STRATA_DF2_LOG_MIB stashes 4); a request that restores a stashed lineage rebuilds the ring rows of its window with the same projections, bitwise equal to the original update (STRATA_DF2_CHECK_REBUILD=1); the drafter's history is the whole prompt 2026-11-02 04:43:36 +01:00
Niko1221 f47df12624 metal DFlash2: the attention floor follows the conversation (kept for a request that goes on from the same history, lowered when a request restarts earlier, set to the resume point for a restarted lineage); it stayed at the last restore's resume point and starved every shorter prompt of context rows 2026-11-02 02:52:21 +01:00
Niko1221 86cbd533a4 metal DFlash2: the producers write the half GEMM operand themselves (df2_rms_h, df2_conv_h, df2_swiglu_h, df2_attn_merge_h; STRATA_DF2_FUSE_H=0 restores the 37 df2_f16 dispatches): drafter 2.12 -> 2.08 ms GPU, output ids identical; STRATA_DF2_STATS prints a periodic drafter line (serve leaves through exit()) 2026-11-02 02:00:01 +01:00
Niko1221 415b43f95e metal DFlash2: with no MTP loaded the draft vocabulary falls back to the repository's draft_vocab.bin like the MTP loader (it bound the whole 248,320-row head: +372 MiB and +0.7 ms per round) 2026-11-02 00:47:43 +01:00
Niko1221 0941f1fe83 metal: DFlash2 Q4_0 drafter on the Metal window: fragment-order Q4_0 repack at load, df2_mma4s matrix-unit GEMMs, Q8_0 draft head on the matrix units (df2_mma8), DF-04 candidate cap (set_max_drafts), begin_request/note_rows/prepare, attention floor for a restarted lineage; builds on f-0291-df2-q4 2026-11-01 23:17:17 +01:00
Niko1221 37e7b738f5 metal: DFlash2 Q8_0 GEMM kernel over a repacked pack (df2_mm: 12.6 ms a round against 36), Q8_0 draft head, STRATA_DF2_DUMP and tools/dflash2/check_metal_dump.py (final rows cos 0.9999 against the torch port)
# Conflicts:
#	metal/src/engine/msl/dflash2.metal
2026-11-01 23:12:16 +01:00
Niko1221 1d36e65a14 metal: DFlash2 drafter on the Metal window (taps in the decode window and the prompt chunks, Q8_0 pack through the engine's GEMVs, windowed attention, top-16 selector); same Dflash2Drafter API as the CUDA build 2026-11-01 23:12:07 +01:00
Niko1221 5bb21e170a metal: df2_mma8 (draft head Q8_0 rows on the matrix units), stubs_df2.cpp from the first Metal port 2026-11-01 23:11:58 +01:00
Niko1221 488b67a1a9 metal: df2_mma4 / df2_mma4s, Q4_0 in fragment order on the simdgroup matrix units (split-K variant), df2_bench modes for it, soak and head cap; drafter round 3.0 ms GPU / 3.3 ms wall (was 7.1 / 7.4) 2026-11-01 23:08:27 +01:00
Niko1221 4938fcc9f0 metal: df2_bench, the cost of one DFlash2 drafter round on Metal with the Q4_0 pack's shapes (small kernels from the first Metal port, df2_mm4 Q4_0 matrix kernel, engine gemv_mma over native Q4_0 blocks); micro-benchmark only, not in the engine 2026-11-01 22:22:47 +01:00
Niko1221 8dbdcf1b20 DeepSeek engine: an expert profile of another model's size is not read; the router tests run with 192 experts and poisoned padding (CUDA, Metal) 2026-11-01 19:18:48 +01:00
Niko1221 3a3fd4391b Int3 merge f-0291-mac-q (bef28201f): FP16 default on resident IQ3_S and Q2_0 on Metal through setup's config, Coder on spec 3 2026-11-01 15:52:51 +01:00
Niko1221 bef28201ff Mac config: the fp16 decode (STRATA_METAL_F16=1) is the default of a resident IQ3_S or Q2_0 pack; the Coder joins --spec 3 --spec-min-p 0.5
Coder: expert-pruned 256-expert Coder, M5 Max, 5 interleaved pairs, identical greedy tokens in all 40 runs per class, over --spec 2: story -2.5%
(0/5), code +7.1%, JSON +9.3%, agent turn +12.5% (5/5 each). It has no Mac setup entry yet; the name is what a config for it would pass.

fp16 decode (PR 4807): setup writes STRATA_METAL_F16=1 into the config's env for a resident IQ3_S or Q2_0 pack (STRATA_METAL_F16=0 there turns
it off; streaming and the other sets are untouched). The owner's rule was an option unless it passes the 61-task quality suite: off / on / off
again on IQ3_S 54/61 each, on Q2_0 54/61 each, the same 7 tasks failing in all arms, no family drop, no new hallucination flag, 0 pass/fail
changes between two runs of the same arm; decode +14% (IQ3_S) and +15% (Q2_0) in the suite runs, top-1 96-97% and mean KL 0.009-0.016 against fp32
(phaseA-tests/mac-q/RESULTS.md sections 20, 22, 30).
2026-11-01 15:52:11 +01:00
Niko1221 54ef8615bb Int3 merge f-0291-term-small (da8c7f4a4): Terminal fixes and tests 2026-11-01 11:19:09 +01:00
Niko1221 4bc7e35e41 Int3 fix (belongs to f-042-strix-pf and f-0291 b89bf5947): Metal links again. stubs_0291.cpp (qsa_prompt_attn_batch_gated answers not taken, rms_rope_rows stops with its name), io_priority.cpp in the Metal host sources (strata_ds4 calls restore_normal_io_priority) 2026-11-01 09:58:02 +01:00
Niko1221 ab6dfa03d6 Setup on a Mac: only this user's engine stops a model preparation (pgrep asks for this user's uid), so another person's server on a shared Mac no longer sends setup away with 'stop the server' 2026-11-01 09:51:21 +01:00
Niko1221 3410d5520d Int3 merge f-042-maya-rc (8e8e3cafa): Metal DeepSeek router NaN guard, dense Q4_K dequantizer
# Conflicts:
#	src/dsv41/ds4_gguf.cu
2026-11-01 09:50:55 +01:00
Niko1221 8e8e3cafad dsv41 Metal: router NaN guard in the MSL route kernels, and a dense Q4_K dequantizer; tests for both
Router: ds4_route and ds4_route_publish left an all-NaN gate row's pick at 0x7fffffff and read sc[0x7fffffff] (threadgroup memory) and
vram[0x7fffffff]; the test process dies with SIGBUS on the old kernel. ds4_route_fallback_pick takes the lowest expert not picked yet
(the CUDA/HIP guard's rule) and raises a flag in a buffer of the Metal host; router_nonfinite_take synchronises and reads it
(metal_host::router_bad_take), so ds4_main ends the request with the error it already has. The warning names the GPU on Metal; the
CUDA/HIP text is unchanged. Test: metal/tests/ds4_route_guard_parity.cpp (finite, all NaN, +-inf, half NaN, fewer than k finite).

Dense Q4_K: ds4_gguf.cu rows() sends a dense matrix of a type metal_host::dequant_rows does not know to iq::dequant_rows, whose CUDA
launch has no Metal dispatch and aborts the engine. ds4_dq_q4k (ggml's dequantize_row_q4_K, the Q5_K kernel without the fifth bit) is
added; any other dense type now fails with a plain message naming it. Test: metal/tests/ds4_dq_parity.cpp (Q4_K, Q5_K, Q6_K, Q8_0, BF16
against ref_quant, padded row stride).
2026-11-01 09:49:17 +01:00
Niko1221 8e7ed68181 Metal: STRATA_METAL_NFCHECK=1 counts non-finite logits and the largest |logit| in every head window (test tooling)
The engine's #879 check only sees logits that come back to the host; the Metal engine picks tokens on the GPU, so a half-precision overflow (STRATA_METAL_F16) would show as wrong text, not as an event. With the variable set, each head window's logits are scanned: a line for the first five windows that held a non-finite value, a count every 500 head windows. Off by default, no cost unset.
2026-11-01 01:07:41 +01:00
Niko1221 3277bfcd71 Metal: opt-in fp16 GEMVs and Q2_0 experts in decode windows (STRATA_METAL_F16=1), from PR 4807 by rasa04
Unset, the output is unchanged (the build with the change, unset, gives the same greedy ids as the build without it in 12 of 12 runs, gemv_parity / gr_parity / expert_parity pass). With STRATA_METAL_F16=1 the decode windows of a resident model use half-precision GEMVs (Q2_0, Q3_K-Q6_K, IQ4_XS) and the Q2_0 routed experts.
M5 Max, spec 3 + min-p 0.5, 3 interleaved pairs, decode tok/s unset -> on: Q2_0 story 105.0 -> 114.9 (+9.4%), code 125.6 -> 143.7 (+15.5%), json 130.8 -> 135.1 (+3.3%, one noisy pair), agent 116.1 -> 131.6 (+13.4%); IQ3_S (dense GEMVs only) story 93.1 -> 104.3 (+8.8%), code 103.6 -> 118.5 (+12.5%), json 122.5 -> 135.4 (+10.6%), agent 103.8 -> 117.8 (+12.3%).
It changes arithmetic: teacher-forced over 4,995 positions against the same build unset, Q2_0 top-1 97.12%, mean KL 0.0094 (p99 0.119), perplexity 4.456 against 4.442; IQ3_S top-1 96.16%, mean KL 0.0160 (p99 0.211), perplexity 4.119 against 4.135. The half range is not guarded (see the PR). Off by default.
2026-11-01 00:39:53 +01:00
Niko1221 91411e17f8 Metal: 256 routed experts (the expert-pruned Coder, #4706): the routers, the prompt chain and the SSD stream take the model's expert count
Window::init accepts 512 or 256 experts a layer; the decode router (router_route / moe_route), the prompt router (route_topk) and the plan buffers use the model's count, the SSD stream reads it from the GGUF. The route kernels are templated on the logits a lane holds (16 for 512, 8 for 256); the 512 path is the old code token for token, the logits rows keep their 512-float stride, the predictor's unused columns are -inf. The MTP layer keeps its own 512 experts.
Tests: prompt_parity route_topk and fuse_parity router_route run both counts (all pass on the M5 Max). IQ3_S 512 experts: greedy ids identical to the build before in every class and prompt (3 interleaved pairs), speed equal (decode +/-0.5% median, prompts -0.5..+5.9%, inside the spread). Not run: an end-to-end 256-expert model (58 GB download).
2026-10-31 20:54:38 +01:00