Commit Graph
465 Commits
Author SHA1 Message Date
Pavlo Ratushnyi f907a1bfdf Merge branch 'claude/ms-trim' into claude/port-gpu-bringup 2026-10-17 11:06:19 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 6050e8644a perf(serve): the refill queued inside the assembly is opt-in (LELEKA_REFILL_DEFER=on) until it has a GPU result
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 10:14:53 +02:00
Pavlo Ratushnyi ad1c047b10 Merge branch 'claude/prefill-kernels' into claude/port-gpu-bringup 2026-10-17 10:13:04 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 8c8ced060c docs(prefill): tier-on A/B
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 10:12:44 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 7c4b036384 docs: paired A/B of the step-cost trims, pcie_frac evidence
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 08:52:25 +02:00
Pavlo Ratushnyi 70bf2efe2e Merge branch 'claude/round-overhead' into claude/port-gpu-bringup 2026-10-17 08:52:12 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 1bd72a1a85 docs(serve): job 809, the unmodified Original on the port's corpus
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 08:51:58 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 935678805c docs(prefill): laptop A/B of the compute-stage kernels
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 08:23:23 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 f29d8ad400 docs(prefill): compute-stage kernel results (RTX 5090 job 961, laptop gates)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 08:23:13 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 3e00018f47 perf(serve): queue the lent-slot refill after the intake uploads and before the graph capture
The refill DMA (1.4 GB, ~40 ms) otherwise held back the decode phase's small synchronous uploads (PLE seed) on the copy engine; now it overlaps the ~75 ms host-side capture.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 05:38:43 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 c30cf5c38d docs: per-step host costs of the Original serve loop
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 03:16:20 +02:00
Pavlo Ratushnyi 5da8f13165 Merge claude/port-gpu-bringup (d777560) into claude/ms-trim 2026-10-17 02:57:09 +02:00
Pavlo Ratushnyi 14eeb39865 Merge branch 'claude/port-gpu-bringup' into claude/prefill-kernels 2026-10-17 02:55:52 +02:00
Pavlo Ratushnyi d777560c58 Merge branch 'claude/round-overhead' into claude/port-gpu-bringup 2026-10-17 02:47:39 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 fc12844537 perf(prefill): GDN chunk starts from the mirror's device state when it holds the prior; more PLE reader threads
LELEKA_PREFILL_GDN_MIRROR=0 keeps the canonical host upload. Final residual of every row bit-identical (PREFILL-R gate) on the laptop.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 02:13:46 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 24000a38b5 perf(prefill): batched input staging, folded finite guards, element-parallel dequant, fast finite checks
- KAR PLE rows of a whole chunk are resolved to cache slots on the host (parallel pread of the misses) and decoded by one kernel straight into the arena; each distinct token embedding is decoded once and broadcast to the four residual streams on the device (LELEKA_PREFILL_STAGED_INPUT=0 keeps the per-token path).
- GR read/inject and GDN chain guards ride on their producer kernels; GDN/QSA weight dequantization is one thread per element (LELEKA_PREFILL_FUSED_SCANS=0, LELEKA_PREFILL_FAST_DEQUANT=0 keep the originals).
- Two-barrier GDN recurrence is EXPERIMENTAL (LELEKA_PREFILL_FAST_REC=1), off by default.
- Branch-free finite check and single-copy upload of the GDN state; PREFILL-R bit gate, per-command profile tags, model-free GPU probes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 02:04:42 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 c0190bdb6d feat(cuda-driver): sealed prefill_stage PTX (chunk-wide PLE decode, embedding broadcast, GR/GDN kernels with folded guards, element-parallel dequant)
New precise-recipe asset (extra-seal-plan group prefill-stage, nvcc 13.2.86), sealed with compile_assets.py/seal_pins.py, with its sm_86 companion.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 02:04:42 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 3c33af3e01 perf(serve): the lent-slot refill copies run on the cache's own non-blocking stream
Other synchronous uploads of the decode phase (PLE seed, canonical GDN) no longer queue behind the 1.4 GB of refill DMA on the default stream.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 02:01:14 +02:00
Pavlo RatushnyiandClaude Opus 5.5 7a113d1406 docs(serve): expert residency record (job 805: placeholder profile, static vs adaptive)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 01:56:37 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 ef6e2c54f8 perf(serve): wait for the lent-slot refill behind the decode phase's assembly (LELEKA_REFILL_DEFER=off controls)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 00:59:04 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 2f793d03c9 perf(serve): single-pass canonical GDN intake, one write for the window PLE staging, chat/sampled smoke options, conv span
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 00:42:27 +02:00
Pavlo RatushnyiandClaude Opus 5.5 858f42001e docs(serve): job 804 record (shared window modules, reverted executable reuse)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 00:13:51 +02:00
Pavlo Ratushnyi e3980f3e21 Merge branch 'claude/port-gpu-bringup' into claude/ms-trim 2026-10-17 00:07:21 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 7dba64c4d5 perf(serve): pread for KAR PLE rows, per-window env reads cached, sampled corpus smoke, bench_encode
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 00:07:21 +02:00
Pavlo RatushnyiandClaude Opus 5.5 499faec1ae perf(prefill): the chunk expert stream is EXPERIMENTAL and off by default
Job 0708 (same binary, LELEKA_PREFILL_STREAM A/B): with next-MoE copies
queued under the GDN batches the ring fell 1,108 -> 776 ms per 8192-token
chunk but the GDN windows grew by about as much (2,676 vs 2,730 ms per
chunk), and 2048-token chunks got slower (1,755 vs 1,410 ms). The
per-layer copy ring is the default again; LELEKA_PREFILL_STREAM=1 enables
the stream for experiments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 00:03:18 +02:00
Pavlo RatushnyiandClaude Opus 5.5 a9f67649ee fix(serve): default --pcie-frac 0.55 only over a pinned expert bank
The 0.55 default (3e8e10e) also applied to the laptop's pageable low-RAM
mapped bank, whose PCIe share is DMA'd from pageable pages (the copy kernel
needs aliases): the coordinator's 3080 runs decoded at 6.66 tok/s against
~10-12 with 0. Unset, the share is now 0 for a pageable bank and 0.55 for a
registered one; an operator's LELEKA_ORIGINAL_SERVE_PCIE_FRAC applies as given.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 00:01:47 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 57fdd21b13 perf(serve): host profile spans, verify GPU profile report, span cache, sparse suffix reset
Driver host_profile spans (LELEKA_SERVE_PROFILE) for the window launch, doorbell waits, syncs, head, commit and MTP draft
graphs; STRATA_VERIFY_PROFILE report printed per request; PCIe/swap/refill source span cache (LELEKA_SPAN_CACHE=off controls);
suffix drafter clears only the slots it claimed (LELEKA_SUFFIX_RESET=full controls).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 23:59:59 +02:00
Pavlo RatushnyiandClaude Opus 5.5 c45bcaafd7 Revert "perf(serve): update the previous verifier's graph executables instead of instantiating anew"
Job 804 (RTX 5090, rt-b8): with the parked executables on (the default),
both arms broke the stack in the smoke's cancellation sequence (a window
failed with CudaExecution after a few requests, the stack went Broken)
while every arm with LELEKA_GRAPH_EXEC_REUSE=off passed. The executable
update path is withdrawn; the instantiation it would have saved is ~21 ms
per request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 23:17:36 +02:00
Pavlo RatushnyiandClaude Opus 5.5 52e0911652 docs(prefill): paired laptop run against the Original (identical greedy outputs, prefill on par)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 23:03:28 +02:00
Pavlo RatushnyiandClaude Opus 5.5 973e0d2fdf feat(serve): --dump-routing for the expert-cache profile (LELEKA_ORIGINAL_SERVE_DUMP_ROUTING)
generate.cpp's --dump-routing writes every routed expert so tools/make_profile.py
can rank the (layer, expert) pairs a workload uses; the expert-cache profile then
decides what starts resident. The port's tier writes the same records (layer,
k, ids, weights) for every decode window row it serves (prompt routing is not
traced). Off unless the variable names a file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 21:58:46 +02:00
Pavlo Ratushnyi 7e930efc91 Merge branch 'claude/port-gpu-bringup' into claude/round-overhead 2026-10-16 21:56:41 +02:00
Pavlo RatushnyiandClaude Opus 5.5 cdf284c9c3 docs(serve): round-overhead A/B record (jobs 800-803)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 21:56:41 +02:00
Pavlo Ratushnyi ae269b8f14 Merge branch 'claude/port-gpu-bringup' into claude/prefill-throughput 2026-10-16 21:47:03 +02:00
Pavlo RatushnyiandClaude Opus 5.5 deff468321 docs(prefill): chunk-size rounding evidence, 8192-chunk breakdown, stream overlap and laptop findings
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 21:47:03 +02:00
Pavlo Ratushnyi 0850cfe272 Merge branch 'claude/prefill-throughput' into claude/port-gpu-bringup 2026-10-16 21:45:43 +02:00
Pavlo Ratushnyi b075aad4d6 Merge branch 'claude/round-overhead' into claude/port-gpu-bringup 2026-10-16 21:45:42 +02:00
Pavlo RatushnyiandClaude Opus 5.5 3eb74054e0 perf(serve): wait for the adaptive tier's swaps at the round start
Job 803 (static vs adaptive tier, paired): with the context synchronizes
gone from the publication, the adaptive swap copies (96 experts, ~0.2 GB
every 4 rounds) overlap the next window and its CPU share; the CPU pool
time per round rose by ~1-2 ms and the fenced publication lost against the
serial one with the tier adapting (62.6/63.8 vs 63.7/64.4 tok/s), while it
was neutral to positive with static residency. The swaps now land before
the next window (wait_swaps at apply_pending, after the draft): what the
synchronizes used to enforce, made explicit, and the resident set of a
window no longer depends on when the copies finished.
LELEKA_SERVE_SWAP_WAIT=off polls as generate.cpp's apply_pending(false).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 20:54:11 +02:00
Pavlo RatushnyiandClaude Opus 5.5 f2c5f5eb0e perf(serve): router lookahead opt-in (LELEKA_CPU_POOL_LOOKAHEAD=on)
Laptop A/B/A (RTX 3080, mapped experts, 3 prompts x 2 passes, 128 tokens, warm page cache, same binary
7c584c2): decode tok/s on 7.21/8.54/11.49/9.44/10.00/12.94 and 8.17/6.20/10.47/8.29/9.92/12.98 vs off
9.29/8.97/11.82/8.15/9.82/13.53 (means 9.94, 9.34 vs 10.26), identical outputs in all three arms. The
thread warmed ~175k experts and spent ~11 s of CPU on router GEMVs per run on an 8-core CPU that already
runs 7 workers and the host. Off by default until a cold-cache measurement shows a gain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 20:14:03 +02:00
Pavlo RatushnyiandClaude Opus 5.5 6fa92c13e4 perf(serve): update the previous verifier's graph executables instead of instantiating anew
Each request's verifier instantiated its seven window/commit graphs again
(~19 ms of the ~110 ms assembly on the 5090, job 803 profile). A drained
verifier executable is now parked with its context (at most 16, destroyed
with the context) and the next verifier's graph of the same policy and node
count is applied to it with cuGraphExecUpdate; when the driver refuses the
update (topology or node kinds differ) the parked executable is destroyed
and the graph instantiated as before. LELEKA_GRAPH_EXEC_REUSE=off keeps the
per-request instantiation (A/B control).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:45:42 +02:00
Pavlo RatushnyiandClaude Opus 5.5 57c2558961 perf(serve): share the verify window's sealed modules across the per-request verifiers
Every request's verifier bank loaded (and SHA-256 checked) the window's
sealed PTX modules again, ~1 MB of PTX for the expert kernels alone, and
unloaded them at the end of the phase. The context now keeps the modules
an earlier bank loaded (Context::window_modules, unloaded with the context)
and later banks share them: the same sealed image and entries, admitted
once. LELEKA_WINDOW_MODULE_CACHE=off loads per bank as before (A/B control).
The serve profile reports record.modules (window module loading inside
record_all).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:42:09 +02:00
Pavlo RatushnyiandClaude Opus 5.5 ae02262c08 perf(cpu-expert): specialise the AVX-512 IQ, Q2_0 and the IQ4_NL row kernels on format and token count
iq_avx512.cpp templates row_dot<TY, NT>; the Rust kernels looped over a runtime token slice with the
format matched per half block. dot_multi512, rust_q2::dot512 and iq4nl now dispatch once per row to
const-generic bodies (format x 1..8 tokens) with the same operations in the same order per token.
Proof: tests/borrowed_group_parity.rs prints a digest of every output bit of its 120 synthetic groups (all
10 format pairs, 1..8 rows); the digests of the previous and this build are identical. Model-free group
cost on the i9-11900H laptop, 7 workers: 226/250 -> 206/218 ms per 48-group round.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:36:35 +02:00
Pavlo RatushnyiandClaude Opus 5.5 4726afa27e perf(cpu-expert): pin the host loop once to the first physical core (session.cpp SessionLoopScratch)
The direct pool's caller drains beside the workers, which are pinned to every physical core but the
first. Like the Original's session loop, the caller is now pinned once (on its first group) to that free
core and its previous mask is restored when the pool drops; unpinned, its drain and doorbell spin can
land on a worker's core or SMT sibling (the Original measured 26.9 vs 36.3 GB/s for this). Placement
only: no arithmetic changes. LELEKA_CPU_POOL_PIN_HOST=off is the A/B arm.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:32:17 +02:00
Pavlo RatushnyiandClaude Opus 5.5 7c584c253a perf(serve): router lookahead for the file-mapped expert source (expert_source.cpp RouterLookahead)
When the direct CPU tier starts layer l over a mapped bank, a background thread applies layer l+1's
router (BF16 host copy) to layer l's MoE input, takes each row's top-10, drops the experts the VRAM tier
holds for l+1 and advises their pages (MADV_WILLNEED) so the reads are in flight while layer l computes.
Advice only: what is computed, and how, is unchanged. Started once on the first mapped group (routers and
per-layer bank layout loaded then); a prediction still running makes the next submit skip. Off with
LELEKA_CPU_POOL_LOOKAHEAD=off (A/B arm); the resident source never starts it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:28:31 +02:00
Pavlo RatushnyiandClaude Opus 5.5 e4af9a643d perf(serve): one source fence per layer group for the CPU and PCIe experts
with_moe_routed_group_source opens one routed source loan per layer group (one size observation at
begin and one at finish) and MoeRoutedSourceScope::retarget moves it from job to job with the same
member checks a fresh per-expert scope applies; inside, every job is still validated individually
(binding, its actual gate/up/down descriptors and formats, its bank spans, first-use row admission) with
the same refusals. The direct CPU tier opens its group this way, the mapped-source prefetch runs inside
the same fence, and the VRAM tier's PCIe sources of a group share one fence too.
LELEKA_CPU_POOL_FENCE=job keeps one fence per job (A/B arm).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:24:31 +02:00
Pavlo RatushnyiandClaude Opus 5.5 e9b8a5e8b6 perf(prefill): enqueue the stream's copies on the calling thread, under the GDN kernel batches
The issuer thread of 80627bc made the prompt path slower (job 707: 1,083
vs 1,413 tok/s at chunk 2048, 2,419 vs 2,624 at 8192): every stage of the
compute path drains with cuCtxSynchronize, which also waits for the copy
stream, so each drain waited while the free-running issuer filled the ring.

