Rewrite the 5090 server model paths in 30 repo files (scripts, tools, docs) from the old
locations (/home/para/leleka-gates, $HOME/leleka-gates, /data/models) to
/home/para/work/leleka/models/..., add the AGENTS.md workspace rule and the move record
docs/experiments/models-move.md. Not merged: the smoke test is pending.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The draft step attends over the 32,768-cell MTP window (512 chunks, one query): with the opt-in, the Original chunk kernel and chain_qsa_decode_merge_n of that
step become sm120_attn_daily.ptx's leleka_qsa_decode_chunk_daily / leleka_qsa_decode_merge_v2 (module slot 22 after the chain slot; the window_ids pre-launch
keys on the new chunk entry too). sm120_probe `attn512` byte-compares the pair against the Original on the draft shape and times them; it has not been run
yet (no GPU slot), so the switch stays default off.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Confirmed against the C++ in engine/strata and fixed:
- rust_native_general.rs group_dot_bytes_policy omitted the `gu == 23 && !avx512` multi-token branch of
native_expert.cpp native_gu_rows (`nt >= mt_min && (iq512_supported || (!cpu512 && iq256_supported))`);
rust_pool.rs had it since STRA-324. The choice is now one function, gu_multi_route, shared in shape with the
pool. Regression: a differential test (re-runs itself with STRATA_FORCE_AVX2=1 on an AVX-512 CPU) fails
with a 1-ULP difference on the old code, plus a routing-table test.
- rust_legacy.rs row256 (STRATA_CPU_YMM=1 on an AVX-512 CPU) now fuses `corr += d*(hx0+hx1)` like expert.cpp
row_dot (line 242) and row_dot_multi (line 294) under GCC -mfma. Regression: scalar model, fails on old code.
NOT changed, unconfirmed (need the pinned ggml source, which is not in the repo): rust_kq.rs small_dot
`sums += m*s`, rust_k_blocks.rs mins_sum, rust_ggml_extra.rs iq1 scalar.
KAB1: new `--cases ext` (72 cases; the 40 of `all` are untouched) adds token counts 4-7 for the row-type list
and IQ2_XXS / IQ2_XS at 1..8 tokens; GateUpFormat gains Iq2Xxs / Iq2Xs (additive; the runtime still admits only
18/21/22/23/42). The C++ driver edits are list-only and were NOT compiled here (no ggml). 16 tokens exceed MAXT
and the KAB1 header and are not covered. New Rust-only test token_count_invariance: the first two tokens of a
group are bit-identical for groups of 2..8 tokens on all 14 gate/up x down pairs.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Replaces window_moe_gu_<T> + swiglu_entries_kernel + quantize_q8_1_kernel of every routed-expert group launch (VRAM and PCIe tier) by one launch of upstream's
native_gu_swiglu_kernel (16-lane sub-warp rows, gate and up row at once) for the gate/up types 16 17 18 21 22 23 at n_embd 2560, n_ff % 32 == 0; every other
format keeps the three-kernel plan. New sealed asset sm120_gu_swiglu.cu (group sm120-decode) textually includes sm120_iq_prefix.cuh, the pinned
iq_kernels.cu up to the dequant banner (generated and checked by scripts/decode-sm120/make_iq_prefix.py; the whole file would instantiate 24 MB of PTX).
Kernel parameter: upstream's 88-byte NativeExpertLayout (the window's 64 bytes + tail_off, had_block, d_signs = 0).
Switch: policy.gu_swiglu, resolved at window recording from the card (cc 12.0), LELEKA_SM120_PERF=0 and LELEKA_SM120_GU_SWIGLU=0|1.
Model-free probe (tools/decode-sm120/sm120_probe.cpp gu, RTX 5090): the q8_1 blocks the down kernel reads are byte-identical to the old three-kernel path in
30 cases (types 16 17 18 21 22 23, 1-8 rows, 1-40 groups, 1-7 entries a group, random blobs with valid block scales); per layer at 4 rows 20.9 -> 14.2 us (16),
29.8 -> 20.7 us (18), 24.9 -> 19.6 us (21), warm L2. Types 29 and 42 are not probed and not routed to the new kernel. Not yet measured end to end.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Ports engine/strata qsa_decode_attn.cu attn_chunk_kernel_pre75<mode 1, NC 2> and attn_merge_v2_kernel<16> as sm120_attn_daily.cu (new sealed asset,
group sm120-decode) and selects them in QsaWindow::decode_attention when policy.qsa.attn_daily is set. The policy bit is resolved at window recording
from the card (cc 12.0), LELEKA_SM120_PERF=0 (whole set off) and LELEKA_SM120_ATTN_DAILY=0|1 (wins in both directions, any card).
Model-free probe tools/decode-sm120/sm120_probe.cpp on the RTX 5090: chunk partials, merge(old) of both partial sets and merge_v2 are byte-identical to
the sealed Original kernels on 66 cases (T 1,2,4,5,6,8 x n_ids 2051..0, masked pages, two score ranges). Per call at T=4: chunk 29.8 -> 20.3 us,
merge 6.5 -> 2.9 us (warm L2, graph-timed); 12 QSA layers per window. Not yet measured end to end.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
kab time: monotonic ns + TSC slices with a dependent-add clock calibration before and
after each slice (tq_cpu_parity --bench method; slices whose clock moved >5 percent are
dropped, threshold from tq_cpu_parity.cpp:303), RESIDENT and STREAMED regimes, pinned
single-thread pool, 4096-aligned buffers, manifest and case input hashes, effective
environment. aa.sh: seeded schedule, N rounds of two fresh processes, per-round ratios
only. time_smoke.sh runs the acceptance commands. Only tools/kernel-ab/ is touched.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
KAB1 files-only exchange: kab gen writes case-<id>.in (64-byte header, synthetic
blocks), runs the unchanged engine/strata CPU expert kernels for tree avx512 and
tree avx2 (two scrubbed child processes) and writes case-<id>.cpp-<tree>.out and
manifest.json last (tmp + rename, sha256 + length of every file, provenance).
verify_manifest.py (stdlib, Python >= 3.9) implements the reader rule with exit
0/1/2. The build is a Makefile over the pin's translation units and the pinned
ggml 3cf03257f (no cmake on the server; flags transcribed from the CMake files,
make check-pin detects drift). kab poolcheck proves the stage composition equals
the real ExpertPool bitwise. The time mode is STRA-317.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The sealed chain_window assets conflicted: bringup sealed a new chain_window.ptx (entry chain_gr_down_t2w8_nb4, c9ccd81) while upstream-p0
clamped the q8_1 scale and sum in the opt-in chain swiglu+quantize entry (4654f01, plan row 1.1). Resolved from the bringup sealed file:
only chain_swiglu_quant_kernel was replaced (scripts/q8/splice_ptx.py), every other byte stays as sealed; the entry text is byte for byte what
scripts/q8/rebuild_quantizer_ptx.sh compiles from the merged chain_window.cu (nvcc 13.2.86, checked on the server).
Regenerated, not merged by hand: the pin in original_verify_window_chain.rs (scripts/q8/repin.py), and the sm_86 companions, MANIFEST.json and
sm86_table.rs (scripts/gpu-bringup/sm86_assets.py build: 132 companions, check OK). The six other quantizer PTX and their companions equal
upstream-p0's. docs/upstream-port-plan.md: rows 0.1-0.5, 1.1, 1.2 from upstream-p0, row 0.6 from bringup, merge note on row 1.1.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A q8_1 block stores d = amax / 127 and the sum of its 32 activations as fp16: one massive activation (amax > 8.3 M, or a sum past 65504)
rounded to inf and the dot products then read inf * 0 = NaN (NonFiniteMmqOutput here, "!!!!" upstream). The quantizers now clamp both
to the largest finite half and keep the codes inside int8 (strata/kernels/q8_1_finite.hpp); a NaN input still gives a NaN sum.
Finite blocks are stored bit for bit as before.
Sites: head_quant (mtp_original_full_head_native, native_head_native), mtp_original_quantize (mtp_original_tail, mtp_original_full_checks),
quantize_q8_1_kernel (mtp_original_full_head_iq, native_head_iq: the routed experts' input and SwiGLU output) and the opt-in chain
swiglu+quantize (chain_window). Not taken: the MMQ prompt quantizers (ggml quantize_mmq_q8_1, mtp_prefill_q8), which upstream did not clamp.
The sealed PTX are patched entry by entry (scripts/q8): three were built with CUDA 13.0.88, which is not installed, and a recompile
renames the hashed anonymous-namespace entries; only the quantizer entries change, every other byte is the sealed one. Pins, the seal
plan digests and the sm_86 companions (sm86_assets.py build) follow. tools/q8-probe compares old and new PTX on the GPU.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>