Commit Graph
18 Commits
Author SHA1 Message Date
Robert KarlandClaude Fable 5.1 22d72e69e7 pool: the native-pack rows at the layer's widths, not the canonical FF / H; the served model's name from its file
Every verify window with an expert miss computed on the CPU decoded to
token 0 ("!!!!") on both Qwen3.6 files: the first serve of the Q4_K_XL
pack at 262,144 context (9,980 of 10,240 experts resident) and IQ3_XXS
under any --vram-cap.  Found by elimination on the 4090: all-resident runs
were correct at every context and KV format, --pcie-frac 1.0 (misses by
DMA, computed on the GPU) was correct, --pcie-frac 0 (misses on the CPU)
was wrong with ggml's plain dot products, with one pool worker and on the
IQ3 file alike.

ExpertPool::run_split_multi_native split its gate/up and down phases over
FF (640) and H (2560) rows per expert, the canonical Q2_0 pack's widths
compiled into expert.hpp, while a native layer's NativeFmt carries its own
n_ff / n_embd (512 / 2048 here): the down phase wrote 512 rows past every
output row into the next token's, the gate/up phase read 128 rows past
each expert's block.  The phases now take the layer's widths; native_fmt
refuses a layer wider than the pool's SplitBufMulti buffers (H x FF).

tests/core/pool_native_widths_test: three Q8_0 experts at 2048 x 512, four
tokens, the pool's rows against the kernels called directly, bitwise
equal, and a guard after every output row.  It fails on the old row
counts (the guard) and passes now.  After the fix on VM 221: Q4 at 8K with
forced CPU misses 328 tok/s correct, Q4 at 262,144 by default 322 tok/s
correct, IQ3 at 262,144 under --vram-cap 11264 (5,762 slots, 56%) correct
at 169 tok/s; the Qwen3.6 and native-expert ctest subset 32 of 32.

