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>
The MoE prompt stage already reads the routed expert ids on the host to group rows by expert; collect the per-expert row counts
(no device work) and, at the end of the prompt phase, swap the most-routed missing experts into the VRAM slots in one batch
queued on the tier's copy stream (same ranking as the adaptive tier). Off by default.
Also: first-request A/B arms (static/adaptive x seed on/off, tier reset between requests) for the corpus, long-context and
laptop smokes, per-round hit-rate marks, and unit tests.
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>