Commit Graph
27 Commits
Author SHA1 Message Date
Pavlo RatushnyiandClaude Sonnet 5.5 5e4c9c9530 models: all model paths point into the work folder (models/leleka-gates, models/deepseek-v41-flash)
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>
2026-10-29 19:12:29 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 94af186c8c Merge claude/fix-batch-326-329 into speed-train
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-29 08:26:40 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 d6aee34af4 sm120 ATTN_DAILY for the MTP draft step: opt-in LELEKA_SM120_ATTN_DAILY_MTP=1 (default off, not run on the GPU yet)
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>
2026-10-29 03:04:43 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 9750539d4d STRA-329: native-cpu-expert AVX2 IQ4_XS multi-token route, fused Q2_0 correction, KAB1 ext case set
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>
2026-10-29 01:26:26 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 0765a20958 sm120 decode switch GU_SWIGLU: fused expert gate/up + SwiGLU + q8_1 (upstream native_gu_swiglu_kernel) in the verify window (default on for cc 12.0)
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>
2026-10-29 01:20:32 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 0ca709cad1 sm120 decode switch ATTN_DAILY: upstream pre75 attention chunk + merge v2 in the verify window (default on for cc 12.0)
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>
2026-10-29 01:07:31 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 dcb2f3dbbd feat(kernel-ab): C++ driver time mode, aa.sh A/A control (STRA-317)
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>
2026-10-28 20:40:44 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 9b39c56968 tools/kernel-ab: out-of-tree C++ reference generator for the CPU kernel A/B (STRA-248)
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>
2026-10-28 20:04:55 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 beea1b42a9 Merge claude/upstream-p0 (plan rows 0.1-0.5, 1.1, 1.2) into claude/port-gpu-bringup
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>
2026-10-26 23:19:55 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 4654f01b15 q8_1 scale and sum stay finite in the sealed quantizers (plan 1.1; upstream 2b726ba6, f6601bf8, 7a0e3023, e372d4ff)
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>
2026-10-26 18:27:20 +01:00
Pavlo Ratushnyi 7a5711b71c chain-probe: down variants checked at every T in 1..8 2026-10-25 14:14:41 +01:00
Pavlo Ratushnyi e26abf62bd chain-probe: first-pass chain timing; docs 2026-10-25 14:04:23 +01:00
Pavlo Ratushnyi 23ff8040e0 chain-probe: final probe list (tiled down), pf experiment dropped 2026-10-25 13:38:14 +01:00
Pavlo Ratushnyi c9ccd81856 chain: hyper-connection down projection tiled over rows and tokens (8 rows x 2 tokens per block): 16.6 -> 9.7 us at 4 rows, bit-identical; probe diagnostics; sealed chain_window.ptx 2026-10-25 13:34:33 +01:00
Pavlo Ratushnyi 7992cd21a7 qsa-late: pin test; GR down variants with R rows per warp (probe), perf3 job scripts 2026-10-25 12:23:06 +01:00
Pavlo Ratushnyi 897f2aa476 Merge branch 'claude/chain-kernels' into claude/port-gpu-bringup 2026-10-24 20:54:12 +02:00
Pavlo Ratushnyi c73379efd7 chain: 'all' leaves qsa out; MTP keeps the Original chunk kernel 2026-10-24 03:07:58 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 ce7eed156a chain: probe harness fixes (sync after uploads), trimmed GR down variants, QSA phase profile, vocabulary replay job, doc draft
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 02:22:37 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 4ee333fea7 feat(chain): MTP draft step group (staged GR, load-hoisted attention chunk, merge over used chunks, hoisted argmax/top-prob), A/B and trace job scripts
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 01:07:43 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 4debcdfba9 feat(chain): GR down shapes, fused swiglu+quantize and sigmoid+scale, load-hoisted greedy argmax and top-prob (groups tiny, head), window table tool
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 01:00:15 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 ffbb440fc8 feat(chain): latency-hoisted bit-identical window kernels (plan copy, CPU rows, doorbell, GDN ab, GR norm/up, QSA chunk) behind LELEKA_CHAIN, probe tooling
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 00:49:14 +02:00
Pavlo Ratushnyi 2bdf57a853 Merge branch 'claude/port-gpu-bringup' into claude/ledger 2026-10-23 16:13:46 +02:00
Pavlo Ratushnyi 22085505a2 cupti-trace: finish a window that is open at process exit (leak the state, wait for the watcher) 2026-10-23 16:09:57 +02:00
Pavlo Ratushnyi a6be2e2106 Merge branch 'claude/ledger' into claude/prefill-overlap 2026-10-23 16:09:03 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 4effc72ad5 docs: roofline model (measured 5090 ceilings, per-step tables) and schedule design; microbench h2d2
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-18 02:48:00 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 3c41ee0646 tools/microbench: model-free roofline microbenchmarks, offline model, holder jobs; docs/schedule-design.md draft
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-18 02:05:18 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 0841f7cc0f tools/cupti-trace: CUPTI Activity tracer (injectable, trigger-file windows) + scripts/profile loader and single-trace report
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-18 01:11:40 +02:00