Commit Graph
1611 Commits
Author SHA1 Message Date
Pavlo RatushnyiandClaude Sonnet 5.5 02c784249a Merge claude/speed-vs-strata-08143a: PcieAuto (off), tail fusion HEAD_CHAIN_BATCH (off), D1/D2 default on, hit-share-gap analysis
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 17:43:42 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 ff6667d89b Merge claude/prefill-latency: hit-gap analysis, per-layer tier counters
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 17:43:41 +01:00
Pavlo Ratushnyi 26dd97c994 Merge branch 'claude/tail-fusion' into claude/speed-vs-strata-08143a 2026-11-11 17:28:23 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 d1ad19e765 Tail fusion: LELEKA_SM120_HEAD_CHAIN_BATCH (off), residual write and head mix of all rows in 6 launches
Analysis (docs/experiments/verify-tail-and-gaps.md, CUPTI windows CP.1 / CL.2 / CY.1 against VANL): R6 is the
single-stream control (2035 gaps, 211 us) against VANL (1194, 119 us); with the side streams LEL has 1124 / 123.7 us,
residual +0.006 ms. R7 has no gap. R8 (+86.5 us at LEL's T mix) is the hyper-connection chain 31.2, the head matmul at
T >= 3 38.4 and the greedy pick 18.0.

The switch batches the 6 T launches of the tail (mtp_full_native_write plus the five lm_head_mix kernels a row) into
6: new sealed sm120_head_chain.cu/.ptx (final write, head norm, pre-final mix with the row as grid.y, compiled with the
--use_fast_math flags of the originals), the existing multi-column bf16 gemv, mtp_full_down_silu over the contiguous
rows. Bitwise by construction (same bodies, same per-column fma chain). Flag in GrConfig::head_chain_batch like U5a;
HEAD_MIX_MULTI untouched. Model-free probe tools/decode-sm120/sm120_probe_head_chain.cpp (built, not run), report
script scripts/e2e/codex/speed/verify_tail_report.py, 15 unit tests (288 original_verify tests pass).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 17:27:58 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 2f8379ecd4 Add LELEKA_ORIGINAL_SERVE_PCIE_AUTO: Strata's PcieAuto share controller (opt-in, default off)
Port of generate.cpp PcieAuto (0.2.6) as a pure policy (strata_pcie_auto.rs): the PCIe share of the
missed experts is link / (link + 1.85 x CPU-pool byte rate), read from the pool's wall time per
CPU-computed expert over windows of 48 then 96 and 96 decode rounds, rounded to 0.05, kept in
0.10..0.60, dead band 0.025, at most three updates. Wired into GpuExpertPool: the share of
split_group comes from the controller instead of the constant; the pool time is the worker pool's
dispatch of each direct group (group-open clock, no new Instant::now). With the switch off the
plan is unchanged. Placement-class change: CPU and GPU round differently.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 17:13:27 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 d635a73c9a Enable LELEKA_SM120_DOWN_SUB16 (D1) and HITS_IN_COMBINE (D2) in the 5090 profiles (identity and probes PASS, window deltas); D3 WAIT_M_ROWS is a measured loss, stays off; ledger
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 16:52:52 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 44059bdf04 profile-only estimate of cross-layer slot reallocation gain (tier.cross.*), no behaviour change
Files: crates/engine-qwen35-cuda/src/qwen_forward/original_serve_residency/cross_layer_potential.rs (new),
original_serve_residency.rs (module line), original_serve_residency/source_spans.rs (one call in queue_swaps; speed-session file, profile-only hook permitted by the orchestrator).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 16:29:59 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 622c16e15d Enable LELEKA_SM120_COMBINE_VEC4 (S11) in the 5090 profiles (identity PASS, window delta -0.016 ms a graph); S9 and U5a stay off, ledger
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 01:25:31 +01:00
Pavlo Ratushnyi ef128c3b04 Merge claude/speed-vs-strata-08143a: sm_120 defaults, verify side streams, fused commit, step ledger, upstream microbench
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

# Conflicts:
#	deploy/rust-runtime/profiles/rtx5090-32g-file.json
#	deploy/rust-runtime/profiles/rtx5090-32g-gguf-ple.json
#	deploy/rust-runtime/profiles/rtx5090-32g.json
#	docs/experiments/step-ledger.md
2026-11-11 01:18:50 +01:00
Pavlo Ratushnyi 278c4b2218 Merge claude/ffn-wait-m-rows (D3); both seal manifests hand-merged and validated as JSON 2026-11-11 01:11:52 +01:00
Pavlo Ratushnyi e76bc1bcbb Merge claude/ffn-hits-combine (D2) 2026-11-11 01:11:19 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 7395f00dee Verify window: LELEKA_SM120_DOWN_SUB16 (group-strided sub8/sub16 routed-expert down projection), off by default
D1 of docs/experiments/ffn-phase-loss-design.md. New sealed sm_120 asset sm120_down_sub16.ptx
(nvcc 13.2.86), entries sm120_moe_down_20 (IQ4_NL, 8 lanes a row, 32 rows a block) and
sm120_moe_down_42 (Q2_0, 16 lanes a row, 16 rows a block): upstream's
native_down_multi_kernel<TD, SUB_DOWN> hb == 20 branches, with the row-dot reduction tree of the
literal window_moe_down_<T> (row_dot_multi) reproduced in 8 / 16 lanes. grid.y strides over the
groups, so the PCIe pass launches kPcieGroupRows = 4 block rows (the fused GU_SWIGLU gate/up of
that pass too) instead of one per possible group. Only n_ff == 640 and the two formats; any other
layer keeps window_moe_down_<T>. Switch off: the recorded graph is unchanged.

Planner: group_kernels / GroupKernels / DownKernel in plan_expert_groups.rs. Asset, formats and
the PCIe block rows in original_verify_window_down.rs; asset pinned in extra-seal-plan.json and
ptx-sm86/MANIFEST.json ("not built for sm_86 by design"). Probe: sm120_probe `down` compares the
whole output buffer of both kernels byte for byte (T 1-8, 0-16 groups, grid.y cap and 4,
n_embd 2560 and 2552); built, not run (no GPU).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 01:10:46 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 e22027119a D2 HITS_IN_COMBINE: add_hits folded into the combine (sm120_combine_hits, off by default)
LELEKA_SM120_HITS_IN_COMBINE: one leleka_verify_combine_k10_vec4_hits launch per layer
replaces moe_hit_add + the combine (mtp_full_combine or the COMBINE_VEC4 kernel), -48
launches per graph. New sealed asset sm120_combine_hits.cu/.ptx (nvcc 13.2.86, sm_120,
--fmad=true --ftz=false; pinned in extra-seal-plan.json and ptx-sm86/MANIFEST.json),
planner and ffn_hits_combine in original_verify_window_ops/hits_combine*, asset preloaded
via required_assets. Shapes the kernel does not fit record add_hits + the scalar combine.
Model-free probe tools/decode-sm120/sm120_probe_hits.cpp (+ build_hits.sh): add_hits +
combine against the folded kernel byte for byte, T 1-8; built, not run (no GPU).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 01:07:18 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 3362615444 D3 WAIT_M_ROWS: wait on flag M folded into the CPU-rows copy (sm120_wait_copy_rows), sealed asset, probe
LELEKA_SM120_WAIT_M_ROWS (off by default): wait_cpu defers the ring, copy_cpu_rows records one
leleka_verify_wait_copy_rows launch (grid tokens x k, 128 threads) instead of verify_wait_flag_ge +
the rows copy. Thread 0 of each block polls, fences, block barrier, then the copy of
chain_copy_rows_from_mapped_kernel. PTX built with nvcc 13.2.86 and pinned (extra-seal-plan,
ptx-sm86 MANIFEST note). Model-free probe tools/decode-sm120/sm120_probe_waitrows.cpp (late flag,
T 1-8) built, not run (no GPU).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 01:01:49 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 d6ae35fbcf FFN phase scaffold: switches DOWN_SUB16, HITS_IN_COMBINE, WAIT_M_ROWS (off), FfnSwitches, hooks and stubs
T0 of docs/experiments/ffn-phase-loss-design.md: three opt-in switches resolved in
original_verify_window_sm120.rs, the FfnSwitches DTO carried in WindowPolicy::ffn, one-line
hooks in the window ops (wait_cpu, copy_cpu_rows, hit_add, combine) and the planner site
(ExpertGroupSite::down_sub16), and per-task stub files. All switches off: the recorded
graph is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 00:51:04 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 300d329467 profile-only tally of VRAM/PCIe/CPU experts per layer group (tier.lNN.vram|pcie|cpu), no behaviour change
Files: crates/cuda-driver/src/original_verify_gpu_plan/plan_tier_tally.rs (new),
original_verify_gpu_plan.rs (module line), original_verify_gpu_plan/cpu_sink_publish_gpu_plan.rs (one call, speed-session file, permitted by the orchestrator for profile-only hooks).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 00:49:44 +01:00
Pavlo Ratushnyi b800bba09e Merge branch 'worktree-agent-acd2587ce4944ff56' into claude/prefill-latency 2026-11-11 00:47:02 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 3a3e3d6569 prefill ring prefetch: stage into the first free unreserved slot (fix stage.slot_not_gathered at sources > slots)
pkg-s16 (51b36adf7), 9/30 requests: RING-REFUSE layer=46|47 check=stage.slot_not_gathered reserved=0
slots=384 sources=410..460. With prefetch hits the copies skip the hit sources, so once a layer's sources exceed
the ring the wrap reaches a slot holding an earlier source's copy that is not gathered yet; the stage_room
shortcut (reserved == 0) then let stage_one refuse.

- stage_target (leleka-cuda-model ring_prefetch) searches forward, wrapping, for the first slot that is not
  reserved and free (never filled or gathered); without a prefetch it is stage_next itself (the literal ring:
  copies and gathers in one order, lookahead one short of the ring).
- Ring::stage_room: no reserved shortcut; "no copy needed or stage_target finds a slot", so the walk waits for
  a gather instead of refusing.
- Host tests: 200 seeds of 460 sources / 384 slots with random prefetch hits among the first 300, other sizes;
  the model asserts no stage onto a reserved or unread slot and that stage_target refuses only when no
  unreserved slot is free (both fail with the old stage_target). 18 tests.

Switch stays OFF by default. Not run on a GPU.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 00:46:48 +01:00
Pavlo Ratushnyi 1de8a37a13 Merge branch 'worktree-agent-acd2587ce4944ff56' into claude/prefill-latency 2026-11-10 23:18:48 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 61e72f36fd prefill ring prefetch: detached drains opt-in, RING-REFUSE trace, slot bookkeeping in the host model
PET.1 (3ba2a0e37, LELEKA_PREFILL_RING_PREFETCH=1): 5/12 requests failed with InvalidProjectionShape.
The slot bookkeeping the suspects named (prefetched source staged again, reserved slot reused, gather of an
empty / read slot) is now the pure SlotState / stage_needed / stage_target of leleka-cuda-model::ring_prefetch,
called by the driver's Ring and by the host tests: none of those paths is reachable. The unreviewed change was
the compute_drain background stream (process-wide: scoped drains that skip unregistered streams, memsets for
zero uploads, deferred frees in the small-chunk mixers/routers while copies are pending). It is now opt-in:
LELEKA_PREFILL_RING_PREFETCH_DETACH (policy field detach_drains, default off); by default the drains stay
context-wide.

- RING-REFUSE trace under LELEKA_TRACE_DRIVER_ERRORS / LELEKA_BRINGUP_TRACE (passed in with
  set_ring_error_trace; no env read, no new global): one line naming the refused check (new.validate,
  new.schedule_slots, layer.preflight, sources.spans, stream.*, stage.*, gather.*, enqueue.*) with layer,
  source, stage_next, reserved, slots; RING-PREFETCH lines for issued / hits / wasted / dropped / cancelled.
- Host tests: 15 (prefetched source never staged again, reserved slot skipped until its gather then reused,
  gather reads a slot exactly once, distinct refusal names, detach default off) plus a settings test row.
- Without the prefetch, stage_one / gather keep the literal checks and order (stage_target from stage_next).

Switch stays OFF by default. Not run on a GPU.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 23:18:30 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 c4bdb01ff0 refill batch GPU test: stage markers
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 21:06:04 +01:00
Pavlo Ratushnyi 4f6c2b7155 Merge branch 'worktree-agent-a1dcdd989fb63fb9a' into claude/prefill-latency 2026-11-10 20:50:04 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 2e8bd2040a refill: batched lent-slot refill copies behind LELEKA_REFILL_BATCH (experimental, off)
- cuda-driver: optional cuMemcpyBatchAsync_v2 + cuStreamWaitEvent in AsyncApi (api/enabled/batch_copy.rs,
  stub answers can_batch() == false); pure call plan refill_batch_copy::plan_batch_calls (<= 512 copies per
  call, same order/bytes/destinations) and issue_copies with per-copy fallback after a refusal.
- OriginalExpertCache::fill_slots_queued_batched: same checks, pieces and order as fill_slot_queued_on, one
  context entry; batch on the fill stream ordered after the legacy default stream by fill_event; registered
  bank only; a refused call is reported once and the rest goes per copy; driver errors poison as before.
- engine: settings memory.refill_batch (LELEKA_REFILL_BATCH on|1) and refill_lent's batched branch;
  profile counters refill.batch_calls / refill.batch_copies / refill.per_copy.
- tests: host-side plan tests; #[ignore] GPU test comparing per-copy vs batched slot bytes.
- docs/experiments/refill-batch-copy.md. No GPU run, no speedup claimed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 20:49:32 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 079a8f3a03 merge ring prefetch; drop the ring diagnostics that added debt (skip-after-N, route trace); chain_gate in its own file; width
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 20:45:04 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 3ba2a0e371 prefill: EXPERIMENTAL copy-ring prefetch behind LELEKA_PREFILL_RING_PREFETCH (off by default)
After a layer's copy ring drained, the experts the next layer missed most often in its last N chunks (per-layer
miss history, top K <= ring/2, none on the 8-slot ring) are copied into the next ring's stage slots on the copy
stream, overlapping the combine and the next mixer. The next Ring::new adopts the set: a routed, non-resident
source with the same host bytes reads its prefetched slot (reserved until its gather, ordered by the slot's
copied event); the rest are dropped. stage_one skips reserved slots; the stage-ahead walk waits for a gather
when the next free slot is still live. Same experts, kernels and group order: bitwise neutral by construction.
A set no ring took is drained on end_prompt_stream / begin_prompt_stream / close.

