Commit Graph
2346 Commits
Author SHA1 Message Date
Niko1221 d5d5b08379 Merge f-0213-shape (61d883315): a new-shape Qwen4 engine ships as its own component strata-q4-<shape> beside the Strata engine, picked by the model (owner 11-08: separate components; wording approved 'A ok, 1 yes, 2 later, 3 yes') - feed member shape_engines, setup/launch/update/Mac paths, strata --geometry checked against the signed manifest at install, older Controls never offer the model; l620 e2e (Flash-Next engine hash unchanged), Windows long-path install, Mac m1002 run 2026-11-08 22:20:12 +01:00
Niko1221 e3bd5cfdef Merge f-0213-defaults (a04860fad): DFlash2 per-device defaults - Strix Halo and Blackwell cc 12.0 cards with >= 48 GB draft window 6 -> 8 (all sets), conf 0.55 for IQ3_S only on that Blackwell class; end to end through the Terminal's flags, 3 interleaved rounds: Strix UD-Q4_K_XL x1.052 (output differs, deterministic; owner 11-08: ship as is), Strix UD-IQ4_XS-v31 x1.020 (identical), l620 IQ3_S x1.028 (identical); every other card unchanged 2026-11-08 22:09:21 +01:00
Niko1221 d362bc5f00 Engine: no Windows 2560 MiB reserve floor on an integrated (UMA) HIP device (G16)
On Windows HIP, an auto expert cache with no --vram-reserve-mib kept a floor of 2560 MiB free on any card of 15 GiB or more (#1376, made for a 20 GB discrete
card that paged). On a Strix Halo that room is not free: the RAM budget's page-locked complement takes it straight back (cache + complement 71.72 GiB at 2560 and
71.73 GiB at 700 on UD-Q4_K_XL), so the prompt path's own buffers found 0 MiB and the engine stepped its chunk down 16384 ... 1024 for ever; strata launch of a
UD-Q4_K_XL config with no reserve (pictures off, or a model with no picture reader) never started.

The floor now goes through strata::core::wddm_auto_reserve_mib(integrated, total, current, floor): a discrete card of 15 GiB or more still gets 2560, an
integrated GPU (the device property the UMA sizing already reads) keeps the engine's default 700. Discrete cards, Linux and every config that passes
--vram-reserve-mib are unchanged (the block is under _WIN32 + STRATA_USE_HIP and behind !vram_reserve_given). Unit test in uma_cache_test.

