Commit Graph
366 Commits
Author SHA1 Message Date
Niko1221 cc169b5ea6 prefill: Qwen4 UD-Q4_K_XL experts on the fused tensor-core kernels (q4_lite); 150+ SM sm_120 tile line; GDN scan with four tiles (off)
Qwen4-35B-A3B's UD-Q4_K_XL pairs (a Q4_K / Q5_K gate/up with a Q5_K / Q6_K down) were not covered by the fused kernels of moe_fused_iq.cu in the q4_lite build: native_supported took
only the Q5_1 / Q8_0 downs of Flash-Next, so every Qwen4 prompt ran them on the int8 dp4a kernels (nsys, RTX 5090, 4,096 tokens: i8_kernel 198 ms of 496 ms of kernel time).  The Qwen3.6 copy
of the file had its own dispatch (native_supported_ext) for the same pairs; the K-quant down instances (native_kernel<Q5_K / Q6_K, false>, 256-value super-blocks, n_ff 512) are already in
the file.  This takes them into the main copy for the q4_lite shape:

- kKqDownGeo (n_ff % 256 == 0, and not the Qwen3.6 copy): DevInfo sets the two down instances up (kqd, occ_kqd5 / occ_kqd6), native_supported takes the pair, experts_native launches them,
  and the pair counts as the wide class of the tile rule.  Flash-Next's n_ff 640 and the Qwen3.6 copy compile the code they had: the device code of moe_fused_iq.cu, of its Qwen3.6 copy and of
  every kernel of prefill/kernels.cu in a default-geometry sm_120 build is byte-identical to H11's (cuobjdump -sass per function, 74 + 78 + 66 functions; the one new function is below).
- STRATA_PF_FUSED_KQD: unset = on for a compute capability 12.0 card (measured), off elsewhere; 1 on any sm_80+ card, 0 the dp4a kernels again.
- fused_tile::Card::mid_all (STRATA_PF_S120_MID_ALL, on in the q4_lite build, wide pairs only): a 150+ SM sm_120 card (RTX 5090, RTX PRO 6000) takes the 100-149 SM mid rule, 128 rows from
  112 rows an expert.  The tile only groups routed rows: same output bits (hashes below).  Unit test: tests/prefill/fused_tile_rule_test.cpp.
- gdn_tc_scan_kernel<false, true, 3, 4> and its launch branch, STRATA_GDN_TC_TILES=4 / STRATA_GDN_TC_TILES4 (default off: an RTX 5090 ran the scan 19.9 ms against 18.8 ms with two tiles,
  4,096 tokens).  Same bits as two tiles by construction (a warp owns its columns).