- leleka-cuda-model ring_prefetch: policy, MissHistory ranking, match_prefetch, next_unreserved_slot (+ host
  model of the reserved-slot ring walk), 10 tests
- driver: policy passed via OriginalMmqCopySchedule::set_ring_prefetch (no env read); counters
  ring.prefetch_issued / _hit / _wasted / _failed (MB), span ring.prefetch_issue
- engine: ServeSettings::prefill_ring_prefetch (+ _WINDOW), settings test; issue from run_prompt_layer
- docs/experiments/ring-prefetch.md: design, switch, counters, GPU validation plan (R-hash identity, A/B by tail)

Not run on a GPU: no identity probe, no A/B, no speedup claimed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 20:41:57 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 1799aee147 profiles: the expert stream starts at 1536 rows in the 5090 profiles (chunk hashes identical, prefill.read -180 ms at 1.5-4k tails); ledger Q4/Q5 ring findings
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 20:18:59 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 2f358e072a Merge repair: valid JSON in extra-seal-plan.json and ptx-sm86/MANIFEST.json after joining the S11/S9 and U5a branches
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 19:15:52 +01:00
Pavlo Ratushnyi 4a1845aedb Merge branch 'claude/u5a-gr-down-fused' into claude/speed-vs-strata-08143a
# Conflicts:
#	crates/cuda-driver/ptx-sm86/MANIFEST.json
#	crates/cuda-driver/src/original_verify_window_sm120.rs
#	scripts/gpu-bringup/extra-seal-plan.json
2026-11-10 19:15:36 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 0518311567 verify window: LELEKA_SM120_GR_DOWN_FUSED (hc split + tiled down projection as one launch, step U5a), off by default
New sealed sm_120 asset sm120_gr_down_fused.ptx (nvcc 13.2.86): leleka_gr_down_fused_t2w8 replaces
chain_gr_split + chain_gr_down_t2w8_nb4 (96 launches fewer per verify graph). The block stages R' * w_norm of
its two tokens into shared memory, adds the sum of squares in the split kernel's order, scales with rs and
runs the down kernel's dots; the operations and their order are those of the two kernels (bitwise by
construction; upstream's gr_down_v3 sums in another order). A no-op, said once, without the chain gr pair.
Planner, switch resolution (Sm120Switches, GrConfig.down_fused), unit tests, model-free probe
tools/gr-down-fused (not run: no GPU). Not measured. Microbench harness: the NaN outputs were a stream race
between the poison memsets and the kernels, fixed; inputs are checked finite.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 19:14:46 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 b8a74d01dd Verify window: LELEKA_SM120_COMBINE_VEC4 (float4 routed-expert combine) and LELEKA_SM120_HEAD_MIX_MULTI (one multi-token head mix), both off by default
COMBINE_VEC4: new sealed sm_120 asset sm120_combine_vec4.ptx (nvcc 13.2.86), entry leleka_verify_combine_k10_vec4,
upstream combine_k10_vec4 (non-hits form). Same per-element operations as the sealed mtp_full_combine: first
product rounded, nine fmaf in expert order, one add of the shared row. Falls back to the scalar launch when
k != 10, n % 4 != 0 or a row base is not 16-byte aligned. Same launch count as the scalar path.