The stream (same stream_all order, slots and events) is now driven by the
calling thread only: a layer's MoE queues its own entries up to the ring
(as the per-layer ring did), and the GDN prompt producer calls
prefetch_point right after its last drain before its sync-free kernel batch,
which queues as many of the upcoming MoE layer's entries as 90% of its
previous batch window covers at LELEKA_PREFILL_PCIE_GBPS (45), so those
copies run under the GDN kernels and are complete by the batch's closing
drain. Same bytes, slots, gathers and products.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:24:11 +02:00
Pavlo RatushnyiandClaude Opus 5.5 3e8e10ed5f perf(serve): default --pcie-frac to the Original's 0.55 with the copy kernel
Job 802 (RTX 5090, paired a/b/b/a, one binary, copy-kernel staging, expert
tier on, 6 prompts x 2 passes x 128 tokens): pcie_frac 0 decodes at 41.9 /
42.7 tok/s mean, 0.55 at 62.2 / 63.6 (+48%), TTFT unchanged (1214/1209 vs
1212/1207 ms). Placement differs between the two (PCIe experts run on the
GPU, which rounds differently from the CPU pool), so outputs differ as
documented for the tier; the tier itself stays opt-in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:20:53 +02:00
Pavlo Ratushnyi 8b544a7c5f Merge branch 'claude/port-gpu-bringup' into claude/round-overhead
# Conflicts:
#	crates/leleka-runtime/src/qwen_forward/original_serve_host.rs
#	crates/leleka-runtime/src/qwen_forward/original_serve_residency.rs
#	docs/original-serve.md
2026-10-16 19:19:48 +02:00
Pavlo Ratushnyi 064e309f9b Merge branch 'claude/port-gpu-bringup' into claude/prefill-throughput 2026-10-16 19:19:11 +02:00
Pavlo RatushnyiandClaude Opus 5.5 468f34e1f5 test(serve): long-context smoke writes its prompt ids for the Original (LELEKA_ORIGINAL_SERVE_LONG_IDS_DIR)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:19:11 +02:00
Pavlo RatushnyiandClaude Opus 5.5 f845d86f47 merge: claude/pool-zero-copy (direct CPU expert pool: borrowed expert bytes, one dispatch per group, one-time admission, mmap page prefetch)
5090 decode mean 18.4 -> 56.5 tok/s on 6 prompts (verify window 169.5 -> 54.5 ms); laptop RTX 3080 mean 2.74 -> 8.10 tok/s
(Original 8.15). Real-model crosscheck: 4320 groups / 57556 expert rows, 0 differing floats. LELEKA_CPU_POOL=legacy keeps the
old path for A/B, =crosscheck runs both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 17:56:35 +02:00