The front end reported every model as "qwen3.8-flash-next-iq3_xxs"; the
id is now the GGUF's base name without a shard suffix.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-12 19:42:41 -07:00
Robert KarlandClaude Fable 5.1 c77631ebba Qwen3.6 step 3: the split-K bound applies to dense shapes only; a sparse shape keeps one block per 64 cells at any capacity
The MTP drafter's ring runs qsa_decode_attn_batch at its --mtp-window (32,768 by default: 512 blocks), so the 128-block cap had moved Flash-Next's drafter onto the online-rescale kernel with another summation order and a smaller scratch. qsa_decode_attn_chunks(cap, s) and the scratch take the shape: sparse keeps ceil(cap / 64) blocks and the old formula, dense is bounded at 128; below sm_75 every sparse shape runs the single-chunk kernel, so Flash-Next's path is the previous kernel, grid and scratch bit for bit at every capacity. The test holds sparse 32,768 -> 512 blocks and the old scratch; the notes state the drafter's case.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 13:50:45 -07:00
Robert KarlandClaude Fable 5.1 99c7614a01 Qwen3.6 step 3: one QsaShapes builder (strata/core/qsa_shapes.hpp); dense = the three indexer widths zero, in qsa_dense and the kernels' guard alike
verify.cpp's and mtp.cpp's hand-written builders copied the geometry's two zeros and kept qsa_real_shapes()'s idx_top_k 2048, a shape that was neither sparse nor dense: qsa_dense said dense, the kernels' guard said "not set up" and exited at the window's first kv_append. The builder is now one inline function used by layer, verify and mtp (session and prefill follow in [shared] commits), qsa_dense tests all three widths, and qsa_shapes_valid (non-exiting, what validate() prints and exits on) refuses a half-set shape by name. The parity test builds the shape through the builder for a qwen35moe and a qwen4exp geometry and holds the half-set one as the negative.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 13:50:26 -07:00
Robert KarlandClaude Fable 5.1 77983af4a4 native_expert_parity: the GPU bound is the tolerance policy's 2e-2; the CPU and CPU-vs-GPU rows get their own
GPU against the float reference: 2e-2 (oracle-crosscheck.md: the Q8 oracle's ffn_moe_out max 5.3e-3 with the 4x
margin; Qwen3.6's five pairs measure 9.7e-3 to 1.3e-2), 3e-2 only for a pair with a Q5_0 role (q4_K/q5_0 measures
2.7e-2 at 2560 x 640, the pair the CMake note already describes).  CPU against the reference stays at 3e-2: ggml-cpu
rounds the activations to Q8_K, one scale per 256 values against the GPU's q8_1 per 32 (measured up to 2.2e-2).
CPU against GPU, printed but never gated before, gets 4e-2 (both roundings, measured up to 2.4e-2).  Each line prints
its bound.  RTX 4090: 15 of 15 ctests, both real files at layers 0 / 34 / 39, q4_K/q5_0 and q5_0/q8_0 pass.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 13:22:50 -07:00
Robert KarlandClaude Fable 5.1 973303cfb5 Qwen3.6 step 3: the single-chunk pre75 kernel kept for capacities under 8,192 cells, and the step3-attn notes
On sm_61 the looped kernel costs 16-28 registers over PR #540's body (80-92 at G 12 against 63-64) and 13-17% on the Q4_0 pool at short widths; a register cap spilled and cost every format more. So a capacity under kMaxChunks x 64 runs attn_chunk_kernel_pre75_single, the old body with G and the null-ids identity: every Flash-Next state (cap 2,051) is the old kernel to the instruction (interleaved A/B on the 1080 Ti: 42.0 vs 41.0-41.7 us fp16, 38.9 vs 38.9 INT8, 40.8 vs 41.0 Q4_0), and the looped form runs only for the dense model's long-context states, where it is ahead (419 vs 493 us at 32,768). The notes carry the layout, the harness, the tolerances and both cards' numbers.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 12:54:17 -07:00
Robert KarlandClaude Fable 5.1 a711e8d6b3 Qwen3.6 step 3: the KV kernels accept the dense shape, the prompt kernels write only G rows, the parity test reads the oracle's #2 names
qsa.cu's geometry guard demanded indexer widths; a dense shape (idx_n_head, idx_dim, idx_top_k all 0) passes it for the KV, gather, attend and gate kernels, and the indexer's own entry points refuse it by name (validate_indexer). The MMA prompt kernels wrote accumulator rows 0..7 unconditionally, which at G = 2 overwrote the next KV head's output; the rows are guarded by G. The scratch bound is 528,448 floats (2.02 MiB) at 16 heads, not the 2,080,832 the first wording said.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 12:54:17 -07:00
Robert KarlandClaude Fable 5.1 77b8035fa3 kv_hybrid_parity: the prompt-kernel case skips below sm_70 instead of failing
qsa_prompt_attn_batch refuses cc < 70 by design (no mma.sync) and prefill takes the batched decode kernel there, which case [4/4] already holds to the same reference; the Pascal pass counted that refusal as a failure.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 12:54:17 -07:00
Robert KarlandClaude Fable 5.1 994d0dcbe8 Qwen3.6 step 3: qsa_dense_parity (host reference in four KV formats, the oracle's attention seams at G 8/12/2, the negatives) and qsa_attn_bench
The fixtures (cmake/qwen36_attn_fixtures.cmake) are the synthetic qwen35moe GGUFs at head_dim 256 for 16/2, 24/2 and 4/2 with ref/qwen36.py's dumps on 40 tokens; the test runs the dumped q/k/v through the engine's norm, RoPE table, fp16 append, decode kernel and gate and holds them to Qcur-3, Kcur-3#2, kq_soft_max-3, kqv-3, attn_gated-3. Negatives: the gate skipped, adjacent-pair RoPE, the GQA map h % n_kv, G = 12 on 16 heads, the sparse width 2,051 on 3,000 cells. qsa_attn_bench uses only the pre-step-3 entry points so it builds against the old kernel too.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 12:54:17 -07:00
Robert KarlandClaude Fable 5.1 7fe016ed72 Qwen3.6 step 3: the prompt attention kernels take G as a template parameter (2/8/12) and a null ids as the identity
The MMA tiles are 16 query rows, so every G <= 16 pads with zero rows as 12 did; the host picks G from the geometry and falls back to the decode kernel (which refuses by name) for any other ratio.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 12:54:17 -07:00
Robert KarlandClaude Fable 5.1 aab15eea39 Qwen3.6 step 3: dense decode attention - G templated at 2/8/12, a null ids as the identity, the split-K scratch bounded at 128 blocks per KV head
The decode kernel gathers through ids and the page table, so dense attention (no indexer) is the identity selection: a null ids is it, with the width n_kv from the step (qsa_dense: idx_n_head == 0; qsa_selection_width returns n_kv, qsa_selection_cap the state's max_cells instead of the 2,051 every caller spelled out). G, the query heads per KV head, was a literal 12; it is a template parameter now, picked by qsa_attn_group from the geometry and refused by name for any other ratio (qsa_attn_group_check: G = 12 asked of 16 heads is a message, not a mis-indexed run). The split-K partials grew with the capacity (64.5 MiB per query row at 262,144 cells): the grid is capped at 128 blocks per KV head and a block walks its span in 64-cell sub-chunks with the running (m, l, acc) rescale; the span comes from the token's width on the device, so up to 8,192 cells it is the old grid and the old arithmetic bit for bit.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 12:54:17 -07:00
Robert KarlandClaude Fable 5.1 9f33a93a99 native_expert_parity: the negative control's gate scales with the block's share of the row; the blob restored after it
The sign flip of one 32-value block in a 640-wide down row moved the row by 8e-3 to 1.4e-2 relative on the RTX 4090
(one of 20 blocks), under the 1e-2 the brief states for Qwen3.6's 256-value blocks of a 512-wide row.  The gate is
now 1e-2 x (block values / 256) x (512 / n_ff), printed with the measurement; the locality half (no other row moves
by any bit) is unchanged.  The corrupted blob is copied back before the decode-once and dequantizer checks, which
read the device blob (they compared the corrupted gate row and failed every pair).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 12:27:10 -07:00
Robert KarlandClaude Fable 5.1 0d13f41287 native experts: IQ3_XXS, Q5_K and Q6_K down projections, Q6_K gate/up (Qwen3.6-35B-A3B's expert formats)
The grouped down kernels were generic in Fmt<T> but STRATA_D_FMTS listed only the 32- and 64-value types plus IQ4_XS,
so native_expert_supported refused every layer of both Qwen3.6 files: UD-IQ3_XXS's IQ3_XXS down (37 layers) and
UD-Q4_K_XL's Q5_K (37) and Q6_K (34, 38, 39).  IQ3_XXS and Q5_K join the down list; Q6_K gets llama.cpp's
vec_dot_q6_K_q8_1 (VDR 1, dp4a) and dequantize_q6_K transcribed, Fmt<14>, and a place on all three lists plus is_iq
and iq_row_bytes (the prompt path's fp16 dequantizer).  A 256-value down type needs n_ff % 256 == 0, which
native_expert_supported already checks: Qwen3.6's 512 passes, Flash-Next's 640 is still refused.

Harness: native_expert_parity takes --geom HxFF and gains the negative control (e): the sign byte of one block's fp16
scale flipped in one down row must move that row's GPU output by more than 1e-2 relative and no other row by any
bit, and the same in one gate row must move the output by more than 1e-4.  Five Qwen3.6 pairs run as ctests at
2048x512, q6_K/q8_0 at 2560x640, and q4_K/q6_K at 2560x640 is the refusal (WILL_FAIL).  native_grouped_parity adds
Q6_K and the three down types to its bitwise v1 sweep, the five pairs at 2048x512, and --bench-down (the down kernel
alone per expert, the step-5 budget).  iq_multi_parity adds the IQ3_XXS down pair at 1024x512.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 12:27:10 -07:00
Robert KarlandClaude Fable 5.1 ad2be2cc26 router_top10_parity at 256/8 and shared_expert_parity at 2048 x 512 on the native Q8_0 path
The router harness runs its five fixtures at both 512/10 and 256/8 (random, all-equal,
12-way tie wider than k, a tie of exactly k scattered through the range, dominant expert)
and asserts the 2^-14 clamp unreachable at both (8/256 is 512x the clamp).

The shared-expert harness adds Qwen3.6's shape: 2048 x 512, Q8_0 projections through
native_mmvq with Q8_1 activations and the native BF16 scalar gate, against a host reference
written from the block layouts (9.6e-8 relative); the silu-on-up reading and the skipped
gate as negatives (83%, 272%); shared_expert_multi bitwise the per-token call; and the
output moved by rounding the F32 gate weight to BF16 reported (2.5e-4), not asserted.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 12:18:08 -07:00
Robert KarlandClaude Fable 5.1 e63b61e10c qwen36_seam_parity: the decode GDN, router and shared-expert kernels held to the oracle's seams
cmake/qwen36_oracle_dumps.cmake writes k.gguf (2 k-heads / 4 v-heads of 128, 256 experts
top-8, shared expert 512 in Q8_0, BF16-exact gate weights) and runs ref/qwen36.py on the
11-token "hello world" sequence in F32 and --act-quant q8 modes; qwen36_seam_parity reads the
fixture and the dumps and holds, by llama.cpp's cb() names:

- conv_output_silu-0, new_state-0, final_output-0 through the legacy, pinned native and
  fused decode paths token by token with the state carried, and through the verify window's
  multi-token kernels over two windows (8 + 3) with commits; the fused path also at
  q/k_conv_predelta-0, gate-0, beta_sigmoid-0.  Worst 2.3e-7 against 8e-5 (gdn_out class).
- ffn_moe_topk-0 identical and ffn_moe_weights_norm-0 at 6e-8 from the oracle's logits.
- ffn_shexp_gated-0 on the native Q8_0 path with the 1-D BF16 scalar gate at 3.5e-7 against
  the Q8 oracle (1.2e-2 against the F32 oracle: the activation rounding); shared_expert_multi
  bitwise the per-token call.
Negatives through the kernels: the sigmoid gate (126% at final_output-0), the un-normalised
router weights (24%), the shared gate skipped (52%).  Exits 77 without the fixture.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 12:18:08 -07:00
Robert KarlandClaude Fable 5.1 5c6eb91ca8 GDN output gate selectable per model: SiLU(z) for qwen35moe, sigmoid(z) kept for qwen4exp
Qwen3.6 closes the GDN layer with rms_norm(o) * ssm_norm * SiLU(z) where Flash-Next uses
sigmoid(z) (study 3.2, inventory row 39; the oracle's negative control puts the two 1.07
relative L1 apart).  `kernels::GdnGate` names the choice and every decode output kernel
takes it as an argument: `gdn_out_norm` (legacy), `fused_gdn_step_norm` (the default native
decode), `native_gdn_out_norm` (pinned unfused), and the verify window's
`gdn_step_norm_multi`, which must stay bitwise the fused kernel.  The sigmoid arithmetic is
unchanged; SiLU is ggml's op_silu form z / (1 + exp(-z)).  No global: the layer passes
`ModelGeometry::gdn_gate()` (next commit).

gdn_parity now runs the recurrence at both geometries, 16/48 (VPK 3, sigmoid) and 16/32
(VPK 2, SiLU), through all four implementations, checks the verify kernel bitwise against
the fused one (verify, commit and split-commit paths), and makes the wrong gate a negative
case through each kernel itself (86-125% apart), beside the existing four traps.  The
harness uses a blocking stream: its first version raced its own pageable memcpy resets on
a non-blocking stream and reported the native kernels 7.5x off at one geometry.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 12:18:08 -07:00
Robert KarlandClaude Fable 5.1 1d2e400920 Qwen3.6 step 2: the native expert layout takes the model's widths; the engine reads the geometry before the layout
expert_layout_load(pack, n_layers, n_expert, n_embd, n_ff, err): each layer's NativeFmt is built with
the model file's widths instead of the compile-time 2560/640 (geometry-inventory.md row 108), and a
pack without native_experts.txt (the canonical Q2_0 form) is refused for any other geometry.
generate.cpp reads ModelGeometry from the --native file before the layout load, logs it for a
non-Flash-Next file, refuses the fused tensor forms by name, takes the router k and the embedding
dims from it, and reads the rope keys under the file's own architecture prefix.

tools/iq_pack.py: --layout-only writes native_experts.txt alone and prints the census; the draft
(nextn) block of an -MTP file is left out of the trunk layout; fused ffn_gate_up_exps refused;
FORM carries qwen35moe's attn_norm / post_attention_norm / output_norm (F32 as stored).

tests/data/native_experts/qwen36-{iq3_xxs,q4_k_xl}.txt from the real files (40 x 256; 10,594 and
18,726 MiB, mean blobs 1.035 and 1.829 MiB, as censused in docs/QWEN36-35B-A3B.md), and
expert_layout_test loads them at 2048 x 512 with every layer's types (IQ4_XS down on 34/38/39;
Q6_K down on 34/38/39, Q5_K gate/up on 39) and sees them refused at 2560 x 640.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 09:48:22 -07:00
Robert KarlandClaude Fable 5.1 9a53e42de4 Load from slow or remote stores: retrying reads, n-gram table in its own memory, container thread default
A RunPod network volume (S3-backed FUSE) refuses reads now and then with
ENOMEM or EIO, which made the expert load fail at start.  The new
strata/platform/robust_read.hpp retries such reads, halves the number of
parallel readers while the store refuses and raises it again afterwards.
The expert loader reads through it, prints progress, and names the file,
offset and error on failure.  --ple-io ram now reads the n-gram table into
anonymous memory with 16 readers instead of locking the file mapping, which
needs ulimit -l and faulted pages back from the store.

The front end's default thread count comes from the container's CPU quota
when there is one: a pod showed 256 host CPUs with a 32-CPU quota.

Verified on a 3090 pod: the model loads in normal mode straight from the
volume in 12 minutes, through two refused reads; from local disk in 19 s.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-05 21:17:37 -07:00
Robert KarlandClaude Fable 5.1 12a7825605 Import Strata at 6f32ec0 (upstream snapshot, unmodified)
Source: https://github.com/Niko1221/Strata, commit 6f32ec070f23ced9f50e704d854d775da52591ab
(engine 0.1.39, MIT). Every file is as upstream published it; later commits
show exactly what this fork changes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-04 12:55:44 -07:00