Merges the decode, kernels and CPU/platform reviews of Strata 41cf05a0..870aedd9 into one ranked port list for Qwen3.8-Flash-Next IQ3_S + KAR + MTP on the 5090 and the 3080 (correctness and hygiene 4.x, decode 5.x, prefill 6.x, laptop 7.x), with the state of each row from main and the local branches (upstream-fixes, draft-vocab, models-move), the contradictions between the reviews resolved, a paragraph on what upstream does not give (no 200+ tok/s at 245k), and the next ports in order with the GPU they need. Every number is marked measured, claimed by upstream, estimate or unverified. Old rows updated: 2.1 (default OFF, no e2e gain), 3.1 (not the cause of the 5090 gap), 3.3 (pa-pcie35 slightly worse), 2.6 (closed), 2.2, 3.2, 3.4 (pointers). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
121 KiB
Porting plan: Strata upstream 41cf05a0 into the Leleka runtime
Source of the list: docs/upstream-digest-2026-10-25.md (ranked shortlist 1.1, defaults flipped 1.3, possible bugs of ours 1.4).
Owner's instruction (2026-10-25): take what upstream has, as a plan and actions, and try everything. Every item below is tried; an item is
kept only if it passes its gate, otherwise it stays behind a flag or is dropped with the numbers written here.
Rules for every item (AGENTS.md): no performance claim without a paired A/B on the same workload plus a quality result; synthetic and end-to-end
numbers reported separately; output-changing items are experimental flags until their own gate passes; the Original reference build stays the pinned
stra169-ladder (upstream builds are not a valid baseline, digest 1.3). The port is not bit-deterministic between processes (job 9n0: two runs of
the same build agree on 13.5 % of the rows, d_top1 p99 0.24, 0.65 % argmax flips), so "identical" claims need the run-to-run band as yardstick.
Gates: U unit/CPU test; I identity probe (kernel output bytes vs the old kernel, model-free); R replay A/B on the 5090 (9e3 CRM capture,
paired arms in one process, 3+ repeats); Q teacher-forced agreement (scripts/quality/q_tail_gate.py, rule: p99, max and flip rate each <= 1.25x
the run-to-run control); L live Codex session.
Phase 0: correctness, cheap, no GPU needed
| # | Item (upstream SHAs) | Action | Gate | Status |
|---|---|---|---|---|
| 0.1 | Control-token text in messages becomes real special tokens (c16f31f8, 98b7ea94, 0d613031) |
swap <think>, </think> and the other control literals in message text (user, tool, system, assistant history, tool-call arguments, tool descriptions) for private-use marks before the template renders; after it encode those spans as plain text (Tokenizer::encode plain spans); the template's own markers stay special; same path for token counting |
U (injection fixtures), L | U done (2026-10-25, native Windows cargo test: leleka-tokenizer lib 11 + marked 7 + fast_path 7 + oracle 3, strata-control 259 lib + 33 backend_worker_http, leleka-runtime lib 504, all green; the injection fixtures are in crates/tokenizer/tests/marked.rs, responses.rs tests and backend_worker_http.rs). leleka_tokenizer::LiteralMarks maps every type 3/4 literal to a plane-15 private-use mark (a forged mark is escaped); render_request marks instructions, message text, reasoning, call arguments, tool outputs, tool descriptions/schemas; the gateway's own <tool_call>/<tool_response> markers stay literal; Tokenizer::encode_marked is the one path for generation and /input_tokens; the text contract carries the marked string and leleka-runtime prepare_prompt reads it with encode_marked. Not done: strata-desktop-core (runtime_gateway, runtime_tools) still renders unmarked text; replayed assistant text keeps its marks too (a model-written </think> in history is replayed as text); an engine older than this change reads the marks as private-use characters. L todo (live Codex session) |
| 0.2 | --dump-logits header lies on native packs (504579da) |
check every parity harness that compared against it | U | checked, not affected; guard added (2026-10-26). Searched the whole tree (scripts, tools, benchmarks, docs, crates, desktop, control-plane; engine/strata excluded) for dump-logits, dump_logits, logits_identical, logits-dump readers and fixtures: the only reference is the manual debugging recipe in docs/gpu-bringup.md step f.5 ("re-run the first differing case with the CLI --dump-logits"), never executed by a harness. Every parity and quality harness of ours reads other channels: the serve-mode STRATA_LOGPOS top-k rows (scripts/quality/q_lib.py, q-common.sh, jobs 991-9973, scripts/numerics/num_lp*.py), the DBG residual window lines (num_cmp_resid.py, num_lad_tools.py) and text/token outputs (compare-chat-reports.py, the replay and smoke harnesses). The upstream defect is real for the pinned reference build stra169-ladder (older than 504579da: header written at open, n_prompt + max_new rows promised, a native pack never reaches the dump site), so the recipe in gpu-bringup.md now says to check the dump first, and scripts/quality/logits_dump_check.py (offline, no model; --selftest passes: honest file, header lying with no rows, count one too high, short body, truncated row, wrong vocabulary) trusts the file size instead of the header and refuses an empty dump. No code of ours changed. Not verified: the recipe itself was not re-run on the server (no GPU job) |
| 0.3 | Spec window / MTP drafts near the context end run past max_cells (e85567b6) |
test the controller at max_context - k |
U | U done (2026-10-26, server rnr5090, cargo test --release: leleka-runtime lib original_spec_controller + original_serve_engine 60 passed, leleka-cuda-driver --features cuda-driver lib 382 passed). Ours was not the upstream crash (the serve loop ended as length instead of "ran out of context") but had the same hole in two places: (a) verify_commit ended the request when p + t > max_context instead of taking the rows that fit (upstream generate.cpp room), losing up to 7 tokens at the end of a context, and the MTP chain drafted mtp_t - 1 cells whatever the context had left (upstream mtp.cpp: max_steps = min(.., max_cells - (p + a))); (b) the driver refused a draft launch when first + a + max_t - 1 > 262144 (mtp_original_full_drafter.rs, mtp_original_full_round.rs) although only draft 0 was needed: a request admitted at the edge (n + max_new + 8 = 262144, a window of up to 8 rows plus accept 7) died with InvalidQwenShape. Now: the window shrinks to max_context - p (no room = finished as context; a shrunk window is not observed by the adaptive policy), the chain is clamped to max_context - (p + a) through set_draft_plan and restored on the next round, chain_end_within_cells bounds the driver's chain loop, the staging checks bound what is staged (first + max(rows, a + 1)). Tests: spec_windows_and_drafts_never_pass_max_context_at_any_distance_from_the_end (max_t 2/4/6/8, k = 1..max_t+3 from the end, fixed / suffix / min_p / adaptive: no row or draft cell >= max_context, text = greedy of every row that fits), a_window_near_the_context_end_takes_only_the_rows_that_fit, the_chain_is_shortened_near_the_end_and_restored_after_it, a_chain_clamped_by_one_request_is_restored_for_the_next, serve_request_to_the_context_end_stays_inside_the_cells_and_ends_as_context (real engine over the fake port), the_chain_stops_at_the_last_cell_that_exists (driver). Mutation check: with the window shrink and the chain clamp removed, 5 of these fail. Not verified on a model (no GPU run: the driver check relaxation is exercised only by the pure helper test). Open: the MTP ring is fixed at MTP_ORIGINAL_MAX_CELLS = 262144 cells while leleka_context::geometry::MAX_CELLS is 524288: a 512K context cannot draft past cell 262143 (not changed here) |
| 0.4 | PLE gather_batch matches prefetched rows by position (36381540) |
test reordered and duplicated keys on our async PLE reader | U | U done, ours is not affected (2026-10-26, server, cargo test --release: leleka-model-format lib ple_reader 27 passed, leleka-runtime lib kar_ple_cache 5 passed, 2 ignored need the real archive). Upstream's bug is in its PleTable::gather_batch fast path, which compared the prefetch slot list with the requested token list position by position and re-read the rows of a reordered or duplicated batch (a second ticket; the bytes were right, the read was wasted). Ours has no such matching: PleReader::issue returns a Ticket that owns its output buffer (slot i = request row i; plan_reads records one Use per request slot, duplicates included) and the row cache is keyed by row id; the per-token path (ple_issue/ple_collect, original_window_ple) pairs a token with its own ticket, and the KAR PLE GPU cache (kar_ple_cache.rs, lookup_rows) is a RowMap keyed by row id. Pinned by ple_reader::tests::prefetched_keys_are_matched_by_row_never_by_position (the upstream cases: ordered, permutation, subset, duplicates, duplicate prefetch, missing key, extra prefetch, none, over the window, window overflow, plus out-of-range rows; cache 0 / 8192 rows, inline / threaded; every slot equals the byte oracle, tickets collected out of order, a row already fetched is not read again, a batch never reads more than its distinct rows) and kar_ple_cache::slot_tests::rows_are_matched_by_row_id_never_by_position_in_the_chunk (swapped, reversed, shifted, repeated, subset and mixed known/new chunks keep each row in its slot). No code change |
| 0.5 | Conversation/prefix cache edge cases (8824e217 cancelled between windows loses the restored conversation; 940011da full cache drops instead of evicting; aece46db 1-token prompt with spec) |
tests on the prefix store and serve loop | U | U done; one defect found and fixed (2026-10-26, server, cargo test --release -p leleka-runtime --lib: 557 passed, 56 ignored (GPU/model)). (1) 8824e217: ours was affected on the default conversation cache (ServeConversation, the prefix cache is off by default). begin clears the live claim of the session (live_ok = false until the request ends) and a request cancelled while its prompt was read (between two chunks or before the first one) finished with nothing noted, so the conversation it had restored (live session or checkpoint) was no longer continuable and the next request of the conversation read from its last checkpoint. Now prefill() that ends Cancelled hands the claim back when the state allows it (ServeConversation::note_cancelled_prefill: placed request, 0 < reached < prompt.len(), nothing broken, no state lag, draft ring at the session's position: the same predicate a live continuation needs at the next begin; otherwise nothing is claimed as before). A cancel in the decode phase already kept the claim (host.draft_in_step()). The prefix cache variant was already right (store kept, live truncated per chunk): new a_request_cancelled_right_after_restoring_its_session_keeps_it. Tests: a_request_cancelled_between_prompt_chunks_leaves_its_conversation_live (also shows the old behaviour: without the claim the retry restores a checkpoint), a_cancel_before_the_first_chunk_keeps_the_restored_session_and_a_session_that_is_not_in_step_keeps_nothing. (2) 940011da concerns upstream's parked-conversation RAM cache (not bound in ours: NO_PARKING); the equivalents are covered: ConversationCache evicts oldest-first by slots and bytes and refuses only an image bigger than the whole budget (a_full_cache_evicts_the_oldest_for_the_new_snapshot_by_slots_and_by_bytes), the prefix store evicts by value (a_full_store_evicts_the_session_idle_longest_so_the_newest_request_is_cached, plus the existing store tests), the checkpoint chain is bounded by LRU (the_chain_is_bounded_and_the_saved_points_follow_it). No code change. (3) aece46db was a CLI-only start-position sentinel (0 meant "speculation not started"); ours has no sentinel (position = n - 1, the controller starts at 0 for a 1-token prompt). Pinned by a_one_token_prompt_speculates_from_position_zero (controller: fixed, suffix and adaptive windows, greedy text), serve_request_with_a_one_token_prompt_speculates (real engine over the fake port), a_one_token_prompt_starts_empty_reads_nothing_and_checkpoints_nothing (conversation), a_one_token_prompt_reads_nothing_and_claims_nothing (prefix). Not verified live: the keep-claim path needs a cancelled request on a real stack (the smoke original_serve_conversation_smoke_resume_matches_a_full_read does not cancel); no job was run |
| 0.6 | Callback-thread affinity (0e20d9ae, c08fd902): one no-op host callback before the host thread pins itself; claimed 142.8 -> 207.8 tok/s on a 5090 + 9950X |
check our host functions (compute_drain, DMA staging); microbench the callback latency on the server |
R | not affected here, no speed claim; kept as a defensive Linux-only warm-up (LELEKA_CB_WARMUP=off skips it); see Results |
Phase 1: numerical robustness
| # | Item | Action | Gate | Status |
|---|---|---|---|---|
| 1.1 | q8_1 scale/sum overflow becomes NaN (2b726ba6, f6601bf8, 7a0e3023, e372d4ff) |
port the clamps to our sealed quantizers (q8_1_store, native_quantize_q8_1, SwiGLU quantizer, gr_q8_*) and regenerate the PTX; probe with extreme activations |
I, Q | U/I/Q done (2026-10-27; gate Q: new against old build is inside the run-to-run control: p99 d_top1 0.112 against 0.131, max 0.157 against 0.367, argmax flips 1 against 12; with the chain kernels p99 0.179 against 0.197, max 0.413 against 0.413, flips 3 against 13). Ours had the old formula everywhere (d = amax / 127, make_half2(d, sum), roundf(xi / d) stored as int8): the entries 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 chain_swiglu_quant_kernel (chain_window). gr_q8_*, q8_1_store and the shared-expert SwiGLU quantizer have no separate copy in our sealed set (the GR reads and the shared expert quantize through head_quant; the experts through quantize_q8_1_kernel). Not changed: the MMQ prompt quantizers (ggml quantize_mmq_q8_1, mtp_prefill_q8; upstream did not clamp them either) and the Q8_0 CPU-consistent quantizers. PTX not regenerated by a full compile: three of the sealed files were built with CUDA 13.0.88 (not installed anywhere) and a recompile renames the hashed anonymous-namespace entries, so only the quantizer entries are replaced (scripts/q8/splice_ptx.py, recipe scripts/q8/rebuild_quantizer_ptx.sh, nvcc 13.2.86; the recipe reproduces the sealed head_quant text byte for byte on a recompile of the old source); every other byte of each sealed file is unchanged. Pins (original_verify_window_{proj,moe,chain}.rs, native_head.rs), the seal-plan digests and the sm_86 companions (sm86_assets.py build: 131 companions, check OK; it also added the companions of chain_window and original_verify_window_pcie_fast that were missing before) moved with them (scripts/q8/repin.py). Tests on the server: leleka-cuda-driver lib 387 passed with --features "cuda-driver sm86", leleka-runtime lib 564, ptxas -arch=sm_120 accepts every spliced file. I (tools/q8-probe, scripts/q8/probe_all.sh, run directly on the 5090, log ~/work/gpu-runs/q8/probe_all.log): all 7 assets OK. 65,536 random blocks per asset (scales 1e-6..1e3, zero blocks, subnormals, ties, one big lane): 64,676 identical byte for byte, the 860 that differ are exactly the blocks whose float sum is past 65,000 or whose scale is past the half range (OLD stored inf there); 0 h words differ in the chain kernel. 15 edge/extreme blocks (sum 65504/65520/4e6, amax 8.0e6/8.4e6/1e9/1e30/FLT_MAX, +-inf, +inf and -inf, NaN lane, all NaN, zero): OLD stored a non-finite scale in 9 and a non-finite sum in 12; NEW stores a finite scale and sum in all of them except where the block really sums to NaN (it stays NaN so STRATA_DBG_NAN-style guards still see it), codes inside +-127 and equal to clamp(round(x / d)); a block that was finite before is the same bytes. Q (queued behind the other agent's upspeed-31-* jobs, job up2-q8-quality, log ~/work/gpu-runs/holder2/jobs/up2-q8-quality.log, runs ~/work/gpu-runs/quality/runs/Q8-*; NOT run yet): rt-old (this branch before the change) twice and rt-new once, teacher-forced along the Original paths, static tier, seed off, plus both with LELEKA_CHAIN=all; compare with python3 scripts/quality/q_pair.py Q8-A1-old/port.log Q8-B1-new/port.log --control Q8-A2-old/port.log (identical rows expected; if the port is not bit-deterministic run to run, read the deviation against the A1/A2 control with q_tail_gate.py's rule). Until that runs, "outputs for normal activations are bit-identical" is established for the quantizer kernels (I) and not end to end Merged into claude/port-gpu-bringup (2026-10-26): the bringup branch had sealed a different chain_window.ptx (new entry chain_gr_down_t2w8_nb4, commit c9ccd81), so the chain clamp was not taken as a file from either side: the bringup sealed file is the base and only chain_swiglu_quant_kernel was replaced (splice_ptx.py; the entry text is byte for byte what rebuild_quantizer_ptx.sh compiles from the merged chain_window.cu on the server, nvcc 13.2.86), every other entry is the bringup one. Its pin, the sm_86 companion set (sm86_assets.py build: 132 companions, check OK) and the table were regenerated on the merged tree; the six other quantizer assets and their companions are identical to the ones of this row. |
| 1.2 | NaN guard with self-healing, prompt retry after a non-finite window (f332a855, 894f133b; STRATA_NAN_GUARD=1) |
non-finite detection on the window logits, re-read from the last good checkpoint; port to the serve loop | U, L | U done, L done for the injected path, default OFF (2026-10-27). What a guarded round does: OriginalSpecController::verify_commit takes its round checkpoints and, with LELEKA_ORIGINAL_SERVE_NAN_GUARD=on (profile engine_env key; ..._RETRIES 0..8, default 2), runs the round again after the same restore when a window fails with NonFinite (verify, validation or output admission); other errors, a failed restore or take-back (then the original error, controller marked failed) and a window that stays non-finite after the retries behave as before. Each healed and unhealed window is logged (leleka-serve nan-guard: ...), counted (healed= in DBG spec-stats) and published in the telemetry document (nan_guard.healed_windows, unhealed_windows, last: leleka-memory telemetry::nan_guard_healed/unhealed). LELEKA_ORIGINAL_SERVE_NAN_INJECT=n[xK] (upstream STRATA_NAN_INJECT) makes the n-th checked window read as non-finite K times after it ran well. The fake-engine tests of 2026-10-26 were not enough, the live stack found two more things the guard has to undo: (1) a completed window that no commit was enqueued for keeps window_ready and an armed QSA journal in the driver, so the next run answered InvalidQwenShape (Failed(InvalidDimension): first live G1, run in original_verify_schedule.rs); (2) the window also leaves state behind that only the commit graph repairs: the PLE history (advanced row by row, set from the kept row's snapshot at commit) and the index tails/spare row, so a rerun that only cleared (1) completed but differed from the refused window (first row -0.000392 against -0.000368, another value for every further rerun, the same values in four processes). Now OriginalSpecEngine::discard_window (port discard_window, driver OriginalVerifier::discard_window and OriginalVerifyQsaJournal::discard_window) runs after the two restores: the journal writes back the index state and the PLE history it read when the window began (set_window_snapshots, on only when the guard has retries: twelve small reads and one 360 KB read per window) and the verifier takes the window back. Not healed: a non-finite value the driver detects inside run (stage checks, logits scan) releases the verifier (abort_gpu_waits), so the retry's discard fails and the request ends with the original NonFinite as before; and the cases of the next paragraph. Details: docs/upstream-port-numerics.md. Tests (server, cargo test --release): leleka-runtime lib 567 passed, leleka-memory lib 84. In original_spec_controller, the fake engine now refuses a window while a completed one is outstanding (as the driver does) so the retry tests fail without the take-back: the_retry_takes_the_refused_window_back_before_it_stages_the_rows_again (order: drain, both restores, take-back, same rows), a_window_that_cannot_be_taken_back_ends_the_healing_with_the_original_error, plus the 2026-10-26 set (the_guard_reads_its_three_switches_and_refuses_a_malformed_one, a_non_finite_window_is_run_again_from_its_checkpoint_and_the_request_completes, the_guard_costs_nothing_when_nothing_is_wrong (identical engine call log with the guard on and off), a_window_that_stays_non_finite_fails_the_request_after_the_retries, only_a_non_finite_failure_is_retried_and_a_guard_that_is_off_retries_nothing, a_checkpoint_that_cannot_be_restored_ends_the_healing_with_the_original_error, the_injection_exercises_the_same_path_on_a_good_window_and_counts_windows_across_requests); in original_serve_engine: a_refused_window_is_taken_back_only_after_it_drained_and_a_failed_take_back_poisons. Live (RTX 5090, binary rt-guard4 = this tree, guard on, jobs up3f-w1, up3h-det, up3g-def; runs ~/work/gpu-runs/quality/runs/Q8-D-*, Q8-H-W1-*, Q8-H-*; earlier attempts Q8-G1-*, Q8-G1b/c-*, Q8-G2b/c-* kept as the failure record): all 12 runs rc=0 with the nan-guard lines (G1 = window 7 once, G2 = window 25 twice; the injected window's position depends on the window cuts of that run: 122/132/133/126/113). Deterministic arm (LELEKA_ORIGINAL_SERVE_CPU_WORKERS=1 LELEKA_SPEC=4 LELEKA_SPEC_SUFFIX=0: one CPU expert worker, the fixed window, no timing-driven suffix choice): the control, G0 twice, is bit-identical in all 546 window blocks and all 711 forced rows; G1 and G2 equal G0 in every one of the 546 window blocks once the refused window is dropped (forced rows: 711 identical, 0 different, 0 argmax flips, q_pair.py), and every rerun is bit-equal to the window it replaces (rerun_check: G1 1 of 1, G2 2 of 2). Default tier (15 CPU workers, adaptive window): not bit-reproducible between processes, so only the envelope can be read: the control G0a/G0b has 215 of 514 common rows identical, max d_top1 0.166, p99 0.120, 2 argmax flips; G1 against G0b 58/483, max 0.362, p99 0.152, 6 flips; G2 against G0b 49/452, max 0.243, p99 0.159, 5 flips; (the earlier control of two runs of the unguarded build, Q8-A1-old against Q8-A2-old: 51/506, max 0.367, p99 0.131, 12 flips). Every rerun in G1 and G2 is bit-equal to its refused window here too. Default stays OFF (NanGuard::DEFAULT_ON): the unit test shows the guard changes no engine call when nothing fails, but the snapshots cost reads per window and the guard-on speed was not measured (no performance claim). Not covered: a non-finite prefill chunk (the deferred prompt guards poison the CUDA context by design, so there is nothing to retry on), a failure after the commit was enqueued, a real driver-detected non-finite inside run (see above), and upstream's gateway retry from token 0 |
Phase 2: decode speed, bitwise (no change of output)
| # | Item | Action | Gate | Status |
|---|---|---|---|---|
| 2.1 | sm_120 bitwise decode set (SIDE_MIXER=2, ATTN_DAILY, GR_UP75, GR_DOWN_TG=1, GU_SWIGLU; interleaved MMVQ 2-4 columns; ba2c2d5f, 94104176, 75afe3f4, ffac97f7, ...) |
compare each against our chain kernels / MMVQ; port what is not already ours | I, R | ATTN_DAILY, GU_SWIGLU, SIDE_MIXER (GDN half) implemented on claude/decode-sm120-switches (one switch per commit, section "sm_120 decode switches" below); GR_DOWN_TG, GR_UP75 not ported (we have equivalent chain kernels); MMVQ_IL not done. Update 2026-10-30: ATTN_DAILY and GU_SWIGLU are implemented, byte-identical to the sealed kernels at kernel level (model-free probe, M: 66 and 30 cases) and show no end-to-end gain in the paired 247k session (M), so both ship default OFF (a741f8e5); SIDE_MIXER (GDN half) is implemented, default OFF, with no identity or timing result; the open question of the different turn-2 input tokens between arms (105470 against 105427) is unresolved. What is left of the old diff list is ranked in row 5.4, the SIDE_MIXER / GRAPH_PRIO pair in 5.3 |
| 2.2 | #783 decode series and F7 ports (multi-token router, float4 combine, fused per-head RMSNorm+RoPE, batched K/V append, exact-T GDN, MTP catch-up skipping rejected rows, late shared-expert fork, multi-block argmax) | diff the list against docs/chain-kernels.md; port the missing |
I, R | diff list below, nothing implemented. Update 2026-10-30: the unported remainder is re-ranked in row 5.4 (estimates sum to about 2-6 % of a round for all of it together, E) |
| 2.3 | CPU expert rows (2a669f3c, 79376a27, 16c4da94, 5ece068f): router accumulators in registers, Q5_1/Q8_0 down-row dots, 512-bit gathers, default worker count |
copy job into crates/native-cpu-expert |
U, R | 3 of 4 sub-items do not apply to this model and these CPUs; worker plan ported opt-in; see Results |
| 2.4 | Bitwise prefill kernels (4e69f974, c675f5b7, 5f843a92): GDN 3 value heads per thread, quantize each token's MoE input once, DEQUANT_WIDE |
port the prefill kernels | I, R | done, see Results 2026-10-27: gdn_rec_kh opt-in (-6 % per launch, not worth enabling), GDN out-norm without the dead store (on, bit-identical, ~1 % of the GDN stage), quantize-once and DEQUANT_WIDE not ported (reasons in the analysis table) |
| 2.5 | QSA top-k at long context (wide kernel past 135K cells, cluster top-k on sm_90+; 586367cb, d05d26e9, 6ef23b89) |
compare with our qsa_late; keep the better |
I, R | done, see Results 2026-10-27: wide prompt top-k (QSA stage -4 % at chunk 2048, -6 % at 8192 in the replay) and the cluster decode top-k (window -8..-10 % per round in the replay, bit-identical) are the defaults |
| 2.6 | WSL KV host copy pinned with cudaHostRegister (c41c0ebb) |
laptop only | L (laptop) | closed, not needed (2026-10-30, desk review docs/upstream-review/kernels.md section 9, not re-run): the premise (driver caps cudaHostAlloc(Mapped) near 1 GiB under WSL2) does not hold on this laptop (docs/laptop-profile.md lines 18 and 61: 16 x 512 MiB cudaHostAlloc and 1-16 GiB cudaHostRegister succeeded) and the port already pins its KV host copy (3.094 GiB); the native-Windows laptop runs do not use WSL |
Phase 3: output-changing, experimental flags (each needs its own quality gate)
| # | Item | Action | Gate | Status |
|---|---|---|---|---|
| 3.1 | Route tail skip (65268d99, b4e3407b, 6ab541f6, 55e2072c): a missed expert that every token of a window routes at rank >= 7 is neither copied nor computed; claimed +10..20 % decode on 12-16 GB cards, +11.5 % on a 5090 (NVFP4) |
port into the CPU-pool/stream path behind LELEKA_ROUTE_TAIL_SKIP=N, off at >= 90 % cached |
R, Q (KL) | implemented, experimental, default OFF; +15.2 % decode on the 9e3 replay but the quality gate FAILS; see Results. Update 2026-10-30: the skip is not the cause of our 5090 gap to vanilla at 256k (M, unpaired: vanilla 6.5 ms/token with the skip against 6.6 with it off, docs/experiments/decode-gap-5090.md section 3; the skip-off pair v-nsk-t was never run), and in the production shape (seed off, 93-96 % of routed entries in VRAM, M) there are few missed entries left to skip. The +15.2 % and this result describe different regimes, see "Contradictions resolved" below. Stays OFF, no work planned |
| 3.2 | Fused int8 prompt experts (959e6c34, b1e0fdaa): prompt +7/+5/+3 % at 4K/20K/98K |
experimental prefill flag | R, Q | todo. Update 2026-10-30: re-scoped as row 6.2 (fused int8 prompt experts with grouping on the GPU, L); vanilla runs it by default on a 5090 and the STRATA_PF_FUSED=0 vanilla arm was never run, so its share of the old TTFT gap is unknown (U); row 6.1 measures that first |
| 3.3 | PcieAuto (pcie_frac from the measured CPU speed), async tier by measurement, ADAPT_LAG (aa7b0cb1, ab97f174, b18700c8, b437b8ea, d69424c9) |
compare with our DMA-mode share (0.45) and adaptive swaps | R | partly measured, no gain on the 5090. The arm pa-pcie35 (fixed share 0.35, the value vanilla's PcieAuto settles on) was run against the 0.45 base in the parity audit (scripts/e2e/decode/parity-audit-ab.sh, docs/experiments/parity-audit-5090.md) and came out slightly worse than 0.45 (reported to this document's author; the magnitude is in the run logs under /data/leleka-e2e/parity-audit/, not copied into a repo document: U until it is). LELEKA_PCIE_AUTO stays off, 0.45 stays the default. Upstream changed nothing here in 41cf05a0..870aedd9 (cpu review D5, negative result). ADAPT_LAG / ADAPT_NOWAIT and the 3080 share are laptop questions, row 7.5 |
| 3.4 | Chunked GDN prompt recurrence (0f78032f), speculation extras (cost-aware window, probabilistic acceptance, DFlash2, lookup chain) |
opt-in experiments | R | todo. Update 2026-10-30: speculation extras closed or parked by the decode review: SPEC_COST (our adaptive controller is a superset, +5.1 % over fixed window measured), SPEC_PROB (our sampled path needs no gated proposal) and GB10 HC_UPMIX are not applicable; DFlash2 and the lookup chain stay unmeasured (upstream's tuner calls the lookup chain 3-8.5 % slower, C); chunked GDN prompt recurrence is row 6.7 |
Results of the 2026-10-26 session (branch claude/upstream-speed, server rnr5090, RTX 5090 + Ryzen 9 9950X3D, driver 595.99.02, CUDA 13.2, test binary rt-a1 sha256 6e5bbc24..., pinned Qwen3.8-Flash-Next IQ3_S pack + KAR level-2 PLE)
Row 0.6 callback-thread affinity
- Microbench (synthetic; job
upspeed-06-cbaff-micro, upstream'scuda_callback_affinity.cpp, separate processes, 10 rounds interleaved): the effect is real on this machine. Lazy creation after pinning: median 988-989 us per callback (9 of 10 processes; one process 6.7 us). Warm-up before pinning: 1.7-6.8 us. - Our code does not hit it. (a) Flag B of
fetch_dmais raised bycuStreamWriteValue32on Linux (original_gpu_schedule_ffi.rs::raise_flag_after; a host callback only withLELEKA_PCIE_FLAGB=host, the WSL default, or when the driver refuses the write), so the default 5090 decode launches no host function and the driver creates no callback thread. (b) WithLELEKA_PCIE_FLAGB=hostthe callback thread exists but is created before the host thread pins itself:publish_gpu_planof the first window group enqueues the host function beforeDirectCpuPool::compute_grouppins the caller (pin_caller, CPU 0). Measured with a thread listing during decode (jobupspeed-06-threads, 3 requests of 9e3, FLAGB default/host x warm-up off/on): host thread mask0, expert workers masks1..15, every driver thread (cuda...,cuda-EvtHandlr, and in the host-flag runs the callback thread, named after its creator) mask0-31; no callback thread on CPU 0 in any run. - Decode tok/s of request 2 (9,556 tokens), two passes each, not a paired A/B: default/off 172.2, 174.5; default/on 173.2, 178.7; host/off 170.7, 173.9; host/on 168.4, 174.8. The mechanism is absent in both arms, so the 30-pass A/B was not run (it would measure noise).
- Kept: one no-op
cuLaunchHostFunc+cuStreamSynchronizeat the creation of the first stream (Linux only; Windows CPU sets are per thread), so a later change of the call order cannot reintroduce 1 ms callbacks. A guard, not a speed-up. Not verified: WSL (laptop route A), where flag B is a host callback by default.
Row 3.1 route tail skip (LELEKA_ROUTE_TAIL_SKIP=N, EXPERIMENTAL, default OFF, output changing)
Port: split_group_tail (original_serve_residency.rs). A missed expert (not resident, valid id) whose best rank over all entries that route it is >= N gets kind -2: not in the GPU plan, not staged over PCIe, not computed by the CPU pool, row zero (the CPU writes zeros for every entry it does not own), route weights not renormalised; skipped experts leave the miss count before the PCIe share is rounded. Off when at least LELEKA_ROUTE_TAIL_SKIP_MAX_CACHED (90) percent of the experts are in VRAM (21.5 % are here, so it is ON). Router ids are sorted by descending probability (router_top10.cu), so slot = rank as upstream. Unit tests in original_serve_residency (11 pass on the server). Replay arms: +tailN suffix of a LELEKA_SPEC_ARMS entry (in-process pass-level A/B), !tailN flag of a LELEKA_REPLAY_ARMS entry (per stack).
- Speed, end to end (job
upspeed-31-ab-9e3; one process; live CRM session capture 9e3, 24 requests, 34,443 recorded tokens per pass, teacher forced; auto tier 9,100 slots per layer, adapt-every 2,LELEKA_CHAIN=all, adaptive window @ 0; one warm-up pass, then 3 repetitions x 2 arms, arm order rotating): A (skip off) 167.00 tok/s (passes 166.93 / 166.89 / 167.17, sd 0.15, 95 % CI +-0.38) against B (skip 7) 192.38 (192.36 / 192.32 / 192.45, sd 0.07, CI +-0.17). Paired gain +15.2 % (15.23 / 15.24 / 15.12, sd 0.07). Rounds per pass 8,744 against 8,648; the skip removed about 1.01 M entries per pass of about 19 M (roughly 44 % of the entries the CPU and PCIe tiers would otherwise serve). n = 3 per arm, not 30: the queue was shared (the job started 3 hours after submission) and the pass-to-pass sd is 0.1 %, far below the effect; the job was stopped after the third repetition. Not measured: the 256k-class capture 9w2 (jobupspeed-31-ab-256kwas prepared, never reached the GPU and was removed from the queue); a 12-16 GB card (laptop commands are indocs/windows.md). - Quality (jobs
upspeed-31-q-autoand-ctl; teacher forced along the 9e3 recording, first 16 requests, 32,331 rows, top-16 log-probabilities, static auto tier, seed off, arms G = skip off and T = skip 7 in one process, control = the same reference with another chunk cut (4096);scripts/quality/q_tail_gate.py):
| d_top1 p99 | d_top1 max | argmax flips | |
|---|---|---|---|
| control (chunk cut, rounding noise) | 0.3995 | 3.37 | 470 (1.45 %) |
| skip 7 against skip off | 1.0050 | 5.81 | 895 (2.77 %) |
| limit (1.25 x control) | 0.499 | 4.22 | 1.81 % |
FAIL on all three (and outside the Original envelope 0.22 / 0.43 / 2.8 % for p99 and max). A +15 % decode gain that costs 2.5x the p99 deviation of rounding noise stays an experimental flag: not to be enabled in any profile. Not tried: rank 8 or 9 (fewer experts skipped), the 2048-slot tier (upspeed-31-q-2048, never ran), a downstream answer-quality check. Upstream's own gate was KL 0.003-0.006 on other packs; ours is another pack and another measure, the numbers are not comparable.
Row 2.3 CPU expert rows
The four upstream changes were checked against what our crate runs (crates/native-cpu-expert is Rust; its .cpp files are references):
- router accumulators in registers (
router_dot): used only by the router lookahead, which is opt-in (LELEKA_CPU_POOL_LOOKAHEAD=on) and only over file-mapped experts; it does not run in the 5090 decode. - Q5_1/Q8_0 down-row dots: our
DownFormatisIq4Nl | Q2_0and the IQ3_S pack's down matrices are IQ4_NL, so no row would use them. - 512-bit gathers: upstream enables them only on GenuineIntel parts with AVX-VNNI (Alder Lake, Sapphire Rapids and later,
cpu_gather_fast) and measured them slower on Zen 4. The 9950X3D is AMD and the laptop's i9-11900H (Tiger Lake, AVX-512 without AVX-VNNI) does not qualify either; our crate already has the opt-inSTRATA_IQ_GATHER. - default worker count: ported as
pool_plan(plan_pool_workers, upstream's mock-CPU test cases, cgroup quota, hybrid P/E counts; 7 tests pass on the server;default_workers()= 15 on the 9950X3D, equal to the stack's constant, so there is nothing to A/B on the 5090). Opt-inLELEKA_CPU_POOL_PLAN=on; on the laptop it would give 7 instead of 15 (8 of 15 workers have no core of their own there), unmeasured; commands indocs/windows.md. No scalar-reference row tests were written because no row kernel changed.
Rows 2.1 / 2.2
Diff list above; no implementation, nothing measured.
Not verified / not done
The 30-pass A/Bs (3 repetitions for 3.1, none for 0.6 because the mechanism is absent), the 256k-class A/B, the 2048-slot quality gate, anything on the laptop GPU. cargo build/test was not run on this laptop (by instruction); all builds and unit tests ran on the server from a tarball of the worktree.
Rows 2.4 / 2.5: analysis (2026-10-27, branch claude/upstream-rest, from claude/port-gpu-bringup c40531f)
Method: read the upstream sources (engine/strata/src/prefill/kernels.cu, src/kernels/cuda/qsa_select.cu, moe_mmq.cu, prefill.cpp) against ours (crates/cuda-driver/src/prefill_stage.cu,
qsa_late.cu, qsa_resident_index_program.rs, the sealed qsa_prompt_select.ptx that the decode window launches as qsa_topk_ref). The upstream repository has no history in our tree, so the
commits are identified by content. Where the 256k workload stands (night5-long-256k, job on 2026-10-27, 5090): a 5-turn session to 243k tokens has TTFT 25.2-30.6 s per turn (chunk 2048,
per-layer ring: expert DMA dominates, 0.8-1.1 s of a ~1.2 s chunk) and decode 80-103 tok/s against 130-170 at short context. Two different things can move at depth: the prompt stages whose
cost grows with the position (QSA index: scores, top-k) and the decode window's QSA select (one qsa_topk_ref CTA per query, 12 layers).
| Item | Upstream | What we have | Verdict |
|---|---|---|---|
GDN recurrence, 3 value heads per thread (4e69f974) |
gdn_rec_kh_kernel: 64 blocks, cp.async blocks of 8 tokens, 2 barriers per token |
the Original's gdn_rec_cols_pipe (192 blocks, 5 barriers) and our opt-in two-barrier leleka_prefill_gdn_rec |
ported (leleka_prefill_gdn_rec_kh, opt-in): bit-identical, but only -6 % per launch on the 5090 (see Results); 64 blocks on 170 SMs leaves the card two thirds idle |
| no dead FP32 store in the GDN output norm | gdn_out_norm without the y store |
leleka_prefill_gdn_out_norm writes y (nothing reads it afterwards: the projection takes y16) |
ported as leleka_prefill_gdn_out_norm_y16, bit-identical y16 and status words |
quantize each token's MoE input once, scatter to the K rows (c675f5b7) |
quantize_scatter_mmq_q8_1_cuda instead of a gather over T*K rows |
ggml quantize_mmq_q8_1 with the id gather over T*K rows (sealed Original MMQ asset) |
not ported: upstream's own number is 77.5 -> 58.1 ms for a 32K prompt on a 5090, i.e. at most ~5 ms of an 8192-token chunk (0.3 %), and it needs a new kernel in the MMQ q8_1 layout plus the inverse slot map |
DEQUANT_WIDE (5f843a92) |
wide dequantization of Q4_K/Q5_K/Q6_K/IQ4_XS, default on sm_86/sm_61 only | our leleka_prefill_dequant_* already run one thread per element (9 ms per chunk on the 5090, 36 ms per 2048-token chunk on the 3080) |
not applicable to sm_120; a thread-per-8-values variant could only matter on the 3080 (not measured) |
QSA top-k, 1,024-thread kernel past ~135K cells (586367cb) |
block_topk_wide_kernel (per-warp histograms, 4 radix passes + count + emit) |
qsa_topk_ref (Original, 256 threads, 704-byte stride between lanes) and our leleka_qsa_topk_fast (256 threads, coalesced, 6 passes) |
ported, faster than fast from ~10k blocks (-45 % at 180k, -49 % at 245k per 256-row tile); upstream's one-read sample kernel measured and not used |
QSA top-k on a thread-block cluster, sm_90+ (d05d26e9) |
block_topk_cluster_kernel: 8 CTAs of 1,024 threads per query, histograms pushed through distributed shared memory |
the decode window launches qsa_topk_ref with one 256-thread CTA per query (12 layers per window) |
ported (qsa_cluster.cu, cuLaunchKernelEx inside the captured window): 183 -> 19.5 us per call at 245k tokens (4 queries) in the model-free probe |
cluster greedy argmax (6ef23b89) |
sampler.cu |
one block per token, 79 us per window (docs/chain-kernels.md) |
row 2.1/2.2 item, tier 2 |
Project Maya (github.com/Ajay9o9/project-maya, MIT; analysis 2026-10-27, owner's request)
A Strata fork rewritten for GLM-5.3-Flash (321B MoE, DSA sparse attention, KDA layers, NextN MTP). Read: the README and the sources at commit 10b7b07 (shallow clone kept outside the tree; the
code that matters is src/core/glm_fast_path.cu, glm_prefill.cu, src/kernels/cuda/glm_batch.cu, src/kernels/cpu/kq_avx512.cpp, src/program/generate.cpp). Every number below is Maya's claim on Maya's
hardware (3090, V100, 4090, GLM), not ours. Their model is not ours: the indexer has 32 heads, the MTP block is a GLM NextN block with RAM-tier experts, the expert formats are Q3_K/Q2_K. Ranked by
expected value for the Qwen3.8-Flash-Next IQ3_S pack on the 5090 (primary) and the laptop:
| Rank | Candidate (Maya switch) | Maya claims | What we have | Verdict |
|---|---|---|---|---|
| 1 | (g) Next-layer expert prestaging while attention runs (STRATA_GLM_PRESTAGE, prompt ring; PREFETCH_N/RANK/AT for decode), (f) conversation state on SSD (STRATA_GLM_SLOTS: 4K tokens resume in 0.2 s instead of a re-read) |
prefetch decode 19.64 -> 20.22 tok/s on 3090+3060; no number for prestage | prompt: the per-layer ring plus stream_all from 4096 rows (already overlaps the next layers' DMA with the mixers); decode: router lookahead (LELEKA_CPU_POOL_LOOKAHEAD, opt-in), adaptive tier. Prefix cache and conversation cache are RAM only |
(f) is the one with a 256k payoff: a 245k re-read is 25-40 s of TTFT (night5) against seconds from an SSD slot; it is the tiered-cache epic STRA-236, not a kernel port. (g): small; the stream already does it above 4096 rows; for chunk 2048 the per-layer ring could prefetch layer l+1's routed set only after its router runs (the same limit Maya has). Not started |
| 2 | (d) Multi-token AVX-512 Q3_K/Q2_K CPU kernel (kq_avx512.cpp, STRATA_GLM_KQ, ~2x ggml from 8 tokens per expert) |
prompt-path CPU experts | crates/native-cpu-expert: IQ3_S/IQ4_NL (our pack) and Q2_0 kernels with RUNTIME dispatch AVX2 (iq_avx2, q2_avx2) / AVX-512 (iq512, avx512_ok(): F/BW/VL/DQ + XCR0) |
does not apply to our pack: Maya's kernel is for Q3_K/Q2_K weights and for prompt-path CPU experts; our prompt experts run on the GPU (MMQ) and decode has 1-4 tokens per expert, below Maya's break-even of 8. What it exposes is a gap in our CPU tiers (next paragraph) |
| 3 | (a) Sparse-attention indexer as FP32 register-tiled GEMM (STRATA_GLM_DSA_SCORE, 78.8 -> 5.6 ms at 4096 tokens, position 10K, 3090) and the mma.sync prompt attention (STRATA_GLM_PREFILL_ATTN, 832 -> 966 tok/s at 26.6K) |
against Maya's warp-per-pool kernel | our indexer scorer is already the Original's TF32 3-pass tensor-core kernel (block_scores_tc_kernel, 0.34 ms per 256-row tile at 147k tokens) and the prompt attention is already mma (113 ms per 8192-token chunk, ledger); the select was the top-k, now ported (row 2.5) |
already ahead of the baseline Maya fixes; folded into row 2.5: after the wide top-k the late-chunk QSA index is scores 131 + top-k ~45 ms of ~1.9 s. The tile size and 3xTF32 split of the scorer (7 TFLOP/s on 2.4 GFLOP) are the only headroom; not bitwise-safe to touch (the Original's score bits decide near-tie selections) |
| 4 | (c) Promotion of a fetched hot RAM-tier expert into VRAM only when its aged route count clears PROMOTE_MIN |
stops churn on a 4090 with 128 GB RAM; hurts with little RAM (29.6 -> 28.3 tok/s on 30 GB) | adaptive swaps (ADAPT_EVERY/SWAPS): replace the least-routed residents of a layer while the gain >= 1.5, counts decay 0.7 (hysteresis already) |
equivalent mechanism; revisit only if the e2e traces show swap churn at 256k (job 9r1 / telemetry swaps). No port |
| 5 | (b) Draft-expert filter (STRATA_GLM_MTP_KEEP: the NextN draft fetches only its best-scored missing experts) |
acceptance 76-81 -> 82-83 %, decode +5 % on 3090+3060 | the Qwen MTP block's experts are one n_expert * BLOB device allocation (original_mtp_bank.rs): the draft has no misses |
not applicable on the 5090 and (if the MTP bank is device resident there too) on the laptop; to be re-checked on the 3080 profile (docs/laptop-profile.md) before closing |
| 6 | (e) Idle spin sleep for pool threads (SERVICE_IDLE_MS) |
idle engine 1 % of a core instead of one core per GPU | rust_general_pool.rs workers spin self.spin and then park on a condvar; pool_plan sizes the workers to physical cores |
already have (not measured idle CPU here) |
CPU tiers (owner's rule: runtime dispatch, the AVX2 path stays the default and keeps being tuned, bit-identical integer dot products, nothing requires AVX-512 at build or run time). State of
crates/native-cpu-expert on 2026-10-27, from the sources (no CPU measurement made): (1) AVX2 baseline: present for IQ3_S/IQ4_NL/Q2_0 (iq_avx2.cpp, q2_avx2.cpp, kq_avx2.cpp,
rust_simd::avx2_ok); (2) AVX2 + AVX-VNNI (256-bit vpdpbusd): missing as a runtime tier. rust_ggml_native.rs probes cpuid 7.1 EAX bit 4 but only as a compile-time cfg!(target_feature = "avxvnni") branch of
ggml's types, so the binary neither uses it on an Alder/Raptor Lake/Core Ultra part nor requires it; the IQ dot kernels use maddubs + madd; (3) AVX-512(+VNNI): present with runtime dispatch
(Dispatch.iq512, avx512_ok(); STRATA_FORCE_AVX2=1 forces tier 1), the Q2_0 S2 path in expert.cpp is the VNNI-512 reference. The decode CPU legs are memory-bound (about 39 GB/s of 52, expert.cpp
comment), so an AVX-VNNI tier saves ALU work, not bytes: expect a gain only where the pool is compute-bound (laptop, 8 workers on 4-6 cores). A tier 2 would be an additional #[target_feature(enable = "avx2,avxvnni")]
variant of the IQ3_S/IQ4_NL dots selected by cpuid 7.1 EAX bit 4 + XCR0, integer-exact against tier 1 (same int32 sums, so bit identity by construction), measured with rust_bench on the laptop: todo, not started.
Conclusion: nothing from Maya survives as a kernel port for the 5090 beyond what row 2.5 already took; the two items worth a task are the SSD conversation state (f, STRA-236) and the AVX-VNNI CPU tier (laptop).
Results of the 2026-10-27 session (branch claude/upstream-rest, server rnr5090, RTX 5090 + Ryzen 9 9950X3D, driver 595.99.02, CUDA 13.2.2, Qwen3.8-Flash-Next IQ3_S + KAR level 2 pack, MTP pack data/mtp-rt)
Rows 2.4 / 2.5 (gates I and R)
- U:
leleka-cuda-driverlib 395 passed (--features "cuda-driver sm86"),leleka-runtimelib 631 passed (server, release). - I, kernels (model-free,
qsa_late::gpu_tests,prefill_stage_gdn_gpu): every top-k variant (fast,wide,sample+wide_failed,cluster) writes the same ids as the Original'sqsa_topk_ref, whole output buffer, in 24 cases (prompt tiles of 256 rows and decode calls of 1..5 rows, positions 100..261,500, continuous / heavy-tailed / 16 tied levels / all equal scores, then_kv <= widthidentity branch included).leleka_prefill_gdn_rec_khequals the Original'sgdn_rec_cols_pipein state, readout and witness for t = 1, 2, 7, 8, 9, 200, 1500, 2048, 8192 and for an infinite state, a NaN input and an overflow. The no-store out-norm writes the samey16and the same four status words (3 cases incl. non-finite inputs). - I, end to end (job
rest-id-256k, replay ofnight5-long-256k, 5 requests 45,766..242,849 tokens, teacher forced, static tier, one CPU worker, fixed window; 8 arms in one process: baseline, kh, two-barrier rec, wide, cluster, all, no-store, baseline again):q_tail_gateover 1,502 forced rows: d_top1 median / p99 / max 0.0000 and 0 argmax flips for all 7 arms against the baseline. The final-residual hashes of the first 100 prefill chunks (requests 0..3, up to 198k tokens) are equal in all arms; request 4 starts from another prefix-cache checkpoint in five of the arms (reused 194,560 instead of 196,608 tokens: the auto prefix budget under host memory pressure), so its chunk hashes are not comparable (its logprob rows are equal anyway). - R, kernel level (model-free, warm, mean of 20 launches): wide against fast top-k per 256-row tile: 91.7 vs 144.6 us at 100k, 138 vs 251 us at 180k, 172 vs 334 us at 245k tokens (equal below ~32k tokens); decode top-k
qsa_topk_refvs cluster per call (1..5 queries): 157 vs 17 us at 131k, 183 vs 19.5 us at 245k tokens, 12 QSA layers per window;qsa_decode_scoresis 14-52 us at the same depths (not the cost). GDN recurrence per 8192 tokens and layer: Original 4.31 ms, two-barrier 3.91, kh 4.04 (the 5090 is latency bound at 4.5 warps per SM; upstream's kh kernel was tuned for 64-80 SM cards). - R, replay A/B (job
rest-ab-256k,night5-long-256kreplayed in one process, fresh stack per arm, teacher forced, production env, prefix cache 20,000 MiB; B/X/K at chunk 2048 and D/Y at chunk 8192, 3 repetitions per arm; X/Y = wide + cluster + no-store, K = kh only): host load made the wall times useless (B: 132..273 s for the same work, swap at 40 GB), so the PREFILL-PROFILE stage sums (sd < 1 %) and the decode window time are the measurements. QSA stage: 18,247 -> 17,491 ms (-4.1 %, chunk 2048), 13,846 -> 13,059 ms (-5.7 %, chunk 8192; -7 % past 100k tokens). GDN stage: kh -1 %, no-store -1 % (chunk 8192). Decoderound.run_windowper round: B 19.5 / 20.4, X 18.0 / 18.0 / 18.5 ms (-8..-11 %); decode tok/s 83.2 / 82.7 (B) against 93.5 / 93.0 / 90.1 (X). The kh kernel alone (K) shows no stage gain worth a default. - Quantize-once and
DEQUANT_WIDEwere not ported (analysis table above): bounded by 0.3 % of a chunk and sm_86-only.
The 5090 gap to vanilla Strata on the 256k session (owner's priority item, 2026-10-27 evening)
Same text (long_session.py, 5 turns to ~245k tokens, 300 output tokens), TTFT s / decode tok/s per turn (scripts/upstream-rest/turns.py):
| run | turn 1 | 2 | 3 | 4 | 5 | sum TTFT | mean decode | wall |
|---|---|---|---|---|---|---|---|---|
| night5 (chunk 2048, uniform per-layer slots) | 26.0 / 88.9 | 26.8 / 91.1 | 30.6 / 85.8 | 25.2 / 102.6 | 25.7 / 80.0 | 134.3 | 89.7 | 151 s |
| night6 (chunk 8192) | 12.7 / 88.7 | 11.5 / 96.1 | 13.6 / 83.3 | 12.0 / 91.8 | 11.0 / 92.3 | 60.7 | 90.4 | 77.6 s |
| rest-before1 (night6 config, new binary, branch features off) | 14.2 / 83.3 | 12.2 / 96.8 | 13.8 / 79.2 | 12.4 / 90.7 | 11.2 / 77.5 | 63.8 | 85.5 | 81.6 s |
| rest-before2 | 10.7 / 91.8 | 11.3 / 94.2 | 14.0 / 80.2 | 12.4 / 90.1 | 10.9 / 81.3 | 59.2 | 87.5 | 76.6 s |
| rest-after1 (sized per-layer cache only: the defaults flip of the kernels had not reached the server) | 11.3 / 104.3 | 11.5 / 104.8 | 13.3 / 97.4 | 11.9 / 115.6 | 10.9 / 91.6 | 58.8 | 102.7 | 73.8 s |
| rest-after2 | 15.0 / 95.1 | 13.9 / 109.4 | 13.3 / 99.9 | 12.1 / 113.1 | 10.9 / 90.0 | 65.2 | 101.5 | 80.3 s |
| rest-full1 (all branch defaults: sized cache + cluster decode top-k + wide prompt top-k + no-store out-norm) | 11.3 / 105.3 | 11.2 / 112.4 | 13.0 / 112.8 | 11.5 / 121.7 | 10.5 / 104.4 | 57.6 | 111.3 | 71.3 s |
| rest-full2 | 11.0 / 105.2 | 11.2 / 109.3 | 13.2 / 110.3 | 11.5 / 126.2 | 10.5 / 102.8 | 57.3 | 110.7 | 71.2 s |
night7 (global slots, PER_LAYER=no, night binary, owner's job) |
13.6 / 103.7 | 11.6 / 100.4 | 13.8 / 90.5 | 13.4 / 96.6 | 10.9 / 92.0 | 63.3 | 96.6 | 79.0 s |
| vanilla Strata 0.2.6 / engine 0.1.50 | 6.9 / 121.7 | 8.3 / 144.2 | 9.4 / 147.7 | 8.2 / 164.4 | 8.5 / 194.3 | 41.3 | 154.5 | 51.2 s |
The first rest-after* pair measured the sized cache alone: I committed the defaults flip of the three kernels and then synced the server tree from git ls-files -m, which no longer listed the committed files, so those binaries still had cluster / wide / no-store off (found when the log line leleka-serve qsa prompt top-k was missing from the binary; sync-rest now diffs against the base commit). rest-full* are the real defaults, with the kernels confirmed by leleka-serve qsa prompt top-k: wide and qsa decode top-k: thread-block cluster in the engine log.
Findings (runs rest-before*, rest-after*, rest-full* under ~/work/leleka-e2e/runs/; before = the same binary with LELEKA_ORIGINAL_SERVE_PER_LAYER_SIZED=0 LELEKA_QSA_CLUSTER=0 LELEKA_QSA_TOPK=fast LELEKA_PREFILL_GDN_NOSTORE=0):
- Chunk 8192 is the prefill fix (night5 -> night6: 134 -> 61 s of TTFT); it is not the default of the shipped deploy profile yet.
- Slot sizing, root cause.
run-e2e.sh(and thertx5090-32gprofileengine_env) setLELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER=yes.original_cache_startup::opentook the profile-sized path only for!per_layer; with per-layer it openedslotsslots of the LARGEST layer blob (2.54 MiB; 8,701 slots in 21.57 GiB) with per-layer admission, while the Original's per-layer plan (generate.cpp ~6333, #369) gives every layerquotaslots of its OWN blob (1.94 MiB average). Fixed: the same VRAM now holds 11,280 slots (21.50 GiB; the Original/vanilla reach 12,575 in 23.87 GiB because they have 2.2 GiB more free before the cache).LELEKA_ORIGINAL_SERVE_PER_LAYER_SIZED=0restores the uniform plan. The output is not bit-identical to the uniform plan (more experts run on the GPU, which rounds differently from the CPU): quality gaterest-q-256k. - Decode +28 % (mean over the turns 85.5 / 87.5 before -> 111.3 / 110.7 tok/s with all defaults): the sized cache alone gives +17 % (102.7 / 101.5;
round.run_window19.2 -> 18.4 ms per round, 697 rounds against 787), the cluster top-k adds +9 % (16.9 / 16.0 ms per round, i.e. -12 % against before; QSA decode select was 12 x ~180 us per window). Per-layer sized slots (102 tok/s) are as good as global admission (night7, 96.6 tok/s, old binary): the per-layer admission is not what held decode back, the slot size was. Still 1.4x behind vanilla (154.5 tok/s; its round is ~14 ms). Vanilla's route-tail skip (lossy, on by default) is not copied. - Prefill is still 1.4x behind vanilla (59-65 s against 41 s of TTFT). Per chunk of 8192 at position 139k (PREFILL-PROFILE): gdn 469, qsa 468, moe 654 (ring 456, prepare 123), total 1,677 ms. The session totals hardly moved between before and after (qsa 13.85 -> 13.76 s, moe.ring 15.6 -> 15.4 s).
moe.ringdid not change when the resident slots went from 8,701 to 11,280 (the ring already skips the experts the arena cache holds; its entry count fell from 17,770 to 15,534 per chunk, but the ring is compute bound, not DMA bound: see the section on the prefill expert stream below, which corrects an earlier reading of this paragraph). Vanilla runs the prompt experts on the fused int8 kernels (STRATA_PF_FUSED=1, row 3.2, lossy). - The wide prompt top-k shows in the e2e as the QSA stage: 13.85 s (before) -> 12.99 / 12.98 s (full), -6.2 %, as in the replay; TTFT sum 63.8 / 59.2 -> 57.6 / 57.3 s (-5..-10 %, inside the turn-to-turn noise of 1-2 s). Prefill is untouched otherwise (moe.ring 15.4 s, gdn 14.7-15.2 s of a 54.4 s prefill total).
- Quality gate Q (job
rest-q-256k, replay ofnight5-long-256k, teacher forced, production env: adaptive tier, 15 CPU workers, chunk 8192, prefix budget 6,000 MiB, top-16 log-probabilities, 1,501 rows; Z0 = all branch defaults (11,280 slots, wide, cluster, no-store), P1 / P2 = before (8,674 uniform per-layer slots, fast top-k, ref decode top-k, store);q_tail_gate.py --ref 1): Z0 against P1: d_top1 median 0.0038, p99 0.186, max 0.417, argmax flips 30 (2.00 %); the run-to-run control P2 against P1: median 0.0036, p99 0.196, max 0.384, flips 34 (2.27 %). Rule (each <= 1.25 x the control): p99 0.186 <= 0.245, max 0.417 <= 0.480, flips 2.00 % <= 2.84 %: PASS; both are also inside the Original envelope (p99 0.22, max 0.43, flips 2.8 %). The kernels alone are bit-identical (gate I); the deviation is the placement change of the larger cache, and it is smaller than the noise between two runs of the old build. A first try of this job failed to open the second stack of the process (driver error: HostAllocationwith a 20,000 MiB prefix cache and a loaded host) and is kept asrest-q-256k.first-try.log. Same job, speed (not a paired A/B: logprob tracing slows decode): TTFT sum 56.8 s (Z0) against 57.2 / 57.1 s (P1 / P2).
The prefill expert stream is not what holds a chunk back (job rest-dma-diag, 2026-10-27 22:00)
Question: does the ring skip experts that are resident, and is the copy stream exposed (21 GB/s over the stream window against 47-50 GB/s isolated DMA)? Replay of the first 3 requests of night5-long-256k (21 chunks, 162,040 tokens, chunk 8192, production env, 11,280 slots, 2,238 lent), two processes:
- Resident experts are already skipped (
begin_stream_inner:lease.cache_expert_span(layer, expert)?.is_some()-> no entry). Entries per chunk = 24,576 - (slots - lent): 15,534 = 24,576 - (11,280 - 2,238); with the uniform 8,701 slots it was 17,770 (24,576 - (8,701 - 1,895)) and the bytes per chunk fell from 36.96 to 32.44 GB with the larger cache. Vanilla at 12,575 - 2,089 streams about the same (14.1k entries). The earlier statement "the ring streams whatever is resident" (this document, finding 4 above) was wrong:moe.ringdid not move with the slot count because the ring is not DMA bound (below). - A:
LELEKA_PREFILL_COPY_STATS=1(timestamp event around every entry, all 15,534 entries sampled):PREFILL-COPY mode=thread entries=15534 calls=46602 bytes=32444043408 avg_call=696194 dma_gbps=44.6 sampled=15534 issue_ms=102.6 stream_ms=1584.0 avg_gbps_over_stream=20.5(the other chunks: dma_gbps 44.5 / 45.3, stream_ms 1597 / 1079). The pure DMA time of the 3 x 686 KB copies of an entry is 44.5-45.3 GB/s, i.e. 0.73 s of the 1.58 s stream window: the copy engine is idle for more than half of the window. The 21 GB/s is bytes over the window, and the window is the chunk: the issuer waits for theusedevent of entry k - 512 (ring of 512 slots, one layer ahead), so it is paced by the compute. - B:
LELEKA_PREFILL_DIAG_SKIP_EXPERT_DMA=1(no expert copies at all, wrong outputs, compute only): stage sums over the 21 chunks A -> B: total 33,321 -> 33,495 ms, moe 15,221 -> 15,616 ms, gdn 9,388 -> 9,288 ms, qsa 6,965 -> 6,849 ms. Removing the whole DMA does not shorten a chunk, so there is no exposed copy time and no overlap, ring size, depth or 3-copies-per-entry change can buy anything (hypotheses a-d are moot;streamsync398 calls / 1.06 s per chunk is the host waiting for compute). - Where the 1.63 s of a chunk go (position 139k, host spans, GPU kernels sum to about 1.2 s): gdn 464 (compute 381, state_in 35, state_out 41), qsa 437, moe 653 (prepare 122, spans 26, ring 454, finish 38), input 30, validate 12, attn_read 7, the rest below 30. About 0.3-0.4 s are host-side serialisation points between the kernels (per layer: GDN state upload/download, the router / route grouping readback in
moe.prepare, the finite-span walk inmoe.spans,moe.finish), and the MMQ + gather + combine kernels of the ring (255 + 47 + 28 ms in the ledger table). Vanilla's chunk (about 1.37 s) runs the prompt experts on the fused int8 kernels (PF_FUSED, lossy, row 3.2) and has not been profiled per stage here. Next candidates, none started: (1) hidegdn.state_in/out(76 ms, 4.7 %: a per-layer synchronous host round trip of the recurrent state), (2) pipelinemoe.prepare(122 ms: route readback and grouping of layer l+1 behind the GPU work of layer l), (3) row 3.2 as an opt-in experiment.
Host-blocking calls of one prefill chunk, per call site (job rest-sync-sites, LELEKA_PREFILL_STALL_TRACE=1, chunk 8192, 2026-10-27)
compute_drain::timed now records every kind (alloc, free, H2D, D2H, memset, drain, D2D, stream/event sync) per call site, ranked by blocked ms (PREFILL-SITE lines at the end of each chunk). One chunk, PREFILL-COPY ... blocking: alloc=83/6.7ms h2d=240/13.2ms d2h=479/31.3ms drain=949/68.5ms streamsync=398/733.9ms, stream window 1,242 ms. The 398 cuStreamSynchronize calls (734 ms in this chunk; 951-1,060 ms in the 1.6 s chunks of the other runs):
| # | call site (innermost first) | calls | blocked ms | what it waits for | on the critical path? |
|---|---|---|---|---|---|
| 1 | OriginalGdnPromptDevice::produce (end of a GDN layer) |
35 | 241.7 | the layer's GEMMs, conv, recurrence (GPU running) before the state download | the GPU is busy while it waits; after it returns the GPU idles through state_out (download, seal, stage) and the next layer's state_in (alloc + upload): about 76 ms per chunk |
| 2 | copy_ring::Ring::drain <- finish_statuses (end of a MoE layer) |
48 | 196.4 | the layer's gathers + grouped MMQ before the status words are read | GPU busy while waiting; then moe.finish (38 ms) and the next layer's moe.prepare run with an empty compute stream |
| 3 | QsaPromptIndexWorkspace::run_resident_arena (indexer: scores, top-k) |
12 | 89.1 | the 32 score + top-k tiles | GPU busy; the host then validates the selection |
| 4 | QsaPromptAttention::run_resident (attention) |
36 | 74.1 | attention kernels of 3 sub-steps per QSA layer | GPU busy |
| 5 | OriginalMoePromptDevice::run via prepare (kind 5 drain) |
92 | 53.1 | router, top-k, sort before the ids are read back to the host | needed: the host groups the routes of the layer from them |
| 6 | OriginalQsaPromptDevice::project |
60 | 29.4 | indexer q/k projections | GPU busy |
| 7 | OriginalMoePromptDevice::run (prepare / finish) kind 7 |
46 + 46 | 28.4 + 22.0 | router logits / combine | GPU busy |
| 8 | Transfer::copy (resident index copy of the prefix, KV copy_prefix) |
12 | 22.6 (+13.2 drain) | DMA of the whole prior index/KV prefix into the arena | grows with position |
| 9 | the remaining ~20 sites (D2H of flags and routing ids 479 calls / 31 ms, alloc 83 / 6.7 ms, GDN copy_from 35 / 10.7 ms, GdnChunkDevice::new allocations 70 / 5.5 ms) |
~60 | small copies and allocations | the D2H of the MMQ finite flags (48 / 18 ms) and the GDN state download (35 / 7 ms) block the host behind the layer |
Reading: nearly all of the 734 ms is the host waiting for kernels that are still running, so most of these syncs do not by themselves idle the GPU. What idles it is the host-only work after a sync returns and before the next layer's first launch: per chunk gdn.state_in 35 + gdn.state_out 41 + moe.prepare 122 (of which 53 is the drain of site 5) + moe.spans 26 + moe.finish 38 + input/validate/QSA host bookkeeping, i.e. the 0.3-0.4 s between the kernel sum (about 1.2 s) and the chunk (1.6 s). The in-situ DMA is 44.6 GB/s (gate above), so the "22 GB/s" of the stream window is the window, not the engine. Removing these syncs is not a matter of deferring status words: sites 1, 2, 5 gate the host's own next step (the route ids, the download of the recurrent state, the status words of the layer). It needs the host work of layer k+1 (router readback and grouping, state upload) to overlap the kernels of layer k, which is a double-buffered restructuring of prepare / produce / finish; not started. The exact deferral that exists is LELEKA_PREFILL_DEFER_GUARDS (on).
Is there 0.3-0.4 s of host-only time per chunk to pipeline away? (job rest-gdn-laps, LELEKA_PREFILL_PROFILE_SYNC=1, chunk 8192, 2026-10-27)
With every span drained (so a span shows its own GPU + host time) the chunk is 1,558 ms against 1,631 ms undrained: the drains cost nothing, the work is a serial chain. The same chunk (position 32k):
| span | drained ms | undrained ms (139k) | what is in it |
|---|---|---|---|
moe.prepare |
47.6 | 122 | router + top-k kernels, route-id readback, host grouping. The 122 ms of the undrained run contain the wait for the GPU work queued before it (attention / FFN reads, injects are asynchronous there: 7 ms each undrained, 70-83 ms drained) |
moe.spans |
25.7 | 26 | pure host loop over the ~512 experts of the layer (bank spans, descriptor checks) |
moe.finish |
38.0 | 38 | combine kernels + status read |
gdn.state_in / state_out |
24.5 / 37.0 | 35 / 41 | per layer: chunk start + 8,192 row keys 16.0 ms, state upload / alloc 8.4, seal (row edges) 8.7, owner.finish (3.1 MB download, finite scan of the host copy, mirror adopt) 28.2 |
GPU time of the chunk, summed over its commands (PREFILL-COMMANDS, includes the per-command launch overhead of the drained profile): GDN 369, QSA 275 + index 79 + KV 22, GR read / inject 184 (readn 124: gr_mix_r 48, three GEMMs 72; injectf gr_write_norm_rs 56), MoE (MMQ + gather + combine, ledger) ~330: about 1.27 s of the 1.56 s. So the GPU idle time is about 0.3 s, but the purely host-side items that a pipeline could hide add up to about 100-120 ms (state_in 25 + state_out 37 + spans 26 + the host part of prepare ~35 + input/validate/init ~30); the rest of the idle time is launch latency inside chains of small kernels. The cheap host trims that need no redesign (skip the finite scan of an already validated mirror-resident state, reuse the row keys across the 36 GDN layers of a chunk, pool the 3 MB state buffer) are worth about 20-30 ms per chunk (1.5 %), below the 1-2 % noise of a paired A/B. Hiding the rest means keeping layer k+1's route readback / grouping and state upload in flight under layer k's kernels, i.e. double-buffering ownership types that are single-owner by design (GdnChunkStart / GdnChunkRow capabilities, OriginalMoePromptLayer): large, and its ceiling is ~7 % of a chunk. Not started; a better lever is the GR read / inject pair, 180 ms of bandwidth-bound passes over the 335 MB residual (R is 4 streams x 8192 x 2560 x 4 B) that run at 2-3x their traffic floor: bit-identical fusion / re-tiling candidates (gr_mix_r, gr_write_norm_rs, the three read GEMMs) with a model-free byte-compare probe, no ownership changes.
The hyper-connection kernels of the prompt are on their traffic floor (model-free probe, 2026-10-27 22:05)
prefill_stage_gr_gpu::gr_kernels_run_near_their_traffic_floor_at_chunk_size (T = 8192 rows, R = 335.5 MB, 20 warm launches; the byte-compare probe gr_fused_guards_equal_the_separate_guard_kernels_bit_for_bit already exists and passes: 4 cases, outputs and flag words equal the Original's kernels + separate guards). Achieved bandwidth of the three kernels that make up readn / injectf (the RTX 5090's DRAM peak is 1.79 TB/s, about 1.5-1.6 TB/s is what a streaming kernel sustains):
| kernel | us per call | bytes it must move | achieved |
|---|---|---|---|
leleka_prefill_gr_norm_rs (R in, xn16 out) |
318 | 503 MB | 1.58 TB/s |
leleka_prefill_gr_mix_r (R and g in; mixed f32 + bf16 + f16 out) |
523 | 839 MB | 1.60 TB/s |
leleka_prefill_gr_write_norm_rs (R in and out, bo in, xn16 out) |
616 | 923 MB | 1.50 TB/s |
The "floor of 18 ms per pass" quoted before counted only one read of R: mix_r also reads the 335 MB gate tensor g and writes three images of mixed, write_norm_rs reads and writes R. Against their real traffic the kernels run at 84-89 % of the DRAM peak, so no re-tiling or fusion of these kernels can buy more than ~10 % of their 180 ms per chunk (about 5-8 ms), and the three GEMMs of readn (72 ms) are cuBLAS calls whose algorithm cannot change without changing bits. Same for the other large passes: the GDN convolution reads and writes the 335 MB h (0.47 ms per call against a 0.4 ms floor). The 8192-token prompt chunk is therefore bound by the memory traffic of fp32 activations 10,240 wide plus the serial host/GPU chain measured above; the only remaining bit-identical savings are the host trims (20-30 ms) and the launch latency of the small-kernel chains. Reducing the bytes (bf16/f16 activations, fused int8 prompt experts) changes numerics and is row 3.2 territory. No code changed for this item.
GPU idle-gap anatomy of one steady chunk (CUPTI, job rest-cupti-chunk, chunk 8192 at position 139,264, 2026-10-27 22:35)
Method: tools/cupti-trace injected into the replay (night5-long-256k, production env, branch defaults), a 7 s window opened when the previous chunk finished, scripts/profile/lct_report.py --stamps ... --chunk 1 for the window and the new scripts/upstream-rest/gap_anatomy.py for the causes (a gap = no kernel of ANY stream runs, at least 20 us; the cause is the first that applies: an expert copy completing within 4 us before the gap's end = copy-wait, a blocking host call covering 30 % of it = host-sync, launch calls covering 30 % = launch-bound, else host-gap). The traced chunk takes 1,841 ms (1,631 ms untraced: CUPTI adds ~12 %), 52,097 kernel launches, 47,944 copies. Port only: no Original trace of this chunk exists (the ledger's old 16k / 180k traces of the Original are from before the stream and the sized cache).
- GPU busy (union of all streams) 1,411.5 ms = 78.3 %, idle 392.0 ms = 21.7 %; gaps >= 20 us: 1,698, 373.6 ms (smaller gaps 18.4 ms). H2D copy engine busy 738 ms (40 %) at 46.4 GB/s over 32.5 GB in 46,746 copies, 69 % of the copy time overlaps kernels.
- By cause: host-gap 177.0 ms (9.8 %), host-sync 105.4 ms (5.8 %), copy-wait 75.2 ms (4.2 %), launch-bound 16.1 ms (0.9 %).
- Top sites by total idle ms (previous kernel family -> next, cause; per chunk):
| # | idle ms | gaps | site | cause | what it is |
|---|---|---|---|---|---|
| 1 | 56.2 (+6.4) | 33 | gdn_prefill_finite_f32 -> gr_scan |
host-gap | end of every GDN layer: seal, 3.1 MB state download, host finite scan, mirror adopt, stage (gdn.state_out) |
| 2 | 51.1 (+5.6 sync) | 47 | moe_prefill_finite_f32 -> mmq_zero |
host-gap | between a MoE layer's router/finite kernels and its first MMQ launch: route readback, host grouping, the finite-span walk (moe.prepare + moe.spans) |
| 3 | 50.1 | 769 | mmq_gather -> mmq_gather |
copy-wait | the compute stream waits for the copied event of the next expert (the DMA is behind compute for ~1/3 of the layer's entries) |
| 4 | 36.4 + 16.0 + 9.9 | 12 + 16 + 9 | qsa_index_scan -> kv_guard / qsa_scan_half / rms_rows |
host-sync / host-gap | per QSA layer (12): the stage copy of the whole prior KV prefix (147 MB at 46 GB/s = 3.2 ms) and its drains, kv copy_prefix in append_resident_arena, in the compute stream between the indexer and the attention |
| 5 | 20.8 + 12.3 + 10.9 | 306 + 48 + 44 | mmq_gather -> mmq_gather, mmq_finite -> mmq_gather |
host-gap | host issue of the per-expert gather launches (24,014 gather kernels of 2.8 us) |
| 6 | 17.7 + 10.5 | 13 + 4 | mmq_finite -> moe_prefill_combine |
host-sync / copy-wait | the layer's status drain before the combine |
| 7 | 14.3 (+7.7 +6.6) | 31 | gr_mix_r -> gdn_prefill_zero |
copy-wait / host | start of a GDN layer: chunk start, row keys, 8.4 ms of state upload / alloc |
| 8 | 5.4 | 8 | gr_mix_r -> qsa_scan_half [cuMemAlloc] |
host-sync | allocations in the QSA layer start |
Blocking calls overlapping the gaps: cuMemcpyDtoH_v2 229 gaps / 137 ms (498 calls per chunk: route ids, flags, the GDN state), cuStreamSynchronize 166 / 97 ms, cuMemcpyHtoD_v2 32 / 27 ms, cuMemAlloc_v2 20 / 18 ms.
Verdict. Launch latency inside chains of small kernels is not the problem (launch-bound 16 ms = 0.9 %; 52k launches cost the CPU 157 ms at 3 us but they are queued ahead of the GPU), so capturing per-layer small-kernel chains as CUDA graphs buys at most that 0.9 %; graph capture is not worth the ownership changes. The idle time is host work between dependent GPU phases (about 280 ms of 392 ms in the traced chunk, ~250 ms untraced, 15 %): GDN layer boundary 62 ms, MoE route readback + grouping + gather issue 100 ms, QSA prefix stage copy and drains 65 ms, status drains 28 ms, plus expert copy waits of 75 ms. None of them is a single removable item above the 3 % bar that is bit-identical without restructuring: the largest candidates are each 3-4 % and each needs a double-buffered owner (a second KV stage for the QSA prefix copy, which the Original lays out once in the shared arena; a second GDN state / row-key set; an asynchronous route-id readback with the grouping of layer k overlapping the kernels of layer k-1).
Not taken (reasons in the digest)
Qwen3.6-35B-A3B path, Metal/SYCL/HIP-only changes, K8V4 streaming and elastic KV (--kv-grow; our serve path excludes K8V4), the installers and host app.
DeepSeek-V4.1 engine: separate plan after this one (digest part 2; needs the disk work already done on the server, /data).
Rows 2.1 / 2.2: what upstream has that our window does not (diff list, 2026-10-26; no implementation)
Method: read the resulting upstream code (engine/strata, commit 41cf05a0) against our chain kernels (crates/cuda-driver/src/chain_window.cu, docs/chain-kernels.md) and the sealed Original window kernels,
which are the OLD upstream pin (so the old pin has none of sub16, up75, down_tg, SIDE_MIXER, COMMIT_BATCH, HEAD_MIX_MULTI, SH_FORK, native_qsa_rms_norm_rope). Every gain below is an
estimate from our own per-family microseconds (ledger section 5, docs/chain-kernels.md 2.4; chain 12.6 ms and round about 25 ms per 4-row window on the 5090), not a measurement; upstream's own
numbers are claims on other hardware (RTX PRO 5000, sm_86 cards). Nothing here was run. Re-sealing PTX (sm_120 and ptx-sm86) is a fixed extra cost for every item marked "seal".
| Item (upstream switch) | Our status | Estimated gain per window | Effort | Numerics |
|---|---|---|---|---|
GR_DOWN_TG=1 |
HAVE, better: chain_gr_down_t2w8_nb4 (9.7 us against the Original's 18.4 us at T=4) |
none | - | - |
| multi-token router, multi-token GR read/write | HAVE: the old pin already batches them; our chain GR is the better one | none | - | - |
HEAD_MIX_MULTI (one multi-token head-mix launch instead of 5 kernels per token, verify.cpp 301-316, 2327-2345; ours: plan_head_mix, original_verify_window_gr.rs:622) |
MISSING | 60-100 us (0.5-0.8 % of the chain); the chain GR kernels already take T tokens, maybe no new PTX | S | bitwise (verify byte for byte) |
COMMIT_BATCH + state-only GDN commit (verify.cpp 2646-2700, verify_kernels.cu 180-215, 1067-1087, 1160-1170; ours: verify_gdn_conv_commit_kernel + the full verify_gdn_step_norm_multi_kernel per layer, original_verify.rs:331-336, commit graph 158 kernels, 0.463 ms) |
MISSING | 250-350 us per ROUND (1.0-1.4 % of the round), on the critical path between rounds | M, seal | bitwise (gdn_parity) |
ATTN_DAILY (qsa_decode_attn.cu attn_chunk_kernel_pre75, reduce12, attn_merge_v2: 16 shuffles instead of 60, 2 cells per step) |
MISSING: ours is the literal old kernel (leleka_qsa_decode_chunk, qsa_native_decode.cu:81); chain_qsa_decode_chunk only hoists loads and measured slower |
140-235 us (1.1-1.9 %): 30-50 % of the 470 us chunk | M, seal | bitwise |
cluster argmax / top-k (sampler.cu, sm_90+) |
MISSING (our greedy argmax: one block per token, 79 us per window; draft sampler 38 us, row_top_prob 36 us) |
120-160 us per round (0.5-0.8 %); N/A on sm_86 | S-M (cuLaunchKernelEx inside capture), seal |
bitwise |
SIDE_MIXER=2 + SH_FORK_LATE (GDN a/b gates and the indexer chain on side stream 1, the gate projection and QSA query chain on stream 2, events inside the captured graph) |
MISSING: our window is one stream, no cross-stream edge | 300-700 us (2.4-5.5 % of the chain); the 5090 has 170 SMs and our kernels are small-grid; upstream claims -1.2 % (A4000) / -2.3 % (3060) | L (side streams + event capture in OriginalCapture, keep the QSA journal in order); no seal |
bitwise (scheduling only) |
GR_UP75 (interleaved reductions, tail dot over 4 rows) |
PARTIAL: chain_gr_up8/16 already hoist the loads |
50-100 us (0.4-0.8 %) | S, seal | bitwise |
batched K/V and indexer append (kv_q8.cu:193, native_qsa_indexer.cu:269,300) |
MISSING (one row per launch, original_verify_window_qsa.rs:530) |
50-90 us (0.5 %) | M, seal; keep the streamed host-mirror semantics | bitwise |
float4 combine (native_moe.cu 66-93; the fused combine_k10_vec4_hits is HIP-only) |
MISSING | 30-50 us (0.3 %) | S, seal | bitwise |
16-lane sub-warp expert kernels + GU_SWIGLU (iq_kernels.cu native_gu_multi_kernel<..SUB16> 1864, row_dot_80_sub16 1561, launch_gu_swiglu; ours window_moe_gu_*/window_moe_down_* are the old warp-per-row kernels, chain_swiglu_quant_kernel fuses SwiGLU with the quantizer only) |
MISSING / PARTIAL | 200-350 us (1.6-2.8 %): the old kernel idles half the lanes on the third pass; no upstream number | L (a 5.7k-line file, per-format parity), seal | bitwise (claimed) |
MMVQ_IL interleaved MMVQ, 2-4 and 5-8 columns (native_mmvq.cu 2979-3175, q8_1_il.cuh; tables only for IQ4_XS, Q4_K, Q5_K, Q6_K, Q3_K; the 5-8 column table is sm_120-only) |
MISSING (we run the old exact head_n*_t* kernels) |
100-400 us (0.8-3 %); bounded by dense 2,250 us against a floor of ~2,000; larger at T >= 5 where the old kernel falls back; which of our dense weight types the tables cover is unknown | L, seal | bitwise (claimed, mmvq_il_parity) |
fused per-head RMSNorm+RoPE (native_rope.cu 69-125, 175-245) |
MISSING (split_q, rms, rope: 7 launches against 3) | ~40 us (0.3 %) | S-M, seal; must match the sealed --use_fast_math pair bitwise |
bitwise (verify) |
| exact-T GDN a/b | PARTIAL (chain_gdn_ab_multi_kernel hoists weights across 96 warps) |
50 us or less | S, seal | bitwise |
MTP catch-up skipping rejected rows (mtp.cpp 73-79, 1580) |
MISSING | 20-80 us per round (0.1-0.3 %) | M | gate it (not claimed bitwise) |
ONE_TOKEN_COMMIT |
MISSING | about 0 at 3.06 tokens per round (only T=1 windows) | M, seal | bitwise |
Ranking by estimated gain per effort: (1) HEAD_MIX_MULTI, (2) COMMIT_BATCH + state-only GDN commit, (3) ATTN_DAILY, (4) cluster argmax, (5) SIDE_MIXER=2 + SH_FORK_LATE (the largest single item, L),
(6) GR_UP75 delta, (7) batched appends, (8) float4 combine, (9) sub16 experts + GU_SWIGLU (L), (10) MMVQ_IL (L), then the rest.
Measure first, all model-free (nothing needs a model load): the T distribution and T=1 share of the live windows (docs/e2e-data/945*: decides MMVQ_IL 5-8 columns and ONE_TOKEN_COMMIT); a per-kernel sum of the
72 GDN commit kernels from the job 9062 trace (bounds COMMIT_BATCH); a chain_probe gr-style shape for the head mix at T = 1..8 (byte-compare the per-token chain against the staged multi read);
tools/chain-probe/qsa_prof.cu extended with upstream's attn_chunk_kernel_pre75 + attn_merge_v2 against leleka_qsa_decode_chunk (cold weights, our 64-cell grid); an mb_pdl.cu-style two-branch graph for
the overlap bound of SIDE_MIXER / SH_FORK (a/b-sized kernels beside a qkv-sized MMVQ on 170 SMs); upstream's decode_cluster_parity --bench on 248,320 logits; window_moe_gu_16 / window_moe_down_20
against the sub16/sub8 kernels with random blobs, 30 groups, cold weights (gates the biggest item); mmvq_il_parity --bench on the 5090 with our shapes and T from 4 to 8.
Closing the host gaps between dependent phases: three bit-identical changes (2026-10-28)
The CUPTI anatomy named four host-side gaps per 8192-token chunk. Three were taken, each behind its own switch (all on by default now, =0 restores the old path;
replay arm flags !qpf/!noqpf, !gpool/!nogpool, !mspan/!nomspan). The fourth, the route readback, cannot be overlapped as proposed: the router of layer k reads the residual
that layer k-1 writes, so there is no earlier GPU work to hide the readback under; only the host work after it (grouping, spans, gather issue) can shrink.
| step | switch | what changed | where the time was |
|---|---|---|---|
| (a) QSA prefix-copy overlap | LELEKA_PREFILL_QSA_PREFETCH |
the 147 MB prior-KV prefix copy of a QSA layer starts at the beginning of the layer on a side stream (event after the compute stream's last write of the shared stage, copy, event the layer's own copy_prefix waits on) instead of in the compute stream between indexer and attention. No second stage is needed: the arena stage is free when the layer starts. Same bytes, same spans, earlier. |
qsa_index_scan -> kv_guard, 62 ms/chunk |
| (b) GDN state pool | LELEKA_PREFILL_GDN_POOL |
the two 3.1 MB buffers per GDN layer and chunk (ping-pong scratch, mirror spare) come from a pool of four instead of cuMemAlloc + cuMemFree (144 driver calls per chunk, each free a device-wide synchronization), and the downloaded state is scanned for finiteness once instead of twice. | gdn_prefill_finite -> gr_scan, cuMemAlloc gaps (18 ms) |
| (c) MoE span cache | LELEKA_PREFILL_MOE_SPAN_CACHE |
the resolved bank spans and formats of every admitted (layer, expert) are kept per bank (same lifetime as the finite-admission bitmap, keyed by the bank address); a later chunk skips the per-expert binding walk (moe.spans, 26 ms/chunk). bank.eligible and the format-equality check still run per expert. |
moe_prefill_finite -> mmq_zero |
Not done: a deferred (asynchronous) state download for the GDN layer end. GdnPrior owns the host values and is staged into the transaction before the next layer starts, so a deferral needs a lazy prior or a second ownership
chain; with the pool and the single scan the remaining boundary cost is the 3.1 MB synchronous download per layer (about 0.3 ms x 36).
Identity (gate I). Final residual hash of every prefill chunk (LELEKA_TRACE_PREFILL_R) and the top-16 rows of the teacher-forced decode, replay arms in one process each (a third fresh stack in one process fails with HostAllocation, so
the 256k job runs two arms per process):
945-codex-crm(84 requests of 10k-70k tokens, chunk 2048): arms B (all off), P, G, M (one switch each), ALL:cmp_rhashIDENTICAL on 108 / 108 chunks for P, G, M and ALL; 4,135 top-16 rows per arm with d_top1 and dmax16 exactly 0.0, 0 argmax flips.night5-long-256k(5 requests 45k-243k, chunk 8192, grid 8192, sized per-layer slots, decode capped at 48 tokens): B1 against A1, A2, B2, P, G, M, B3: IDENTICAL on 34 / 34 chunks each; top-16 rows B1 vs A1: 242 rows, d = 0, flips 0.
Paired timing (same replay, same process shape; arm_prof.py sums the prefill-chunk times of the PREFILL-PROFILE lines, positions >= 100k = 19 chunks, 141,844 tokens; B = all off, A = all on). The summed chunk time is stable to +-10 ms between repeats of the same arm; sum_ttft is not
(the first arm of a process is 1-2 s slower than the second, see the table), so the chunk sums are the comparison and the TTFT sums are given for completeness:
| arm (process order) | chunk sum all (ms) | chunk sum >= 100k (ms) | qsa >= 100k | moe >= 100k | gdn >= 100k | sum TTFT (s) |
|---|---|---|---|---|---|---|
| B1 (1st of proc 1) | 66,366 | 36,859 | 9,168 | 12,199 | 8,151 | 68.4 |
| A1 (2nd) | 63,455 | 35,817 | 8,600 | 11,807 | 8,050 | 65.0 |
| A2 (1st of proc 2) | 64,639 | 35,826 | 8,600 | 11,782 | 8,110 | 66.5 |
| B2 (2nd) | 64,875 | 36,864 | 9,171 | 12,233 | 8,109 | 66.4 |
| B3 (2nd of proc 4) | 64,917 | 36,847 | 9,169 | 12,230 | 8,122 | 66.5 |
| P (qpf only) | 65,641 | 36,363 | 8,600 | 12,224 | 8,164 | 67.6 |
| G (gpool only) | 64,802 | 36,781 | 9,176 | 12,195 | 8,057 | 66.4 |
| M (mspan only) | 65,385 | 36,489 | 9,170 | 11,838 | 8,159 | 67.3 |
Reading: at >= 100k, B (3 repeats) 36,857 +- 9 ms, A (2 repeats) 35,817 / 35,826 ms: -1.03 s = -2.8 % of the prefill chunk time, split exactly as designed: (a) QSA -569 ms (-6.2 %), (c) MoE -430 ms (-3.5 %), (b) GDN -17..-77 ms (-0.2..-0.9 %, at the
noise floor). Over all 34 chunks B is 64.9-66.4 s and A 63.5-64.6 s (the shorter chunks carry the first-arm effect). The single switches add up: P -494, G -76, M -368 ms at >= 100k. Sum TTFT of the five requests: B 66.5-68.4 s, A 65.0-66.5 s, about 1.3-3.4 s (2 %) lower, within the
order effect, so the claim is the chunk-time one. The replay is the production shape (chunk 8192, sized slots) but with LELEKA_TRACE_PREFILL_R=1 on in every arm and decode capped at 48 tokens; the real-stack 4-run A/B (rest-e2e-ab2, binary with the defaults on, before = the three switches =0) is queued; its numbers are not in this table.
Hardware / software: RTX 5090 (driver 595.99), CUDA 13.2.2, Rust release test binary rt-qpf3 (switch defaults off, env/arm override) for the table; rt-qpf4 / bin-e2e4 have the defaults on (the only difference). Model: Qwen3.8-Flash-Next IQ3_S + KAR L2, expert cache auto (sized per layer), prefix cache 6000 MiB.
Scripts: scripts/upstream-rest/jobs/rest-qpf-id2.sh, rest-qpf-256k.sh, rest-qpf-256k-b.sh, rest-e2e-ab2.sh.
sm_120 decode switches (2026-10-29, branch claude/decode-sm120-switches on claude/train-a-stra-245 406b40a8; rows 2.1 / 2.2)
Speed-train decision (2026-10-29): ATTN_DAILY and GU_SWIGLU ship default off. The paired e2e session at 247k (/data/leleka-e2e/runs/sm120, summarize.sh) showed no gain: decode tok/s turns 1-4 with both on 127-131, with both off 125-144, turn 5 dominated by the PLE scan stall (fixed separately). The two arms also differ in the input tokens of turn 2 onward (105470 vs 105427), so the e2e outputs are not identical although the replay-identity gate reported d = 0; this is unresolved. Run-to-run spread of the base arms is as large as any gain.
Upstream turns five bitwise switches on by default on a compute capability 12.0 card (engine/strata/include/strata/core/sm120_series.hpp). One commit each, all behind
LELEKA_SM120_<NAME>=0|1 (wins in both directions on a 12.x card; a card below 12.x never takes a switch, the PTX is sm_120 only, so the sm86 build is unaffected) and LELEKA_SM120_PERF=0 (whole default set off); replay arm flags !attn/!noattn, !gus/!nogus, !side/!noside.
Code: crates/cuda-driver/src/original_verify_window_sm120.rs; model-free probe tools/decode-sm120/sm120_probe.cpp (byte-compares the new kernels with the sealed ones, RTX 5090);
scripts scripts/decode-sm120/ (build, seal, holder jobs sm120-replay-id.sh and sm120-e2e-ab.sh, summarize.sh).
| switch | what was done | default on cc 12.0 | model-free result (RTX 5090, driver 595.99, CUDA 13.2.2, graph-timed, warm L2) | end-to-end |
|---|---|---|---|---|
ATTN_DAILY |
sm120_attn_daily.cu: upstream attn_chunk_kernel_pre75<mode 1, NC 2> + attn_merge_v2_kernel<16> replace leleka_qsa_decode_chunk / _merge in QsaWindow::decode_attention |
off (opt-in LELEKA_SM120_ATTN_DAILY=1) |
66 cases (T 1..8, 0..2051 cells, masked pages): chunk partials, merge of both partial sets and merge_v2 byte-identical; T=4 chunk 29.8 -> 20.3 us, merge 6.5 -> 2.9 us (12 QSA layers a window) | see the jobs below |
GU_SWIGLU |
sm120_gu_swiglu.cu (+ generated sm120_iq_prefix.cuh, the pinned iq_kernels.cu up to the dequant banner): upstream native_gu_swiglu_kernel replaces window_moe_gu_<T> + swiglu_entries_kernel + quantize_q8_1_kernel for gate/up types 16 17 18 21 22 23 at n_embd 2560 |
off (opt-in LELEKA_SM120_GU_SWIGLU=1) |
30 cases (6 types, 1..8 rows, 1..40 groups): the q8_1 blocks the down kernel reads are byte-identical; per layer at 4 rows 20.9 -> 14.2 us (16), 29.8 -> 20.7 us (18), 24.9 -> 19.6 us (21) | see the jobs below |
SIDE_MIXER (GDN half of =2) |
the GDN gates and the gate projection of every GDN layer on two side streams of the window graph (fork after the quantizer, join before the recurrence); OriginalCapture owns the side streams |
off (no identity or timing result yet) | none (no new kernel) | pending |
GR_DOWN_TG=1 |
not ported: chain_gr_down_t2w8_nb4 (9.7 us at 4 rows, part of LELEKA_CHAIN=all) is the same idea and measured faster than the Original's |
- | - | - |
GR_UP75 |
not ported: chain_gr_up8 (5.7 us at 4 rows) already hoists the loads; vanilla's gr_up75 averages 9.45 us in its trace (mixed T), not comparable, not probed |
- | - | - |
Not covered by the probe: gate/up types 29 (IQ1_M) and 42 (Q2_0) (kept on the three-kernel path), the MTP draft attention (keeps the Original chunk kernel), the QSA half of SIDE_MIXER.
Gates still to run on the 5090 (queued as holder jobs sm120-replay-id and sm120-e2e-ab, outputs under /data/leleka-e2e/runs/sm120-id and /data/leleka-e2e/runs/sm120):
identity (teacher-forced replay of night5-long-256k, top-16 rows, expected d = 0 and 0 flips) and the paired 256k session (frozen corpus, pinned upstream profile, arms base/all/attn/gu/side).
Upstream review 2026-10-30 (Strata 41cf05a0..870aedd9, consolidated port list for our product)
Sources, all desk reviews on main (nothing built, no GPU, server not touched): docs/upstream-review/decode.md (speculation, tiers, window kernels), kernels.md (CUDA kernels, prefill, memory planner, build), cpu-and-platform.md
(CPU experts, protocol and tool calls, caches, Windows, defaults). The range is 585 commits (503 without merges); releases 0.2.6, 0.2.7, 0.2.7.1, 0.2.8 (Qwen engine 0.1.50 -> 0.1.54). Our pin stays 41cf05a0 and the Original reference build stays stra169-ladder;
nothing here changes the provenance record in docs/upstream.md.
Target: Qwen3.8-Flash-Next IQ3_S + KAR + MTP; RTX 5090 server and RTX 3080 laptop; 256k agent sessions. Ranking follows AGENTS.md: (1) protocol correctness and tool-call integrity, (2) model quality, (3) end-to-end agent throughput, then decode and prefill throughput.
Rows are numbered 4.x correctness and hygiene, 5.x decode and speculation, 6.x prefill and TTFT, 7.x laptop and platform, and are ordered by that ranking inside each group.
Label of every number: (M) measured in this repository (document or log named), (C) upstream's claim on upstream's hardware (RTX PRO 5000 72 GB with every expert in VRAM, 2 x A4000, RTX 3060 / 5070, CMP 170HX, R9700, P100, GB10; none is our 5090 or 3080), (E) estimate by arithmetic from our own numbers (low confidence unless stated), (U) not verified. Gates are the letters at the top of this document; L for a tool-call row means a live Codex session.
What the three reviews agree on
- No commit in the range gives the 5090 a lossless decode gain above about 2 % (E, all three reviews). The decode-side items are bitwise opt-ins of 0.5-1.9 % (C) measured on a card that holds every expert, other cards' tables, or lossy switches.
- Upstream reversed two lossy defaults inside the range because of long agent sessions: residency-biased routing (
20a63cf0: 4.5 of 10 agent tasks with it, 5.6 without, repetition loops, C) and approximate late-layer prefill KVA (e3450e45: shipped off, 0 of 10 agent runs on one card at split 24, C). That supports our rule of no lossy default before its own gate. - Nothing changed upstream in the things that explain our laptop and 5090 gaps: route tail skip default 7, PcieAuto, ADAPT_LAG, the sm_86 nine-switch table, the CPU expert row kernels (except an opt-in test mode), the expert profile data, the chat template, the tokenizer (cpu review sections 3 and 5, git search over the range).
- A refreshed vanilla baseline is slightly faster by new defaults (
GR_UP_WIDE,GR_V3,PROMPT_ATTN_IMMA,PLE_AUTO_RAM, 256 MiB less auto cache; 1-3 % in total, C). The comparison binary is 0.2.6 / engine 0.1.50. A build from 0.2.7 or later needsSTRATA_DEFAULTS=026(a3ab37fc) or each switch set explicitly, and the choice recorded in the run metadata (row 4.14).
Contradictions resolved
| # | Contradiction | Resolution |
|---|---|---|
| 1 | Route tail skip: our port gave +15.2 % decode (M, 9e3 replay, row 3.1) and upstream claims +10..20 % on 12-16 GB cards and +11.5 % on a 5090 with NVFP4 (C); the gap analysis finds no share of the 5090 gap at 256k in it (M, unpaired: vanilla 6.5 ms/token with the skip, 6.6 without, decode-gap-5090.md section 3) |
Both can hold. The +15.2 % was measured with the 9,100-slot auto tier where 21.5 % of the experts are in VRAM, so about 44 % of the CPU and PCIe entries could be skipped (M). In the production shape (seed off, 93-96 % of routed entries in VRAM, M, decode-tail-5090.md section 2) few missed entries remain to skip, and vanilla's hit rate is 96-99 % (M, old unpaired). The "no share" result itself rests on unpaired runs and the pair v-nsk-t was never run (kernels review section 2), so it is (M) but weak. The skip also failed its quality gate (p99 d_top1 1.005 against a limit of 0.499, M). Decision: stays OFF, not a lever for the 5090 gap, no further work unless the laptop (16 GB, many misses) is taken up with its own gate |
| 2 | PLE reader after a failed read (ebe3383a): decode review B2 says "not checked in our reader"; kernels review H7 says "done in ours" |
Checked on claude/upstream-fixes (03e891cd): the reader already releases every ticket after a failed read; the one open way to wait for ever was a source that panics, now a failed read; new tests with several tickets in flight. Row 4.6 |
| 3 | Cache identity (f8ff3420, c7a0cef1): decode review B3 "unknown", kernels and cpu reviews "not affected by design" |
Our prefix store is keyed by the token hash chain and verifies tokens on every match (docs/prefix-cache.md); the conversation path binds no parking (NO_PARKING). Pinned by a characterization test a33ab0bd (A, B, A, C and back, restores checked cell by cell). The checkpoint-copy allocation failure (f62589fd) is still not traced. Row 4.10 |
| 4 | Layer-major prefill gain: kernels review "3080 20-40 % of TTFT, 5090 3-6 %", cpu review "laptop prefill 1.5-2x, 5090 2-4 %" | The same estimate from the same laptop numbers (E): moe.ring 14.3 s of about 23 s per 6144-token chunk, measured before the PLE fix (docs/laptop-vs-vanilla.md), so the ring share must be re-measured. Upstream's 2.8-5.7x TTFT (C) is against a 512-token chunk, ours is 6144 / 8192, so it does not transfer. Row 6.5 |
| 5 | Priority of the NVML device-wide free VRAM (3100ca05): decode review 4, kernels P3, cpu P2 |
Laptop only (WDDM per-process free memory); the 5090 server on Linux does not have the problem. Ranked after the correctness rows, before the speed rows of the laptop. Row 7.1 |
| 6 | Residency-biased routing: decode review "experimental flag, priority 7", kernels and cpu reviews "reject" | Parked. Upstream withdrew it, we already have one lossy placement flag that failed its gate, and the failure mode (loops in long agent sessions) is our workload. Not started; would need an agent-task completion gate on top of gate Q. Row 5.8 |
| 7 | tool_call_recovery: decode review leaves it to the protocol reviewer, cpu review ranks it P1, upstream turned it on by default in 0.2.8 (3fcb2106) |
Ours is implemented and default OFF (ab54ae20): it changes whether text becomes a call, and upstream's evidence (98.3 % against 92.9 % of 1,462 turns read as intended, C) is a reporter's corpus under Claude Code, not Codex. Row 4.3 |
| 8 | TTFT gap to vanilla: the plan table says 57.3 s against 41.3 s (M, 2026-10-27, old corpus, unpaired); the kernels review quotes newer paired runs of about 52 s against 55 s taken from a task brief | Only the first is written in a repository document. The newer paired TTFT numbers are not in the repo (U); the prefill gap today is therefore unknown, which is why row 6.1 (a vanilla arm with PF_FUSED=0) comes before any prefill port |
| 9 | Draft vocabulary gain: release notes say +2.7 to +3.1 % decode for English text (C), upstream's DETAILS.md says "English 1-2 % faster" (C) |
Both are upstream claims; ours is unmeasured. Row 5.1 uses the paired A/B and identity jobs |
| 10 | GR_UP_WIDE: +1.9 % story / +0.7 % code (C, RTX PRO 5000) against our estimate 0.3-1 % (decode review, E) and 0-1 %, likely 0 (kernels review, E) |
Upstream beats the Original's mtp_scalar_gr_up, our chain kernel chain_gr_up8 (5.7 us at 4 rows, M, docs/chain-kernels.md) is already faster than that, so the claim does not transfer. Row 5.5, probe first |
What upstream does not give us
Upstream shows no 200+ tok/s at 245k context anywhere, on any card that misses experts. Its 200+ figures are RTX PRO 5000 with every expert in VRAM at short context (story 211.8, code 244.7 tok/s, C, release-notes-0.2.7.md), a Windows 5090 at 128K configured context with at least 900 MiB free (205-230 tok/s, C, DETAILS.md), and a 4K callback-affinity test
(142.8 -> 207.8 tok/s, C; row 0.6 found the mechanism absent in our code, M). On our 5090 at 247k vanilla 0.2.6 measures 137.2 and 127.5 tok/s in two runs and varies about 20 % between runs, ours with the seed off 137.2 (M, turns 1-4, decode-tail-5090.md section 1); the paired speed-train
read was 134.9 (ours) against 135.4 (vanilla) (M, two runs each, as quoted in draft-tail-5090.md). At 2.05 tokens per round (ours, M) 200 tok/s needs a 10.3 ms round against our 15.2-15.4 ms (M) and vanilla's 11.8 ms (M, old unpaired); with a 14 ms round it needs about 2.8 tokens per round (E).
Upstream shows neither, and its own tuner says windows wider than 4 rows are 4-16 % slower and the lookup chain 3-8.5 % slower (C).
The levers for 200 tok/s at 245k are ours: tokens per round (2.05-2.13 against 1.79-1.88 for vanilla, M, vanilla's from old unpaired runs, so we are not behind there, and nothing in the range raises it) and removing the CPU-expert waits (verifier CPU callbacks 3.9 ms of a 15.2 ms round, M, draft-tail-5090.md section 1; VRAM share of routed entries 80-85 % with the prompt seed
against 93-96 % with it off, M, decode-tail-5090.md section 2), plus the draft (1.7 ms against vanilla's 0.9 ms, M and M-unpaired). The remaining upstream window-kernel ideas sum to about 2-6 % of a round (E, row 5.4) and cannot close that distance alone.
Consolidated port list
Row numbers 4.x to 7.x are new. "Branch" means a local branch not merged into main at the time of writing (2026-10-30); git log main..<branch> shows its commits.
4.x Correctness and hygiene (priorities 1 and 2: tool-call integrity, model quality)
| # | Item (upstream SHAs) | Action | Gate | Status |
|---|---|---|---|---|
| 4.1 | Quoted tool call inside a string argument cut the argument silently (77794e34, b72f56e0, upstream #4078; cpu review A1, a confirmed defect of ours) |
follow upstream's quote rule in control-plane/src/tool_output.rs; port upstream's corpus first |
U (+ L) | done on main (c5c60ac6 corpus: 49 specimens, 41 Qwen-form, 8 DSML skipped; 9b07fdd9 fix). Before the fix 11 of 41 specimens and 2 of 6 quoted-value shapes were read as upstream expects, after it 13 of 41 and 5 of 6 (M, code reach on upstream's corpus, not a session rate). Deliberately not taken: a value that reopens its own parameter stays an error (duplicate parameter), pinned by native_tools_sdet. L todo: count the shape in real failed-output captures (STRATA_DEBUG_FAILED_OUTPUT) |
| 4.2 | Recoverable shapes that ended in a failed response: </function> left out, </tool_call> left out, a call inside the reasoning, damaged array / object arguments (d7113273, 805ebe17, upstream #4427, #4077; cpu review A2, A3, A4) |
read them as calls, log every acceptance; an undeclared tool name stays an error | U (+ L) | done on main (f528844f, default behaviour, each acceptance logged on stderr). Undeclared names are NOT returned as text as upstream does (a text answer ends an agent's turn, a failed response is retried by the client; pinned by native_tools_sdet, backend_worker_http). Open brackets and bare strings in arguments are not repaired by default. Repairs interpret what the model wrote: the owner has not recorded an explicit decision in the repo (U). L todo |
| 4.3 | tool_call_recovery: calls drifted by a token (<parameter=NAME> opener, <=NAME>, bare <function=NAME>, JSON inside <tool_call>, a second call in one wrapper) (3fcb2106, 5bc479d9; cpu review A5) |
opt-in setting tool_call_recovery / STRATA_TOOL_CALL_RECOVERY=1, declared tools only |
U, L, then Q-equivalent: completion of real agent tasks | implemented, experimental, default OFF (ab54ae20; strata-control lib 339 passed, M). Recovery on upstream's 41 Qwen specimens: off 24 of 41, on 30 of 41, the 6 that need it 0 of 6 against 6 of 6 (M, code reach, not a rate for real sessions). Upstream's 98.3 % against 92.9 % (C) is a reporter's corpus under Claude Code. Not enabled in any profile until measured on our own failed-output captures and a Codex session |
| 4.4 | Aliases of a declared tool name: namespace__member, namespace=member, bare member, mcp_a_b (805ebe17, fd8d37e9; cpu review A6) |
test whether the model mistypes our 24-hex namespace alias (ns_<hex of sha256(namespace/name)>, response_tools.rs) on a Codex MCP namespace before adding aliases; owner policy on fail-closed against text |
L (needs the model) | todo, hypothesis only (U): the risk that the 24-hex alias is mistyped is not measured. Undeclared name = error stays |
| 4.5 | Window-graph cuGraphInstantiate out of memory ended the engine (a8c1d4b7, 2a9a67c1, upstream #3702; decode B1, kernels C5 / H3) |
drop the widest window graphs that do not fit and carry on; an upload failure is a warm-up skip | U, then a GPU run with the failure injected (LELEKA_TEST_WINDOW_INSTANTIATE_OOM_AT=N) |
branch claude/upstream-fixes, b5d5b24f; CPU tests only, never run on a GPU (U), not merged. Matters at the edge: free VRAM at decode is 316-563 MiB on the 5090 (M, vram-footprint-5090.md), and vanilla ends with about 459 MiB free on the laptop (M, laptop-vs-vanilla.md; ours not re-checked) |
| 4.6 | PLE reader hang after a failed read (ebe3383a) |
tests with several tickets in flight; a panicking source is a failed read | U | branch claude/upstream-fixes, 03e891cd, not merged. The failed-read path already released tickets (so the upstream bug did not apply); the panic case was the open hole. Pin: row 0.4 for the other PLE bug |
| 4.7 | q8_1 division flavour of a fused producer (7d1016f3, 789d8390; kernels H1) |
guard that chain_swiglu_quant_kernel divides like the pair it replaces |
U (read-only PTX analysis) | branch claude/upstream-fixes, 58305a19, not merged. Sealed PTX (sm_120 and sm_86): the fused kernel and the swiglu_entries_kernel + quantize_q8_1_kernel pair of mtp_original_full_head_iq (the routed-expert path of the window) use div.rn.f32; the fast-math copies (native_head_iq, native_head_native) are not on that path. Constraint: parity-audit-5090.md row 7 proposes re-sealing the quantizers with fast-math, which would move the other side of this pair; decide the flavour once for the whole q8_1 family before any such re-seal |
| 4.8 | nvcc 13.2.0 / 13.2.1 miscompile some sm_120 kernels (IQ2_S / IQ3_S products wrong; upstream TROUBLESHOOTING.md, kernels H4) |
validate_ptx refuses a PTX whose header names V13.2.0, V13.2.1 or V13.2.51 |
U | branch claude/upstream-fixes, 6af628aa, not merged. Tree check (M, kernels review): 86 sealed files V13.2.86, 56 V13.0.88, 58 V12.8.93, none bad |
| 4.9 | --adapt-decay outside 0..1 diverges (4a7e373d, upstream #1284) |
clamp LELEKA_ADAPT_DECAY to 0.7 with a logged line |
U | branch claude/upstream-fixes, 7d016625, not merged (env knob only, default unchanged) |
| 4.10 | Cache identity and the checkpoint copy (f8ff3420, c7a0cef1, f62589fd; decode B3, kernels D1 / H8, cpu B1 / B3) |
pin that a restored conversation never serves another one; trace what a device allocation failure inside a checkpoint save does | U | identity: branch claude/upstream-fixes, a33ab0bd, a test, no code change, not merged. Checkpoint-copy OOM path: todo, read the save path and add a test with an injected allocation failure (prefix-cache failures drop the entry and the request goes on per docs/prefix-cache.md, but the device-allocation case is not traced) |
| 4.11 | Silent local-memory spills in kernels (3a3f35c6, kernels H5 / C7) |
run ptxas -v over the sealed PTX, keep an allowance table; also catches register growth after a splice (row 1.1) |
U | todo, offline, needs the CUDA toolchain only (no model, no GPU run) |
| 4.12 | Per-thread copy streams and events leak VRAM over many cold prompts (3478382e, f62589fd, upstream #3470) |
free VRAM must stay flat over N long cold prompts (LELEKA_VRAM_LEDGER=1) |
R-style leak run | todo, needs a GPU run (U: no leak known in our driver wrappers, not audited) |
| 4.13 | Window-invariant CPU rows as a test mode (499e9635, 447460e8, upstream #3416; cpu review D1) |
each token's CPU expert rows take the bits of the one-token call whatever the window width; use only to tighten the run-to-run band of gate Q | Q tooling | todo, no speed claim. Motivation: the port is not bit-deterministic between processes (13.5 % of rows identical across two runs, M, header of this document) and fixed windows with one CPU worker are bit-identical (M, job up3h-det); that window-width dependent CPU rounding is a main part of the band is an inference (U) |
| 4.14 | Vanilla baseline hygiene (a3ab37fc, STRATA_DEFAULTS=026) |
every A/B arm built from upstream 0.2.7 or later sets STRATA_DEFAULTS=026 or each switch explicitly, and records it in the run metadata; the pin and the reference build do not move |
process | rule only, no code. Reason: a 0.2.8 binary silently carries GR_UP_WIDE, GR_V3, PROMPT_ATTN_IMMA, PLE_AUTO_RAM and a 256 MiB smaller cache (1-3 % in total, C), the size of our run-to-run spread |
| 4.15 | Control-token text in messages (old row 0.1; c16f31f8, 98b7ea94, 0d613031) |
finish strata-desktop-core (runtime_gateway, runtime_tools still render unmarked text) |
U, L | unchanged from row 0.1: U done, desktop-core not done, L todo |
Merge note for claude/upstream-fixes: git diff --stat main...claude/upstream-fixes reads 13,685 insertions and 13,039 deletions over 13 files, but with --ignore-space-at-eol only 661 insertions and 15 deletions (M, just measured): four of the six commits (11 of the 13 files) rewrote whole files' line endings (the same issue 47707480 fixed on main for other branches). Re-normalize to the repository's line endings before merging so that the review and blame show the real change.
5.x Decode and speculation (priority 3)
| # | Item (upstream SHAs) | Action | Gate | Status |
|---|---|---|---|---|
| 5.1 | English draft vocabulary draft_vocab_en.bin, 40,525 ids against our 106,299 (decode P1; release notes 0.2.7) |
opt-in LELEKA_DRAFT_VOCAB=en|cyrillic|fr|path, digest-checked, data file kept outside Git |
R (paired A/B), Q (q_pair with an A/A control), then a tool-call integrity check before any profile |
branch claude/draft-vocab (4232adaf port, d6fc9086 jobs and notes), not merged, untested on a GPU (U). 11 CPU unit tests pass, the real-file test passed on the laptop 2026-10-30 (M). Jobs draftvocab-ab.sh and draftvocab-id.sh are written, not run. Claimed +2.7 to +3.1 % decode and about 110 MiB VRAM, about 55 slots (C; E for the slots); at 0.15 ms per 1 % of a 15 ms round (E) the claim would be 0.4-0.45 ms. Not bitwise: acceptance changes window shapes. English favours it; a Chinese or Russian session loses. Needs /data/leleka-e2e/decode/assets/draft_vocab_en.bin (sha256 369151522226a5ed...97fb25) on the server |
| 5.2 | Our own speed work already on main (no upstream SHA; measured in docs/experiments/decode-tail-5090.md, draft-tail-5090.md, vram-footprint-5090.md) |
keep, measure combined | R, Q | in main. (a) Prompt-routing seed off in the 5090 profile (fcb4f02b, in main; placement class, not bit-identical; its record says the owner must confirm it and no confirmation is written in the repo, U): 108.1 -> 137.2 tok/s over turns 1-4 of the 247k session, 3 runs per arm (M); quality by the relative criterion (d_top1 p99 0.2500 against the 0.2278 control, max 0.7567 against 0.6751, flips 2.10 % against 2.59 %, M); no perplexity or task-completion check. (b) PLE row cache evicts from a recency queue instead of scanning all rows (a73d0906): the scan cost 9-11 s over the 153 rounds of turn 5 (M, span), turn 5 was invalid for ours in every arm before; the post-fix turn 5 is not recorded in a repo document (U). (c) Slots: dense weights in 64 MiB slabs (8c9748a3, 688 MiB of driver rounding measured, about +310 slots E), reserve 130 MiB opt-in (981c7aad, about +87 slots E, default stays 300), prompt-embed alias experimental (521bfc91, about +166 slots E), planner against the Context budget (6e58e775), 5090 budget raised to 32,819,404,800 (b63a91b2, in main; its record says owner confirmation is required). (d) Draft and host tail (3cf185a3, 2f267df9, 8735bbc5, c2198a7b): 0.45-0.65 ms of 15.35 ms per round (E), no GPU run of these in a repo document. The combined paired result is not in a repo document except the quoted 134.9 against 135.4 tok/s (M, two runs each, vanilla varies 20 %, before the slot and draft-tail work) |
| 5.3 | SIDE_MIXER=2 + SH_FORK_LATE, and GRAPH_PRIO (0049fa73; row 2.1; decode R4) |
GDN half implemented; no identity or timing; GRAPH_PRIO has nothing to prioritise until side branches exist |
I, R | SIDE_MIXER GDN half implemented, default OFF, no result; GRAPH_PRIO not ported. Estimate for the pair 2.4-5.5 % of the chain (E, plan table), upstream round -1.2 % (A4000) / -2.3 % (3060) (C); GRAPH_PRIO +1.8 % on a CMP 170HX, 0 for us without side branches (C / E). Largest single remaining window item, effort L |
| 5.4 | Remaining bitwise window kernels (row 2.2 list): HEAD_MIX_MULTI, COMMIT_BATCH + state-only GDN commit, cluster argmax, batched K/V append, float4 combine, sub16 experts, MMVQ_IL |
in the order of the 2026-10-26 ranking: HEAD_MIX_MULTI (S, 60-100 us E), COMMIT_BATCH (M, 250-350 us per round E), cluster argmax (S-M, 120-160 us E), then the rest |
I, R | nothing implemented. All estimates are (E) from our per-kernel microseconds and sum to about 2-6 % of a round; after ATTN_DAILY / GU_SWIGLU showed no end-to-end gain (row 2.1, M), expect less. The fused commit is also noted as "examined, not done" in draft-tail-5090.md (vanilla 109 us kernel). Invariant to keep for one-token windows: the commit is skipped only if the window self-committed (789d8390) |
| 5.5 | GR_UP_WIDE: HC up projection, one warp per row, 1,280 blocks instead of 160 (d18d8ba0, d39e2a75; decode R1, kernels B1) |
model-free byte-compare and timing of upstream's kernel against chain_gr_up8 at T = 1..8 on the 5090; port only if the probe shows more than about 3 us per read |
I | todo. Claimed +1.9 % story / +0.7 % code, bitwise (C, RTX PRO 5000, all experts resident); our estimate 0-1 % (E, contradiction 10). 3080: not applicable (sm_120 only) |
| 5.6 | STRATA_QSA_SPLIT_ATTN (decode P2) |
model-free probe at 245k cells first, rounding-level, gate Q | I (probe), Q | todo. The only upstream kernel idea aimed at attention at depth that we have not looked at. Claimed +2.8 % / +3.5 % decode after a 30K prompt, KL 0.0016 against a floor of 0.0012 (C, RTX 3060 / A4000). Our attention alternative ATTN_DAILY gave no end-to-end gain (M), so be sceptical |
| 5.7 | GR_V3 stream-split HC read, default on for cc 12.0 above 13 GiB (54d9363c; decode R2, kernels B2) |
do not port now; revisit only if 5.5 shows the HC read still matters | Q | not planned. +1.2 % on RTX PRO 5000 but -3.0 % / -5.9 % on 2 x A4000 and +1.0 % / -3.4 % on a 3060 (C), another summation order. Never for the 3080 |
| 5.8 | Residency-biased routing STRATA_ROUTE_PRIOR (c30656aa, 0afaaa39, 20a63cf0; decode R5, kernels B8) |
none | Q and an agent-task completion gate | parked, not started (contradiction 6). Claimed +37.6 % story / +35.2 % code at 2.0 on a 3060 12 GB (C), withdrawn in 0.2.8. Our order of magnitude if it worked: about -1.5 ms per round, about +10 % (E, from 3.9 ms of CPU callbacks); expect it to fail gate Q like the tail skip (M, tail skip at 2.5x the control) |
| 5.9 | Not taken (reasons in the reviews): HC_PERSIST (-5.4 % story, C), SPEC_PROB, GB10 table incl. HC_UPMIX and SPEC_COST, SELECT_LONG (sm_60 build only; we have the cluster top-k, row 2.5), MMVQ_IL tables for sm_80 / 8.9, 16-row windows, RAM-tier follows conversation, PLE-in-RAM policy, AMD tuning, EXPDEC, HC_REQ8, split serving, EXCHANGE_ROTATE, --pool-affinity |
none | - | closed. HC_UPMIX has no decode call site in the source and upstream withdrew its GB10 decode claim (C) |
6.x Prefill and TTFT (priority 3, after decode)
| # | Item (upstream SHAs) | Action | Gate | Status |
|---|---|---|---|---|
| 6.1 | Size the fused-experts share before porting it (kernels review M1, M2) | paired vanilla 0.2.6 arms on the frozen 245k corpus: STRATA_PF_FUSED=0 against default, with per-stage PREFILL-PROFILE; plus model-free upstream prefill_fused_iq_test against our MMQ layer pass at T = 8192 |
R | todo, no code. Vanilla runs the fused path by default on a 5090 (170 SMs >= 80, C), the PF_FUSED=0 arm was never run (2026-10-28-s0-7-vanilla-arms.md leaves it out), so how much of the old TTFT gap belongs to it is unknown (U) |
| 6.2 | Fused int8 prompt experts with grouping on the GPU (old row 3.2; 959e6c34, b1e0fdaa, bdcc34df, 10c8cc62, c47c6994, 9a398bd5, 9e203190; kernels A1) |
after 6.1; about 2,300 lines of CUDA to seal for sm_120 and a rewrite of the launch loop in mmq_original_ring.rs; experimental flag |
I (identity), Q, R, L | todo, effort L. Claimed +7.0 / +5.2 / +3.4 % prompt at 4K / 20K / 98K, +9.9 / +5.4 / +3.4 % in the History table (C, RTX PRO 5000, experts resident), KL against MMQ 0.0002-0.0010 (C). For us: 6-12 % of chunk time on the 5090, low confidence (E; the host-wait part of about 100-130 ms of the traced chunk follows from our CUPTI anatomy, the kernel part is C), i.e. 3.5-7 s of the 58 s five-turn TTFT sum. Not for the 3080: upstream keeps MMQ below 80 SMs (-4.7 % on a 48-SM 5070, -4.5 % on an A4000, C) |
| 6.3 | PF_FUSED_TILE 64 / 128-row tile (9a398bd5; kernels A1b) |
model-free sweep once 6.2 exists | I | todo, depends on 6.2. GB10 +3.4 to +4.3 % (C); E 0-4 % of MoE kernel time |
| 6.4 | STRATA_PREFILL_CPU_SHARE=auto for prompts below 1024 tokens (pin era, absent in ours: 2026-10-28-s6-1-lossy-audit.md V-02; kernels review section 9) |
measure on short agent deltas (tool outputs, 0.5-3K tokens), which are the common turn | R, Q | todo, not started. Claimed -28..-34 % prompt time at 512 tokens, -20..-26 % at 1,000 (C, 3060 / P100 / 5070). Whether it applies to a 5090 with a fast GPU is unknown (U). Tier owner's area; changes where experts run, so gate Q |
| 6.5 | Layer-major prefill: a super-chunk of S tokens runs layer by layer, routed experts staged once per super-chunk (ffe40c16 and 17 more, upstream #3976, #1670; kernels A2, cpu E1) |
model-free count of ring bytes per token at S = 1x, 2x, 4x the chunk; then an experimental flag, laptop first | Q (first-token KL 0.0007-0.009, C), L | todo, effort L, depends on the prefix-cache grid decision (a checkpoint cannot be taken inside a super-chunk). 5090: little, the ring is compute-bound (removing all expert DMA did not shorten a chunk, M, rest-dma-diag), E 2-6 %. Laptop: E 20-40 % of TTFT (contradiction 4), unmeasured. After 6.2 because both rewrite the ring |
| 6.6 | PROMPT_ATTN_IMMA int8 tensor-core prompt attention (54d9363c; kernels A4, cpu E5) |
later, one kernel, rounding-level | Q | todo, low value. Claimed +1.1 to +2.5 % prompt (C); E at most 0.5 % of TTFT (attention is 113 ms of a 1.6 s chunk, M, ledger) |
| 6.7 | Chunked GDN prompt recurrence (old row 3.4; 0f78032f) |
after 6.2 and 6.5; 5090 only | I?, Q | todo. Claimed 1.8x on the recurrence on a 5090, 0.73x on a 3060, 0.87x on a 5070 (C); ours is about 155 ms of a 1.6 s chunk (E, 4.3 ms x 36 layers), so at most about 70 ms (E); output-changing |
| 6.8 | Not taken: KVA approximate late-layer prefill (lossy, upstream shipped it off, decode -11 % on one card, C; kernels A5, cpu E4), GDN_TC (sm_80 / sm_90 only), PLE_COMPACT, DEQUANT_SIDE, swiglu_quant (E < 0.3 %), PF_FUSED NT / F16 / WS variants, quantize-once and DEQUANT_WIDE (already decided in row 2.4), async checkpoint copies (E < 1 % of a turn on PCIe 4/5) |
none | - | closed |
7.x Laptop (RTX 3080, native Windows) and platform
| # | Item (upstream SHAs) | Action | Gate | Status |
|---|---|---|---|---|
| 7.1 | Device-wide free VRAM for cache sizing under WDDM (3100ca05, upstream #1911; decode R13b / B6, kernels C4, cpu C1) |
size the expert cache from min(CUDA free, NVML free) on Windows; crates/leleka-runtime/src/qwen_forward/original_cache_startup.rs reads context.memory_info().0 today and NVML only for telemetry (crates/cuda-driver/src/nvml.rs) |
U, then L on the laptop | todo, effort S. Upstream's report: CUDA read 30,994 MiB free where NVML read 24,348 with 6 GiB held elsewhere on a Windows 5090, and a card filled to 0 MiB free decoded 80-115 tok/s against 205-230 tok/s with at least 900 MiB free (C). Not measured on the 3080 (dGPU shows 0 MiB at idle on this Optimus laptop, M, laptop-vs-vanilla.md). The 5090 server on Linux is not affected |
| 7.2 | A restart or reconfigure must wait for the predecessor's pinned memory (07d5ecfa, 01d6f7b9, upstream #4051; cpu C4) |
read the control-plane restart and reconfigure sequencing; add a bounded wait on the predecessor's pinned memory | U, then L | todo, check first. Possibly the same cause as the known "reconfigure bricks the engine" problem of the native Windows path (cpu review C4); unconfirmed (U). The laptop has the smaller margin |
| 7.3 | Sparse copied events and deduplicated slot waits in the streamed prompt walk (a11f8b0a, f217b23b; kernels A3, cpu E3) |
model-free probe of cuEventRecord + cuStreamWaitEvent cost on the 3080 under native Windows; only then the opt-in change in mmq_original_ring.rs |
I (replay identity) | todo, laptop only. Upstream measured about 80 / 45 us per record / wait under WDDM on an AMD RX 6900 XT (C); the same figures on an NVIDIA GPU are a hypothesis: at 15-20k entries per chunk it would be about 2-2.5 s of a roughly 22 s chunk (E, low confidence, 0-7 %). Lossless (same copies). 5090 on Linux: no |
| 7.4 | Late-allocation reserve of the auto cache (cfa197e2; kernels C1) |
confirm with LELEKA_VRAM_LEDGER=1 that nothing allocates after the cache on the laptop path |
U | todo, check. Vanilla 0.2.8 keeps 256 MiB more free (about 100 slots, 1.8 % on 16 GB, E); ours keeps a 1,024 MiB laptop reserve and a 300 MiB decode reserve (docs, per the kernels review) |
| 7.5 | 3080 placement knobs: PcieAuto, ADAPT_LAG, ADAPT_NOWAIT, route tail skip, the sm_86 nine-switch table |
none from upstream (unchanged in the range, cpu review D5) | R, Q | nothing new to port. The documented laptop gap is vanilla's lossy tail skip (30-40 % of its decode, per laptop-vs-vanilla.md, cited by the cpu review, not re-checked here) and its PcieAuto share; the 5090 result of row 3.3 does not transfer to a 16 GB card (U) |
| 7.6 | Finite / magnitude guard on gathered PLE rows on Windows (ebe3383a, 8dd297d0, upstream #3602; cpu C5) |
cheap check on decoded rows, as upstream's PLE_CHECK; upstream's all-logits NaN on Windows with split GGUF shards was not reproduced or explained there |
U | todo, effort S. Our Windows read-ahead has a verify mode (LELEKA_PLE_AHEAD_VERIFY, 1.36 M rows compared, 0 mismatches, M) but no production guard |
| 7.7 | Not taken: WSL KV pin (row 2.6, closed), nvidia-smi poll interval (cpu C6, WSL fallback only), PLE-in-RAM policy, AVX-512 pack warning, ARM / Apple builds, installers |
none | - | closed |
Next ports in order
One next action per row. None = CPU or documents only (laptop shell or WSL, no GPU). Server GPU = needs rnr5090, which is down now (its NVMe aborts writes under sustained load; claude/models-move is not merged and its smoke test never completed, so the job scripts of this list still name the old model paths on main; verify any new copy with direct IO before a run). Laptop GPU = needs the RTX 3080 and the owner's preconditions: charger, OEM performance mode, nothing else on the GPU, the protocol in docs/experiments/2026-10-28-s3-1-laptop-safety-protocol.md, and short jobs only because of the 0x19C freeze.
| Order | Row | Single next action | Needs |
|---|---|---|---|
| 1 | 4.5-4.10 | normalize the line endings of claude/upstream-fixes, re-run its CPU tests (WSL, build output inside the worktree), merge |
None |
| 2 | 4.14 | write the STRATA_DEFAULTS=026 / explicit-switch rule into the A/B protocol of the job scripts |
None |
| 3 | 4.1-4.3 | count the recoverable shapes in the existing failed-output captures; record the owner's decision on repairs (4.2) and on recovery (4.3) | None for the count; live session = Server GPU |
| 4 | 4.10 (checkpoint OOM), 4.11 | read the checkpoint save path and add the injected-failure test; run ptxas -v over the sealed PTX |
None (toolchain on the machine that has it) |
| 5 | 5.1 | merge claude/draft-vocab, then run draftvocab-id.sh (A/A floor first), then draftvocab-ab.sh |
Server GPU |
| 6 | 6.1 | vanilla arms PF_FUSED=0 against default on the frozen 245k corpus with PREFILL-PROFILE; model-free prefill_fused_iq_test |
Server GPU |
| 7 | 5.5 | model-free probe of gr_up_wide_kernel against chain_gr_up8 at T = 1..8 |
Server GPU |
| 8 | 4.5, 4.12 | run the injected instantiate failure (LELEKA_TEST_WINDOW_INSTANTIATE_OOM_AT) and the VRAM-flat leak run |
Server GPU (the OOM case is also relevant on the laptop: Laptop GPU) |
| 9 | 7.1 | implement min(CUDA, NVML) free memory for Windows with a unit test; check on the laptop with another process holding VRAM |
None for the code; Laptop GPU for the check |
| 10 | 7.3 | model-free probe of event record / wait cost under WDDM | Laptop GPU |
| 11 | 7.2, 7.4, 7.6 | read the restart sequencing; read the VRAM ledger line after warm-up; add the PLE row guard | None; 7.4 needs Laptop GPU |
| 12 | 6.4 | measure a short-delta prompt (0.5-3K tokens) with and without a CPU share | Server GPU |
| 13 | 6.2 (then 6.3) | only if 6.1 shows a share of at least a few percent of chunk time: start the fused-expert port behind an experimental flag | Server GPU for all gates |
| 14 | 5.4, 5.3, 5.6 | HEAD_MIX_MULTI byte-compare probe; then SIDE_MIXER identity and timing; then the QSA_SPLIT_ATTN probe at 245k cells |
Server GPU |
| 15 | 6.5 | model-free count of ring bytes per token for S = 1x, 2x, 4x; decide the prefix-cache grid | None for the count; Laptop GPU to re-measure the ring share after the PLE fix |
| 16 | 4.4, 4.13 | test the namespace alias with the model on a Codex MCP namespace; window-invariant CPU rows as a test mode | Server GPU for 4.4; 4.13 None until it is used in a gate |
Not verified in this section: the reviews are desk reviews and their "Have it?" answers come from greps; every (E) is arithmetic, none was measured; the status of the branches is as of 2026-10-30 (claude/upstream-fixes, claude/draft-vocab, claude/models-move not merged, claude/draft-tail merged into main through speed-train2); the combined effect of the speed work in row 5.2 has no paired result in a repo document.
Order of work and where it runs
Phase 0 and 1.2 run on the laptop in WSL (tests) and are committed one by one on claude/upstream-port; GPU gates (R, I, Q) go through the server queue
(~/work/gpu-runs/holder2/jobs), one job per item, results appended to this table with the numbers and the decision (kept / flagged / dropped).