Measured (UD-Q4_K_XL, --prefill auto, one engine process per arm, ABBA, medians of the requests):
- RTX 5090, CUDA 12.9, PCIe 28 GB/s, tokens / s old (dp4a) -> new: 2,048 6,051 -> 6,559, 4,096 6,801 -> 7,238, 8,192 7,397 -> 8,455, 16,384 8,079 -> 9,307, 32,768 7,955 -> 9,384.
- 4,096 tokens with the 128-row tile against the 64-row one: 7,429 against 7,014 (+5.9 %).
- Golden (36 probes, K = 256): dp4a top-1 0.97413 / KL 0.016412; fused 0.97448 / KL 0.014918 (the owner's Ultra 0.97622 / 0.013379).
- Logits of the last prompt position and 512 greedy ids: switch off = H11 bit for bit (3 real prompts of 900 / 655 / 6,144 tokens, tiled 4,096 / 5,120 / 12,000); tile 64 / 128, mid_all and four
  GDN tiles = the same bits as the default.  Fused against dp4a: the same ids until position 263 / 77 / 96 of 512 (rounding level, as the other fused pairs).

phaseA-tests/notes-q4-bw.md has the tables.  settings register and docs/SETTINGS.md regenerated.
2026-12-04 16:23:35 +01:00
Niko1221 d9edf662b2 Merge commit 'af842183d9b980131a58c6b630af24cc0b5005f4' into f-0226-q4-strix 2026-12-04 12:12:37 +01:00
Niko1221 09fce1116b Merge int-0226 into f-0226-q4-strix 2026-12-04 12:12:17 +01:00
Niko1221 e3b43127dd kv_fp8.hpp: __builtin_memcpy under clang HIP (Windows build of the QSA kernels)
kv_fp8_to_f32 / f32_to_kv_fp8 are __host__ __device__ and used std::memcpy.
clang HIP with the MSVC STL treats std::memcpy as a host-only function inside
a host-device function, so qsa_prompt_attn.cu / qsa_decode_attn.cu failed to
compile for every RDNA target on Windows ("reference to __host__ function
'memcpy' in __host__ __device__ function"). Linux builds were unaffected
(libstdc++ declares it device-callable).

STRATA_KVF8_MEMCPY is __builtin_memcpy on __HIPCC__ and std::memcpy
everywhere else, so the CUDA, Metal and CPU object code is unchanged.
2026-12-04 12:01:18 +01:00
Alexey Fateev a389331b93 qwen4-opt: sm_86 decode/prefill/MTP optimizations for Qwen4-35B-A3B on 1xRTX 3090
Ported from alesha-pro/Strata qwen4-opt 0d42d69f1a onto the q4_lite shape, every shared-code change fenced:

- the fused 256 x 8 router (native_router_topk_logits: top-8 on the logits, softmax over the 8 selected) and the router + all-resident expert plan in one
  launch (route_and_plan_256x8, resident_plan's one-warp path for up to 32 entries; sm_70+ only, Pascal and HIP keep the two-launch path)
- STRATA_QFUSE, STRATA_SMALL_UNR, STRATA_Q8_INPLACE(_MIN_OUT), STRATA_Q8_SM60_BPS as sm_86 defaults for the q4_lite build only; a QFUSE one-token window
  self-commits (it did not: #6583); the shared expert's gate row rides in the router launch for 1..4 rows (lfuse n >= 1, aux kernels)
- the 2048-wide unrolled BF16 GEMV / GDN a-b reads, Q4_K as the i8 expert down type, no drafter = one-token windows

Everything sits in #ifdef STRATA_Q4_OPT (defined for the q4_lite build only) and behind STRATA_Q4_OPT=0 at run time; the fork's edit of route_topk (Qwen3.6's
256 x 8 kernel) is a new kernel instead, so the other shapes keep their bits. Not taken from the commit: terminal/tools/qwen4_mtp_rt.py (the fork's native
Qwen4 MTP packer; community #7786 is the same tool with IQ4_NL / Q4_0 / Q8_0 experts and tests, taken in the next commit with its author).

Ported from alesha-pro/Strata qwen4-opt 0d42d69f1a
2026-12-04 11:23:24 +01:00
Niko1221 1a47ed2c80 q4_opt: the STRATA_Q4_OPT build macro, q4_lite only
include/strata/core/q4_opt.hpp and a line in cmake/strata_geometry.cmake. STRATA_Q4_OPT is defined for the q4_lite shape and for no other build, so
Flash-Next, Qwen3.6, Ling, Hy4 and Inkling compile the text they had (q4_opt_enabled() is a constant false there). In a q4_lite build STRATA_Q4_OPT=0 in
the environment switches the qwen4-opt changes off again (A/B on one binary). Carries no behaviour change by itself.
2026-12-04 11:23:24 +01:00
Niko1221 b1d001a2df Merge community PR #7784 (zacharyblasczyk): qwen4_intake q4_lite geometry checks, merged-projection layout, qwen4 pre-tokenizer, UD-Q4_K_XL fixture
Takes the contributor's two commits with authorship unchanged: qwen4_intake.py known-shape matching (q4_lite / q4_mid / q4_big / q4_deep -> component strata-<shape>), nextn_predict_layers and the MTP layer in the layout (indexer and hyper-connection nextn tensors), the merged-projection alternatives (attn_qkv_gate, ssm_beta_alpha, hc_*_down_inject) with the mixed merged/split blocker, the PLE role, the Qwen4 template hash, the qwen4_35b_ud_q4_k_xl fixture, the tokenizer ignore_merges report and family_layout.hpp's MTP block for hyper-connection shapes (the MTP layer kind exists only when the geometry has n_mtp_layers > 0, so Flash-Next is unchanged).

Conflicts resolved against what the branch already had: the qwen4 pre rule in strata_tokenizer.py was already there (Q4-GGUF), so its comment and test sentinel (qwen5 as the unknown pre type) stay and the PR's IGNORE_MERGES_PRES constant replaces the inline test, which the intake report reads. The PR's extra intake tests (qwen4 pre rule, merged/split projections, compress_ratios length and type, sibling quant mix, Flash-Next with an in-file MTP block, bad rms eps, mixed tensors) come in as they are.
2026-12-04 10:05:19 +01:00
Niko1221 65bb249ae0 Merge seankoji's fix c1b6a2cb8f: size the unfused QSA prefill rows for the compiled model
split_q and gate_attn (engine/src/prefill/kernels.cu) were hard-coded to 24 query heads x 256. On the 16-head q4_lite shape they read and wrote 1.5x the real rows (a guard overwrite) and used a 24-head gate stride. They now take the head count and head dim from the compiled geometry (new prefill/qsa_query_rows.hpp) plus a host regression test; for the 24-head shapes the arithmetic is the same as before. The unfused path runs whenever the attention gate is not fused into the attention epilogue (STRATA_QSA_FUSE_GATE=0, the kv_rot / kv_hybrid KV formats, old_attn, or a refusal of the gated kernel) and for split_q when STRATA_QSA_FUSE_NR=0. The contributor's commit and its author line are unchanged, as the owner allowed.
2026-12-04 10:04:09 +01:00
Niko1221 ad1bd480ce Merge community PR #7774 new commits (22a9714c9b..ac85058cad, saatvik-viniak)
Takes bd90b8c526 (drafting: a run config's own DFlash2 pack and tap, --draft-tap block-input), ffec4241bd (gfx12 prompt attention: pin the q.k WMMA before the trimmed store), b1f68b4beb and ac85058cad (make_profile --n-layer for the 40x256 q4_lite profile) and the two docs commits (16x128K profile, mixed workload matrix). The contributor's commits and authorship are unchanged.

One conflict in engine/src/core/verify.cpp: the Loop branch's tap_here expression (STRATA_WITH_LOOP) and the PR's block-input tap style meet at the same lines. The merge keeps the Loop code and adds the PR's !tap_block_ guard to both the Loop and the non-Loop tap condition, so the output-tap path is skipped exactly when the block-input tap (verify.cpp ~2075) is active.
2026-12-04 10:03:44 +01:00
Niko1221 9ac2b10705 Merge commit '1f18a1386f' into f-0226-q4-kv
# Conflicts:
#	engine/src/q4lite/q4_engine.hpp
#	engine/src/q4lite/q4_main.cpp
2026-12-04 09:47:51 +01:00
Niko1221 1f18a1386f Merge f-0226-q4-gguf (d0d5d573b7): packaging of the strata-q4-lite shape, gguf_reader compress_ratios made explicit
450e9c7071: build_cuda_windows.py takes SHAPE=<geometry> (additive, off without SHAPE). 355b7629c5: gguf_reader.hpp accepts the compress_ratios list "longer by the MTP layers" only where the compiled
shape has n_mtp_layers > 0 (`kMtpTail ? n_layers + n_mtp : n_layers`; behaviour was already equal, now it is explicit). d0d5d573b7: with SHAPE=q4_lite, build_cuda_linux.sh and build_cuda_windows.py
also build engine/src/q4lite, check `strata-q4-lite --version`, and ship it as the second program of the strata-q4-lite component; Linux shape builds get the RUNPATH $ORIGIN flags elf_check.py needs.
2026-12-04 09:46:54 +01:00
Niko1221 8d3f6e511c Merge f-0226-q4-prefill (c42156a88e) into f-0226-q4-hip 2026-12-04 09:33:32 +01:00
Niko1221 355b7629c5 gguf_reader: the compress_ratios "list longer by the MTP layers" is accepted only where the compiled shape has an MTP block
read_geometry accepted a compress_ratios list one entry per in-file MTP layer
longer than block_count. The accepted length is now n_layers + n_mtp_layers only
when the compiled geometry has n_mtp_layers > 0 (q4_lite); every other shape
accepts exactly one entry per layer, as before.
2026-12-04 09:28:54 +01:00
Niko1221 65bf959972 Merge branch 'int-0226' into f-0226-q4-strix 2026-12-04 09:23:56 +01:00
Niko1221 7e94c3e0c7 KV fp8: compiled only where STRATA_KV_FP8 is defined (every geometry except the default flash_next)
cmake/strata_geometry.cmake defines STRATA_KV_FP8 for the non-default geometries.  Without it: the
QsaAttnPools::fp8 member does not exist, kv_fp8_enabled() is constexpr false, the extra append / gather
kernel parameters and the mode-5 prompt-attention launch are preprocessed away, so the Flash-Next
kernels and their parameter lists are the text they were.  --kv fp8 on such an engine is refused with a
message.  strata-q4-lite and the q4_lite `strata` build have the format.
2026-12-04 08:44:31 +01:00
Codex (gpt-6.2-astra) c1b6a2cb8f [Engine] Size unfused QSA prefill rows for the compiled model
Use the compiled query geometry for both launches, their bounds, and gate strides. Verified the 16-head guard-overwrite regression and stock 24-head output on synthetic CPU fixtures. Implemented by gpt-6.2-astra high in 54c67c0ab7bcaefe2c1ed6980f3b5beb71ddf261.
2026-12-04 18:40:52 +11:00
Niko1221 b0c4b5deb9 Merge int-0226 (6795dc829a) into the Loop branch 2026-12-04 08:38:00 +01:00
Niko1221 82131a2c8d Merge branch 'f-0226-q4-core' into f-0226-q4-mtp
# Conflicts:
#	engine/src/q4lite/CMakeLists.txt
2026-12-04 08:32:20 +01:00
Niko1221 5c5b93a0b2 KV cache: --kv fp8 (E4M3 K and V, int8 pool layout, one fp16 scale per 64 values)
Additive and guarded: QsaAttnPools::fp8 and the process-wide kv_set_fp8() default to false, so every
existing kernel keeps its arithmetic.  New header kernels/kv_fp8.hpp (integer/float E4M3 conversion,
no cuda_fp8.h, so the same code runs on CUDA of every architecture and on HIP).

- kv_q8.cu: append (scale amax/448, E4M3 code) and gather read the switch.
- prefill/kernels.cu: the prompt path's kv_append kernel takes it as a parameter.
- qsa_decode_attn.cu: load8_q8 and the three V dequant sites decode E4M3 when pools.fp8.
- qsa_prompt_attn.cu: KV_MODE 5 = mode 0's fp16 shared-memory layout filled from E4M3 x scale at the
  gather; the int8 tensor-core kernels, split decode and the HIP int8 wmma are skipped for fp8.
- qsa_pattn.cu: not used for fp8 (the usual path).
- conversation_snapshot.cpp: snapshot format +32 for fp8 (an INT8 state never restores an FP8 image).
- generate.cpp: --kv fp8 (also sets the INT8 pool switch), help text.
2026-12-04 08:30:42 +01:00
Niko1221 1b0e6a2ba5 loop: the looped-core code is compiled only into the q4_lite build (STRATA_WITH_LOOP)
Every hunk that #7673 and the Loop lane added to the shared engine sources (verify, prefill, session, generate, conversation
cache / spill / snapshot / file / state, shared_expert, the Metal stub list) is wrapped in
#ifdef STRATA_WITH_LOOP <new> #else <old> #endif, so a build without the macro compiles exactly the text f-0226-q4-gguf
c3fefe0caa had (checked mechanically: the macro-off text of every file equals c3fefe0caa, the macro-on text equals the
unguarded file). cmake/strata_geometry.cmake defines STRATA_WITH_LOOP for -DSTRATA_GEOMETRY=q4_lite only; loop_adapter.cu,
its cuBLAS link, loop_adapter_test and the stub sources are added only then. Flash-Next, Qwen3.6, Ling, Hy4, Inkling, the
Metal and the SYCL builds are unchanged. Not guarded: the hip_compat cublasSgemm alias (a macro nobody expands), the Python
server flags (inert without --loop-adapter), docs.
2026-12-04 08:16:16 +01:00
Niko1221 27adf14a15 Merge f-0226-q4-loop (59d682c535): the Qwen4 Loop (2 steps) on the qwen4exp engine, CUDA, opt-in
The owner's Qwen4-35B-A3B-Loop.safetensors (strata_dual_coda_loop_v1) as an opt-in loop in the qwen4exp engine at q4_lite: --loop-adapter FILE --loop-passes 2|3 --loop-coda universal|compact. Default off; without
--loop-adapter no loop code runs. The math is pinned to the owner's trainer (03_train_dual_coda_loop.py). Scope: this Loop runs on the qwen4exp engine (the Unsloth GGUF / UD-Q4_K_XL path) with CUDA only; the owner's
.strata builds run on the standalone strata-q4-lite host, which has no Loop yet; Metal and HIP Loop are separate branches. History: the community PR #7673 (Dave3991 / Alexey Fateev, CUDA) with the contributors'
commits kept, the loader and user_args (--loop-coda is a kept user flag), the Q4-GGUF merge and the clamp.
2026-12-04 08:12:00 +01:00
Niko1221 2ca0a5a27a q4lite: MTP drafter (Qwen4-35B-A3B-MTP.strata) and greedy speculative decoding
q4_mtp.{hpp,cu}: loader (BF16 trunk widened to fp32, the 256 routed experts through the
KEXP kernels with the sidecar's own Section 3/4), the one-layer drafter (own KV cache and
indexer state through q4_attn), K = 1..3 draft chain, spec_generate_greedy.
Engine: forward() argmax_out, forward_spec / spec_commit (mixer rollback, PLE conv history
and context snapshot), streams_dev(), stream().  CLI: --mtp, --spec K, --prompts.
2026-12-04 08:10:25 +01:00
Zachary Blasczyk d42ff55e75 qwen4_intake: sync MTP indexer layout and serve test_tool_format 2026-12-04 01:04:03 -06:00
Niko1221 12561dbcb3 Merge f-0226-q4-core (6420ce855c): strata-q4-lite, the Qwen4-35B-A3B engine for the owner's .strata quants (Compact / Balanced / Ultra)
New standalone engine strata-q4-lite (shape component strata-q4-lite; engine/src/q4lite, engine/include/strata/q4lite, engine/tests/q4lite): the expert kernels (f-0226-q4-kexp lineage) and the attention mixers (f-0226-q4-attn).
Not built by default (its own CMake; engine/CMakeLists.txt, src/core and src/ling32 are untouched). The shared edits are additive and under a new switch: include/strata/kernels/gdn_pairing.hpp (new) and the
GDN kernels (fused_gdn.cu, gdn.cu, native_gdn.cu, verify_kernels.cu, prefill/gdn_chunk.cu) use STRATA_GDN_QH(head, h_k, h_v), which expands to the expression they always had (head % h_k) unless
-DSTRATA_GDN_PAIR_GROUPED is defined (Qwen4: the HF checkpoint order, repeat_interleave), so the default device code is unchanged. Compact and Balanced reproduce the owner's quant-vs-BF16 numbers on the golden (see the merge log).
2026-12-04 07:40:14 +01:00
Saatvik Viniak bd90b8c526 drafting: a run config's own DFlash2 pack and tap; --draft-tap block-input
A run config may now name its own DFlash2 drafter instead of the pinned
incoai/Flash-Next packs: "draft_model": "<path>", or
"dflash2": {"pack": ..., "family": ..., "tap": "block-input"}.

- supported_model() takes a config-named pack and lifts the model-family
  gate for that config only; pack_ready()/drafter_ready() check that exact
  file (a whole DF2P v1 pack: magic, version, an index whose tensors lie
  inside the file, and its own size + SHA-256 kept in a .ok marker); nothing
  is fetched, tuned, converted or replaced for it.  Decision.pack reaches
  decide()/apply() and an explicit --draft-model in user_args is the same
  assertion.  A config without the keys keeps the pinned flow byte-identical.
- "tap": "block-input" (or "draft_tap") adds the engine's new
  --draft-tap block-input.  The pinned packs read each target layer's
  completed output (mean of the hc streams); the RadixArk/Qwen4-DFlash2
  checkpoint and SGLang's DFLASH taps read the NEXT layer's input, after the
  hyper-connection mix and per-stream norm, before attention (vLLM captures
  it at layer+1).
- engine: core/tap_plan.hpp maps a pack's target ids to the tapped layer for
  both styles (count, per-stage share of a layer split, slot0), with a
  CPU-only test.  Verifier::set_taps(layers, block_input) captures the block
  input from the window's mixed buffer in pre() and keeps the completed-output
  tap unchanged in post(); generate.cpp parses --draft-tap output|block-input,
  refuses block-input on Metal (its window writes output taps), and ends a
  start whose pack cannot be served in block-input style rather than let the
  drafter read a short tap row.  Default unchanged.

Tests: terminal/tests/terminal/test_drafting_custom_pack.py (new),
test_drafting_pin.py now uses a whole DF2P pack, engine tap_plan_test.
Engine built with -DCMAKE_CUDA_ARCHITECTURES=70 -DSTRATA_GEOMETRY=q4_lite
(sm_70, CUDA 12.6).
2026-12-04 00:39:17 -06:00
Niko1221 910de18068 uma(gfx1151): skip duplicate host expert arena on 96/32 carve-out split 2026-12-04 07:28:02 +01:00
Niko1221 17a7b174f6 Merge f-0226-q4-gguf (c3fefe0caa): the Q4-GGUF guard commit 2026-12-04 07:06:17 +01:00
Niko1221 bfeaf60291 merge f-0226-q4-core (lead's engine, model, mixers interface) 2026-12-04 07:05:20 +01:00
Niko1221 781d9ab621 loop: strata_dual_coda_loop_v1 (the owner's Qwen4-35B-A3B-Loop.safetensors) on the looped-core mechanics of #7673
The format is read from the safetensors metadata (core 12..27, coda 28..39) and its math follows the owner's trainer
(03_train_dual_coda_loop.py): attn / mlp LoRAs (hidden -> 128 -> hidden, scale 0.25) added to the block outputs, the
cross-pass mixer R = x + sigmoid(gate) * up(silu(down(rms(m_prev - x) * (1 + norm)))), the entry of every extra pass is
the core's input state, and the coda LoRA delta is scaled by cd_omega[layer] from the first </think> token on.

New: LoopTarget::kAttn / kMlp, loop_lora_add_gated, loop_adapter_set_coda, --loop-coda universal|compact, a sticky
</think> flag (kLoopStickyClose) in the existing per-token flag vector. Without a loop adapter nothing runs.
2026-12-04 07:01:39 +01:00
Zachary Blasczyk 5ddb280956 Engine: qwen4_intake q4_lite geometry checks, qwen4 pre-tokenizer, and UD-Q4_K_XL fixture 2026-12-03 23:56:20 -06:00
Niko1221 c3fefe0caa qwen4exp: the in-file MTP tail and the qsa_pattn scalar path only exist where the compiled shape needs them
PR 7774 changed shared code for every geometry: the in-file MTP layer-count
check was dropped from compiled_geometry_mismatch, nextn_predict_layers was
read and subtracted from block_count for every qwen4exp file, and the
qsa_pattn float4 weight loads were replaced by a scalar loop.

Now those paths depend on the compiled geometry: a shape with n_mtp_layers > 0
(q4_lite) reads the key, subtracts the tail and does not compare the MTP
count; every other shape (Flash-Next and the other q4 shapes) keeps the code
it had, including the three float4 loads at G = 12 and the old error text.
2026-12-04 06:56:09 +01:00
Niko1221 613f42346e Merge refs/pr/7673 (e3f62bfe9c, Dave3991 / Alexey Fateev): looped recurrent-core adapter mechanics for the qwen4exp engine (CUDA) 2026-12-04 06:54:18 +01:00
Niko1221 a4f5be2c0d Merge refs/pr/7774 (22a9714c9b, saatvik-viniak): Qwen4-35B-A3B on the qwen4exp engine at q4_lite
Community PR taken with the contributor's commits and authorship unchanged:
the 41-block file (trunk = block_count - nextn_predict_layers), the GGUF
trunk-view splitter, the qwen4 pre-tokenizer, qsa_pattn G from the geometry,
the MTP sidecar runtime, and the docs/bench results.
2026-12-04 06:51:48 +01:00
Niko1221 a20c3b9738 GDN kernels: STRATA_GDN_PAIR_GROUPED switch for the q/k head pairing (additive)
New include/strata/kernels/gdn_pairing.hpp: STRATA_GDN_QH(head, h_k, h_v) is head % h_k (the expression every kernel had)
unless -DSTRATA_GDN_PAIR_GROUPED, which gives head / (h_v / h_k), the HF repeat_interleave order of Qwen4.
Used at the pairing sites of fused_gdn.cu, native_gdn.cu, gdn.cu, verify_kernels.cu and prefill/gdn_chunk.cu.
Default builds are unchanged.
2026-12-04 06:51:04 +01:00
Niko1221 34973822be q4lite: Qwen4-35B-A3B .strata manifest/file reader, GPU model loader, glue kernels, PLE hash
New standalone engine directory engine/src/q4lite (Ling-family, no change to src/ling32 or src/core):
manifest parser, Q4File (reader + expert directory check), GpuModel (trunk arena + resident experts),
hyper-connection / router / shared-expert merge / PLE kernels, PLE n-gram hash.
2026-12-04 06:48:42 +01:00
Niko1221 87a7e7ec7d Inkling CUDA: the hybrid lane probe keeps the CPU pool under the container quota and decides on the best round with a 0.95 margin; the FP8 one-token step uses the tensor-core attention by default from 64K
1. Cold-expert lane probe (hybrid starts). A rented RTX 3070 8 GB (SQ-20, container CPU quota of 15.36 CPUs on 32 visible CPUs) showed the 0.2.25 rule on the edge: CPU lane
67 to 72 ms against 79 ms for the copy-in lane (ratio 0.87 to 0.91 against the 0.9 line); one start in eight crossed it (COPY lane, 11.7 tok/s instead of 16), and the 16 spinning
worker threads were more than the quota allowed. Now: the worker pool of the CPU lane stays below the container's CPU quota (one CPU left for the main thread; no quota = no change;
STRATA_INK_THREADS still wins); the rule compares the best of three rounds of each lane and gives a noisy lane (slowest round 25 % over its best) three more rounds; the CPU lane
is kept below 0.95 of the copy-in lane's time (kCpuClearlyFaster, was 0.9). The log has one more line with all rounds. Measured (8 alternating fresh starts each, same card, SQ-20 hybrid,
drafter off): 0.2.25 7 CPU lane at 15.6-16.3 tok/s and 1 COPY lane at 11.7; this change 8 of 8 CPU lane, CPU reading 57.5-63 ms, 17.8-18.7 tok/s (+13 %). RTX 5070 (owner PC, SQ-10):
6 of 6 copy-in lane quiet and 6 of 6 with 12 busy background processes, 71-74 tok/s, unchanged. ink_cold_lane_test covers the 5070, 3070, A4000 and 145 ms cases.

2. Tensor-core attention default (worker B's numbers, PR2 of 0.2.25 left it opt-in). The one-token decode step (no tree, no chain, M = 1) of an FP8 K/V whose capacity is at least
65536 positions runs through ink_attn_tc.cuh on a card whose set does not carry TC_ATTN, when it is not COMPACT, one slot, sm_80 or newer, and no drafter is loaded (a drafter's
12-row verify lost 4 to 6 %). K8V8 / K8V4 stay opt-in (STRATA_INK_TC_ATTN_KV8=1), a card whose set carries TC_ATTN is unchanged, the memory plan only grows by the scratch the part
already needs. STRATA_INK_TC_ATTN_DEFAULT=0 takes the rule out (register entry, docs). Measured on the RTX 5070 (old non-COMPACT plan, SQ-10, FP8, same exe rule on/off and the
0.2.25 exe, alternating): 128K decode 45.3 / 45.2 against 41.5 / 41.5 tok/s (+9 %), 32K 59.6 / 59.4 against 59.7 / 59.5 (no change below the floor), greedy tokens identical to
0.2.25 on prose, doc32k and doc128k (2 of 2 rounds). CTest gates on the 5070: default, kv8, minctx and the new rule gate (FP8 only, M = 1 only, nothing below 65536 positions).
2026-12-04 04:10:29 +01:00
Saatvik Viniak 8edd104839 qwen4exp: read nextn_predict_layers in the artifact guard
read_geometry took block_count at face value, so Qwen4-35B-A3B's 41 blocks (40 trunk + the in-file MTP block)
were compared against the compiled 40 and refused - including when the same file was only the --ple-gguf source.
Derive the trunk (block_count - nextn_predict_layers), and let compress_ratios list either the trunk or the
blocks.  The kernels never see the MTP tail.
2026-12-03 21:05:21 -06:00
Saatvik Viniak 3e862df6e8 qwen4exp: an in-file MTP block is file layout, not a kernel shape
compiled_geometry_mismatch compared n_mtp_layers, so a q4_lite build (declaring the
published file's blk.40) refused the 40-block trunk view and vice versa.  The kernels
do not see the MTP block; the trunk is what they run.  Drop the comparison (as with
n_expert/top-k, which are runtime values).
2026-12-03 20:59:27 -06:00
Saatvik Viniak 89561aaaf1 qwen4exp: support Qwen4-35B-A3B (q4_lite) in the engine and packer
The published Unsloth Q4_K_M GGUF is the same architecture as Flash-Next but
a new shape: 40 trunk layers (plus an in-file MTP block, nextn_predict_layers=1),
hidden 2048, 16:2 query/KV heads, 30 GDN + 10 QSA layers, 256 experts top-8,
ff 512, hyper-connection low rank 256, and 1M native context.

- q4_lite: declare the in-file MTP layer (n_mtp_layers=1) so the geometry reads
  block_count 41 as 40 trunk layers.
- geometry_from_gguf: read nextn_predict_layers for every family.  Flash-Next
  files do not carry the key, so they keep n_mtp_layers=0.
- qsa_pattn: derive G (query heads per KV head) from the compiled geometry
  instead of pinning 12, and build the per-cell weight vector without reading
  past a shorter row (G=8 on this shape).
- iq_pack: split the official GGUF's merged tensors (attn_qkv_gate,
  ssm_beta_alpha, hc_*_down_inject) into the engine's layout, in llama.cpp's
  order (src/models/qwen4exp.cpp); exclude the in-file MTP block from
  native_experts.txt (the trunk is 40 routing layers).
- strata_tokenizer: recognize tokenizer.ggml.pre 'qwen4' - qwen35's split rule
  with ignore_merges on, as llama.cpp reads it.
2026-12-03 20:51:41 -06:00
Niko1221 8c8ed5cd0b scratch: + KDA scan 2026-12-03 03:59:50 +01:00
Niko1221 a521ae94e0 ling32 sycl: per-kernel profiling build (-DSTRATA_SY_PROFILE: sy::launch records every kernel by caller:line, totals printed at exit; compiled out by default) 2026-12-03 03:39:58 +01:00
Niko1221 64e49101d5 Merge f-ling32-int (de6f7bb0d4): k=2 prefetch default for the tier B pool layout 2026-12-03 02:47:47 +01:00
Niko1221 de6f7bb0d4 ling32 tier B pool layout: k=2 prefetch predictor by default
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.
2026-12-03 02:41:04 +01:00
Niko1221 3bdcefe4d2 Merge f-qfn-b70 (aa7379dac8) into int-0225
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.
2026-12-03 02:14:43 +01:00
Niko1221 633631b7db Merge f-ling32-sycl (920badbe8a): SYCL port of prune_experts so strata-ling32 links on Intel 2026-12-03 02:11:30 +01:00
Niko1221 577f851f00 Merge f-ling32-prod (7c95c85fce) into int-0225
Ling on Intel ships (SYCL_ENGINE_SHIPPED = True), with L32-SYCL's f-ling32-sycl efddd28358 and L32-CUDA's f-ling32-int ed115c6300 / 78a15b86bd (via f-ling32-prod); GUI-LING's map-experts fix b9e7b3e2b1 arrives as the same change (2f6b1cc5b8), merged cleanly. Conflicts: terminal/data/settings-register.json and docs/SETTINGS.md: three-way merge of names and hand-kept fields from both sides, regenerated with tools/settings_register.py (check clean, no empty status), docs/SETTINGS.md regenerated with --docs.
2026-12-03 01:33:39 +01:00
Niko1221 ed115c6300 Merge commit 'efddd28358' into f-ling32-int 2026-12-03 01:07:58 +01:00
Niko1221 bc07468544 Merge commit 'efddd28358' into f-ling32-prod 2026-12-03 01:07:31 +01:00
Niko1221 ba2ed8d2a5 ling32 sycl tier: cudaFree lowers the shim's free-memory estimate, int's lazy-KV and MTP-auto regressions in the SYCL ctest block, tier suite script
- sycl_compat: every cudaMalloc block's size is tracked so that cudaFree (the tier store's lazy-KV give-back) raises the cudaMemGetInfo fallback (no driver query on Windows) again
- CMake: ling32_mtp_auto_regress and ling32_kv_grow_regress in the SYCL block
- l32sy_tiersuite.sh: build, 11 tier shapes on the narrow and wide fixture, the tier regressions, every spec-span leg in one job
2026-12-03 00:05:51 +01:00
Niko1221 d31625ca6f Merge f-ling32-int (217f218bb0) into int-0225: HIP stub for volta_extra_smem, corrected --mtp-auto rule 2026-12-02 23:43:48 +01:00