Commit Graph
645 Commits
Author SHA1 Message Date
Pavlo Ratushnyi b4ef2eec47 Merge branch 'main' into claude/speed-vs-strata-08143a 2026-11-11 01:22:25 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 b8bcd7e777 FFN switches D1-D3: probe, identity and window stubs; ledger rows and job names
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 01:19: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 RatushnyiandClaude Sonnet 5.5 638dd8c812 Merge claude/prefill-latency: prefill ladder, stream-all 1536, graph reuse, park fast, check merge, host holder tooling
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 01:18:12 +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 RatushnyiandClaude Sonnet 5.5 5267c9d538 Ledger: V2 device part at parity, V4b closed by V4a, K11 per layer, S7/D2/D3 rows (FFN phase analysis)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 00:41:16 +01:00
Pavlo Ratushnyi 8d73d862c1 Merge branch 'claude/v2-ffn-design' into claude/speed-vs-strata-08143a 2026-11-11 00:40:55 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 d19d08b698 V2 FFN phase: loss analysis and design (offline CUPTI timeline script)
Per kind/T/layer-class timeline of the FFN phase for LEL (CL.2, CT.1, CY.1)
and VANL from the request-29 windows, shift-share of the +0.95 ms into device
chain / arrival of the CPU rows / tail / tier mix, and the device-side options
that remain (sub16 down kernel with PCIe pass rows, add_hits in combine, wait M
folded into copy rows) with a task split. Analysis only: no engine code, no GPU.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 00:40:33 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 917289a5e5 Ledger: S11/S9/U5a identity results, probe run 2
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 00:04:55 +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 318190a55c ledger Q6: raw batch copy driver check passes on the 5090 (719 is test-specific)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 23:06:53 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 94185828f9 ledger: refill batch copy result (bytes-bound), prefetch first GPU run fails
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 21:49:18 +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 Ratushnyi 83e21ebdfb Merge branch 'worktree-agent-acd2587ce4944ff56' into claude/prefill-latency 2026-11-10 20:42:25 +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 cdb0958b6d ledger: Q6 refill deferral on top of the default set (no gain), batch copy plan
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 20:36:21 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 4bcf913773 ledger: U6 expert-major bank copy (deferred), U7 fused int8 prompt experts, Q2/Q3 against the VANL logs after the stream threshold
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 20:23:03 +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 137d2899a6 Speed program: ledger counts
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 19:23:34 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 fc1e94ea55 Speed program: window variants CP/CS/CH/CD/CZ, ledger S11/S9/U5a built and queued (probes, identity, CUPTI windows)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 19:23:28 +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 Ratushnyi 1c8c4abac2 Merge branch 'claude/s11-s9-combine-headmix' into claude/speed-vs-strata-08143a 2026-11-10 19:15:14 +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 456f5336b1 Speed program: ledger V5/V7 analysis of the flag waits (no kernel overhead to remove; the loss is the CPU leg's arrival), cupti_flag_waits.py
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 18:55:34 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 79cec246cb ledger: section deltas of check merge, park fast and graph reuse (profiled boots)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 18:04:17 +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 9b9f736bff Speed program: ledger, A/B rules of 2026-11-10; second half of the tie-spread A/B withdrawn; S6 closes without its own paired A/B
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 17:34:44 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 deb0d73489 Speed program: ledger, QSA prelude set A/B (no regression) closes K6/K1/S10; fused commit window 509 -> 125 us (S6/O11 wait for identity)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 17:04:56 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 818c604ab2 Speed program: ledger, set A/B of the side branches (M against U): decode +2.11 %, no regression; V3a/V3b/V4a stay fixed
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 14:44:42 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 c7920322f3 Speed program: ledger C2v, correct four kernel-time cells
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 12:24:11 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 e4c9208570 Speed program: ledger section C2v, the CUPTI windows of the new verify switches against CL.2 and VANL
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 12:23:58 +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 c499df4141 Speed program: ledger U5 measured on the 5090 (upstream hc down faster by 3-6 us a launch), new row U5a
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:17:10 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 66d23c594e ledger: group A/B of check merge + park fast + chain, park ASYNC rerun, GDN-TC logit gate verdict and profile
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:15:31 +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 6cf6d35c8f ledger Q7: reuse works on the GPU (assemble+disassemble 118 ms to 20.7 ms per request, 29 of 30 reused)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 04:24:20 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 5541b47242 ledger O8/O9: chain pipeline never engages (min_p > 0 in every draft); check merge detection PASS, 114 to 105 nodes; teacher-forced identity job
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 03:45:09 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 0a3d6a6f4a ledger: job-name map for the chain gate diagnosis
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 02:50:31 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 e7a26c60c5 ledger: job-name map for the parking rerun after the ASYNC fix
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 02:36:21 +01:00
Pavlo Ratushnyi 1e11d1f612 Merge branch 'claude/prefill-prefix-park-fast-2' into claude/prefill-latency
# Conflicts:
#	docs/experiments/step-ledger.md
2026-11-10 02:34:32 +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 de4da3a5d9 ledger A1-A3 (empty-request probe) and B3 (parking first GPU results)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 02:25:11 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 823d544cf5 ledger U1: first GPU results (parity pass, logit gate arm I1 outside the envelope, A/A floor pending)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 01:24:56 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 8bd63be469 holder: guard against a non-sparse lab holder in pf_ab_job (restart sparse and requeue); ledger row M1; ladder A/B ran on the full holder
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 01:01:09 +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 f1175265cb ledger: job-name map for the Q7 identity and profile job
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 00:56:52 +01:00