Merge branch 'main' into claude/speed-vs-strata-08143a
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,270 @@
|
||||
# Decode graph reuse across requests (ledger row Q7)
|
||||
|
||||
Status: wired behind `LELEKA_DECODE_GRAPH_REUSE` (off by default, typed setting `serve.decode_graph_reuse`), unit tested
|
||||
host-side and on the lifecycle fake, NOT run on a device. The speed session's driver part (`DeviceRef` handles, `OriginalVerifier::
|
||||
park` / `rearm`, `OriginalVerifyCanonicalGdn::reseed`, `docs/experiments/verify-decode-graph-reuse-handles.md`) is merged in;
|
||||
this side is the policy (`DecodeGraphKey`, `GraphReuse::begin` / `end`, `HeldAssembly`), the QSA owner loan in the journal
|
||||
(B2), the drafter decision (B3), the shared-expert pin and weights epoch, and the stack wiring (section 4). With the switch off
|
||||
every path is the one before this change. No speedup claim; the sections to compare are in section 5.
|
||||
|
||||
## 1. Why the graphs are recorded per request
|
||||
|
||||
`decode_phase` (`OriginalServeStack`) calls `assemble_decode` -> `AssembleInputs::assemble` (`original_serve_verifier.rs`) for
|
||||
every request, and `teardown_decode` -> `disassemble` at its end. `assemble` is: `prepare` (geometry, canonical GDN image
|
||||
uploaded from the session's priors, QSA gamma), `OriginalVerifyQsaJournal::new` over the twelve QSA owners, then
|
||||
`capture_verifier`: a new `OriginalVerifier` (new `Physical` arena, mapped allocations, two streams), one aggregate
|
||||
(`OriginalVerifyWindowResources`) per T = 1..=max_t plus one for the commit graph, and `record_all` (nine graphs at T <= 8
|
||||
with the mode17 policy, 54-62 ms capture + 27-30 ms instantiate). `disassemble` closes the verifier (drains, drops every
|
||||
graph and aggregate), which releases the aggregates' references to the QSA journal so `into_owners` can take the owners back,
|
||||
and `release_mtp` drops the MTP drafter's programs bound to this verifier's bank.
|
||||
|
||||
The recording is per request because of OWNERSHIP, not because the kernel arguments change:
|
||||
|
||||
1. The QSA owners (twelve index images + mapped K/V journals) belong to the prompt executor. The next request's prefill
|
||||
writes them (chunks, prefix-cache import, rollback). They can only get there by moving out of the journal
|
||||
(`Rc::try_unwrap` in `into_owners`), which requires every graph that holds the journal to be gone.
|
||||
2. The resources borrow the stack: `DecodeResources<'s, 'ctx>` holds `&'s DenseWeightCache`, `&'s MoeWeightCache`,
|
||||
`&'s OriginalNativeOutput`, `&'s DeviceBuffer` (PLE history and scratch), `&SharedKeys` (a value of the request's own
|
||||
stage). A value that borrows fields of `OriginalServeStack` cannot be stored in it (self-reference); this is why
|
||||
`DecodeView` borrows the fields one by one.
|
||||
3. The shared experts and routers are LRU entries of the MoE cache (`ensure_original_verify_shared`); the prompt path loads
|
||||
layer by layer and may evict and reload them, so their device addresses are not guaranteed to survive a prefill.
|
||||
4. The MTP drafter's round programs read the verifier's bank (final R span) and are released with it (`mtp_release_verifier`);
|
||||
they are re-captured against the next bank (spans `draft.*`, a second cost of the same cause).
|
||||
|
||||
`docs/decode-parity.md` already records this as "Verifier persistence: not done ... needs the executor to use the owners through
|
||||
the journal".
|
||||
|
||||
## 2. What the captured graphs point at
|
||||
|
||||
Per-request buffers (created by `assemble`, addresses change every request today; data must be re-seeded if the buffer is kept):
|
||||
|
||||
| Resource | Created in | Per request | Can be stable |
|
||||
| --- | --- | --- | --- |
|
||||
| Canonical GDN image (36 layers x 128*48*128 + 10240*3 f32, ~118 MB) | `prepare_assembly` (`original_verify_canonical_gdn(states, histories)`) | allocated and uploaded from the session priors | yes: keep the buffer, re-upload (118 MB H2D, stays in the per-request cost) |
|
||||
| Verifier arena, `prof`, 15 mapped allocations, window modules | `OriginalVerifier::new` | new | yes: sized by `verify_geometry(max_t, max_cells, blobs)`; only the window state is data (`last_t`, `last_position`, `generation`, staged tokens) |
|
||||
| Head rows per T, embedding rows per T, GDN journal, window aggregates | `aggregate()` | new | yes, part of the kept assembly |
|
||||
| QSA journal `Rc<OriginalVerifyQsaJournal>` | `OriginalVerifyQsaJournal::new` | new Rc around the executor's buffers | the buffers are the executor's (fixed addresses); the Rc must outlive requests |
|
||||
| Graphs, streams, event | `record_all` | new | the point of the feature |
|
||||
|
||||
Stable resources the graphs also point at (owned across requests today, so reuse needs only a proof that they were not
|
||||
reallocated): dense weights and gamma, router and shared experts (MoE cache entries, see 1.3), `OriginalNativeOutput`, PLE history
|
||||
and PLE scratch (stack buffers), RoPE tables, the registered expert banks of the pcie path, the VRAM expert cache slots.
|
||||
|
||||
Context length, window width, expert tier:
|
||||
|
||||
* Context length and positions are DATA (staged into mapped host memory / device flags before each `run`); the arena and
|
||||
the QSA journals are sized for `max_cells`, fixed by the configuration. A longer context does not change the graphs.
|
||||
* The window width T is the graph identity (`OriginalGraphKey::VerifyWindow(t)`, t in 1..=8) and `max_t` is the arena
|
||||
geometry. `verifier_max_t` can only fall during a process (`narrow_window_policy` after a graph OOM); a held assembly
|
||||
recorded for another `max_t` must be retired.
|
||||
* The expert tier: `pcie_mode` (0 DMA, 2 copy kernel) and the per-layer role bytes are baked into the graphs
|
||||
(`set_pcie_mode`, `pcie_role_bytes`); the VRAM cache slot contents are data (published plan), the cache object and the
|
||||
registered banks are addresses. `decode_pcie_mode` is a function of the configuration and of the cache being present.
|
||||
* Process-level switches resolved at recording time: `qsa_cluster_requested` (cluster top-k), the sm120 switches
|
||||
(`from_env`), `WindowPolicy::mode17()`. They are fixed for a process; they are in the key so a change is caught.
|
||||
|
||||
## 3. Key and invalidation (coded: `original_serve_stack/decode_graph_reuse.rs`)
|
||||
|
||||
`DecodeGraphKey { max_t, max_cells, pcie_mode, tier, cluster_topk, weights_epoch, owners_epoch }`. `weights_epoch` and
|
||||
`owners_epoch` are counters bumped by the owners of the physical buffers whenever one that a window reads or writes in place
|
||||
is freed, moved or reallocated. `GraphReuse::begin((key, seed), owners, retire)` returns the held assembly only for an equal key, with the owners taken back
|
||||
at the addresses the graphs bound and `HeldAssembly::rearm(seed)` accepting; otherwise it retires it (`Why::KeyChanged(name) |
|
||||
OwnersChanged | RearmRefused | NothingHeld | Disabled`) and gives the owners back to record a new one. `end` parks the assembly
|
||||
of a clean request, lends the owners home and keeps it; a failed or cancelled request keeps nothing; `invalidate` retires it
|
||||
(broken stack, reconfigure, narrowed window). A reuse that cannot show an equal key is a
|
||||
re-record. The lifecycle fake (`lifecycle_fake/graphs.rs`, tests `backend/lifecycle_tests/graphs.rs`) bakes the key and the seed
|
||||
into its graph set and fails the request on a replay for another key or without a re-arm: kept and re-recorded sets give the
|
||||
same text, a kept set costs no recording, each of the seven key inputs forces a re-record, a refused re-arm and a failed
|
||||
request do not replay.
|
||||
|
||||
Owners of the epochs:
|
||||
|
||||
* `weights_epoch`: `MoeWeightCache::weights_epoch()` counts every raw entry the cache evicted (`room`, `room_protected`) and
|
||||
every pin release; `pin_for_window(keys)` / `unpin_window()` make `is_pinned` true for the 192 shared tensors so the prompt
|
||||
path cannot evict them while a set is held (the existing eviction rule, as for the profile's permanent pool). Not wired
|
||||
yet: pinning shrinks what a prefill can evict, and a prefill that finds nothing evictable fails with `InputAllocation`, so
|
||||
it is switched on only together with a held set. The routers and the other dense operands live in the dense cache, which
|
||||
does not evict after open.
|
||||
* `owners_epoch`: replaced by the journal's own check (B2): `take_back` compares the window addresses (`window_addresses(layer)` for the twelve
|
||||
layers: resident pools, table, host copy, resolver, pooled and dead key spans) taken when it lent the owners with those
|
||||
of the owners that come back; any difference is a refusal and a re-record.
|
||||
|
||||
## 4. The pieces: handles (speed session), owner loan, drafter, stack wiring
|
||||
|
||||
### B1. The held assembly cannot borrow the stack (done by the speed session: `DeviceRef` handles)
|
||||
|
||||
`DecodeResources<'s>` is `OriginalVerifier<'ctx, OriginalVerifyWindowResources<'a, 'ctx>>`; the aggregates hold `&'a
|
||||
DeviceBuffer<'ctx>` into the dense cache (projections, GR, QSA operands, gamma), the PLE history and scratch, the RoPE tables
|
||||
and the MoE cache (shared experts, `original_verify_moe`). The prompt path of the next request needs `&mut MoeWeightCache` and
|
||||
`&mut DeviceBuffer` (`seed_ple_history`), which a live `&'a` forbids, and a value that borrows fields of the stack cannot live in
|
||||
the stack. No safe restructuring of the stack alone fixes this: an owner above the stack would have to hold the MoE cache
|
||||
immutably (the prompt path mutates it) or split the shared experts out of it (the prompt path loads them through it).
|
||||
|
||||
Exact change that removes the borrow (files of the speed session's area, or operand types they use):
|
||||
|
||||
* `original_verify_window_moe.rs` (5 sites: `OriginalVerifyMoeLayerWeights`), `original_verify_window_gr.rs` (16: `PleBuffers`,
|
||||
`HcLayerBuffers`, ...), `original_verify_window_proj*` and `original_verify_window_qsa.rs` (5), `qwen_dispatch/fixed_operands.rs`
|
||||
(34): replace the `&'a DeviceBuffer<'ctx>` operands with a shared handle `DeviceRef<'ctx>` (an `Rc` to the allocation plus
|
||||
offset and length, `Clone`, derefs to `&DeviceBuffer` for the existing `qwen_address()` calls). The aggregates then have no
|
||||
`'a`, `OriginalVerifyWindowResources<'ctx>` and `DecodeResources<'ctx>` can sit in the stack, and the borrow of the caches
|
||||
ends at `assemble`.
|
||||
* The caches hand out handles: `DenseWeightCache::original_verify_*` and `MoeWeightCache::raw_shared` clone the `Rc` of the
|
||||
entry (the entries become `Rc<DeviceBuffer>`); an unpinned entry that a held set still references is dropped from the
|
||||
cache's book on eviction but not freed (the set keeps the allocation alive; `weights_epoch` bumps, so the set is retired
|
||||
at the next request).
|
||||
* `seed_ple_history` writes through the shared handle (a `&self` upload of `DeviceBuffer`, device idle).
|
||||
|
||||
### B2. QSA owner loan (coded, driver)
|
||||
|
||||
`OriginalVerifyQsaJournal` (`cuda-driver/src/qsa_verification_commit*`, not a speed-session file) keeps its owners as
|
||||
`RefCell<Option<..>>` behind the accessors `index`, `index_mut`, `kv`, `kv_mut`, which refuse (`InvalidQwenShape`) while the
|
||||
owners are out, so a graph run, a window arm or a commit over a lent journal fails instead of touching nothing.
|
||||
|
||||
* `lend(&self) -> Result<OriginalQsaOwners>`: needs the journal valid, not armed, every index idle and published and standing
|
||||
where its journal does. It records the `OwnerPrint` of each of the twelve layers: the `window_addresses` (resident pools,
|
||||
table, host copy, resolver, pooled and dead key spans) and the image's tail and block-position addresses, i.e. every
|
||||
address the captured append and attention commands bind; then moves the 24 owners out (all 24 are borrowed and found full
|
||||
before the first moves).
|
||||
* `take_back(&self, owners) -> Result<(), (Error, owners)>`: takes the print of the returning owners, requires all twelve
|
||||
idle at one position (`check_aligned`) and the print equal to the lent one. Equal: the owners are put back, the journal
|
||||
stands at their position, disarmed. Anything else (an address moved, a resolver reset, a print that cannot be taken,
|
||||
called while not lent) fails the loan and the journal for good (`validate_context` then answers `ContextPoisoned`) and
|
||||
gives the owners back to the caller with the error, so none is lost; the stack retires the assembly.
|
||||
* The state machine is `cuda-driver/src/owner_loan.rs` (pure; unit tests run without a GPU: round trip, a changed address or
|
||||
a missing print fails for good, steps out of order change nothing).
|
||||
* `into_owners` (the retire path) keeps working and refuses a lent journal.
|
||||
* The stack side: `DecodeResources` implements `HeldAssembly` (`original_serve_verifier/held.rs`): `lend` / `take_back` map
|
||||
the twelve layers to and from the executor's 48 slots (`place_owners`) and refuse owners that are not at exactly the
|
||||
assembly's slots; `park` and `rearm` return `false` until the bank has them (below).
|
||||
* GPU check (orchestrator, with the speed session's `park` / `rearm`): lend, run a prompt over the executor's owners,
|
||||
`take_back`: accepted when the prompt only appended; `take_back` of owners after a `reset` of the mapped journal (new
|
||||
resolver) must be refused.
|
||||
|
||||
### B3. MTP drafter bound to the kept bank (coded)
|
||||
|
||||
`GraphReuse::begin` / `invalidate` take a `retire` callback that runs before the retired assembly is dropped; `end` never
|
||||
calls it when the assembly is kept. The stack passes `|| executor.mtp_release_verifier(binding)` (the current `release_mtp`).
|
||||
So a kept bank keeps the drafter's cached round programs (no first-draft capture in the next request) and a retired one
|
||||
releases them before its bank closes. Lifecycle fake: `drafter_releases` is 0 across kept requests and exactly 1 per
|
||||
retirement (key change, owners moved, refused re-arm, `invalidate`) and per request with the switch off or `park` refused.
|
||||
Open point for the GPU run: the drafter's tail keeps the last staged window of the previous request; the first request after
|
||||
a re-arm must clear it (today `set_prompt_len` does; check `OriginalMtpActor` for anything keyed on the previous request).
|
||||
|
||||
### The stack side (wired)
|
||||
|
||||
* `OriginalServeStack::held: GraphReuse<DecodeResources<'ctx>>`, enabled by the setting. `DecodeView::assemble` takes the QSA
|
||||
owners from the executor as before, then `begin_kept`: with the switch off it returns them untouched (`Start::Record`,
|
||||
the old path); on, it builds the `DecodeGraphKey` (`graph_key`: `verifier_max_t`, `max_cells`, `decode_pcie_mode`, tier
|
||||
present, `cluster_topk_requested()`, `MoeWeightCache::weights_epoch()`) and the seed (`RearmSeed`: binding and the session's
|
||||
`OriginalVerifiedBase`) and asks `GraphReuse::begin`. `Reused` skips `AssembleInputs::assemble` and queues the lent-slot
|
||||
refill that assembly's prepare step would have queued; a refill that cannot be queued lends the owners out again and
|
||||
retires the set (the failure goes through `resolve_assembled`, which adopts the owners). `Record { owners, why }`
|
||||
assembles as today over those owners and prints why a kept set was not reused (`decode graphs recorded again: ...`).
|
||||
`Lost` marks the stack broken.
|
||||
* `DecodeResources` implements `HeldAssembly` (`original_serve_verifier/held.rs`): `park` = `OriginalVerifier::park`, `rearm` =
|
||||
`OriginalVerifier::rearm` with the 36 GDN priors (`gdn_layer_priors`) and the PLE history of the session's base, `lend` /
|
||||
`take_back` = the journal's loan mapped to the executor's 48 slots. Any refusal or error answers `false` / `None` / `Err`,
|
||||
and the policy retires the set.
|
||||
* `serve` computes the key before the request runs; `teardown_decode` (`decode_teardown.rs`) keeps the assembly only for a
|
||||
request that was served without an error, whose host outcome is neither `failed` nor `dirty` (`keepable`), and whose
|
||||
drafter and pins went through: `mtp_end_request_keep_bank` (the drafter forgets an unfinished draft and the staged window,
|
||||
keeps its programs), `MoeWeightCache::pin_for_window(shared)`, then `GraphReuse::end` (park, lend, `QsaOwnerHome::adopt`).
|
||||
Not kept: the old teardown (`release_mtp`, `disassemble`, adopt), or, when the owners were already home, `release_mtp` and
|
||||
`verifier.close()`. Kept: no `release_mtp`, no `disassemble`, spans `decode.keep` (park + lend + adopt) in their place.
|
||||
* Retirement always runs `retire_kept` first (`release_mtp` = `mtp_release_verifier`, then `unpin_window`) and drops the
|
||||
assembly after it, so the bank is never closed under the drafter. It happens in `begin` (changed key, owners at other
|
||||
addresses, refused re-arm), in `OriginalServeStack::close`, and in `reset_expert_tier`.
|
||||
* Weights: the assembly holds handles, so an evicted tensor stays alive; the pin only avoids loading it a second time. A freed
|
||||
entry the window reads, and the release of the pins, move `weights_epoch`, which retires the set at the next request.
|
||||
* With the switch off `Ending` carries no `Keep`, `GraphReuse::begin` is not called, and `teardown_decode` runs the old body
|
||||
unchanged.
|
||||
|
||||
### Drafter state keyed on the previous request (checked)
|
||||
|
||||
`OriginalMtpDrafter` holds: `in_flight` (a draft launched and never finished), the tail owner's staged verifier window
|
||||
(`full.source`), the cached round programs (`graphs`, `graph_metadata`), `direct_window_mode`, `ring_owner`, `policy_key`.
|
||||
`end_request_keep_bank` clears the first two (after draining the draft stream) and keeps the rest: the programs name the bank's
|
||||
final-R span (unchanged for a kept bank; `stage_round` refuses a window at another address) and the draft ring
|
||||
(`ring_owner`, `policy_key` are checked by the drafter on use). The actor's other state (`DraftSettings`, prompt length, max
|
||||
drafts, the coupled host) is set per request by the stack as before. To confirm on the GPU: the draft trace and the top-16
|
||||
logprobs of request 2 equal the fresh-assembly run, and `draft.*` shows no capture at the first draft.
|
||||
|
||||
### Scenarios (the lifecycle fake runs them; the real wiring answers the same way where it can run host-side: `backend/lifecycle_tests/graphs.rs`)
|
||||
|
||||
| Scenario | Expected |
|
||||
| --- | --- |
|
||||
| switch off, 3 requests | 3 recordings, 3 drafter releases, set never held |
|
||||
| switch on, 4 requests, different prompts | text equal to the switch-off run; 1 recording, 3 re-arms, 0 drafter releases; the 3 later requests pay no recording |
|
||||
| full cycle: request 1 records, `park`, request 2 re-arms | bank generation 1 then 2; a window token of request 1 refused after the re-arm, a window of request 2 accepted; windows, commits and the wait flag count request 2's rounds only (4, not 8); the canonical image holds request 2's seed, not request 1's |
|
||||
| each key input changed (max_t, max_cells, pcie_mode, tier, cluster top-k, weights epoch, owners epoch) | re-record with `KeyChanged(name)`, 1 drafter release, the new set kept again |
|
||||
| owners moved by the prefill (`take_back` refused) | re-record with `OwnersChanged`, owners not lost, the new set kept |
|
||||
| `rearm` refused | the owners are lent out again, the set retired (1 drafter release), re-record `RearmRefused`, next request re-arms |
|
||||
| `park` refused | not kept, owners home, every request records |
|
||||
| request failed or cancelled | not kept, owners home, next request records `NothingHeld`; `invalidate` of a kept set releases the drafter once |
|
||||
|
||||
### Part 2: the verify bank's re-arm API (done by the speed session; the text below is the spec it was written from)
|
||||
|
||||
Needed in `crates/cuda-driver` (`original_verify_schedule/*`, `original_verify.rs`, `original_verify_gpu_plan*`):
|
||||
|
||||
```rust
|
||||
/// Seed of the next request: the session's recurrent priors, in the canonical image's layout.
|
||||
pub struct OriginalVerifyRearm<'s> {
|
||||
pub gdn_states: [&'s [f32]; 36], // 128*48*128 f32 each
|
||||
pub gdn_histories: [&'s [f32]; 36], // 10240*3 f32 each
|
||||
pub ple_history: &'s [f32], // 9*10240 f32
|
||||
}
|
||||
impl<'ctx, R: OriginalVerifyGraphResources<'ctx> + OriginalNativeHeadGraphResources<'ctx>> OriginalVerifier<'ctx, R> {
|
||||
/// End of a request: drain both streams, wait a pending commit; keep graphs, bank, streams and event.
|
||||
pub fn park(&mut self) -> Result<()>;
|
||||
/// Start of the next request over the same recording. `Err` leaves the verifier unusable (the caller retires it).
|
||||
pub fn rearm(&mut self, seed: OriginalVerifyRearm<'_>) -> Result<()>;
|
||||
}
|
||||
impl OriginalVerifyCanonicalGdn<'_> {
|
||||
/// Overwrite the image in place (same device address): states and histories, 117.7 MB host to device.
|
||||
pub fn reseed(&self, states: [&[f32]; 36], histories: [&[f32]; 36]) -> Result<()>;
|
||||
}
|
||||
```
|
||||
|
||||
Preconditions of `rearm`: `park` ran (both streams idle, `commit_pending`, `window_ready` and `active` false, `failed` false,
|
||||
not released); every captured graph is quiescent; the QSA journal is not armed and not lent. State it resets (everything a
|
||||
fresh `OriginalVerifier::new` + `record_all` leaves, so the first `run` of the new request sees what the first `run` after a
|
||||
recording sees):
|
||||
|
||||
* `OriginalVerifier`: `windows = 0`, `commits = 0`, `completed_generation = None`, `completed_ids = [0; 8]`, profile counters;
|
||||
`split`, `groups`, `resource_keys` as recorded.
|
||||
* `OriginalVerifyBank`: `last_t = 0`, `last_position = 0`, `last_tokens = [0; 8]`, `last_keep = 0`, `generation` advanced (old
|
||||
`OriginalVerifyRow` / `OriginalVerifyWindow` values are refused), `released = false`, `pcie_sources` cleared (held until the
|
||||
previous copy-stream fence); `pcie_mode` / `pcie_roles` unchanged (they are in the key).
|
||||
* Every device and mapped flag the graphs wait on or raise (`verify_wait_flag_ge_kernel` / `_or_kernel` operands, the group flag
|
||||
rings and doorbell of `raise_group_flag` / `wait_doorbell`, the `verify_clear_status` words, the ident-hit and tail-snapshot
|
||||
flags): back to the value they have at the end of `record_all` (zero). The graphs compare against a "want" that counts up
|
||||
inside a window; it must restart.
|
||||
* The gpu-plan state in `Physical.mapped[..]` (the published plan, the fetch tables) and `prof`: cleared.
|
||||
* The canonical GDN image (`reseed`) and the PLE history image (`seed.ple_history`, through the journal's `ple` handle).
|
||||
|
||||
Postcondition for the stack: the first `stage_window` of the new request is accepted at any `position` the QSA owners stand at.
|
||||
The policy retires and re-records on any `Err` or `false`, so a partial re-arm is safe.
|
||||
|
||||
## 5. Validation (GPU, orchestrator)
|
||||
|
||||
1. Identity: greedy output and top-16 logprob rows over N requests with different prompts and lengths, switch on vs off,
|
||||
with an eviction of a shared expert in between, a changed `max_t` (graph OOM fallback) and a request that fails in the
|
||||
middle (each must re-record and match); the draft trace of request 2 equal to the fresh-assembly run.
|
||||
2. The stderr lines: `decode graph reuse ... on` at open; `decode graphs recorded again: <why>` for every request that did not
|
||||
re-arm (expect none after the first in a steady run; `OwnersChanged` means the prefill moved an owner buffer, `RearmRefused`
|
||||
a driver refusal).
|
||||
3. Spans, paired A/B on the same workload (cache state recorded): `decode.assemble` (recording) against `decode.reuse`
|
||||
(take back + re-arm), `decode.disassemble` against `decode.keep` (park + lend + adopt), `record.capture`,
|
||||
`record.instantiate`, `record.modules` (should be 0 after the first request), the first-draft capture in `draft.*`,
|
||||
`prefill.*` (the pins and the kept pool must not slow the prefill), end-to-end request time.
|
||||
4. VRAM at the decode low-water mark (`vram_note "decode end before disassemble"`) and during the prefill: a kept set holds the
|
||||
graph pool, the bank arena, the mapped staging and the 118 MB canonical image; the loan ladder and the prefill arena
|
||||
budget see that much less.
|
||||
5. The GPU tests of the speed session's doc (section 5 of `verify-decode-graph-reuse-handles.md`) and the journal check of
|
||||
B2 (lend, a prompt over the owners, take_back accepted; a `reset` of the mapped journal between must be refused).
|
||||
|
||||
## 6. Expected size of the win and what stays
|
||||
|
||||
Removes `record_all` (83-85 ms) and the aggregate construction; the canonical image upload and per-request state seeding stay
|
||||
(about 15-25 ms of the 98-109 ms), `decode.disassemble` (B4, 11.7 ms) becomes a park. The kept pool costs VRAM during prefill.
|
||||
@@ -0,0 +1,50 @@
|
||||
# План: Leleka стабільно швидше за Strata на агентських задачах
|
||||
|
||||
Власник: оркестратор. Працюємо тільки за цим планом; нова ідея спершу потрапляє сюди, потім у роботу. Реєстр кроків: `docs/experiments/step-ledger.md`.
|
||||
|
||||
## Ціль і мірило
|
||||
|
||||
* Реальні агентські задачі (Codex: `nestng-crm`, `ttt`), довгий контекст 30–245k.
|
||||
* База vanilla (не перемірювати): VANL 202,1 ток/с і 462 с задачі, VAN 222 ток/с і 434 с (n=3).
|
||||
* Поточний LEL: 158–160 ток/с декод, 485–555 с задачі. Розрив −21 % декоду.
|
||||
* Успіх: LEL ≥ VAN за часом задачі й ток/с на обох задачах, accept 56/56, ttt грається.
|
||||
|
||||
## Правила
|
||||
|
||||
1. Лінійно по конвеєру запиту: запит → prefill → decode-раунд. Крок N+1 після закриття кроку N.
|
||||
2. Закриття кроку = виміряна дільнична дельта (профіль цього кроку) + ідентичність (2057 logprob-рядків, 1036 draft-рядків) + запис у реєстрі. Не відкидати «нижче шуму».
|
||||
3. Після кожного етапу груповий e2e: повні сесії Codex проти бази, без перемірювання vanilla.
|
||||
4. Lossy (tail skip тощо) лише з окремим гейтом і словом власника. Дефолти lossy не вмикаємо.
|
||||
5. Правила коду: доменні DTO, змістовні імена (також для завдань і гілок), функції ≤30 рядків, ≤5 параметрів, файли ≤400, гейти limits/arch на нулі.
|
||||
6. Черга GPU йде в порядку етапів (prefill перед decode). Імена завдань словами: `<область>-<що>-<крок>`.
|
||||
|
||||
## Етапи і статус
|
||||
|
||||
| Етап | Зміст | Власник | Статус |
|
||||
|---|---|---|---|
|
||||
| 0 | Архітектура (гексагональна, розміри, params, імена) | hex-finish | **зроблено**, локально, пуш чекає ssh |
|
||||
| 1 | Пам'ять: розріджений holder (одна копія) | hex-finish | **зроблено** (+42 ГБ вільно) |
|
||||
| 2 | Запит: інтейк, resume, prefix import (A1–A3) | hex-finish | вимір ідемпотентний «порожній запит» чекає GPU |
|
||||
| 3 | Prefill: ladder (Q1–Q5), refill (Q6), паркування prefix (B1–B5), запис графів (Q7) | hex-finish | ladder готовий, профіль чекає A/B; решта в черзі |
|
||||
| 4 | Decode: чернетка (ланцюг одним проходом, перевірки finite) | hex-finish | S1 закомічено, чекає ідентичність/A/B |
|
||||
| 5 | Decode: verify-граф (бічні гілки: mixer, QSA, shared) | speed | **зроблено**, дефолт увімкнено (+1,39 % і дільничні дельти) |
|
||||
| 6 | Decode: ядра mixer-половини (S10 батчований append K/V, GDN K7/K7a), accept на пристрої (0,32→0,08 мс), commit (fused) | speed | у роботі |
|
||||
| 7 | Груповий e2e: CRM×3 і ttt×3 проти бази | обидва | після етапів 2–6 |
|
||||
| 8 | Рішення власника: tail skip (+10…12 %, не пройшов гейт CRM) | власник | відкрито |
|
||||
|
||||
## Задачі в LeaseVibe (залежності лінійні)
|
||||
|
||||
Батьківська задача STRA-368. Ланцюг: STRA-369 (пам'ять, зроблено) → STRA-370 (запит A1–A3) → STRA-371 (prefill ladder) → STRA-372 (refill і паркування) → STRA-373 (запис графів) → STRA-374 (чернетка) → STRA-375 (verify бічні гілки, зроблено, чекає груповий A/B) → STRA-376 (verify-ядра і accept на пристрої) → STRA-377 (commit, хост-хвіст) → STRA-378 (груповий e2e). Окремо STRA-379 (рішення власника: tail skip, Playwright, ssh). Статуси на дошці переводить людина (workflow Backlog → Ready for BA), тож актуальний стан у summary задач і в цьому плані.
|
||||
|
||||
## Відкриті блокери і рішення власника
|
||||
|
||||
* ssh-агент ноутбука: пуш на сервер не проходить, усе коміти локально.
|
||||
* Дозвіл поставити Playwright для браузерної перевірки ttt (поки лише статика 14/14).
|
||||
* Tail skip: чи ризикувати ради +10 %.
|
||||
* База порівняння застаріла: upstream Strata на 2026-11-09 це engine 0.1.59 / app 0.2.13.1 (наш пін 0.1.50, 1985 комітів різниці; релізи v0.2.7 .. v0.2.13). Для NVIDIA/Blackwell є зміни: DFlash2 per-device (Blackwell cc 12.0: conf 0.35→0.55, window 6→8), MMQ_KQ дефолтом для cc>=8.0, виправлення передачі completion. Чекає рішення власника: взяти нову базу (одне вимірювання CRM x3 нової ваніли, версія на вибір) і додати в реєстр їхні нові кроки.
|
||||
|
||||
## Ритм оркестратора (кожна перевірка)
|
||||
|
||||
1. Черга GPU (що біжить, що за ним, порядок етапів).
|
||||
2. Лічильники реєстру (open/fixing/fixed/proved-equal).
|
||||
3. Блокери і дрейф від плану; нове питання записати сюди, а не розпочинати.
|
||||
@@ -0,0 +1,102 @@
|
||||
# Lent-slot refill with batched copies (`LELEKA_REFILL_BATCH`, EXPERIMENTAL, off by default)
|
||||
|
||||
Date 2026-11-10. Branch: a sub-agent branch on top of `claude/prefill-latency` (cdb0958b6). Status: **code and host-side
|
||||
tests only; nothing has run on a GPU. No speedup is claimed.** Step ledger row Q6.
|
||||
|
||||
## Problem (M, ledger Q6)
|
||||
|
||||
After every prompt the expert-cache slots the prompt borrowed as scratch (999 to 2,226 slots) are refilled from the
|
||||
registered host bank: `original_serve_residency::refill_lent` calls `OriginalExpertCache::fill_slot_queued` (or
|
||||
`_async` under `LELEKA_REFILL_DEFER`) once per slot. Each call enters the context and issues one
|
||||
`cuMemcpyHtoDAsync_v2` per piece. A slot has three pieces (gate, up, down), or more when `pin_resident` ranges cut a
|
||||
piece. On the 5090 (driver 595.99.02, CUDA 13.2) the host time to issue the copies is `refill.queue` = 70 ms per
|
||||
request (about 70 us per slot); `refill.sync` is 23 ms. Both sit on the request's critical path. `LELEKA_REFILL_DEFER`
|
||||
only moves the wait.
|
||||
|
||||
## Design
|
||||
|
||||
* `LELEKA_REFILL_BATCH=on|1` (`settings::memory::MemorySettings::refill_batch`; the driver reads no environment).
|
||||
When it is on, `refill_lent` collects every `(slot, spans)` pair that needs a refill, in slot order, and makes one
|
||||
call: `OriginalExpertCache::fill_slots_queued_batched(bank, fills, RefillBatchOptions { own_stream,
|
||||
max_copies_per_call: 512 })`.
|
||||
* The cache checks every slot the way `fill_slot_queued_on` does: owner, state, registered source and capacity. It also
|
||||
refuses a duplicate slot. It builds the piece list with the per-copy path's own code (`cache_source`, `copy_pieces`,
|
||||
the `checked_subspan` destinations) and in its order: slot by slot, then gate, up, down. It retains every source
|
||||
`Rc` in `pending` before anything is queued, enters the context once, and issues the list.
|
||||
* `refill_batch_copy::plan_batch_calls` (pure) cuts the list into consecutive calls of at most 512 copies. It leaves
|
||||
out empty copies, which move no byte and which the batch entry refuses. `issue_copies` makes one
|
||||
`cuMemcpyBatchAsync_v2` per call with one attribute: `srcAccessOrder = STREAM`, no location hints, flags 0. Each
|
||||
call gets the same destinations, sources and sizes as the per-copy path, so the slot bytes must come out identical.
|
||||
Only the host cost of issuing them changes.
|
||||
* **Stream.** The batch entry does not take the legacy default stream. The per-copy refill uses that stream unless the
|
||||
refill is deferred. As far as I recall, the CUDA documentation says the batch entry refuses the legacy NULL stream;
|
||||
no header or documentation was available here to confirm it, and it has not been checked on the 5090. So the batch always runs on the cache's own non-blocking `fill_stream`. For a refill that is not
|
||||
deferred, the cache first records `fill_event` on the legacy default stream and makes `fill_stream` wait for it
|
||||
(`cuStreamWaitEvent`). The copies therefore still start only after everything queued there before them. `sync_queued`
|
||||
already waits for both streams, and it stays the fence (`settle_refill`, `lend_prefill_tail`, close).
|
||||
* **Binding.** `api::AsyncApi` resolves `cuMemcpyBatchAsync_v2` and `cuStreamWaitEvent` as optional symbols
|
||||
(`api/enabled/batch_copy.rs`). If either is missing, the batch is unavailable and the refill is issued per copy. The
|
||||
prototype is the CUDA 13 `_v2` form without `failIdx`: dsts, srcs, sizes, count, attrs, attrsIdxs, numAttrs, stream.
|
||||
`CUmemcpyAttributes` is 24 bytes, and a compile-time assertion checks that size. These are the prototype and layout
|
||||
that `original_gpu_schedule_ffi` already uses for the verify window's PCIe DMA. The stub for non-CUDA builds answers
|
||||
`can_batch() == false`.
|
||||
* **Fallback and errors.** The per-copy path is used when:
|
||||
* the driver has no batch entry;
|
||||
* the bank is pageable (the low-RAM file mapping);
|
||||
* this cache saw a batch call refused before.
|
||||
If a batch call fails, the warning is printed once (`leleka-serve: WARNING: the driver refused a batched expert
|
||||
refill ...`) and `batch_refused` is set on the cache. The refused call and every later copy are then issued one
|
||||
`cuMemcpyHtoDAsync_v2` each on the same stream. A copy the refused call may already have queued is copied again with
|
||||
the same bytes. An error from a per-copy call, or from the event record or wait, poisons the cache and is returned,
|
||||
exactly like the per-copy path.
|
||||
|
||||
## Counters (`LELEKA_SERVE_PROFILE=1`)
|
||||
|
||||
| name | meaning |
|
||||
| --- | --- |
|
||||
| `refill.batch_calls` | `cuMemcpyBatchAsync_v2` calls the driver accepted (sum per request) |
|
||||
| `refill.batch_copies` | copies those calls carried |
|
||||
| `refill.per_copy` | copies issued one call each by the batched path: no entry, pageable bank, or after a refusal |
|
||||
| `refill.queue`, `refill.spans`, `refill.sync` | unchanged; with the switch on, `refill.queue` is the one batched call |
|
||||
|
||||
## Tests
|
||||
|
||||
* Host (run on the laptop, `cargo test -p leleka-cuda-driver --features cuda-driver --lib refill_batch_copy`):
|
||||
* calls are cut into consecutive ranges no longer than the cap;
|
||||
* order, destinations, sources and sizes are preserved;
|
||||
* a list within the cap gives one call, and an empty list gives none;
|
||||
* 2,226 slots x 3 pieces give 14 calls of up to 512 copies;
|
||||
* empty copies are left out but keep their place;
|
||||
* a cap of 0 or above 4,096 is refused.
|
||||
* Settings: `LELEKA_REFILL_BATCH` is in `refill_defer_batch_and_locked_only_are_on_or_one`. It is an engine-crate
|
||||
test, so it runs in WSL/Linux only and was not run here.
|
||||
* GPU, `#[ignore]`: `refill_batch_copy_gpu_slots_equal_per_copy` (`crates/cuda-driver/src/refill_batch_copy_gpu.rs`)
|
||||
fills 1,024 slots of 3 role-major pieces from one registered host buffer twice: once per copy, once through
|
||||
`issue_copies` in calls of 512. It requires every byte to be equal between the two and to the host bytes, with the
|
||||
gaps left untouched:
|
||||
`cargo test --release -p leleka-cuda-driver --features cuda-driver,sm120 --lib -- --ignored --nocapture refill_batch_copy_gpu`.
|
||||
|
||||
## What the GPU validation must show (not done)
|
||||
|
||||
1. The ignored GPU test passes on the 5090 (and, separately, on the laptop: on the RTX 3080 under Windows,
|
||||
`cuMemcpyBatchAsync_v2` from page-locked memory faulted with error 700 in `docs/windows.md`, so the switch must stay
|
||||
off there unless this test passes).
|
||||
2. Serve identity: the same requests with `LELEKA_REFILL_BATCH` off and on give identical greedy replies and
|
||||
logprob rows. `verify_slot` of refilled slots, or a slot read-back after `settle_refill`, matches the bank.
|
||||
3. `LELEKA_SERVE_PROFILE=1`, 14 or more warm requests per arm on the default set:
|
||||
* `refill.queue` per request, before and after;
|
||||
* `refill.sync`;
|
||||
* `refill.batch_calls` and `refill.batch_copies` (expected: copies / 512 calls, and `refill.per_copy` = 0 on the
|
||||
registered bank);
|
||||
* wall time per output token.
|
||||
A speedup may be claimed only from that paired A/B with the quality result.
|
||||
|
||||
## Risks
|
||||
|
||||
* The prototype and attribute layout come from the existing verify-window binding, not from the headers on this
|
||||
machine (none are installed here). An ABI mismatch would show as a refused call (fallback) or as wrong bytes; the GPU
|
||||
test checks for both.
|
||||
* The first non-deferred batched refill creates `fill_stream` and `fill_event`. The fill stream is non-blocking, so
|
||||
default-stream work queued after the refill is not ordered after it. Every reader of the lent slots waits in
|
||||
`sync_queued` first, as with the deferred path.
|
||||
* Driver faults of the batch entry on some Windows drivers (above): the switch is off by default.
|
||||
@@ -0,0 +1,149 @@
|
||||
# Prompt copy-ring prefetch (EXPERIMENTAL, off by default)
|
||||
|
||||
Switch: `LELEKA_PREFILL_RING_PREFETCH` (engine settings, `ServeSettings::prefill_ring_prefetch`). Status: implemented
|
||||
and host-tested only. No GPU run, no identity probe, no A/B yet. No speedup is claimed.
|
||||
|
||||
## Problem
|
||||
|
||||
Chunks below the expert stream's row minimum (0.2-1.5k rows on the 5090 profiles; chunks from 1536 rows already use
|
||||
the expert stream) go through the per-layer copy ring. Our profiles show that ring is bound by PCIe DMA. Per request,
|
||||
7,000-12,000 experts that are not resident (14-26 GB, 146-266 per layer, about 2.05 MB each) cross the bus at about
|
||||
45 GB/s. `ring.finish_statuses`, the wait for the copies and the kernels, takes 230-420 ms of a 530-830 ms
|
||||
`prefill.read`. Each layer's GDN/QSA/attention stage takes about 7 ms (about 330 ms per request), and PCIe is idle
|
||||
during it.
|
||||
|
||||
## Design
|
||||
|
||||
1. **History** (`leleka_cuda_model::ring_prefetch::MissHistory`). Every `Ring::new` records the layer's missed set:
|
||||
the experts that were routed and not resident. The history is per layer, as a 512-bit mask per chunk, and keeps the
|
||||
last `window` chunks (default 8). Missed sets are per layer because each layer has its own resident set, and the
|
||||
lent slots change between requests.
|
||||
2. **Prediction** (`MissHistory::predict`). Experts are ranked by how many recorded chunks missed them, then by the
|
||||
most recent chunk that missed them, then by id. Experts resident right now (`cache_expert_span`) are skipped. The
|
||||
top `K` are kept, with `K = min(top_k, ring_slots / 2)`, and `K = 0` for a ring under 32 slots: the literal 8-slot
|
||||
ring of the 512-row rung is never prefetched into.
|
||||
3. **Issue** (`OriginalMmqCopySchedule::prefetch_ring_layer`, called from `run_prompt_layer` through
|
||||
`OriginalMoePromptLayer::prefetch_ring_layer`). This runs right after layer `l`'s ring has closed, which drains both
|
||||
streams, and before layer `l`'s combine. The predicted experts of layer `l+1` are copied into stage slots
|
||||
`0..K-1` of the same row lease. Each copy is the same as `stage_one`'s: the aligned supersets or the exact pieces,
|
||||
with the same destination offsets. The copies run on the schedule's copy stream, and each slot's `copied` event is
|
||||
recorded. The engine resolves the spans from the span cache, or from a walk of the binding that changes nothing.
|
||||
Only experts whose bytes already passed the finite admission scan are resolved; others are not prefetched. By default
|
||||
the drains stay context-wide: the combine's and the next mixer's drains wait for these copies (the PCIe time then
|
||||
overlaps only the GPU work queued before such a drain). With `LELEKA_PREFILL_RING_PREFETCH_DETACH=1` the copy stream
|
||||
becomes the `compute_drain` background stream, as under the chunk expert stream: the drains stop waiting for it,
|
||||
all-zero uploads become memsets and frees are deferred.
|
||||
4. **Adopt** (`Ring::adopt_prefetch`, in `Ring::init` after `admit_sources`). The next ring takes the set (in the detached
|
||||
mode this restores the context-wide drains and flushes the deferred frees). The set is used only if it was issued for this
|
||||
layer, from the same bank (`Rc::ptr_eq`), into the same slot spans, with the same blob size, and with no chunk
|
||||
stream. Otherwise it is drained and dropped. A routed, non-resident source whose host byte ranges are equal to an
|
||||
entry's ranges is consumed from that slot (`source.slot`, `dest`, `prefetched`). The slot is marked `reserved`
|
||||
until that source's gather, and its `copied` event orders the gather. Each entry is consumed at most once
|
||||
(`match_prefetch`). Entries that were not routed, or that became resident, are wasted: the slot stays free, and a
|
||||
later stage copy into it is ordered behind the prefetch by the copy stream's FIFO order.
|
||||
5. **Ring walk.** The slot bookkeeping is the pure `SlotState` / `stage_needed` / `stage_target` of
|
||||
`leleka_cuda_model::ring_prefetch`, which the driver's `Ring` and the host tests both call. `stage_one` skips prefetched
|
||||
sources and picks the next slot that is not reserved. Without reservations, that slot is the literal `stage_next`.
|
||||
`ring_stage_ahead` stops early when the next free slot is not gathered yet (`Ring::stage_room`, always true without reservations). The
|
||||
reserved slots therefore shrink the lookahead and never cause an overwrite. Since `K <= slots / 2`, a free slot
|
||||
always exists.
|
||||
|
||||
The same experts reach the same gather, the same kernels and the same group order. Only the time and the order of the
|
||||
H2D copies change, so the outputs must be bitwise identical.
|
||||
|
||||
**Lifetime and errors.** `end_prompt_stream` is called on every forward exit and on a failed layer. Like
|
||||
`begin_prompt_stream` and the schedule's `close`, it cancels a set that no ring took: it synchronizes the copy stream,
|
||||
drops the set and restores the drains. A failure while issuing is not returned to the layer. It is counted as
|
||||
`ring.prefetch_failed`, the copy stream is synchronized, and fewer experts are prefetched; the ring copies the rest as
|
||||
usual. A set that was adopted is covered by the ring's own drain, because `submitted` is set.
|
||||
|
||||
## Switch
|
||||
|
||||
| Variable | Values | Default |
|
||||
|---|---|---|
|
||||
| `LELEKA_PREFILL_RING_PREFETCH` | `1` / `on` (top K = 150), or a top K in `2..=512` | off |
|
||||
| `LELEKA_PREFILL_RING_PREFETCH_WINDOW` | recent chunks counted, `1..=64` | 8 |
|
||||
| `LELEKA_PREFILL_RING_PREFETCH_DETACH` | `1` / `on`: detach the drains from the pending copies (EXPERIMENTAL) | off |
|
||||
|
||||
The driver reads no environment variable for this feature. The policy is passed with
|
||||
`OriginalMmqCopySchedule::set_ring_prefetch` when the arena owners are attached.
|
||||
|
||||
## Refusal and decision trace (`LELEKA_TRACE_DRIVER_ERRORS` or `LELEKA_BRINGUP_TRACE`)
|
||||
|
||||
The engine passes its driver-error trace switch with `OriginalMmqCopySchedule::set_ring_error_trace`; the driver reads no
|
||||
environment variable. Every copy-ring refusal still returns `InvalidProjectionShape` but also prints
|
||||
`RING-REFUSE layer=.. check=.. source=.. stage_next=.. reserved=.. slots=.. sources=.. error=..`. The checks:
|
||||
`new.validate`, `new.schedule_slots`, `layer.preflight`, `sources.spans`, `stream.layer` / `stream.no_entry` /
|
||||
`stream.entry_bytes` / `stream.pieces`, `stage.no_source`, `stage.source_already_staged`, `stage.all_slots_reserved`,
|
||||
`stage.slot_not_gathered`, `gather.no_source`, `gather.no_slot`, `gather.slot_not_live`,
|
||||
`gather.slot_already_gathered` (followed by `gather.slot` from the caller), `enqueue.closed_full_or_context`. The
|
||||
prefetch prints `RING-PREFETCH layer=.. issued=..`, `layer=.. hits=.. wasted=..`, `layer=.. dropped=.. issued_for=..`,
|
||||
`layer=.. cancelled=..` and `layer=.. issue failed: ..`.
|
||||
|
||||
## Counters (`LELEKA_SERVE_PROFILE=1`)
|
||||
|
||||
| Name | Call count | Value |
|
||||
|---|---|---|
|
||||
| `ring.prefetch_issued` | experts copied ahead | MB |
|
||||
| `ring.prefetch_hit` | prefetched experts consumed by the ring | MB |
|
||||
| `ring.prefetch_wasted` | prefetched experts not consumed (mispredicted, resident by then, or a set dropped) | MB |
|
||||
| `ring.prefetch_failed` | issue attempts that stopped on an error | 1 each |
|
||||
| `ring.prefetch_issue` | host span of the issue | ms |
|
||||
| `ring.copied_mb` | unchanged: copies `stage_one` still made (hits are not counted here) | MB |
|
||||
|
||||
The hit rate is `hit / issued`. The PCIe bytes saved from the ring's critical path equal `hit` MB. The extra bus
|
||||
traffic equals `wasted` MB.
|
||||
|
||||
## What the GPU validation must show
|
||||
|
||||
1. **Identity.** Run with `LELEKA_TRACE_PREFILL_R=1`, once with the switch off and once with it on, on the same
|
||||
prompts. Use 0.2-1.5k-row chunks (the 2048-row rung, 384 slots) and also 512-row rung chunks (8 slots, where the
|
||||
prefetch is a no-op). Every chunk's R hash must be equal. Also check the first-token logprob rows / greedy output.
|
||||
2. **Counters.** `ring.prefetch_hit / ring.prefetch_issued` should be near the offline 55-57 % at K = 150-200.
|
||||
`ring.copied_mb` should fall by the hit MB.
|
||||
3. **Latency.** Run a paired A/B of `prefill.read` and `ring.finish_statuses`, by tail class (chunk rows: <512,
|
||||
512-1535, >=1536 as the control, where the prefetch must stay inactive). Measure on the same workload and record the
|
||||
run metadata the charter requires. Watch `ring.init_sync`: it now waits for prefetch copies that are still in
|
||||
flight. Run the identity first with `_DETACH` off; only then the detached mode, which also changes the mixer's
|
||||
drains, memsets and frees while the copies are pending.
|
||||
4. **Sweeps.** K in {100, 150, 200} and window in {4, 8, 16}.
|
||||
|
||||
## Risks and open points
|
||||
|
||||
- The prefetch competes with the combine's and the next mixer's own H2D uploads on the copy engines. A large K that
|
||||
outlasts the mixer delays the ring's mandatory copies, which queue on the same stream behind the prefetch.
|
||||
- `ring.init_sync` (a context synchronize) waits for every prefetch copy, wasted ones included.
|
||||
- Experts that were routed only once so far (and never finite-scanned) are not prefetched.
|
||||
- Layer 0 of a chunk is never prefetched, because the prefetch is issued from the previous layer of the same chunk and
|
||||
row lease.
|
||||
- Not tested on a GPU: the event ordering, the background-stream switch and the reserved-slot walk are covered only by
|
||||
review and by the host tests in `crates/cuda-model/src/ring_prefetch/tests.rs`.
|
||||
|
||||
## First GPU run (PET.1, 2026-11-10): failures with the first commit
|
||||
|
||||
With the first commit (`3ba2a0e37`, the background stream always on) 5 of 12 requests failed with
|
||||
`InvalidProjectionShape`, and 9 of 30 in the earlier run. From reading the code, the host slot bookkeeping holds: the host
|
||||
tests drive the same functions through the scenarios that were suspected (a prefetched source staged again, a reserved
|
||||
slot reused, a gather of a slot that was never filled or was already read), and none of them can be reached. The
|
||||
unreviewed change was the background stream. It is a process-wide switch that changes every drain, memset and free
|
||||
of the small-chunk mixers and routers while the copies are pending. A drain in that mode skips streams that are not
|
||||
registered, for example the QSA resident-transfer side stream. This is a suspect, not a proven cause: the error code
|
||||
alone does not say which check refused. That mode is now opt-in
|
||||
(`_DETACH`). If the failure persists with it off, the `RING-REFUSE` line names the check.
|
||||
|
||||
## Second GPU run (pkg-s16, 51b36adf7): `stage.slot_not_gathered` on layers 46/47
|
||||
|
||||
9 of 30 requests failed with the same refusal in both arms (with and without `_DETACH`):
|
||||
`RING-REFUSE layer=46|47 check=stage.slot_not_gathered source=391..435 stage_next=7..191 reserved=0 slots=384
|
||||
sources=410..460`. So the detached drains were not the cause. The cause was the slot search. Without a prefetch,
|
||||
copies and gathers run in the same order and the lookahead is one slot short of the ring, so the next slot in ring order
|
||||
always holds the oldest copy, already gathered. With prefetch hits, the copies skip the hit sources, and once the
|
||||
layer's sources exceed the ring, the wrap reaches a slot that holds an earlier source's copy that is not gathered yet.
|
||||
The old `stage_room` shortcut (`reserved == 0`, true once every hit was gathered) then let `stage_one` refuse.
|
||||
|
||||
Fix: `stage_target` searches forward, wrapping, for the first slot that is not reserved and is free (never filled, or
|
||||
already gathered). Without a prefetch it finds `stage_next` itself, as in the literal ring. `stage_room` is now always
|
||||
"needs no copy, or `stage_target` finds a slot", so the walk waits for a gather instead of refusing. Host tests: 200
|
||||
seeds of 460 sources on 384 slots with random prefetch hits among the first 300 sources, plus other sizes. The model
|
||||
asserts that no stage targets a reserved or unread slot, and that `stage_target` refuses only when no unreserved slot is
|
||||
free. With the old `stage_target`, both assertions fail.
|
||||
@@ -21,9 +21,9 @@ No per-step figure exists for A1-A3; each is a `not measured` row that needs a s
|
||||
|
||||
| id | step | LEL | VANL | difference | source | owner | status |
|
||||
| --- | --- | ---: | ---: | ---: | --- | --- | --- |
|
||||
| A1 | HTTP, gateway and proxy time per request | not measured per step | not measured per step | the sum 'rest' per request is Q10: 22 ms against 32 ms | LOG | hex-finish | open |
|
||||
| A2 | tokenizer and prompt assembly | not measured | not measured | n/a | none | hex-finish | open |
|
||||
| A3 | prefix-cache lookup and import (cached tokens per request, import time) | not measured | not measured | n/a (replay logs `cached_tokens`; import time only in `last_import_split`) | none | hex-finish | open |
|
||||
| A1 | request: HTTP, gateway and proxy time (code `pf_probe.py`) | probe pending (job `prefill-empty-request-probe-leleka`) | none: vanilla is not re-measured (owner 2026-11-09); the vanilla figure comes from its existing logs | the sum 'rest' per request is Q10: 22 ms against 32 ms | LOG | hex-finish | measured (probe job `prefill-empty-request-probe-leleka`, 2 boots x 2): tiny prompt wall 0.540 s = engine spans 503 ms (prefill.read 250, refill 137, assemble 94, disassemble 11, round 10, draft 1) + 37 ms outside the engine; cached long prompt wall 0.157 s = engine 120 ms + 37 ms. The same 37 ms for both (client, HTTP, gateway, SSE close) is A1. Vanilla not re-measured (owner); Q10 'rest' per request in real sessions is LEL 22 ms against VANL 32 ms: no loss shown, proved-equal (LEL ahead) |
|
||||
| A2 | request: tokenizer and prompt assembly of a long prompt | probe pending (job `prefill-empty-request-probe-leleka`: long cached prompt minus tiny prompt) | not measured | n/a | none | hex-finish | measured: long cached prompt minus tiny prompt outside the engine = 0 ms (37 ms both), so tokenizer and prompt assembly of the 67k-token prompt cost under the probe precision (about 2 ms); proved-equal |
|
||||
| A3 | request: prefix-cache lookup and import (code `request.resume`, `ctrl.begin_request`, `prefix.*`) | PROFILE `runs/dc1` (60 requests): `request.resume` 2.53 + `ctrl.begin_request` 0.60 + `prefix.import_session` 0.80 + `prefix.draft_resume_at` 1.05 + `prefix.mtp_kv_restore` 0.61 + `prefix.layer_index` 0.38 = 5.97 ms per request | not measured | n/a (replay logs `cached_tokens`; import time only in `last_import_split`) | none | hex-finish | measured, cached repeats of the 67k prompt: request.resume 2.2-2.9 + ctrl.begin_request 0.8 + prefix.import_session 0.6-1.4 + prefix.draft_resume_at 0.8 + prefix.mtp_kv_restore 0.7 + prefix.layer_index 0.4 = 5.5-7.0 ms per request; vanilla's import is inside its prompt time and not separable without the instrumented copy (not built: no evidence that the sums diverge); open at 5.5-7.0 ms |
|
||||
| Q10 | gateway, proxy, serialization ("rest" per request) | 22 ms | 32 ms | -10 ms | LOG | hex-finish | proved-equal (LEL ahead) |
|
||||
|
||||
## B. Prefill (chunks, expert ring and copies, refill, QSA, GDN, first token), then the hand-over to decode
|
||||
@@ -31,15 +31,18 @@ No per-step figure exists for A1-A3; each is a `not measured` row that needs a s
|
||||
| id | step | LEL | VANL | difference | source | owner | status |
|
||||
| --- | --- | ---: | ---: | ---: | --- | --- | --- |
|
||||
| Q8 | request time per output token, prefill + decode | 0.59 + 5.63 = 6.22 ms | 0.36 + 4.61 = 4.97 ms | +1.25 ms (decode +1.02, prefill +0.23) | LOG | both | open |
|
||||
| Q1 | prefill per request at equal uncached tokens | 726 ms | 431 ms | +295 ms | LOG | hex-finish | open |
|
||||
| Q2 | prefill latency by uncached tokens (< 64, 64-256, 256-1024, 1024-4096, >= 4096), median ms | 430, 530, 722, 1002, 4405 | 268, 292, 435, 715, 2184 | +162, +238, +287, +287, +2221 | LOG | hex-finish | open |
|
||||
| Q3 | prefill throughput over uncached tokens | 930-1050 tok/s | 1460-1560 tok/s | -35 % | LOG | hex-finish | open |
|
||||
| Q4 | `prefill.read` fixed part (581 ms + 0.134 ms per token; 485 ms for 239 tokens) | 485-581 ms | whole prefill of that size class 292 ms | +193 and more | PROFILE | hex-finish | open |
|
||||
| Q5 | `moe.ring` in a small tail (72-80 % of the chunk, 48 layers x 7.4 ms, 355 ms for 238 tokens) | 355 ms | vanilla reads tails of up to 64 tokens through verify windows | +355 ms for the smallest tails | PROFILE `prof-l5` | hex-finish | open |
|
||||
| Q1 | prefill: time per request at equal uncached tokens (code ladder `LELEKA_PREFILL_LOAN_TIERS`) | 726 ms | 431 ms | +295 ms. Ladder (`LELEKA_PREFILL_LOAN_TIERS=1`) paired on the sparse holder, n=5 blocks: -3.1 s per 30-request session +-0.5; <= 2048 new tokens -151 ms per request (faster in 19 of 19); n=10 (5 + 5 blocks, jobs `ab3` and `prefill-ladder-ab-pairs-6-10`): -3.0 s +-0.3 per 30-request session, median -104 ms per request, <= 2048 new tokens -154 ms (19 of 19 faster), > 2048 tokens -10 ms; identity PASS (chunk residual hashes equal) | LOG | hex-finish | fixed for the ladder part (switch committed in the 5090 profiles); the remaining gap at equal uncached tokens (rows Q2, Q3) stays open |
|
||||
| Q2 | prefill latency by uncached tokens (< 64, 64-256, 256-1024, 1024-4096, >= 4096), median ms | 430, 530, 722, 1002, 4405 | 268, 292, 435, 715, 2184 | +162, +238, +287, +287, +2221 | LOG | hex-finish | open AFTER THE STREAM THRESHOLD 2026-11-10: VANL means from the VANL engine logs (`read in X ms`, 3 reps): 64-256 tokens 294 ms (n=121), 256-1024 447 (n=72), 1-4k 820 (n=23), > 4k 2062 (n=8); ours `prefill.read` with `STRATA_PREFILL_STREAM_MIN=1536`: 64-256 about 400-620, 256-1024 521, 1000-1536 729, 1536-4096 830, 4k+ 1245-1500: at parity from 1 to 4k tokens and ahead beyond 4.9k, behind by +75..+170 ms below 1k tokens (VANL reads 64-256 tokens in 294 ms = 14 GB / 50 GB/s with the rest of the chunk hidden under the DMA; ours has the DMA at 45 GB/s and about 130 ms of GDN/QSA unoverlapped). Open: ring prefetch (sub-agent, switch off), U6. |
|
||||
| Q3 | prefill throughput over uncached tokens | 930-1050 tok/s | 1460-1560 tok/s | -35 % | LOG | hex-finish | open see Q2 (2026-11-10): the gap that remains is below 1k tokens, not a throughput gap above it. |
|
||||
| Q4 | prefill: fixed part of the chunk read (code `prefill.read`, 581 ms + 0.134 ms per token; 485 ms for 239 tokens) | 485-581 ms | whole prefill of that size class 292 ms | +193 and more | PROFILE | hex-finish | open: root cause found (see Q5) RING FINDINGS 2026-11-10 (jobs `prefill-ring-host-spans-profile`, `prefill-ring-copied-megabytes-profile`, pkg-s11/s12, 15 requests): `moe.ring` is DMA-bound, not host-bound. Host spans of the copy ring per request with a 1.4k tail: init 10.5 ms (`init_sync` 0.0), stage 50.7, gather 36.3, enqueue 30.1 (about 130 ms, parallel with the DMA), `finish_statuses` (host waits for the GPU/DMA) 335.8 ms; the wait grows about 200 ms fixed + 0.08 ms per tail token. Experts copied over PCIe per request: 7,002 (14.3 GB) at a 279-token tail, 8,794 (18.4 GB) at 1,243, 11,576 (24.0 GB) at 1,454, 12,762 (26.5 GB) at 2,837; 146-266 per layer, 45-55 % of the routed experts are not resident. GB / 45 GB/s = 319, 410, 459, 590 ms vs ring wall 332, 428, 462, ~590: the ring runs at the PCIe rate. So synchronisation fixes (step A: syncs, cuMemGetInfo, gather by 16) buy nothing. Offline prefetch study (`LELEKA_PREFILL_ROUTE_TRACE`, 30 requests): the experts the layer's last 3-16 chunks missed predict the next chunk's missing set with 60 % precision at 150 experts per layer (86 hits), an upper bound of about -150..-190 ms per request for a prefetch under the GDN/QSA stage; not built (complex, 40 % wasted bandwidth). PREFETCH FIRST GPU RUN 2026-11-10 (pkg-s14, `LELEKA_PREFILL_RING_PREFETCH=1`, sub-agent branch merged, default off): 9 of 30 requests failed with `class=InvalidDimension` and the chunk hashes differ (60 PREFILL-R lines vs 31): the implementation is NOT correct yet; driver error trace job queued (`prefill-ring-prefetch-failure-driver-error-trace`). Remains OFF. |
|
||||
| Q5 | `moe.ring` in a small tail (72-80 % of the chunk, 48 layers x 7.4 ms, 355 ms for 238 tokens) | 355 ms | vanilla reads tails of up to 64 tokens through verify windows | +355 ms for the smallest tails. Root cause: `prompt_options` (`original_serve_stack_prefill_phase.rs`) sets `force_batched: true`; the planner already emits `PromptPath::Verify` actions for tails <= 64 tokens but the executor's `verify_window` hook (`original_prompt_executor_drop.rs:63`) is not implemented | PROFILE `prof-l5` | hex-finish | fixing (design pending) STREAM THRESHOLD 2026-11-10: vanilla streams every non-resident expert (overlapped with the mixers) from 1024-row chunks (`kStreamAllMinDefault`), ours from 4096 (`STRATA_PREFILL_STREAM_MIN`, `settings/kv.rs`, set when the expert cache was off and only 60 % of the experts were routed). Profile `prefill-expert-stream-from-1024-rows-profile` (shipped / 1024 / 256, 15 requests): prefill.read at tails 2,837 / 2,622 / 2,453 / 1,602 / 1,454 tokens 1129 / 1029 / 1001 / 782 / 799 ms became 876 / 863 / 818 / 702 / 702; no change below 1,300 tokens, worse from 256 rows (279 tokens 465 to 747). Threshold 1536. Job `prefill-expert-stream-from-1536-rows-identity-and-profile` (30 requests): PREFILL-R chunk residual hashes IDENTICAL, 31 of 31 (shipped vs stream), no failures; prefill.read by tail class (mean ms, shipped to stream): < 1000 tokens 530 to 521 (-9), 1000-1536 723 to 729 (+6), 1536-4096 1010 to 830 (-180, -17.8 %), > 4096 1245 to 1280 (+35, noise); over 29 warm requests -45 ms per request (prefill.phase 921 to 877). `STRATA_PREFILL_STREAM_MIN=1536` is set in the three 5090 profiles (not the 3080: tier off there, different trade). Two more levers remain (not done): the prefetch of Q4 and vanilla's CPU share (lossy, off in the reference arm). |
|
||||
| B1 | prefill GDN and QSA stages of a small tail (per stage split) | `prof-l5/Q.1` has moe, moe.ring, gdn, qsa, input per chunk | none for vanilla | n/a | PROFILE | hex-finish | open |
|
||||
| B2 | first token sampling and publication after prefill | not measured | not measured | n/a | none | hex-finish | open |
|
||||
| Q6 | `prefill.refill` of the lent expert slots (2,226 copy spans) | 137-140 ms per request | none | +138 ms; deferring it into the decode assembly (`LELEKA_REFILL_DEFER`): decode -0.92 % (CI -1.63..-0.21), end-to-end +0.56 % (CI -0.15..+1.27) | PROFILE, A/B `ab-l5v2` | hex-finish | fixing |
|
||||
| Q7 | `decode.assemble` (graph re-recording per request: `record_all` 83 ms of 98-109 ms, nine graphs, 54-62 capture + 27-30 instantiate) | 98-109 ms per request | none (vanilla keeps its graphs) | +98-109 ms | PROFILE | both | fixing (device part DONE and merged, branch `claude/verify-decode-graph-reuse-handles` tip 0e8472968: `DeviceRef`, `park`/`rearm`/`reseed`, note `docs/experiments/verify-decode-graph-reuse-handles.md`; open: identity on a GPU, hex-finish part (owner loan, `weights_epoch`, drafter binding, enabling); original plan was: device = shared `DeviceRef` handle in the verify-window/qwen_dispatch operand files plus `park`/`rearm`/`reseed` API, branch after the three side-stream merges; hex-finish = owner loan, drafter binding, enabling `LELEKA_DECODE_GRAPH_REUSE` in the stack; spec `docs/experiments/decode-graph-reuse.md` B1 and Part 2 in `claude/prefill-latency` a4a8d597f; section = `decode.assemble` per request) |
|
||||
| Q6 | `prefill.refill` of the lent expert slots (2,226 copy spans) | 137-140 ms per request | none | +138 ms; deferring it into the decode assembly (`LELEKA_REFILL_DEFER`): decode -0.92 % (CI -1.63..-0.21), end-to-end +0.56 % (CI -0.15..+1.27) | PROFILE, A/B `ab-l5v2` | hex-finish | fixing PROFILE 2026-11-10 (job `prefill-refill-deferred-with-default-set-profile`, default set + stream 1536, YP without / YRP with `LELEKA_REFILL_DEFER`, 14 warm requests each): `prefill.refill` 93.9 vs 70.7 ms and `refill.sync` 23.3 vs 23.3, `refill.queue` 70.0 vs 70.2 ms (the host time to issue the copies stays, now behind the decode assembly); `decode.reuse` 13.0 vs 13.0; wall per output token 5.95 vs 6.01 ms (sums 155.0 vs 154.7 s, 26,047 vs 25,729 tokens): no gain from the deferral on top of Q7 (the host assembly it overlapped with is 13 ms now, not 98). The cost is HOST issue of about 1,000 slots x 3 `cuMemcpyHtoDAsync` = 70 us per slot; plan: one `cuMemcpyBatchAsync_v2` per few hundred copies (driver 595.99 exports it), bitwise (same bytes and order), switch `LELEKA_REFILL_BATCH` off, in progress as a sub-agent branch (host-side tests + ignored GPU test); expected -50..-60 ms per request. `LELEKA_REFILL_DEFER` stays off. BATCH COPY 2026-11-10 (job `prefill-ring-prefetch-and-refill-batch-identity-and-profile`, pkg-s14, `LELEKA_REFILL_BATCH=1`): production refill with the batch: `refill.batch_calls` 6, `batch_copies` 2,997, `per_copy` 0, `refill.queue` 41.7 to 1.0 ms but `refill.sync` 23.8 to 57.0 ms, `prefill.refill` 65.9 to 58.3 ms (-7.6 ms per request): the host issue was already overlapped with the DMA, the refill is bytes-bound (999 slots x 2 MB = 2 GB = 45 ms at 45 GB/s). R hashes of all chunks identical to shipped (31 of 31), 0 failed requests. The isolated GPU test `refill_batch_copy_gpu_slots_equal_per_copy` (Vec registered by cuMemHostRegister, 3,072 pieces) faults with error 719 on the batch arm while the per-copy arm is exact: the known driver bug of the batch entry with page-locked sources (docs/windows.md, 3080), here on driver 595.99 too; the production bank evidently takes another route. Verdict: -7.6 ms is too small to justify a driver entry that faults in some memory kinds; `LELEKA_REFILL_BATCH` stays OFF; Q6 stays bytes-bound (floor = lent slots x 2 MB / 45 GB/s). 2026-11-10 driver check `prefill-raw-batch-copy-page-locked-driver-check` (5090, driver 595.99): `pcie_copy_gpu_raw_batch_page_locked`, `..._raw_batch_mixed`, `pcie_copy_gpu_production_page_locked`, `..._production_pageable` all pass (4/4, ~0.9 s each), so a raw batched copy from page-locked memory works on this driver; the CUDA 719 of the slots-equal GPU test is specific to that test's registered Vec, not to batch copy. Switch stays OFF (gain -7.6 ms, bytes-bound). |
|
||||
| Q7 | `decode.assemble` (graph re-recording per request: `record_all` 83 ms of 98-109 ms, nine graphs, 54-62 capture + 27-30 instantiate) | 98-109 ms per request | none (vanilla keeps its graphs) | +98-109 ms | PROFILE | both | fixing (code 7570247d9, wired behind `LELEKA_DECODE_GRAPH_REUSE`, identity and section delta pending on the GPU): the speed session's handles, `park`/`rearm`/`reseed` and this side's key, `GraphReuse::begin`/`end`, QSA owner loan, drafter decision, shared-expert pin and stack wiring are merged and tested host-side and on the lifecycle fake; compare `decode.assemble` with `decode.reuse`, `decode.disassemble` with `decode.keep`, `record.*`, the first-draft capture, VRAM at the low-water mark; design and scenarios `docs/experiments/decode-graph-reuse.md` GPU (job `host-decode-graph-reuse-identity-and-profile`, package `pkg-s6` = our wiring + the speed session's handles/re-arm, 4 profiled boots x 30 requests): REUSE WORKS. Per request, shipped (AP.1/AP.2): `decode.assemble` 103.5/104.1 ms (`record_all` 86.5/86.9, capture 34.0, instantiate 22.2) + `decode.disassemble` 14.7/12.3 = 118/116 ms. With `LELEKA_DECODE_GRAPH_REUSE=1` (RGP.1/RGP.2): `decode.assemble` 6.0 + `decode.reuse` 14.0/13.8 + `decode.keep` 0.7/0.6 = 20.7/20.4 ms, `record_all` 5.4 (the one full assembly of the first request averaged over 30), `record.capture` 1.1, `record.instantiate` 1.3: section delta about -97 ms per request (a reused request costs ~18 ms: re-arm with the 118 MB reseed). 29 of 30 requests reused, 1 full assembly, zero `decode graphs recorded again` lines (no retire), all HTTP 200. VRAM low-water unchanged (535 MiB free in both). ms/token (unpaired, free-running): 6.18/6.19 shipped against 6.10/6.12 with reuse. Identity: teacher-forced bitwise job queued (`host-draft-switches-teacher-forced-identity`, P4); free-running hashes cannot decide it BITWISE IDENTITY PASS (job `host-draft-switches-teacher-forced-identity`, test binary `rt-pf9`, night5-long-256k, teacher forced, 5 requests to 243k, 240 forced tokens each): top-16 logprob rows 2057 of 2057 identical in both arms, draft trace 1036 of 1036 lines identical, A/A floor identical (q_tail_gate PASS, d_top1 0.0000, flips 0). FIXED for the section: -97 ms per request (118 to 20.7 ms) and identity; ON by default in the three 5090 profiles (`LELEKA_DECODE_GRAPH_REUSE=1`, test `the_switches_that_passed_the_bitwise_gate_are_on_for_the_5090_profiles_only`); the end-to-end paired A/B of the group is still to come GROUP A/B 2026-11-10 (job `host-draft-switches-group-ab`, n=10 per arm, 30 requests each, free-running): the group arm X = chain pipeline + check merge + park fast (reuse RG is NOT in X; its own paired e2e arm is still to run). Decode ms/token A 6.33, X 6.30, paired -0.03 +-0.08 (no regression, no gain visible); session time A 329 +-19 s, X 340 +-20 s but output lengths differ run to run (free-running), so time per equal-output pair is the fair figure: 66 pairs with output within 2 %, mean X-A -73 ms (se 46), median -5 ms. Section deltas stand (Q7 -97 ms per request); the e2e effect is below the A/B noise (about 3 % of session time), CLOSED on section + bitwise identity; ON in the three 5090 profiles; e2e confirmation by RG paired arm pending. SECTION DELTA 2026-11-10 (job `host-set-profile-paired-section-deltas`, one profiled boot per arm, 15 requests, package pkg-s9; AP shipped, YP = check merge + park fast + graph reuse): `decode.assemble` 97.8 ms median + `decode.disassemble` 12.0 ms (= 109.8 ms per request) became `decode.reuse` 13.1 ms + `decode.keep` 0.63 ms (= 13.8 ms) on 14 of 15 requests; the first request records (assemble 178 ms, `record_all` 162 ms vs 81.6 ms shipped, the one-time cost of building the held set); over all 15: 1,726 ms to 373 ms = -90 ms per request including the cold one (-96 ms on the 14 warm ones). Matches the earlier -97 ms. FIXED: section delta + bitwise identity (teacher-forced 2057/2057 rows); ON in the 5090 profiles. |
|
||||
| B3 | prefill: prefix-cache parking in the request path (code `prefix.export_kv` 19.0 + `export_index` 2.3 + `park_tail` 14.7 + `park_block` 6.5 + `after_prefill` 9.4 + `after_chunk` 0.7 + `after_decode` 12.5, mean per request) | 65.1 ms | vanilla parks the conversation (checkpoints) inside its own prompt time, not separable | n/a until the instrumented vanilla | PROFILE `runs/dc1` | hex-finish | fixing (code a88a77b25, switches `LELEKA_PREFIX_PARK_FAST=1` and `LELEKA_PREFIX_PARK_ASYNC=1`, both off by default, identity and section delta pending). Reading of the code: the seven listed spans are nested, not additive (`export_kv` and `export_index` sit inside `park_block` and `park_tail`, which sit inside `after_prefill`, `after_chunk` and `after_decode`), so the request-path total is `after_prefill` + `after_chunk` + `after_decode` = 22.6 ms, not 65.1 ms. FAST: one context drain per park instead of 12, K/V pages copied into unzeroed vectors, index rows take the device-read staging as the result (same bytes; compare `prefix.export_kv` and `prefix.export_index`, new `prefix.export_drain`; the sub-spans `export.copy_fast` and `export.index_copy_fast` replace `export.sync`, `export.alloc`, `export.copy`, `export.index_alloc`, `export.index_copy`). ASYNC (with `--prefix-cache-tail reply`): the `after_decode` part (12.5 ms) is taken after the terminal event of the request, before the prefix summary and before the next request, and reported on the line `DBG profile park_deferred` (sum the `request` and `park_deferred` lines for an equal-work comparison); the tail node is in the store before the next request exactly as before. Not deferred: `after_prefill` and `after_chunk` (the last page also holds cells the decode overwrites and the recurrent state the decode advances, so a later park gives other bytes). Not done: pooled buffers (the store retains the vectors) and threaded copies of the 12 layers. GPU run 2026-11-09 (`prefill-prefix-park-identity-and-profile`): FAST kept the prefix reuse and cut the three `after_*` sections by 2.0 ms (23.5 to 21.5; the first-touch page faults of fresh host memory dominate and stay); ASYNC was refused by the runner (the busy mark `active` was still set while the owner ran the deferred step, so the next request got `runtime_capacity`). Fixed in the next commit: the busy mark is released before the deferred step, so a request that arrives meanwhile is admitted and waits in the control queue (test `a_request_arriving_during_the_deferred_tail_is_admitted_and_queued_not_refused`); pass criterion for the rerun: `cached_tokens` equal to shipped for all 30 and no `engine refused` in requests.log. Pre-faulted buffer pool not built: the store keeps every parked vector, so a pool is the store budget held pre-touched (tens of GiB, or sizes that do not match the variable tail) and needs a store free list or a slab type; allocator tuning (`MALLOC_TOP_PAD_`, `MALLOC_TRIM_THRESHOLD_`) can be tried without code BITWISE IDENTITY PASS (job `host-draft-switches-teacher-forced-identity`, test binary `rt-pf9`, night5-long-256k, teacher forced, 5 requests to 243k, 240 forced tokens each): top-16 logprob rows 2057 of 2057 identical in both arms, draft trace 1036 of 1036 lines identical, A/A floor identical (q_tail_gate PASS, d_top1 0.0000, flips 0). FAST: identity PASS and section -2.0 ms per request: ON by default in the three 5090 profiles (`LELEKA_PREFIX_PARK_FAST=1`); ASYNC is not in the default (admission fix queued for the rerun `prefill-prefix-park-async-fix-identity-and-profile`) ASYNC rerun 2026-11-10 (job `prefill-prefix-park-async-fix-identity-and-profile`, after fix 955a72e37): no `engine_refused`/`runtime_capacity` in any of the 8 boots; `cached_tokens` equal to the shipped arm for 30 of 30 requests in every arm (1,202,318 total); `prefix.after_response` 8.7 ms median on the `park_deferred` line, the work leaves the request path (`prefix.export_kv` 17.0 to 7.6 ms median, `park_tail` 13.7-15.2 to 6.3 ms) but `prefix.after_prefill` is 9.6/9.9 ms vs 10.5/11.1 (shipped) and 9.4 (FAST): the request path gains nothing measurable beyond FAST. FAST CLOSED (bitwise identity + section delta, ON in 5090 profiles); ASYNC stays OFF (no delta beyond FAST, adds a deferred step). SECTION DELTA 2026-11-10 (same job): `prefix.after_prefill` + `prefix.after_decode` per request AP 13.30 + 10.01 = 23.3 ms, YP 13.01 + 7.21 = 20.2 ms (-3.1 ms, -13 %; earlier job: -2.0 ms); `prefix.park_tail` 16.8 to 15.3 ms, `prefix.export_drain` 3 context drains per park instead of 12 (counter 0.00/3), `prefix.export_index` 3.50 to 2.89 ms; `prefix.export_kv` 22.6 to 25.3 ms (the copies themselves are the same bytes). FAST FIXED: section delta -2..-3 ms per request + bitwise identity; ON in the 5090 profiles. ASYNC stays OFF. |
|
||||
| B4 | decode hand-over: tear-down of the request (code `decode.disassemble`) | 11.7 ms per request | none | +11.7 ms | PROFILE `runs/dc1` | hex-finish | open |
|
||||
| B5 | host: admission of CPU work (code `cpu.admit`, 819 calls per request) | 43.2 ms per request | not measured | n/a | PROFILE `runs/dc1` | hex-finish | open |
|
||||
|
||||
## C. Decode round: summary, then draft, verify graph, accept, commit, publication, next round
|
||||
|
||||
@@ -55,10 +58,10 @@ Round-level totals first (they are the sum of the steps below).
|
||||
|
||||
| id | step | LEL | VANL | difference | source | owner | status |
|
||||
| --- | --- | ---: | ---: | ---: | --- | --- | --- |
|
||||
| O9 | draft chain steps and idle between them | 0.27 | not given | +0.27 | ORCH | hex-finish | open |
|
||||
| O8 | draft finite and q8 guard checks (`mtp_original_finite` 158.8 x 0.87 us, `mtp_original_q8_guard` 28 x 0.87 us per round, 186.8 launches) | 0.162 | none | +0.162 | CUPTI | hex-finish | open |
|
||||
| K13 | draft chain role total (chain GR kernels, `mtp_*`) | 3.544 | 2.471 | +1.073 (includes the draft head and checks of R3 and O8; VANL books its draft in the shared GR kernels) | CUPTI role table | hex-finish | open |
|
||||
| O12 | draft finish follows the window width (0.93 ms at T 3.0, 2.5 ms at T 6.2) | window price | | part of the +3.1 ms for +0.65 tokens per round | PROFILE | hex-finish | open |
|
||||
| O9 | draft: chain steps and the host idle between them (code `LELEKA_DRAFT_CHAIN_PIPELINE`) | 0.272 ms per round (2.38 boundaries x 114 us) | idle inside the draft 0.52 ms on 4.5 streams (draft span at equal steps: 1.83 against 1.85) | +0.27 | ORCH | hex-finish | fixing: S1 `LELEKA_DRAFT_CHAIN_PIPELINE` (code `1ab37e408`, opt-in; all chain steps of a greedy draft with min_p 0 enqueued back to back, one drain, flags read once); package `pkg-s1`, identity and profile pair job `host-draft-chain-one-pass-identity`, paired A/B job `host-draft-chain-one-pass-ab` GPU (job `host-draft-chain-gate-diagnosis`, 8,377 drafts): `mtp.chain_gate.min_p` for ALL of them: the adaptive plan gives every round a positive `min_p` (the chain stops at the first step whose probability is below it), so the pipelined path (greedy, `min_p` 0) never engages in production; `mtp.chain_step` stays 0.480 ms x 2.66 steps per round. Pipelining a chain with an early stop would enqueue steps the sequential path never runs (each ~0.45 ms of GPU) against a gain of ~0.1 ms per boundary, so it is a loss without a device-side stop. S1 stays off, parked; the remaining 0.272 ms per round of host turnaround is open for cheaper per-step sync |
|
||||
| O8 | draft: finite and q8 guard checks of the MTP ring (code `mtp_original_finite` 158.8 x 0.87 us, `mtp_original_q8_guard` 28 x 0.87 us per round, 186.8 launches) | 0.162 | none | +0.162 | CUPTI | hex-finish | fixing (code 306b39807, switch `LELEKA_DRAFT_CHECK_MERGE`, off by default; identity and section delta pending): S2' launches every run of ADJACENT checks of a draft step program as one `mtp_original_check_batch` (new sealed asset `mtp_original_check_batch.ptx`; each entry keeps its own buffer, count, kind and status word, so the status words are the separate launches' words). Per step 48 check launches, 3 runs (prefix guards after the GR block 5, tail after the MLP GR 5, tail after the shared gate and up 2): 12 launches become 3, 9 fewer per step, 36 per round at 4 steps (expect `mtp_original_finite` 158.8 to about 111 and `mtp_original_q8_guard` 28 unchanged per round (the merged runs hold finite checks only), plus about 12 `mtp_original_check_batch` launches, net 36 fewer; the upper bound of the gain is about 0.05 ms per round, no claim). Not done: moving a check across another command (deferral to the end of the chain): the checked buffers `qcur`, `r`, `xn`, `lo` are overwritten in place between their checks and the program has no write-set table, so it needs one first. Proofs: `cuda-model` `draft_check_batch` (the merged schedule expands to the separate one, and a NaN/Inf at the edges and middle of every buffer after every kernel leaves identical status words in a simulated step), driver tests on the real command lists, GPU test `check_batch_program_gpu` (`--ignored`, job `draft-check-merge-gpu-proof`) GPU: detection test PASS (73 cases: NaN/+Inf/-Inf in every buffer and Q8 scale, 72 raise a flag, 0 differ from the separate launches); step graph 114 -> 105 nodes (-9 per step, `DBG mtp chain-step graph`, job `host-draft-chain-gate-diagnosis` MCP against AP); section: `draft.finish` 1.392 -> 1.300 ms per round (single boot each, not paired: 6390 and 5744 rounds); bitwise identity under teacher forcing queued (`host-draft-switches-teacher-forced-identity`, P2). The free-running replay cannot decide identity: draft traces of DT, MT and XT diverge at the 12th draft and shipped against shipped differs across boots BITWISE IDENTITY PASS (job `host-draft-switches-teacher-forced-identity`, test binary `rt-pf9`, night5-long-256k, teacher forced, 5 requests to 243k, 240 forced tokens each): top-16 logprob rows 2057 of 2057 identical in both arms, draft trace 1036 of 1036 lines identical, A/A floor identical (q_tail_gate PASS, d_top1 0.0000, flips 0). Check merge: identity PASS, step graph 114 to 105 nodes: ON by default in the three 5090 profiles (`LELEKA_DRAFT_CHECK_MERGE=1`); the paired section delta stays to be read from the group A/B (`host-draft-switches-group-ab`) GROUP A/B 2026-11-10: see Q7 row (X arm includes check merge): no regression, ms/token paired -0.03 +-0.08. Identity bitwise PASS (teacher-forced, 1036/1036 draft lines); ON in the three 5090 profiles. The paired `draft.finish` delta was not profiled in that group job (no profile arm): a profiled arm X vs A is the remaining step for the section number. SECTION DELTA 2026-11-10 (same job, per call over 8,697 / 9,518 / 7,771 draft rounds): `draft.finish` AP 1.548 ms, MCP (check merge only) 1.494 ms (-0.054 ms, -3.5 %), YP (the complete set) 1.577 ms (+0.029 ms, +1.9 %); `gpu.mtp_chain_step` 0.458 / 0.452 / 0.453 ms per step and `mtp.chain_step` 0.488 / 0.480 / 0.481 equal in all three. One boot per arm cannot resolve a 2-4 % difference (boot-to-boot spread of this profile is about 3 %), and YP does not reproduce MCP's gain: the section delta is at most -0.054 ms per round (about -30 ms per request at 580 rounds), not resolved. CLOSED on bitwise identity (1036/1036 draft lines) and the graph-node count (114 to 105); no regression found; ON in the 5090 profiles. A resolved per-round number would need 3 or more boots per arm (not scheduled: owner rule 2026-11-10). |
|
||||
| K13 | draft chain role total (chain GR kernels, `mtp_*`) | 3.544 | 2.471 | +1.073 (includes the draft head and checks of R3 and O8; VANL books its draft in the shared GR kernels) | CUPTI role table | hex-finish | open (O8 `LELEKA_DRAFT_CHECK_MERGE` takes the adjacent checks out of this total once its section delta is measured) |
|
||||
| O12 | draft: finish follows the window width (0.93 ms at T 3.0, 2.5 ms at T 6.2) | window price | | part of the +3.1 ms for +0.65 tokens per round | PROFILE | hex-finish | open |
|
||||
| O2 | kernels outside big graphs | 630 | 147 | +483 | CUPTI | hex-finish | open |
|
||||
| O3 | graph executions per round | 5.38 | 4.47 | +0.91 | CUPTI | hex-finish | open |
|
||||
|
||||
@@ -241,3 +244,47 @@ Queue stubs and result directories carry the readable name from 2026-11-09 (`<ar
|
||||
| `spd-cuo` | draft-and-verify-cupti-windows-leleka (dir `runs/cupti/CL.1`) | done |
|
||||
| `spd-cuv` | draft-and-verify-cupti-windows-vanilla (dir `runs/cupti/VANL`) | done |
|
||||
| `spd-w1` .. `spd-w5` | memory-tier-policy-screening-round-1 .. 5 | done |
|
||||
|
||||
## U. Upstream fixes and small wins after the pin (checked 2026-11-09 against `strata-upstream/main`, reference only, `engine/strata` untouched)
|
||||
|
||||
Owner rule: small upstream wins (+0.3..0.5 %) are taken too. "VANL" here is vanilla 0.2.6; upstream items dated after it are wins on top of vanilla, not gaps against it. Each row says whether we have the analogue, then the closing evidence needed.
|
||||
|
||||
| id | step | LEL | VANL / upstream | difference | source | owner | status |
|
||||
| --- | --- | --- | --- | --- | --- | --- | --- |
|
||||
| U1 | prefill: GDN recurrence as a chunked scan on tensor cores (code `STRATA_GDN_TC`, upstream commits `8c2a84694` opt-in 2026-10-26, default `6858c919c` 2026-11-07 with `STRATA_GDN_CONVL2=2`) | present behind an off-by-default switch (`LELEKA_PREFILL_GDN_TC`); the default prompt GDN kernels stay the sealed Original ones (`leleka_prefill_gdn_rec` / `_kh`); the pinned `engine/strata` (0.1.50) has no `GDN_TC` either | upstream 0.2.9: prompt +4.4 % at 4K, +5.5 % at 16K, +5.7 % at 32K; **lossy**: first-token KL mean 0.0019, max 0.0125; engine gates it at run time (compute capability >= 8, one SM per value head, shared memory) | not a gap against VANL 0.2.6 (it has no `GDN_TC`); a possible win of about 5 % of prefill | upstream commit message | hex-finish | fixing (code c5a8b7794, switch `LELEKA_PREFILL_GDN_TC`, experimental/lossy; parity, quality gate and section delta pending): sealed asset `gdn_prefill_tc.cu` (prep + scan, 99-KB split plan, two value tiles per head on the 5090), runs of >= 128 tokens on sm_120, scratch = the idle dequantization scratch (no extra VRAM); not bitwise by design, the gate is `docs/quality-gate.md` (first-token KL / q_tail_gate / logprob envelope); checks: ignored GPU test `gdn_tensor_core_scan_stays_within_the_gate_of_the_sequential_recurrence` (1e-4), then the quality gate, then section delta = `gdn` stage per chunk of the prefill profile at 4K/16K/32K; no speedup claimed FIRST GPU RESULTS (2026-11-10): parity PASS (readout 5-7e-8, state 1-4e-7, gate 1e-4, T up to 2048+, both tile plans); synthetic kernel time kh 4.049 ms to tensor-core 1.308 ms at 8192 tokens. Logit gate (job `prefill-gdn-tensor-core-logit-gate`, first run, arm I1 only: both processes failed to open arm I2 with `InputAllocation`/`HostAllocation` on the full holder, so there is NO A/A floor): against the shipped path on `night5-long-256k` (5 requests, 45k-243k prompts, 240 forced tokens each) d_top1 p99 0.2727 (limit 0.22), max 0.7405 (limit 0.43), argmax flips 47 of 1658 common rows = 2.83 % (limit 2.8 %): OUTSIDE the Original envelope, preliminary; TTFT of the five requests 63.97 s to 60.57 s (-3.4 s, -5.3 %, unpaired single run). Rerun with the A/A floor on the sparse holder queued. LOGIT GATE 2026-11-10 (rerun with A/A floor, job `prefill-gdn-tensor-core-logit-gate`): A/A floor identical (arm I2 against I1 inside A: 518/518 draft lines, rows identical, so the difference is real); GDN-TC vs shipped: 1658 common rows, d_top1 median 0.0087, p99 0.2727, max 0.7405, argmax flips 47 (2.83 %), DRAFT VERDICT DIFFERENT; envelope (p99 <= 0.22, max <= 0.43, flips <= 2.8 %) FAILED on p99 and max, flips at the limit. PROFILE (job `prefill-gdn-tensor-core-profile`, 2 boots x 30 requests per arm): `prefill.phase` total 35539/34384 ms shipped vs 33996/34572 ms GDN-TC (-22.6 ms per request, -1.9 %, inside the 3 % boot-to-boot spread), because tails are short (mean ~800 uncached tokens, below the 128-token runs the kernel targets in most chunks). VERDICT: stays experimental and OFF; no A/B, no CRM x3. |
|
||||
| U2 | prefill: batched PLE post-ops (code `STRATA_PLE_BATCH`; upstream `78316c8df` 2026-11-02 turns it off for an engine built with CUDA 12.8 on cc 12.0: illegal memory access in `native_ple_postops_batch_snap`) | we run the PLE of a prompt chunk batched (`OriginalPromptDevice::apply_ple`, `ple_batch_ffi`, `ple_batch_queue`); our sealed PTX is ISA 9.2 = CUDA 13.2 and the deploy refuses a driver older than 595 (`docs/deploy.md`), the production RTX 5090 host runs driver 595.99 / CUDA 13.2 | upstream: with CUDA 13.0 the batch is ~23 % faster prompts, so only the 12.8 toolchain faults | same hazard does not apply (no 12.8 build exists in our chain); the batch is already on | source read | hex-finish | proved-equal (we have the fast path and not the faulting toolchain); no work |
|
||||
| U3 | prefill: MMQ row table over-read by the stream-k fixup (code `ids_identity`; upstream `f225844d1` 2026-11-05, class E correctness) | same structure: `ids_identity` is `T*K` entries exactly (`original_prefill_layout.rs:330`, `a.rows("ids_identity", t, K, 4)`), read by the same ggml `mul_mat_q_stream_k_fixup` (`mmq_original_formats_fixup.cu`); upstream needs `T*K + roundup(T, J) + J` entries (J = 8..128). It stays inside the arena today because `bounds_dev`, `grp_gu`, `grp_d` follow it in the same allocation, so the over-read lands in a neighbouring span and the skipped writes never use it | upstream faulted (Xid 31) when the exact table ended a 2 MiB page | latent: not a fault with the current layout, would become one if the order of the `Common` spans changes or `mmq_any` spans end the allocation | source read | hex-finish | fixing: margin `roundup(T, 128) + 128` entries added (`original_prefill_layout/mmq_identity.rs`, unit test of every readable index; always on, class E, no switch); identity (prompt logit digests equal) pending in the batched identity job |
|
||||
| U4 | verify: flag B stays behind queued copies (upstream `40849df0a` 2026-11-05, P1.1, class E) | `OriginalVerifyGpuPlan::raise_after_staging` (`plan_phases.rs`): a plan with a PCIe source queues the flag behind the staging copies on the copy stream even when the plan is empty (`stage_pcie`, then `raise_after_copies`), the copy-kernel mode and the no-source case raise at once. The upstream hazard (an empty plan raising the one counter early while an earlier layer's or the other token group's uploads are still queued) can only occur in the no-source branch if a window mixes groups with and without a source; not shown to happen | upstream: counter jumped past a layer whose bytes had not landed | unknown; needs the check in the file owned by the speed session | source read | device | proved-equal (speed session, 2026-11-09): flag B is a monotonic ring word; a group with a PCIe source raises it behind the staging copies, one without a source or with the copy kernel raises it from the host at once; groups are never mixed in the product (`pcie_num > 0` is fixed once per round, `decode_parts.rs:209`); pure function `flag_b_route(copy_kernel, has_source)` with a truth table added on their branch, behaviour unchanged |
|
||||
| U5 | verify: adaptive-copy range covers the whole round (upstream `40849df0a`) | different implementation: adaptive swaps are planned and applied in `original_serve_residency` (`adapt_swaps` cap 96 per round, `swap_tie_order.rs`); no serial/pipelined split with `lo/hi/bi` ranges exists in the Rust port | upstream: a pipelined round that drained early marked only an earlier round's range resident, so other swaps were lost (slot held the new expert, table still named the old one) | analogue not found; the resident marking of a drained round needs a read-through | source read | device | proved-equal (speed session, 2026-11-09): a swap is `Queued` until `complete_swaps` after `wait_swaps`/`poll_swaps` marks it `Filled`, and the slot search requires `Filled`, so a slot is resident only after its copy landed |
|
||||
| U6 | prefill: expert-major (whole-blob) host bank for the copy ring (vanilla's pack holds one 2 MB blob per expert; ours is role-major, so the ring issues three H2D copies of ~0.7 MB per expert, `copy_exact`/`copy_aligned` in `ring_stage_expert_copies.rs`) | PCIe 44.6 GB/s measured over the copies (`PREFILL-COPY avg_call=696194 dma_gbps=44.6`); a 1.4k-token tail copies 24 GB, the ring wall equals bytes / 45 GB/s | vanilla: Original's own probe 49.9 GB/s with whole blobs | about -10 % of the ring DMA = -30..-45 ms per request at 0.3-1.5k tails (estimate: 0.9x of 460 ms) | PROFILE `prefill-ring-copied-megabytes-profile` (bytes), `docs/upstream-port-plan.md:181` (probe) | hex-finish | DEFERRED by the orchestrator 2026-11-10: it changes the KAR bank layout and the single compressed copy of the model (not a ring-local change); come back after the ring prefetch and Q6. Bitwise by construction (same bytes), needs a KAR format/version decision and a sealed-bank migration |
|
||||
| U7 | prefill: fused int8 prompt experts (code `STRATA_PF_FUSED`, `moe_fused_iq.cu`; upstream `959e6c34`, `b1e0fdaa`; ON by default for a 5090 in vanilla via `sm120_series.hpp`, confirmed in the VANL engine log: `prompt experts on the fused int8 kernels (STRATA_PF_FUSED=1, #136)`) | absent (our prompt experts run the grouped MMQ kernels behind the copy ring; port-plan rows 3.2/6.2 are todo, size L, needs the GPU-side grouping) | VANL has it ON (and CPU share OFF in that arm); upstream measured prompt +7/+5/+3 % at 4K/20K/98K; KL against MMQ 0.0002, an exact int8 dot with one float add per 32 values (s0-7 row 5, B2) | not measured: at tails of 64-1024 tokens the ring wall equals the PCIe time of the copied bytes (7-13k experts per request, DMA 319-590 ms at 45 GB/s = ring wall 332-590 ms), so a faster expert kernel only moves the kernel tail after the last copy; expected effect at those tails is small (a few ms per layer of MMQ after the final group), and +3..7 % of compute at 4K+ | model-free `prefill_fused_iq_test` against our MMQ layer (row 6.1), then the Original envelope (`q_tail_gate` on `night5-long-256k`, first-token KL) | hex-finish | open, NOT the cause of the 64-1024 tail gap (that gap is the unoverlapped GDN/QSA compute, ~130 ms, and DMA 45 vs 50 GB/s, rows Q4/U6); experimental switch OFF + gate only after the prefetch and Q6, default with the owner's word |
|
||||
|
||||
## M. Host memory: the lab holder's sealed memfd
|
||||
|
||||
| id | step | LEL | VANL | difference | source | owner | status |
|
||||
| --- | --- | ---: | ---: | ---: | --- | --- | --- |
|
||||
| M1 | lab holder restart after every holder window: the window scripts (`cmp_codex_job.sh` and the jobs built on it: cmp*, kar-off*, spd-van*, spd-cu*, `pf-mv1`) end with `single-copy-holder.sh`, the FULL seal (55.3 GB resident, `allocated=55295533056`), so the sparse holder of `pf-hs1` (`allocated=16000352256`, 10:28) lasted only until `pf-mv1` ended (10:50); the next window `spd-cuv` (13:31) restarted the full one again | 51.5 GiB resident memfd (profile `ple_only` needs 14.9) | n/a (vanilla holds its own copy) | +36.6 GiB of host RAM held twice; builds with the memfd check refuse to start (`leleka up`: "a second copy of model bytes that nothing reads"); `ab3` (12:13-13:17), `ab4` (22:46-23:43) and `dc-p1` ran on the full holder, both arms of each pair on the same one | `notes.md`, holder3.out, `stat` of the memfd | hex-finish | fixing: guard in `pf_ab_job.sh` (allocated size of the inherited memfd above 20 GiB: sparse restart through `pf_holder_window.sh` and the job queued again, `pf_sparse_requeue.sh`); window scripts of other sessions must end with `pf_holder_sparse.sh` instead of `single-copy-holder.sh` (not done: not our files) |
|
||||
|
||||
## Job names (GPU queue stubs and result directories)
|
||||
|
||||
Naming rule (owner 2026-11-09): `<area>-<what it measures>-<arm or step>`, in words; areas `prefill-`, `host-`, `draft-`, `memory-`. Result directories under `/data/leleka-e2e/prefill-latency/runs/` carry the same name. Jobs that already ran keep their old name; the map is old to new.
|
||||
|
||||
| old name | new name (job stub, queue entry and result directory) | what it measures | row |
|
||||
| --- | --- | --- | --- |
|
||||
| `pf-ab4` | `prefill-ladder-ab-pairs-6-10` | paired A/B of the prompt loan ladder against shipped, pairs 6-10, sparse holder | Q1 |
|
||||
| `pr-lel` | `prefill-empty-request-probe-leleka` | empty-request probe on LEL: tiny prompt, cold, cached long prompt | A1, A2, A3 |
|
||||
| `pr-prof` | `prefill-prefix-park-subspans-profile` | profiled replay with the sub-spans of the prefix-cache export (sync, allocation, copy) | B3 |
|
||||
| `s1-id1` | `host-draft-chain-one-pass-identity` | identity and host-span pair, draft chain in one pass against sequential | O9 |
|
||||
| `s1-ab1` | `host-draft-chain-one-pass-ab` | paired A/B n=10, draft chain in one pass (ms per token, task time) | O9 |
|
||||
| `pr-prof` (then `prefill-prefix-park-subspans-profile`) | `prefill-prefix-park-identity-and-profile` | replaces the sub-span profile job: identity of parking FAST/ASYNC against shipped (A, PF, PA) and the profiled pair (AP, PFP, PAP), package `pkg-s3` (commit `7a549b68e`) | B3, U3 |
|
||||
| `s1-ab1` (then `host-draft-chain-one-pass-ab`) | `host-draft-switches-group-ab` | the one paired A/B of the group of host/draft switches (chain pipeline + check merge + parking fast) against shipped, n=10, package `pkg-s4` | O9, O8, B3 |
|
||||
| (new) | `draft-check-merge-gpu-proof` | GPU test `check_batch` (batched guard against separate launches, NaN/Inf in every buffer) | O8 |
|
||||
| (new) | `host-draft-switches-identity` | replay hashes and draft trace lines equal with X (group), the check merge alone (MT), shipped (DT) | O8, O9, B3 |
|
||||
| (new) | `prefill-gdn-tensor-core-parity-gpu` | GPU tests: tensor-core GDN scan against the sequential kernel (gate 1e-4) and kernel timing; package `pkg-s5` | U1 |
|
||||
| (new) | `prefill-gdn-tensor-core-logit-gate` | lossy gate: teacher-forced `night5-long-256k`, 240 tokens by top-16 logprob, shipped against `LELEKA_PREFILL_GDN_TC=1` (A/A floor), Original envelope via `q_tail_gate.py`; test binary `dt/rt-pf7` | U1 |
|
||||
| (new) | `prefill-gdn-tensor-core-profile` | `gdn` stage per chunk, shipped (AP) against tensor-core scan (GTP), replay of 30 requests | U1 |
|
||||
| (new) | `host-decode-graph-reuse-identity-and-profile` | Q7: replay hashes and draft trace equal to shipped with `LELEKA_DECODE_GRAPH_REUSE=1`, and the `decode.assemble`/`decode.reuse`/`record.*` spans; package `pkg-s6` (commit `2a1f2eccf`) | Q7 |
|
||||
| (new) | `prefill-prefix-park-async-fix-identity-and-profile` | rerun of the parking identity (reuse) and sections after the ASYNC admission fix; package `pkg-s8` (commit `4fef1b009`) | B3 |
|
||||
| (new) | `host-draft-chain-gate-diagnosis` | which condition keeps the pipelined draft chain from engaging (`mtp.chain_gate.*` counters), and the step-graph node count with the check merge; package `pkg-s9` (commit `4b0f87bf0`) | O9, O8 |
|
||||
| (new) | `host-draft-switches-teacher-forced-identity` | bitwise identity under teacher forcing (night5-long-256k, A/A floor): shipped against check merge, parking fast and decode graph reuse, one process each; test binary `dt/rt-pf9` (commit `2a1f2eccf`) | O8, B3, Q7 |
|
||||
| `pr-van` | removed | empty-request probe on VANL; vanilla is not re-measured (owner 2026-11-09) | A1-A3 |
|
||||
|
||||
Reference in New Issue
Block a user