CUDA sm_120 sm build (vendored ggml), base vs change from the same path: the binaries are bit-identical (sha256 2b603395...).
Strix (gfx1151, public-0.2.12-style config with no reserve) with the new engine: starts in 77 s and answers 3 chats; the old engine never started it.
2026-11-08 21:13:59 +01:00
Niko1221 febc0226f5 strata --geometry: prints the name of the model shape the kernels are compiled for (the geometry header's kGeometryName; flash_next for the default build). One host line beside --families; no compile flag, no kernel changes. 2026-11-08 20:56:46 +01:00
Niko1221 6ec4d68ab2 DFlash2 per-device defaults (11-08 CONF-SWEEP): Strix Halo window 5 -> 8; Blackwell cc 12.0 with >= 48 GB conf 0.35 -> 0.55 and window 6 -> 8
Strix Halo (gfx1151): engine cap 5 -> 8 and the Terminal writes --spec 8; conf stays 0.35.
Measured (5 interleaved pairs, 5/5 faster): UD-Q4_K_XL +5.3%, UD-IQ4_XS-v31 +2.1%.
UD-Q4_K_XL greedy output differs from the old width's (deterministic run to run); v31 is identical.

Blackwell sm_120 (cc 12.0) with at least 48 GB: cap 6 -> 8, --draft-conf 0.55 (RTX PRO 5000 72 GB,
IQ3_S +2.4%, 5/5 pairs, output identical). The DGX Spark (cc 12.1) and consumer cards under 48 GB keep
conf 0.35 and cap 6. dflash2_auto_cap now takes the compute minor and the card's memory; drafting.py
writes --spec 8 only on these two classes (window_for), so no other card's effective window changes.

draft_cap_test, tests/terminal drafting tests (new test_drafting_card_window.py) and the snapshot
goldens (nv_resident and strix_halo_win only) are updated.
2026-11-08 20:04:02 +01:00
Niko1221 b12773820f #5327: the owner's wording for the "loads anyway" warning, and the RAM notices on stdout in --serve mode only
The warning now reads "the experts need X GiB of RAM and Y GiB is free, but free memory, file cache and reserved huge pages can hold
them, so they load anyway (same answers). STRATA_ARENA_FILE_CACHE=0 reads them from the file instead."  It and the "not enough RAM for
the expert arena ... reads the experts from the file" notice go to stdout only with --serve (before READY, which the server ignores; a
service log has them).  A plain generate run keeps its token stream clean: stderr only, as before the PR.
2026-11-08 19:02:58 +01:00
Niko1221 4890fd9539 #5327 review: the arena shortfall credit leaves out locked file pages, reserved huge pages, a non-2 MiB pool and a pool smaller than the padded mapping
Review of #5531 on top of the contributor's two commits.  The credit read Cached - Shmem - Dirty as droppable, but file pages the
process itself or an engine still exiting has locked (the PLE table's mlock is a mapping of the model file) sit in Cached and the kernel
cannot drop them; MemAvailable leaves them out.  An engine with --ple-io ram and a short arena was told its own locked table could serve
the arena - the shape of #4051's stall.  Now: Mlocked is subtracted; HugePages_Rsvd is subtracted from the free pool; the pool counts only
at the 2 MiB size the arena maps; STRATA_NO_LARGEPAGES (no MAP_HUGETLB try) credits no pool; and the pool must hold the padded mapping
(the pin-by-need stride padding plus the spare blob), not want + blob.  Tests for each.
2026-11-08 17:39:12 +01:00
pjgmobile 41e20da530 #5327: correct the comments - MemAvailable does not credit "only about half" of the page cache (it counts nearly all of it, minus the low watermark); the false alarm this fixes is the reserved hugetlb pool, which MemAvailable does not count at all. The file-cache credit stays as a small secondary margin. Comments only, no code change. 2026-11-08 17:24:35 +01:00
pjgmobile 28bd0185f9 #5327: on Linux an expert-arena shortfall the file cache can serve loads through it again - the 0.1.55 warn-and-proceed (free pages + Cached+Buffers+SReclaimable-Shmem-Dirty cover the need: MemAvailable credits only half the cache), said loudly on stdout as well, because a service setup never sees stderr; the #4846 refusal stays for shortfalls it cannot serve (#4051's anonymous RAM), under a cgroup limit, and on Windows, and STRATA_ARENA_FILE_CACHE=0 turns the credit off; tests 2026-11-08 17:24:35 +01:00
Niko1221 067b4dda5f Vendor the ggml sources the engines build into third_party/strata-ggml
ggml-base, ggml-cpu (x86, Arm) and the ggml-cuda MMQ headers, quantizer and
instances the engines compile, frozen at llama.cpp 3cf03257 with the MIT
licence, UPSTREAM.md (file list with sha256) and tools/check_vendored.py.
The layout is llama.cpp's, so CMake takes ${root}/ggml from the vendored tree
by default (root, sycl, metal, split) and no longer fetches llama.cpp.
-DSTRATA_GGML_DIR=<checkout> stays as an override. Only ggml/CMakeLists.txt and
ggml/src/CMakeLists.txt differ from upstream (trimmed to ggml-base + CPU).
2026-11-08 14:43:03 +01:00
Niko1221 7f46672a48 Merge f-q4-metal (ed1f58d27): the Mac (Metal) engine follows the compiled geometry (q4_lite/q4_mid/q4_big kernel parity 40/40, gate 2 like CUDA), plus the PLE row-buffer fix in src/program/generate.cpp (sized by the compiled hidden size, not 2560; it overran 24 KB at hidden 4096 and crashed Metal serve); default build unchanged (CUDA SASS 3573/3573 and 160/160 host objects, HIP gfx1201/gfx1151 string offsets only, SYCL 129/129 objects and 22/22 checksums, Metal per-token functions identical, UD-Q4_K_XL 10/10 tokens, CUDA IQ3_S 26/26 tokens) (Qwen4 prep) 2026-11-08 10:13:39 +01:00
Niko1221 dcaf4755c1 ple_direct_rows_per_s: the probe's output buffer is PLE_N_HEADS x PLE_HEAD_DIM floats a token, not 2560 (heap overflow of 24 KB at hidden 4096; on Metal it corrupted Apple's shader-cache objects and the first window of strata --serve at q4_big died in MTLCompilerFSCache::getElementImpl) 2026-11-08 09:04:39 +01:00
Niko1221 269f33859b fused_gr: the dynamic-shared-memory opt-in of the single-token down kernel is set once per device, not once per process (a layer split runs it on several cards); doc_pages lists the .md files git knows about, so an ignored build tree's llama.cpp copy is not link-checked 2026-11-08 08:46:50 +01:00
Niko1221 09eb827914 Merge f-q4-hipkg2 (da7b1d022): the AMD prompt-expert kernels (F16 K-quant, native-format fused IQ, Q2 blobs) follow the compiled geometry; default build unchanged (HIP gfx1201 182/182 and gfx1151 194/194 touched functions, CUDA SASS 3573/3573 and 160/160 host objects, SYCL 129/129 objects and 22/22 checksums, Metal 85/85 objects); HIP q4_lite gate 2 0.000183 vs floor 0.000173 (Qwen4 prep) 2026-11-08 06:15:05 +01:00
Niko1221 da7b1d022e Strata Q2 blob fused experts (moe_fused.cu CUDA and gfx11 kernels) and their parity test follow the compiled geometry
Weight-row counts, K stages, code/scale row bytes, the scale staging copies, the H row stride, the down store stride and
the launch grids come from kMoeEmbd / kMoeFF.  The CUDA kernel stages a row's gate/up scales in 16-byte copies, so the hidden
width must be a multiple of 512 (static_assert).
2026-11-08 04:48:52 +01:00
Niko1221 2351f2cccb Strata Q2 blob (prompt path): blob_dequant and strata_q2_kernel take the row lengths, scale counts and offsets from the compiled geometry
Gate/up codes [2 F][E/4 B], down codes [E][F/4 B], gate/up scales [2 F][E/64], down scales [E][F/64] (Flash-Next: 1280 x 640 B,
2560 x 160 B, 1280 x 40, 2560 x 10).  Launch sizes follow.
2026-11-08 04:48:52 +01:00
Niko1221 b273c8006e HIP/CUDA native-format prompt experts (moe_fused_iq.cu): K of gate/up and down, the weight-row counts, the grids and the down store stride follow the compiled geometry
GU_ROWS_K, D_ROWS_K and the 1280 / 2560 weight rows of the int8, WMMA and F16 kernels come from kMoeEmbd / kMoeFF /
kMoeGuRows, with a static_assert that a product's rows are whole work items.  Flash-Next's device code (gfx1151)
is unchanged.
2026-11-08 04:48:52 +01:00
Niko1221 3d209733d2 HIP F16 K-quant prompt experts: the work-item counts, activation strides and down stride follow the compiled geometry
moe_fused.hpp gets kMoeEmbd, kMoeFF and kMoeGuRows from kCompiledGeometry (2560, 640, 1280 for Flash-Next).
moe_f16_common.cuh and moe_f16_kq.cu take GU_NFB, D_NFB, the activation and H row strides, the stage counts and the down
store stride from them, with a static_assert on the divisibility the tiles need.  The default geometry's device code
(gfx1151) is unchanged.
2026-11-08 04:48:52 +01:00
Niko1221 4dad59ab37 Merge f-q4-geometry (fc1c4e429): the model shape is fixed at build time (-DSTRATA_GEOMETRY / -DSTRATA_GEOMETRY_FILE); the default Flash-Next build is unchanged (CUDA SASS 3573/3573, HIP gfx1201 3920/3920, gfx1151 path-string offsets only, SYCL 22/22 checksums, Metal 10/10 tokens, CUDA 130/130 tokens); Qwen4 test shapes q4_lite/q4_mid/q4_big pass logits gate 2 on CUDA (Qwen4 prep) 2026-11-08 04:48:39 +01:00
Niko1221 fc1c4e4295 fused_gr: the Q8_0 up read walks hc_lr in as many 128-value steps as it needs
The up-projection rows of the STRATA_HC_Q8 read were loaded in a fixed 3 steps of 128 values, which covers hc_lr up to 384. At hc_lr 512 (q4_big) columns 384-511 of every row were dropped (KL 0.0059 against llama.cpp, 15 of 144 positions over the rule; 0.00028 and 3 positions after the fix, the same as without HC_Q8). The step count is now (hc_lr + 127) / 128: 3 for Flash-Next's 320, unchanged.
2026-11-08 04:36:17 +01:00
Niko1221 d10a8cd7e1 fused_gr: the Q8_0 hyper-connection read takes its chunk width from n_embd
The STRATA_HC_Q8 read (the default on gfx12 and gfx1151 HIP) split each stream into chunks of a fixed 640 columns. At n_embd 2048 (q4_lite), 3072 (q4_mid) and 4096 (q4_big) a stream is not a whole number of chunks: 12 chunks of 640 cover 7680 of q4_lite's 8192 columns, so every hyper-connection read missed 6% of its input (3% error in the mixed activation, then wrong logits: KL 0.027 against llama.cpp, 67 of 144 positions over the rule).
The chunk is now the largest multiple of 128 up to 1024 that divides n_embd: 640 for Flash-Next (unchanged), 1024 for 2048, 3072 and 4096 (at most 16 chunks, the scratch's room). Static asserts for n_embd % chunk and hc_lr % 32.
2026-11-08 04:36:17 +01:00
Niko1221 38ab10e03e qsa_decode_attn: the q8_v3 value loop compiles for any heads-per-KV-head G
The Flash-Next branch (G == 12) sat in an if constexpr inside a non-template kernel, so its
12-element initialiser was compiled for every G and a build for another geometry stopped with
'too many initializer values'. It moves into a template helper (fold_cell_v3<G>); the
Flash-Next expressions are unchanged.
2026-11-08 00:08:08 +01:00
Niko1221 78f5417195 qsa_decode_attn: the q8_v3 kernel keeps Flash-Next's original probability loop 2026-11-07 23:25:52 +01:00
Niko1221 48f17ff35e fold_cell and gr_up_fast keep Flash-Next's original expressions (device code unchanged for the default shape) 2026-11-07 23:11:46 +01:00
Niko1221 e709a5ff44 native_dense_parity: also n_in 512, 1024, 2048, 3072 2026-11-07 22:59:54 +01:00
Niko1221 4e50c30a59 native_expert_parity: expert widths from Q4KQ_PARITY_EMBD / Q4KQ_PARITY_FF
The synthetic check was fixed at 2560 x 640.  Setting the two variables runs
the same GPU and CPU checks at other widths (512 and 1024 for the K-quant
downs a UD file carries when the width divides by 256).  Default unchanged.
2026-11-07 22:59:23 +01:00
Niko1221 fad95e2611 prefill: shared-expert and interleaved SwiGLU kernels use the geometry's expert width (were 640); STRATA_DBG_NAN also checks the shared expert, its gate and the weights; synth tool --set 2026-11-07 22:36:04 +01:00
Niko1221 b4e9ac7c29 fused_gr: the single-token down kernel takes its hidden row from dynamic shared memory when it does not fit 48 KB 2026-11-07 21:57:06 +01:00
Niko1221 c5d3f55dfe prefill: routed-expert count follows the geometry in the combine, route and peer kernels 2026-11-07 21:52:27 +01:00
Niko1221 f637d759b9 fused_gr down tile and verify/remote-expert top-k follow the geometry 2026-11-07 21:34:06 +01:00
Niko1221 6f379c8e7c generate.cpp: string literals of the PLE checks 2026-11-07 21:29:14 +01:00
Niko1221 caebc48411 generate.cpp: PLE constants declared at function scope, string literals fixed 2026-11-07 21:24:17 +01:00
Niko1221 f3e99e58d5 geometry: attention G, fused_gr tiles and fast up for hc_lr 256-512, top-k from the geometry in native_moe, native activation buffers follow n_embd/n_ff, PLE hash constants read from the model file 2026-11-07 21:21:16 +01:00
Niko1221 99807e8da4 Merge f-q4-kquant (d19ab7302): Metal and SYCL take Q5_K/Q6_K (Metal also Q3_K/Q4_K/IQ4_XS/IQ3_S) down experts for UD files at expert widths 512/1024; additive, today's sets unchanged (Qwen4 prep) 2026-11-07 21:21:00 +01:00
Niko1221 75822f3e9e generate.cpp: the expert layout is loaded for the compiled geometry's layer count 2026-11-07 20:59:19 +01:00
Niko1221 88e6634390 Revert "engine: on AMD that is not gfx12, a UD-Q5_K_XL / UD-Q6_K_XL style file (most expert gate/up tensors Q5_K or Q6_K) runs the K-quant MMQ prompt kernels by default (STRATA_MMQ_KQ=1; was setup's unsloth_default_env; owner yes 11-07); STRATA_MMQ_KQ=0 turns it off"
This reverts commit ffb94c578c.
2026-11-07 18:40:47 +01:00
Niko1221 055274c882 Merge main b0fc432ed (step 4, step 2, 1A) into f-clean-1c
# Conflicts:
#	data/settings-register.json
2026-11-07 18:40:24 +01:00
Niko1221 3a8254d046 native_expert_parity: expert widths from Q4KQ_PARITY_EMBD / Q4KQ_PARITY_FF
The synthetic check was fixed at 2560 x 640.  Setting the two variables runs
the same GPU and CPU checks at other widths (512 and 1024 for the K-quant
downs a UD file carries when the width divides by 256).  Default unchanged.
2026-11-07 18:39:43 +01:00
Niko1221 5e1ea3ff6e tools/q4geo_synth.py: synthetic qwen4exp GGUFs at any shape in the type mix of an Unsloth UD file, and the geometry header of a shape or a real file; routing trace layer bound from the geometry 2026-11-07 18:16:50 +01:00
Niko1221 4041af8e6c prefill, fused_gr, expert kernels: the shape constants are read from kCompiledGeometry (values unchanged for Flash-Next) 2026-11-07 18:08:12 +01:00
Niko1221 af7759b69e geometry: the compiled shape is a header chosen at configure time (STRATA_GEOMETRY / STRATA_GEOMETRY_FILE), with the constraints every shape must meet in one place 2026-11-07 18:04:24 +01:00
Niko1221 e62f3c1ffd Retire STRATA_DF2_GATE and STRATA_DF2_ROW_MS: the calibrated DFlash2 gate (cleanup 4.5 batch D)
Removes AdaptiveGate, df2_gate_on() and df2_gate_row_ms() (window_rule.hpp), their three
sites in generate.cpp and their block in window_rule_test.cpp. The opt-in gate measured
2.7-4.9% slower; with it off (the default) the window rule is unchanged. The register
marks both retired in 0.2.13.
2026-11-07 16:28:46 +01:00
Niko1221 64fac3177c Retire STRATA_GR_Q32_PL: the pipelined HC up-read arm (cleanup 4.5 batch C)
Removes the PL=true template arm of gr_up_q8_q32_kernel (fused_gr.cu) and the three
launch branches behind STRATA_GR_Q32_PL (HIP gfx12 only; no gain over STRATA_GR_Q32_G=2).
The default instantiation is unchanged. The register marks it retired in 0.2.13.
2026-11-07 16:28:46 +01:00
Niko1221 cf0161bfb3 Give the two standalone drivers optional build targets (cleanup 4.4)
src/dsv41/sampler_stat_main.cu -> target ds4_sampler_stat (CUDA, inside the
STRATA_BUILD_DSV41 block, EXCLUDE_FROM_ALL): the DeepSeek sampler statistics
harness that the Metal engine and `strata-dsv41 --sampler-test` compile from
the same sampler_stat.inc.
src/split/tools/selftest_main.cpp -> target strata-split-selftest (HIP,
inside the split engine's CMake, EXCLUDE_FROM_ALL): the split engine's kernel
self-test on one card, with no model. Its header cited a build script in a
private test folder; it now names the target.
Both are built by name only: nothing in the default build changes.
2026-11-07 16:28:46 +01:00
Niko1221 ffb94c578c engine: on AMD that is not gfx12, a UD-Q5_K_XL / UD-Q6_K_XL style file (most expert gate/up tensors Q5_K or Q6_K) runs the K-quant MMQ prompt kernels by default (STRATA_MMQ_KQ=1; was setup's unsloth_default_env; owner yes 11-07); STRATA_MMQ_KQ=0 turns it off 2026-11-07 14:55:49 +01:00
Niko1221 567c46873f engine: on CUDA a GGUF that carries the hyper-connection projections as Q8_0 (Unsloth UD-* files) reads them as Q8_0 by default (STRATA_HC_Q8=1; was setup's unsloth_default_env; owner yes 11-07); STRATA_HC_Q8=0 turns it off 2026-11-07 14:55:06 +01:00
Niko1221 0a50eda160 engine: on Linux with every card gfx12 the chunked GDN scan is on from the first chunk (STRATA_GDN_CHUNKED=1 by default; was the launcher's GDN_STACK_GFX12; owner yes 11-07); STRATA_GDN_CHUNKED=0 turns it off 2026-11-07 14:54:00 +01:00
Niko1221 6858c919ca engine: STRATA_GDN_TC=1 and STRATA_GDN_CONVL2=2 are the Linux CUDA engine's own defaults (was the launcher's GDN_STACK_CUDA; owner yes 11-07); =0 turns each off 2026-11-07 14:53:32 +01:00
Niko1221 343b8eae6c hip prefill: the engine takes the hipBLASLt table beside it by itself on gfx1151 only (the owner's 2026-10-19 rule); another card needs STRATA_HIPBLASLT_TABLE=on; the launcher's off words are read the same way 2026-11-07 14:11:34 +01:00
Niko1221 c9abd38a7f engine: the exact parallel-request stack is the Linux CUDA engine's own default with 2 or more batch slots (was the launcher's PARALLEL_STACK_ENV); each switch keeps =0, a value you set is kept 2026-11-07 14:09:51 +01:00