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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>