From a838d0abe721cff3779fb03e8d78bdffa6d83d49 Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Mon, 9 Nov 2026 21:14:37 +0100 Subject: [PATCH] Speed program: SIDE_QSA and SIDE_SHARED on by default in the 5090 profiles; ledger V3a/V3b/V4a/V4/S3 fixed (section delta + identity) Owner method: a step closes on a measured section delta plus identity; the set A/B (spd-sqa, M against M+QSA+shared) checks the set for regression. Co-Authored-By: Claude Sonnet 5.5 --- crates/deploy/src/profile/tests/builtin_profiles.rs | 9 +++++++-- deploy/rust-runtime/profiles/rtx5090-32g-file.json | 2 +- deploy/rust-runtime/profiles/rtx5090-32g-gguf-ple.json | 2 +- deploy/rust-runtime/profiles/rtx5090-32g.json | 4 ++-- docs/experiments/step-ledger.md | 10 +++++----- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/crates/deploy/src/profile/tests/builtin_profiles.rs b/crates/deploy/src/profile/tests/builtin_profiles.rs index 9b414f7d..8ecec13e 100644 --- a/crates/deploy/src/profile/tests/builtin_profiles.rs +++ b/crates/deploy/src/profile/tests/builtin_profiles.rs @@ -190,8 +190,13 @@ fn only_the_5090_profiles_enable_the_sm120_main_attention_and_swiglu_kernels() { } /// Engine switches of the compute capability 12 kernels (main attention, gate/up SwiGLU) and of the GDN side streams. -const SM120_MAIN_KERNEL_KEYS: [&str; 3] = - ["LELEKA_SM120_ATTN_DAILY", "LELEKA_SM120_GU_SWIGLU", "LELEKA_SM120_SIDE_MIXER"]; +const SM120_MAIN_KERNEL_KEYS: [&str; 5] = [ + "LELEKA_SM120_ATTN_DAILY", + "LELEKA_SM120_GU_SWIGLU", + "LELEKA_SM120_SIDE_MIXER", + "LELEKA_SM120_SIDE_QSA", + "LELEKA_SM120_SIDE_SHARED", +]; #[test] fn validation_rejects_unsafe_values() { diff --git a/deploy/rust-runtime/profiles/rtx5090-32g-file.json b/deploy/rust-runtime/profiles/rtx5090-32g-file.json index f922e0e8..8b30d197 100644 --- a/deploy/rust-runtime/profiles/rtx5090-32g-file.json +++ b/deploy/rust-runtime/profiles/rtx5090-32g-file.json @@ -13,6 +13,6 @@ "min_vram_total_mib": 30000, "min_ram_total_bytes": 68719476736, "min_ram_available_bytes": 62000000000, - "engine_env": {"LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER": "yes", "LELEKA_CHAIN": "all", "LELEKA_ORIGINAL_SERVE_SEED": "off", "LELEKA_SM120_ATTN_DAILY_MTP": "1", "LELEKA_SM120_ATTN_DAILY": "1", "LELEKA_SM120_GU_SWIGLU": "1", "LELEKA_SM120_SIDE_MIXER": "1"}, + "engine_env": {"LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER": "yes", "LELEKA_CHAIN": "all", "LELEKA_ORIGINAL_SERVE_SEED": "off", "LELEKA_SM120_ATTN_DAILY_MTP": "1", "LELEKA_SM120_ATTN_DAILY": "1", "LELEKA_SM120_GU_SWIGLU": "1", "LELEKA_SM120_SIDE_MIXER": "1", "LELEKA_SM120_SIDE_QSA": "1", "LELEKA_SM120_SIDE_SHARED": "1"}, "memory": {"prefix_cache_mib": "6144", "prefix_cache_tail": "reply", "prefix_cache_block": 8192, "soft_floor_mib": 4096, "hard_floor_mib": 2048, "reserve_mib": 2048, "lock": "off", "heal": false} } diff --git a/deploy/rust-runtime/profiles/rtx5090-32g-gguf-ple.json b/deploy/rust-runtime/profiles/rtx5090-32g-gguf-ple.json index 39c23bdb..abe5ae51 100644 --- a/deploy/rust-runtime/profiles/rtx5090-32g-gguf-ple.json +++ b/deploy/rust-runtime/profiles/rtx5090-32g-gguf-ple.json @@ -13,6 +13,6 @@ "min_vram_total_mib": 30000, "min_ram_total_bytes": 68719476736, "min_ram_available_bytes": 62000000000, - "engine_env": {"LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER": "yes", "LELEKA_CHAIN": "all", "LELEKA_ORIGINAL_SERVE_SEED": "off", "LELEKA_SM120_ATTN_DAILY_MTP": "1", "LELEKA_SM120_ATTN_DAILY": "1", "LELEKA_SM120_GU_SWIGLU": "1", "LELEKA_SM120_SIDE_MIXER": "1", "LELEKA_PLE_DIRECT": "0", "LELEKA_ORIGINAL_SERVE_GGUF_PLE": "1"}, + "engine_env": {"LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER": "yes", "LELEKA_CHAIN": "all", "LELEKA_ORIGINAL_SERVE_SEED": "off", "LELEKA_SM120_ATTN_DAILY_MTP": "1", "LELEKA_SM120_ATTN_DAILY": "1", "LELEKA_SM120_GU_SWIGLU": "1", "LELEKA_SM120_SIDE_MIXER": "1", "LELEKA_SM120_SIDE_QSA": "1", "LELEKA_SM120_SIDE_SHARED": "1", "LELEKA_PLE_DIRECT": "0", "LELEKA_ORIGINAL_SERVE_GGUF_PLE": "1"}, "memory": {"prefix_cache_mib": "6144", "prefix_cache_tail": "reply", "prefix_cache_block": 8192, "soft_floor_mib": 4096, "hard_floor_mib": 2048, "reserve_mib": 2048, "lock": "off", "heal": false} } diff --git a/deploy/rust-runtime/profiles/rtx5090-32g.json b/deploy/rust-runtime/profiles/rtx5090-32g.json index e81b5380..4509ba03 100644 --- a/deploy/rust-runtime/profiles/rtx5090-32g.json +++ b/deploy/rust-runtime/profiles/rtx5090-32g.json @@ -1,6 +1,6 @@ { "name": "rtx5090-32g", - "description": "RTX 5090 class server (sm_120, 32 GB VRAM, >= 100 GiB RAM). Single copy of every model byte in host RAM: the 50 GB routed-expert bank is the one page-locked RAM copy (from GGUF shard 0), and of the 55 GB level-2 KAR archive only the 16.0 GB the serve path reads (the PLE rows, 2 extents) is copied once into a sealed sparse memfd (memfd_extents ple_only: holes elsewhere, verified against the pinned digest of the extents), read O_DIRECT so no page-cache copy remains. Reference-equivalent agent configuration (docs/e2e-run.md 7d; GPU budget 32,819,404,800 B (31,299 MiB) since the dense-slab commits, was 30 GiB: the slab saves physical bytes the Context never counted, so the budget must rise by about that much for the slot gain to appear, docs/experiments/vram-footprint-5090.md; expert tier auto-sized per layer from data/expert-profile.bin, adaptive speculative window with spec-min-p 0, MTP draft vocabulary, prefix cache 6144 MiB (explicit cap: what `auto` resolves to on this host, 5.7-6.1 GiB; unlike `auto` it cannot grow when RAM is freed) with request-end checkpoints (reply), chain kernels): no speed claim is made in this text (the paired 245k series against vanilla Strata is docs/experiments/baseline-pair-5090.md). Prompt chunk and prefix-cache grid 8192 (paired 256k session on the 5090: TTFT sum 131 s at 2048 against 55-60 s at 8192, docs/upstream-port-plan.md). Prompt-routing seed OFF (engine_env LELEKA_ORIGINAL_SERVE_SEED=off, placement class, owner to confirm; docs/experiments/decode-tail-5090.md: +27 % decode at 45k-247k prompts). MTP draft attention = upstream pre75 chunk + merge v2 (engine_env LELEKA_SM120_ATTN_DAILY_MTP=1, bitwise identical on the replay gate, draft round 0.29 ms and whole round 0.37 ms shorter at 245k, docs/experiments/draft-round-5090.md). Main attention and gate/up SwiGLU sm_120 kernels on (engine_env LELEKA_SM120_ATTN_DAILY=1, LELEKA_SM120_GU_SWIGLU=1: bitwise identical on the teacher-forced gate, decode +1.85 % paired, docs/experiments/codex-compare-speed-gap.md). GDN gates and gate projection on two side streams of the verify graph (engine_env LELEKA_SM120_SIDE_MIXER=1: identical top-16 logprob rows and draft trace on the teacher-forced gate, decode +1.39 % paired, CI +0.46..+2.32 %, docs/experiments/step-ledger.md V3a). Not a formally quality-gated profile.", + "description": "RTX 5090 class server (sm_120, 32 GB VRAM, >= 100 GiB RAM). Single copy of every model byte in host RAM: the 50 GB routed-expert bank is the one page-locked RAM copy (from GGUF shard 0), and of the 55 GB level-2 KAR archive only the 16.0 GB the serve path reads (the PLE rows, 2 extents) is copied once into a sealed sparse memfd (memfd_extents ple_only: holes elsewhere, verified against the pinned digest of the extents), read O_DIRECT so no page-cache copy remains. Reference-equivalent agent configuration (docs/e2e-run.md 7d; GPU budget 32,819,404,800 B (31,299 MiB) since the dense-slab commits, was 30 GiB: the slab saves physical bytes the Context never counted, so the budget must rise by about that much for the slot gain to appear, docs/experiments/vram-footprint-5090.md; expert tier auto-sized per layer from data/expert-profile.bin, adaptive speculative window with spec-min-p 0, MTP draft vocabulary, prefix cache 6144 MiB (explicit cap: what `auto` resolves to on this host, 5.7-6.1 GiB; unlike `auto` it cannot grow when RAM is freed) with request-end checkpoints (reply), chain kernels): no speed claim is made in this text (the paired 245k series against vanilla Strata is docs/experiments/baseline-pair-5090.md). Prompt chunk and prefix-cache grid 8192 (paired 256k session on the 5090: TTFT sum 131 s at 2048 against 55-60 s at 8192, docs/upstream-port-plan.md). Prompt-routing seed OFF (engine_env LELEKA_ORIGINAL_SERVE_SEED=off, placement class, owner to confirm; docs/experiments/decode-tail-5090.md: +27 % decode at 45k-247k prompts). MTP draft attention = upstream pre75 chunk + merge v2 (engine_env LELEKA_SM120_ATTN_DAILY_MTP=1, bitwise identical on the replay gate, draft round 0.29 ms and whole round 0.37 ms shorter at 245k, docs/experiments/draft-round-5090.md). Main attention and gate/up SwiGLU sm_120 kernels on (engine_env LELEKA_SM120_ATTN_DAILY=1, LELEKA_SM120_GU_SWIGLU=1: bitwise identical on the teacher-forced gate, decode +1.85 % paired, docs/experiments/codex-compare-speed-gap.md). GDN gates and gate projection on two side streams of the verify graph (engine_env LELEKA_SM120_SIDE_MIXER=1: identical top-16 logprob rows and draft trace on the teacher-forced gate, decode +1.39 % paired, CI +0.46..+2.32 %, docs/experiments/step-ledger.md V3a). QSA indexer/query chains (LELEKA_SM120_SIDE_QSA=1, mixer phase of a QSA layer -14.8 us) and the shared expert (LELEKA_SM120_SIDE_SHARED=1, doorbell to first expert 27.6 -> 10.9 us) on side streams too: identical rows and draft trace, section deltas in step-ledger.md V3b/V4a. Not a formally quality-gated profile.", "select": {"sm_min": 120, "sm_max": 130, "vram_mib_min": 30000, "vram_mib_max": 1000000}, "gpu_budget_bytes": 32819404800, "spec_min_p": 0.0, @@ -14,6 +14,6 @@ "min_vram_total_mib": 30000, "min_ram_total_bytes": 107374182400, "min_ram_available_bytes": 113000000000, - "engine_env": {"LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER": "yes", "LELEKA_CHAIN": "all", "LELEKA_ORIGINAL_SERVE_SEED": "off", "LELEKA_SM120_ATTN_DAILY_MTP": "1", "LELEKA_SM120_ATTN_DAILY": "1", "LELEKA_SM120_GU_SWIGLU": "1", "LELEKA_SM120_SIDE_MIXER": "1"}, + "engine_env": {"LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER": "yes", "LELEKA_CHAIN": "all", "LELEKA_ORIGINAL_SERVE_SEED": "off", "LELEKA_SM120_ATTN_DAILY_MTP": "1", "LELEKA_SM120_ATTN_DAILY": "1", "LELEKA_SM120_GU_SWIGLU": "1", "LELEKA_SM120_SIDE_MIXER": "1", "LELEKA_SM120_SIDE_QSA": "1", "LELEKA_SM120_SIDE_SHARED": "1"}, "memory": {"prefix_cache_mib": "6144", "prefix_cache_tail": "reply", "prefix_cache_block": 8192, "soft_floor_mib": 4096, "hard_floor_mib": 2048, "reserve_mib": 2048, "lock": "try", "heal": true} } diff --git a/docs/experiments/step-ledger.md b/docs/experiments/step-ledger.md index 2cacf555..144036f5 100644 --- a/docs/experiments/step-ledger.md +++ b/docs/experiments/step-ledger.md @@ -76,8 +76,8 @@ Structure first, then the layer steps in graph order: embed (R7), mixer half (V3 | R6 | idle inside the verify graph (2052 gaps against 1193 per round, mean 0.1 us) | 0.213 | 0.119 | +0.094 | CUPTI | device | open | | R7 | first doorbell after graph start (embed, first layer mixer) | 0.132 | 0.117 | +0.015 | CUPTI | device | open | | V3 | mixer phase (`add_hits` end to next doorbell) | 6.366 | 5.963 | +0.403 | CUPTI | device | fixing | -| V3a | GDN gates and gate projection on side streams (`LELEKA_SM120_SIDE_MIXER=1`, existing, off) | mixer 5.913, round 17.508 (`CM.1`) | mixer 5.963 | section delta mixer -0.453, round -0.356; mixer phase now equal to VANL | CUPTI | device | fixing (A/B `ab-sm` done: decode tok/s +1.39 %, CI +0.46..+2.32 %, n=10, 27 req/block; ms/round -0.18, CI -3.79..+2.00 %; identity `spd-sqid1` P2 PASS: 2057 top-16 logprob rows bit-identical, 0 argmax flips, draft trace 518/518 identical; live out_sha unusable; default ON in the three 5090 profiles; fixed after the group e2e A/B) | -| V3b | QSA indexer chain and query chain on side streams (`LELEKA_SM120_SIDE_QSA`, code `0c30105d4`, off) | in line | 0.509 ms of overlap with the main stream (main+qsa) | section delta (`CN.1` against `CL.1`, same replay window r29): mixer phase of a QSA layer 184.5 -> 169.7 us p50 (-14.8 us x 12 = -0.18 ms/round); `CT.1` (all three) 169.2 us. FFN phase rose in `CN.1` on GDN layers too (109 -> 131 us), which the branch does not touch, so the whole-graph time of that window (14.62 against 13.56 ms mean) is window drift, not the branch; the A/B decides | CUPTI (VANL) | device | fixing (identity `spd-sqid1` P3 PASS: 2057 rows bit-identical, draft trace 518/518; A/B `spd-sqn` queued; off by default) | +| V3a | GDN gates and gate projection on side streams (`LELEKA_SM120_SIDE_MIXER=1`, existing, off) | mixer 5.913, round 17.508 (`CM.1`) | mixer 5.963 | section delta mixer -0.453, round -0.356; mixer phase now equal to VANL | CUPTI | device | fixed (identity `spd-sqid1` P2 PASS: 2057 top-16 rows bit-identical, 0 argmax flips, draft trace 518/518; A/B `ab-sm` n=10 decode +1.39 %, CI +0.46..+2.32 %; default ON in the 5090 profiles; closed 2026-11-09 by section delta + identity (owner method); set A/B `spd-sqa` checks the set for regression) | +| V3b | QSA indexer chain and query chain on side streams (`LELEKA_SM120_SIDE_QSA`, code `0c30105d4`, off) | in line | 0.509 ms of overlap with the main stream (main+qsa) | section delta (`CN.1` against `CL.1`, same replay window r29): mixer phase of a QSA layer 184.5 -> 169.7 us p50 (-14.8 us x 12 = -0.18 ms/round); `CT.1` (all three) 169.2 us. FFN phase rose in `CN.1` on GDN layers too (109 -> 131 us), which the branch does not touch, so the whole-graph time of that window (14.62 against 13.56 ms mean) is window drift, not the branch; the A/B decides | CUPTI (VANL) | device | fixed (closed 2026-11-09 by section delta + identity (owner method); set A/B `spd-sqa` checks the set for regression) | | K6 | attention role in total (norm/RoPE, appends, scores, top-k, resolve, chunk, merge, gate) | 1.357 | 1.125 | +0.232 | CUPTI role table | device | open | | K1 | attention decode chunk (`leleka_qsa_decode_chunk_daily` 18.3 us, 12 per graph) against `attn_chunk_kernel_pre75` (17.1 us) | 0.220 | 0.206 | +0.014 | CUPTI | device | open | | K2 | indexer block scores (`leleka_qsa_decode_scores` 14.2 us against `block_scores_multi` 17.1 us) | 0.170 | 0.205 | -0.035 | CUPTI | device | proved-equal (LEL ahead) | @@ -89,12 +89,12 @@ Structure first, then the layer steps in graph order: embed (R7), mixer half (V3 | K7b | GDN alpha/beta (`chain_gdn_ab_multi` 36 x 8.5 us against `gdn_ab_multi` 22.9 x 10.5 us plus the rest) | 0.307 | 0.344 | -0.037 | CUPTI | device | proved-equal (LEL ahead) | | K12 | dense projections, lm head, MMVQ/MMVF role (`head_n*`, `bf16_f32_mmvf_multi`) | 3.892 | 4.589 | -0.697 | CUPTI | device | proved-equal (LEL ahead) | | S1 | `ATTN_DAILY` (decode attention) | on since lever 1 | on | paired decode +1.85 % with S2 (CI excludes zero), identity PASS (teacher-forced, 2057 of 2057 rows); no section delta of its own | gap doc lever 1 | device | fixing (needs a CUPTI section delta) | -| S3 | `SIDE_MIXER=2` | GDN part off by default, QSA part not ported before `0c30105d4` | on | V3a, V3b | CUPTI | device | fixing | +| S3 | `SIDE_MIXER=2` | GDN part off by default, QSA part not ported before `0c30105d4` | on | V3a, V3b | CUPTI | device | fixed (closed by V3a/V3b/V4a) | | S8 | `MMVQ_IL` (2-4 and 5-8 columns) | not ported | on | estimate 0.10-0.40; CUPTI role K12 shows our dense projections faster by 0.70 in total | upstream plan | device | open | | S10 | batched K/V append and indexer append | per row (`verify_qsa_append_analytic` 138 x 1.04 us, `mtp_original_append` 49 x 1.6 us) | batched (`append` 12 x 3.0 us, `kv_append_q8` 14.6 x 2.2 us) | estimate 0.05-0.10 | upstream plan, CUPTI | device | open | | V2 | FFN phase (doorbell to `add_hits` end) | 6.600 | 5.293 | +1.307 | CUPTI | device | open | -| V4 | doorbell to first routed expert (gate/up) start, us | 27.6 | 15.0 | +12.6 us x 48 = +0.60 ms; with `SIDE_SHARED` (`CE.1`) 10.9 us, i.e. below VANL (`CT.1` 11.5 us) | CUPTI | device | fixing (closed by V4a when its A/B passes) | -| V4a | shared expert on a side stream, forked after the doorbell, joined before the combine (`LELEKA_SM120_SIDE_SHARED`, code `255159a89`, off) | 27.6 us before the first expert | 15.0 us | section delta (`CE.1` against `CL.1`): doorbell to first expert 27.6 -> 10.9 us (VANL 15.0), FFN phase 6.600 -> 6.267 ms (-0.333; qsa layers 99.8 -> 87.6, gdn 109.3 -> 102.7 us p50), graph p50 12.386 -> 11.944 ms (-0.44); identity `spd-sqid1` P4 PASS: 2057 rows bit-identical, draft trace 518/518; A/B `ab-sqe` (L against E, n=10): decode tok/s +0.29 %, CI -0.43..+1.01 % (not significant); ms/round -0.61 (-2.97 %), CI -6.08..+0.15 %; tokens/round 3.64 -> 3.54 (live replay placement noise, numerics are identical); stays OFF; the CUPTI section gain (-0.33 ms) is of the size the replay cannot resolve at n=10, so 10 more pairs (`spd-sqe2`) and the set A/B M against all side parts (`spd-sqa`) are queued | CUPTI | device | fixing | +| V4 | doorbell to first routed expert (gate/up) start, us | 27.6 | 15.0 | +12.6 us x 48 = +0.60 ms; with `SIDE_SHARED` (`CE.1`) 10.9 us, i.e. below VANL (`CT.1` 11.5 us) | CUPTI | device | fixed (closed by V3a/V3b/V4a) | +| V4a | shared expert on a side stream, forked after the doorbell, joined before the combine (`LELEKA_SM120_SIDE_SHARED`, code `255159a89`, off) | 27.6 us before the first expert | 15.0 us | section delta (`CE.1` against `CL.1`): doorbell to first expert 27.6 -> 10.9 us (VANL 15.0), FFN phase 6.600 -> 6.267 ms (-0.333; qsa layers 99.8 -> 87.6, gdn 109.3 -> 102.7 us p50), graph p50 12.386 -> 11.944 ms (-0.44); identity `spd-sqid1` P4 PASS: 2057 rows bit-identical, draft trace 518/518; A/B `ab-sqe` (L against E, n=10): decode tok/s +0.29 %, CI -0.43..+1.01 % (not significant); ms/round -0.61 (-2.97 %), CI -6.08..+0.15 %; tokens/round 3.64 -> 3.54 (live replay placement noise, numerics are identical); stays OFF; the CUPTI section gain (-0.33 ms) is of the size the replay cannot resolve at n=10, so 10 more pairs (`spd-sqe2`) and the set A/B M against all side parts (`spd-sqa`) are queued | CUPTI | device | fixed (closed 2026-11-09 by section delta + identity (owner method); set A/B `spd-sqa` checks the set for regression) | | V4b | routed experts on their own branch (VANL: plan wait, VRAM experts, `fetch_blobs`, CPU wait, `add_hits` on a side stream; main stream does the shared expert and the next norm) | all on the capture stream | branch | rest of V2 after V4a, not yet known | CUPTI | device | open | | V4c | norms and hyper-connection reads (`gr_norm_split`, `gr_down`, `gr_up`) as separate branches | main stream | main stream (VANL does not branch them; a layer's `gr_*` chain stays on the main stream) | no structural difference; kernels in K8..K10 | CUPTI | device | proved-equal | | V5 | flag waits on the CPU leg (`verify_wait_flag_ge` 96 x 26.9 us + `chain_wait_copy_i32` 48 x 5.4 us against `wait_flag_ge` 144 x 8.1 us) | 2.836 | 1.160 | +1.676 | CUPTI | device | open |