HEAD_MIX_MULTI: upstream STRATA_HEAD_MIX_MULTI. The final mixer as one multi-token hc read over output_hc_* (the
layer read kernels, apply = false, no inject), 3 launches instead of 5 per token. No new PTX.

Switch DTO CombineHeadKernels (original_verify_window_combine_head.rs) travels beside the GDN policy; the shared
switch file gets two fields. Unit tests (asset seal, PTX arithmetic shape, launch plans, whole-window launch order with
both switches). Model-free byte-compare probe tools/combine-head written, compiled, not run (no GPU). Design and
CUPTI names: docs/experiments/verify-combine-and-head-mix.md

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 19:08:30 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 39ddd77496 ring: LELEKA_PREFILL_ROUTE_TRACE (routed and non-resident expert masks per layer and chunk, diagnostic)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 18:39:05 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 3a0b5b4e61 ring: profile counter ring.copied_mb (experts copied over PCIe per request, call count and MB)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 18:20:02 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 c15f43020e ring: host profile spans ring.init, ring.init_sync, ring.stage, ring.gather, ring.enqueue, ring.finish_statuses, ring.close (LELEKA_SERVE_PROFILE only)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 18:01:18 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 b56e5afb58 Speed program: fused commit graph ON in the three 5090 profiles (identity P2/P3 PASS, section 509 -> 125 us); ledger closes S6/O11
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 17:46:11 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 1b49397cd0 ring diagnostic: LELEKA_PREFILL_DIAG_SKIP_EXPERT_DMA=N skips the expert copies after the first N (cold slots are uninitialised and the finite guards refuse them)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 17:45:06 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 edad5e7737 Speed program: QSA prelude on in the 5090 profiles (identity P2/P3/P8, section delta per T); ledger K6/K1/K7/K7a/S10/U3/O7 with the window results; PB/ZQ variants for the set A/B
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 12:13:58 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 62695ebd4b profiles: check merge, parking fast and decode graph reuse are on in the 5090 profiles (bitwise identity PASS)
Teacher-forced identity on night5-long-256k (job host-draft-switches-teacher-forced-identity, A/A floor): top-16 logprob rows 2057 of 2057 and draft trace 1036 of 1036 lines identical for each switch against shipped. Section deltas: Q7 -97 ms per request, B3 FAST -2.0 ms, O8 step graph 114 to 105 nodes. The profile allow-list accepts LELEKA_PREFIX_* and LELEKA_DECODE_*. Not on the laptop profile (the check-batch asset has no sm_86 companion).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 05:26:56 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 4b0f87bf08 chain pipeline: profile counters mtp.chain_gate.* (which condition decided each draft)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 02:46:17 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 955a72e378 prefix cache: LELEKA_PREFIX_PARK_ASYNC no longer makes the next request wait for a refusal: the busy mark is released before the deferred checkpoint
The GPU run refused 3 of the first 7 requests with runtime_capacity: serve_generate held ActiveGuard (the Proxy's `active` mark, which Proxy::idle answers with "native generation is active") while the owner ran prefix_after_response, 8-25 ms after the terminal event. Now run_generation ends with the terminal event and the prefix summary, ActiveGuard::release_then drops the mark, and only then the deferred tail runs (and the summary is published again, with the new node). A request that arrives during the tail passes Proxy::idle and its Generate command waits in the control queue that the owner loop reads after the tail; nothing is refused and nothing is lost. prefix_after_response returns whether it parked anything, and does not open a profile span or report a park_deferred line when nothing was deferred.

Test: a request arriving during the deferred tail is admitted and queued, not refused (the proxy is refused while the request runs, admitted from the moment the tail starts, its command is in the queue afterwards).

Ledger row B3 updated with the GPU result of the first run and why no pre-faulted buffer pool was built.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 02:34:07 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 97fa0c389f draft check merge GPU test: load the separate guard module with the context current, keep the stream owner alive, print a verdict per case
The first GPU run failed in FM::load of the separate guard kernels with CUDA_ERROR_INVALID_CONTEXT: unlike CheckBatchModules::load, the test loaded that module outside context.enter(). The test also took the stream from a temporary NativeBatchWorkspace that was dropped at the end of the statement; the workspace now lives for the whole test. Every case prints `CHECK-BATCH case <fault> status words equal|DIFFER` and a summary line; any DIFFER fails the test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 01:02:14 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 22d7e9d824 prefill: the loan ladder (LELEKA_PREFILL_LOAN_TIERS=1) is on in the shipped 5090 profiles
Identity: chunk residual hashes equal (PREFILL-R, jobs id1-id4). Paired A/B n=10 on the sparse holder:
session TTFT sum -3.0 s +-0.3, median -104 ms per request, <= 2048 new tokens -154 ms (19 of 19 faster),
above 2048 tokens -10 ms. The engine default stays off; the profile allow-list accepts LELEKA_PREFILL_*.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 00:58:37 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 7570247d92 Merge claude/verify-decode-graph-reuse-handles; decode graph reuse (Q7) wired behind LELEKA_DECODE_GRAPH_REUSE
Merge of the speed session's driver part (DeviceRef handles, OriginalVerifier park/rearm, OriginalVerifyCanonicalGdn reseed; ptx manifest and seal plan entries of both sides kept, ledger rows of both sides kept) with the owner loan: the journal's owners are Option behind accessors, lend() uses the same idle precondition as the speed session's require_idle.

DecodeResources implements HeldAssembly for real (park, rearm from the session priors, lend and take_back through the journal loan; every refusal retires the set). OriginalServeStack holds a GraphReuse; decode assemble asks begin first (re-arm, refill queue; or the owners back to record), teardown keeps the assembly for a clean request (drafter end_request_keep_bank, shared-expert pin, park, lend, adopt) or runs the old teardown; retirement releases the drafter before the bank closes, in begin, close and reset_expert_tier. The MoE cache pins the shared experts while a set is held and counts freed window entries (weights epoch). Switch off: begin is not called and teardown runs the old body unchanged.

Tests: GraphReuse policy with a logging probe (switch off touches nothing, key change, moved owners, refused re-arm, lost owners, order release before drop), keepable outcomes, the lifecycle fake scenarios, the GPU-free loan state machine. Not run on a GPU. No speedup claim.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 00:50:19 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 2aaa480856 Verify GPU plan: wrap a doc line
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 00:26:14 +01:00
Pavlo Ratushnyi 555dada671 Merge branch 'claude/verify-decode-graph-reuse-handles' into claude/speed-vs-strata-08143a 2026-11-10 00:25:30 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 228552f1a3 Verify GPU plan: raise_after_staging back under complexity 10 (copy-kernel retain extracted)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 00:25:29 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 a3b55ac312 cuda-driver: OriginalVerifier::park / rearm and OriginalVerifyCanonicalGdn::reseed (ledger Q7, part 2)
park drains the commit and both streams and retires every graph's launch, keeping the graphs, the bank, the
streams and the event. rearm(OriginalVerifyRearm { gdn_states, gdn_histories, ple_history }) puts back what
a fresh new() + record_all leaves: the verifier counters and completed-window memory, the bank (staged
window, generation + 1 so stale rows and windows are refused, released = false, held PCIe sources), every
mapped staging allocation (doorbell, the three flag words, the published GPU plan, the CPU rows), the arena
and the profile stamps, and overwrites the canonical GDN image and the PLE history in place (reseed,
117.7 MB). Preconditions (parked, no window outstanding, graphs idle, QSA journal not armed) are refused
without changing anything; an error after the first change fails the verifier so the caller retires it.

Pure parts (seed shapes, the bank book, the reset plan, the registry reset, the refusal order) are unit
tested without a device; the device half is for the identity job.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 00:19:35 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 f029f7b1ec cuda-driver, engine-qwen35-cuda: DeviceRef shared handles replace the verify-window borrows (ledger Q7, B1)
The verify-window aggregates borrowed every weight, scratch and history buffer from the cache that owns
it (&'a DeviceBuffer), so a recorded graph set could not be stored next to its owner and was dropped and
recorded again for every request. DeviceRef<'ctx> is an Rc handle to the allocation (own, or a range of
a slab it keeps alive): Clone is one count increment, Deref reaches the DeviceBuffer the kernels take, a
release while another holder remains frees nothing.

OriginalVerifyWindowResources<'ctx>, OriginalVerifyResources, the GDN/QSA journals, the GR/MoE/proj/QSA
bindings and the RoPE tables carry no 'a any more; DecodeResources<'ctx> likewise. The engine caches
(dense: Vec<DeviceRef>, MoE: EncodedWeight::Raw(DeviceRef)) hand out clones in the assembly only;
seed_ple_history writes through the handle (copy_from_shared). Nothing changes on the existing paths:
same kernels, same arguments, same order. A guard test keeps .clone() out of the window and journal
modules, which only dereference.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 00:18:35 +01:00
Pavlo Ratushnyi c3ab38ce82 Merge branch 'claude/host-decode-graph-reuse-2' into claude/prefill-latency 2026-11-09 23:41:40 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 278d67eeb7 decode graph reuse (Q7), part 2: QSA owner loan in the journal, HeldAssembly protocol (begin/end, drafter release on retire), re-arm scenarios on the lifecycle fake
OriginalVerifyQsaJournal keeps its owners as Option behind accessors; lend() hands the twelve index images and mapped journals to the prompt executor without dropping the journal (and so the graphs), take_back() accepts them only when every address the captured commands bind is unchanged (else the journal is failed for good and the owners go back to the caller). The pure loan state machine (owner_loan.rs) has unit tests that run without a GPU.

GraphReuse gets begin/end over a HeldAssembly trait (park, lend, take_back, rearm): the kept assembly is reused only for an equal key, owners at the same addresses and an accepted re-arm; anything else retires it after the MTP drafter's bindings are released, and the owners are never lost. DecodeResources implements the trait (owner loan real; park and rearm refuse until the verify bank has them, so nothing is kept and every request records as before). The lifecycle fake models the bank (generation, counters, wait flag, canonical image) and the owners, and the scenarios the real implementation must pass are in docs/experiments/decode-graph-reuse.md. Switch off: unchanged path. No speedup claim.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 23:41:02 +01:00
Pavlo Ratushnyi 182e1ca07e Merge branch 'claude/verify-gdn-fused-kernels' into claude/speed-vs-strata-08143a
# Conflicts:
#	crates/cuda-driver/ptx-sm86/MANIFEST.json
#	crates/cuda-driver/src/original_verify.rs
#	crates/cuda-driver/src/original_verify_window_sm120.rs
#	scripts/gpu-bringup/extra-seal-plan.json
2026-11-09 23:39:52 +01:00