diff --git a/AGENTS.md b/AGENTS.md index 1f7e759b..7efd29de 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -28,6 +28,7 @@ reference (the "Original"); the product is the Rust/CUDA port of its Original mo (CUDA Driver API, sealed PTX, NVML sampler), `crates/leleka-memory` (memory governor, pressure gate, telemetry), `desktop-core` and `crates/runtime-client` (the gRPC contract between the engine process and the gateway), `control-plane` (HTTP/Responses gateway), `crates/deploy` (the `leleka` binary: `up/run/status/verify`, memory profiles, resource presets). +* The layers (L0 to L4), the ports, how to add an engine family and what the architecture gates check: `docs/architecture/hexagonal.md`. * Measured on an RTX 5090 server with real Codex CLI sessions (`docs/e2e-run.md`, `docs/ledger.md`, `docs/quality-gate.md`, `docs/prefix-cache.md`, `docs/deploy.md`, `docs/roofline.md`); the RTX 3080 laptop is a secondary, experimental target (`docs/laptop-profile.md`). * The port is complete for the 5090 serve path; open work is listed in `docs/port-remaining.md` and the ledger. diff --git a/README.md b/README.md index c3f2c9b5..735c635f 100644 --- a/README.md +++ b/README.md @@ -74,11 +74,11 @@ What the service is doing, and why a request was slow or failed, is in its logs; ## Repository layout -- `crates/` — the runtime: `leleka-runtime` (engine), `cuda-driver` (CUDA Driver API, sealed PTX), `leleka-memory` (memory governor), `obs` (logging), `deploy` (the `leleka` binary), model-format, tokenizer, sampler and CPU kernels. +- `crates/` — the runtime: `engine-qwen35-cuda` (the engine; `leleka-runtime` is its facade), `engine-core` (pure engine domain), `cuda-driver` (CUDA Driver API, sealed PTX), `leleka-memory` (memory governor), `obs` (logging), `deploy` (the `leleka` binary), model-format, tokenizer, sampler and CPU kernels. - `control-plane/`, `desktop-core/` — the HTTP/Responses gateway (`strata-next`) and the engine/daemon processes. - `engine/strata/` — the pinned upstream Strata, the reference (unmodified by Leleka). - `deploy/`, `scripts/` — profiles, service templates, release packager (`scripts/release/`), test and measurement tooling (Python is allowed there, never in serving). -- `PROJECT_CHARTER.md`, `docs/` — requirements, provenance, decisions, gates and measurements. +- `PROJECT_CHARTER.md`, `docs/` — requirements, provenance, decisions, gates and measurements. Architecture: `docs/architecture/hexagonal.md`. Model weights, request captures, credentials, logs and generated artifacts stay outside Git. diff --git a/docs/architecture/gateway-ports.md b/docs/architecture/gateway-ports.md index 96fa6379..b7fd797f 100644 --- a/docs/architecture/gateway-ports.md +++ b/docs/architecture/gateway-ports.md @@ -1,5 +1,7 @@ # Gateway ports (STRA-338 S16) +The layers, the engine-side ports and the architecture gates are on `hexagonal.md`; this page is the gateway half. + The HTTP/Responses gateway (`strata-control`, binary `strata-next`) talks to everything outside the request through five small traits in `control-plane/src/ports/`. `AppState` holds `Arc` (type aliases `SharedClock`, `SharedEngine`, `SharedResponseStore`, `SharedToolHub`, `SharedVisionEncoder`), never a concrete adapter. The real diff --git a/docs/architecture/hexagonal.md b/docs/architecture/hexagonal.md new file mode 100644 index 00000000..9b71cc01 --- /dev/null +++ b/docs/architecture/hexagonal.md @@ -0,0 +1,227 @@ +# Hexagonal architecture of the Leleka runtime and gateway (STRA-338) + +One page: the layers, the ports, how to add an engine family, what the gates check, and what the verification asked for. +Every statement was read from the code, `architecture.json`, `architecture-baseline.json` or the commits it names. +Detail pages: `gateway-ports.md` (the five gateway ports), `tech-debt.md` (what a step moved but did not fix), +`../experiments/stra-338-gateway-track.md` (the gateway track report). + +## Layers + +The policy is `architecture.json`. A normal dependency points to the same or a lower layer. L0 to L2 are the pure layers: they +may not use `tokio`, `axum`, `tonic`, `tonic-prost`, `reqwest`, `hyper`, `libc`, `rustix`, `windows-sys`, `sysinfo` or `wgpu`. +Inside L3 a crate may use another L3 crate only through an edge listed in `adapter_edges`. Every workspace package is in exactly one layer. + +| Layer | Role | Crates (package names) | +|---|---|---| +| L0 contract | wire and trait contracts | `leleka-backend-api` (the `Backend` trait), `leleka-worker-protocol` | +| L1 leaf libraries | pure or std-only libraries | `leleka-obs` (`Clock`), `leleka-memory` (`MemoryPressure`), `leleka-context`, `leleka-sampler-ref`, `leleka-quant-core`, `leleka-serving-policy`, `leleka-harmony`, `leleka-tokenizer`, `leleka-gguf`, `leleka-kar-codec`, `leleka-experimental-ref`, `leleka-cpu-sys`, `leleka-cpu-kernels`, `leleka-shm`, `leleka-openvino`, `leleka-gateway-text` | +| L2 domain | pure domain of one side | `leleka-engine-core` (prefix cache, conversation policy, prompt plan, speculative-decoding policies, request lifecycle, `EngineFamily`), `leleka-gateway-domain` (sampling, reasoning budget, codec, Responses and Messages protocol) | +| L3 adapters | OS, device, process and file access | engine: `leleka-engine-qwen35-cuda`, `leleka-engine-fake`, `leleka-cuda-driver`, `leleka-model-format` (`WeightSource`), `leleka-native-cpu-expert`, `leleka-libc-shim`; gpt-oss workers: `leleka-gptoss`, `leleka-gptoss-igpu`, `leleka-gptoss-npu`, `leleka-cpu-worker`, `leleka-igpu-worker`, `leleka-npu-worker`, `leleka-gpu-npu-worker`, `leleka-npu-service`, `leleka-igpu`; also `leleka-offline-tools`, `leleka-runtime-client` (gRPC client) | +| L4 hosts | composition roots and facades | `leleka-runtime` (facade), `strata-desktop-core` (the `leleka-inference` binary), `strata-control` (gateway, binary `strata-next`), `leleka-deploy` (the `leleka` binary), `leleka-native-parity-bench` | + +`leleka-runtime` is one line, `pub use leleka_engine_qwen35_cuda::*;` (S22), so the binaries keep importing `leleka_runtime::...`. +`leleka-engine-fake` is a dev-dependency of `strata-desktop-core` only; no production crate depends on it. + +## Dependency picture + +Selected edges of `python scripts/check-architecture.py --report`; every arrow points to a lower or equal layer. The dotted edge is a dev-dependency. + +```mermaid +flowchart TB + subgraph L4[L4 hosts] + ctl[strata-control
gateway root] + dcore[strata-desktop-core
engine process root] + rt[leleka-runtime
facade] + end + subgraph L3[L3 adapters] + q35[engine-qwen35-cuda] + fake[engine-fake] + cuda[cuda-driver] + mfmt[model-format
WeightSource] + cpux[native-cpu-expert] + rtc[runtime-client
gRPC] + end + subgraph L2[L2 domain] + core[engine-core
EngineFamily, run_request,
prefix cache, conversation] + gdom[gateway-domain] + end + subgraph L1[L1 leaf libraries] + obs[obs
Clock] + mem[leleka-memory
MemoryPressure] + gtext[gateway-text, harmony,
tokenizer, ...] + end + subgraph L0[L0 contract] + api[backend-api
Backend] + end + dcore --> rt --> q35 + dcore --> core + dcore --> rtc + dcore -.-> fake + ctl --> gdom + ctl --> rtc + q35 --> core + q35 --> cuda + q35 --> mfmt + q35 --> cpux + q35 --> mem + q35 --> obs + fake --> core + core --> api + fake --> api + rtc --> api + gdom --> gtext + cuda --> mfmt +``` + +`engine-qwen35-cuda` reaches `cuda-driver`, `model-format` and `native-cpu-expert` through three declared adapter edges. `engine-core` +depends on `leleka-backend-api` and `serde` only. `strata-desktop-core` is the composition root of the engine process; `strata-control` +is the composition root of the gateway process (`serve()` in `control-plane/src/serve.rs`). + +## Ports and seams + +| Seam | Trait or type, and where | Dispatch | Why | +|---|---|---|---| +| Clock (engine) | `leleka_obs::time::Clock`; `SystemClock`, `ManualClock`, `AnyClock`, `Stopwatch` (`crates/obs/src/time/clock.rs`) | generic (`C = SystemClock` by default); `AnyClock` is an enum for owners that cannot be generic | read at coarse points (request, decision, tick); hot loops take one reading and compare it | +| Settings / EnvSource | `EnvSource`, `ProcessEnv`, `MapEnv`, `Settings` (`crates/engine-qwen35-cuda/src/settings/`, crate-private) | generic (`&impl EnvSource`) | the operator namespace is captured once; parsers are tested with `MapEnv` | +| MemoryPressure | `leleka_memory::pressure_port::MemoryPressure`; `ProcPressure`, `ScriptedPressure` | `Arc` inside `Governor` | read at sampler and admission cadence, never per token | +| WeightSource | `leleka_model_format::weight_source::WeightSource`; file, shard, resident-tensor and KAR adapters, an in-memory double | generic (`S: WeightSource + ?Sized`) | opened once per load; no method returns an owning copy of the bytes | +| ServeDevice | `ServeDevice` (`crates/engine-qwen35-cuda/src/qwen_forward/original_serve_request.rs`, crate-private), implemented by `OriginalServeStack` | generic (`&mut impl ServeDevice`) | one call per request; tests drive the real `generate` over a scripted device | +| Lifecycle / run_request | `leleka_engine_core::request::{Lifecycle, run_request, ServeError, admit}` | generic, no trait object | admission, reset or resume, prefill, decode, finish: the order and the failure classes run over any owners | +| EngineFamily + `spawn::` | `leleka_engine_core::family::{EngineFamily, spawn}`; families `Qwen35Cuda` and `EngineFake` | `F` is generic; the result is `Box` | the root is monomorphised over the family; the trait object is the process boundary | +| Backend | `leleka_backend_api::Backend` (`crates/backend-api/src/lib.rs`) | `Box` in `RuntimeServer` (`desktop-core`) | methods are request-level (`load`, `start_generation`, `cancel`, `unload`, reports); tokens travel in the `GenerationStream` | +| Gateway ports | `EngineClient`, `ResponseStore`, `Clock`, `ToolHub`, `VisionEncoder` (`control-plane/src/ports/`) | `Arc` in `AppState`, boxed futures | called once per request or per process; streaming loops read the plain `mpsc` receiver | + +Inside the Qwen3.5 adapter there are three more device traits, all crate-private: `RequestOwners` (admission to finish), `PrefixDevice` +(the prefix cache) and `OriginalServePort` (the verify round). The rule behind the table is the `dyn-trait` pattern in +`architecture.json`: dynamic dispatch is for start-up composition and request-level boundaries, not for a round, a chunk or a token. +Two carve-outs are counted by the ratchet instead of hidden: `RequestOwners::prefill` and `decode` take `&mut dyn FnMut` callbacks, and the +`conversation` code in `engine-core` takes `&mut dyn StateMemory` and `&mut dyn SessionEngine`. + +There are two `Clock` traits on purpose: the engine one (std `Instant`, `leleka-obs`) and the gateway one (tokio `Instant`, `control-plane/src/ports/clock.rs`). + +## What is deliberately not a port + +* Kernels and their launch order, and CUDA graph capture and replay. They stay concrete in `leleka-cuda-driver` and the adapter. The STRA-338 + item says not to abstract graph capture until it is measured; nothing here measures it. +* The glue `prefill_actions` and `decode_phase` of `OriginalServeStack`. They hold the CUDA owners, the verifier assembly and the expert-tier + hooks, so they stay in the adapter; the test device mirrors them (`tech-debt.md`, S15). +* Shard open and bind, KAR verification and the CPU expert bank are not behind `WeightSource` yet; each is its own step (`tech-debt.md`, S18). +* The gpt-oss CPU/iGPU/NPU runtime is reached through the worker line protocol (`leleka-worker-protocol`, L0) and `codec::TextCodec` in the + gateway, not through `EngineFamily`. +* `RECONFIGURING`, `INSTANCE`, `settings::process()` and `Governor::global()` are still process-wide in the adapter (`tech-debt.md`, S13 and S14). + +## How to add an engine family + +Today `spawn::` is the only registered family of the engine process: `desktop-core/src/bin/leleka-inference.rs` calls it for the +Original and native paths, and its experimental paths still call the `spawn_backend_*` functions directly. There is no family `enum`; the root +chooses by its own logic, and a second family adds a second arm there. + +1. **Crate.** Create `crates/engine--` (package `leleka-engine--`), add it to `[workspace] members` in `Cargo.toml` + and to layer `L3` in `architecture.json`. Depend on `leleka-engine-core`, `leleka-backend-api` and L1 libraries. Another L3 crate only through an + `adapter_edges` pair that is a real port (the Qwen3.5 crate has three: `cuda-driver`, `model-format`, `native-cpu-expert`). Never depend on L4. +2. **Domain first.** Take policy from `leleka-engine-core` (`prefix_cache`, `conversation`, `prompt`, `spec`, `request`). Anything that needs the OS, + a device, `std::env` or `Instant::now()` goes behind the existing ports (`EnvSource`, `Clock`, `MemoryPressure`, `WeightSource`). +3. **Implement the seam.** A zero-sized marker `struct Family;` with `impl EngineFamily for Family { type Config = ..; const NAME: &'static str = ..; + fn spawn(config) -> Result, BackendError> }`, and `Backend` for the engine it returns. For the request path implement + `Lifecycle` on the family's owners and call `run_request`. Models: `crates/engine-fake/src/lib.rs` (smallest) and + `crates/engine-qwen35-cuda/src/backend/family.rs`. +4. **Register.** Add the crate to `desktop-core/Cargo.toml` and call `spawn::(config)` where the root picks the engine; the result goes to + `RuntimeServer::new` unchanged. +5. **Fake-engine test.** A GPU-free test that starts the family through `spawn::` and drives a request, in the style of + `crates/engine-fake/src/tests.rs`; for lifecycle behaviour implement `Lifecycle` on a scripted owner, as the `lifecycle_fake` device of the + Qwen3.5 adapter does. `desktop-core/tests/api_over_runtime.rs` is the full-chain test (real API router, real `RuntimeServer`, scripted engine). +6. **Gates** (next section): `python scripts/check-architecture.py`, `python scripts/check_architecture_test.py`, `python scripts/check-ci-coverage.py` + (add the package to `scripts/ci-coverage.json` and name it with `-p` in `scripts/check-local.sh`), `cargo test -p `, clippy with `-D warnings`. +7. **GPU rule (AGENTS.md).** A non-lossy change compares greedy output or tensor values with the defined baseline and records the tolerances. Nothing + is called a performance change without paired A/B measurements on the same workload, a quality result, and the hardware, software, model digest, + configuration, cache state, token counts and distributions the charter asks for. Lossy modes stay off by default and are marked experimental. + +## What the gates check + +`scripts/check-local.sh --product` (CI workflow `Product`, `.github/workflows/product.yml`) runs `scripts/check-ci-coverage.py`, +`scripts/check_architecture_test.py` (22 self-tests) and `scripts/check-architecture.py`. Run the last one alone for a local answer. + +| Check | Rule | Source | +|---|---|---| +| layers | every package has one layer; an edge to a higher layer is an error | `architecture.json` `layers` | +| adapter edges | L3 to L3 only through a listed pair | `adapter_edges` | +| purity | L0 to L2 use none of the `forbidden_in_pure` crates | `forbidden_in_pure` | +| size ratchet | no `.rs` file over 400 lines; a file already over may not grow past its baseline entry; a shrunk file is reported stale | `max_lines`, baseline `oversize` | +| source ratchets | per-crate counts of `env-read`, `instant-now`, `path-include`, `process-global`, `dyn-trait` over production code in `src/`; a count may only fall | `source_patterns`, baseline `source` | +| baselined violations | the two known `leleka-memory` dependencies (`libc`, `windows-sys`) | baseline `violations` | + +Commands: `python scripts/check-architecture.py` (0 errors expected), `--report` (layer graph, oversize census, ratchets), `--update-baseline` +(lowers numbers, refuses to raise one), `--update-baseline --allow-increase` (raising needs a reason in review). Test-only modules (a `mod x;` +under a test cfg, `tests.rs`, `*_tests.rs`, `tests/`) are not counted by the ratchets. + +Limits gate and Clippy ratchet (STRA-367). Function at most 30 lines, complexity 10, nesting 4, line 120 columns for new and changed code, a falling +census for legacy, and an opt-in Clippy ratchet (`too_many_lines`, `cognitive_complexity`, `too_many_arguments`). The files are +`scripts/check-limits.py`, `scripts/check-clippy-limits.sh` and `docs/architecture/limits-gate.md`, and `check-local.sh --product` runs the gate. +At the time of writing they exist on branch `claude/hexagonal-integ-lints` (commits `334af80d3`, `054b57bec`, `48b2ce9f4`) and not in this tree; their +census predates S19 to S22. After that branch is merged: `python scripts/check-limits.py`, and `scripts/check-local.sh --clippy-limits` for the Clippy side. + +## Verification evidence rules + +* **Identity is bitwise.** A step that must not change behaviour is compared with the reference binary on the teacher-forced replay of the + `night5-long-256k` capture: 5 requests, 240 forced tokens each, top-16 logprobs of every row and the draft trace. The reference A/A noise floor is + measured first (2057 logprob rows and 1036 draft-trace lines identical, 0 argmax flips), so any difference seen for a candidate is real. Recorded in + the LeaseVibe comments of STRA-344 as `HX-ID1`, `HX-ID2`, `HX-ID3`, `HX-ID-C2` and `HX-GATE2`. +* **Speed is paired.** A/B at 245k, 5 turns, each arm alone on the GPU, order alternating by block, block-paired differences with a confidence + interval. n = 10 blocks can exclude a slowdown of about 1% and shows nothing smaller; the charter's bar for claiming 1% is n >= 30. The records + (`HX-AB`, `HX-AB-C2`, `HX-GATE2`) state non-regression bounds, not speed-ups, and name what they do not cover (other workloads, sampling paths + other than greedy, the laptop 3080). +* **GPU-free steps** are covered by `cargo test`, clippy, `cargo fmt --check`, the architecture gate and, where one was recorded first, a golden + fixture (S21 `responses_pure.json`, the S5a digest goldens, the S2 round transcripts). +* **Not yet recorded.** The STRA-344 thread as read for this page ends with `HX-GATE2` at `17296a58f` (S14, S15, S18), with a note that the commits + after it up to `fc591f4e9` do not touch the engine process. It holds no identity or A/B record for S19 to S22 (`38eb771a4` to `a4ceeab69`), which + move code inside the engine process. The decision comment on STRA-338 puts that batch behind "A/B n=10 first, n=30 only with spare GPU time", with the + identity gate never dropped. Until that run exists, these four steps are verified by the compiler and the GPU-free tests only. + +## State after S22 + +`python scripts/check-architecture.py --report` on `a4ceeab69` (the S22 tip) against the first recorded baseline, commit `55dbadc43` (S1), whose +message states "3 layer violations, 329 oversize files, 65 ratchets" and which was built on `main` `731f060b7`. The two are not strictly comparable: +from S13 the ratchets count production code only, and the `path-include` pattern now skips `tests.rs` and `dir/name.rs`. + +| Measure | main `731f060b7` (S1 baseline) | S22 tip | +|---|---|---| +| `.rs` files over 400 lines | 329 | 121 | +| lines in those files | 303,231 | 96,649 | +| layer violations | 3 | 2 (`leleka-memory` to `libc`, `windows-sys`) | +| ratchet keys | 65 | 73 | +| `env-read` (total) | 492 | 205 | +| `instant-now` | 294 | 201 | +| `process-global` | 303 | 265 | +| `dyn-trait` | 229 | 219 | +| `path-include` | 205 | 231 (cause not analysed here) | + +Where the runtime went (oversize files and their lines, from the two baselines, and the ratchets per crate): + +| Crate | oversize files / lines | `env-read` | `instant-now` | `process-global` | `dyn-trait` | `path-include` | +|---|---|---|---|---|---|---| +| `leleka-runtime` at S1 | 87 / 82,652 | 239 | 74 | 102 | 71 | 94 | +| `leleka-runtime` now (facade) | 0 / 0 | 0 | 0 | 0 | 0 | 0 | +| `leleka-engine-qwen35-cuda` | 17 / 14,089 | 1 | 17 | 59 | 52 | 100 | +| `leleka-engine-core` | 4 / 3,714 | 0 | 0 | 0 | 19 | 0 | +| `leleka-engine-fake` | 0 / 0 | 0 | 0 | 0 | 1 | 0 | +| `leleka-gateway-domain` | 1 / 405 | 0 | 0 | 3 | 5 | 0 | +| `leleka-cuda-driver`, S1 to now | 97 / 91,850 to 30 / 19,617 | 126 to 76 | 44 to 31 | 108 to 110 | 51 to 48 | 102 to 115 | +| `strata-control`, S1 to now | 40 / 42,971 to 10 / 10,764 | 21 to 19 | 37 to 23 | 16 to 11 | 29 to 16 | 0 | + +Size of the new crates (all `.rs` under `src/`, tests included): `engine-core` 11,245 lines, `engine-qwen35-cuda` 113,374, `engine-fake` 92. +`engine-core` has no environment, clock or global in its code, which the zero counts reflect. The largest oversize file of the workspace is +`crates/native-cpu-expert/examples/kernel_ab.rs` (3,347 lines); the largest in the engine crates is +`crates/engine-qwen35-cuda/src/gpu_proofs/native_down_candidate_only.rs` (1,648). + +## Commits of the engine recut (S19 to S22) + +| Step | Commit | What | +|---|---|---| +| S19a | `38eb771a4` | prefix cache and pure memory admission to `leleka-engine-core` (L2) | +| S19b | `d717c6977` | Original prompt plan to `engine-core::prompt` | +| S19c | `93afb07bf` | conversation policy to `engine-core::conversation`; 17 `dyn` uses and 3 oversize test files moved with it | +| S19d | `8987e9ab0` | draft policy and adaptive window policy to `engine-core::spec`; `LELEKA_SPEC_*` parsing stays in the adapter | +| S19e | `58e3d864e` | admission, stop set, `ServeError`, `run_request` over `Lifecycle` to `engine-core::request` | +| S20 | `e049e24fe` | `EngineFamily` and `spawn::`, `Qwen35Cuda`, `leleka-engine-fake`; `leleka-inference` and the full-chain test start engines through the seam | +| S21 | `ff6cb3dcb` and later | `leleka-gateway-domain` (gateway track) | +| S22 | `a4ceeab69` | the engine moves to `leleka-engine-qwen35-cuda` (L3); `leleka-runtime` becomes the facade | diff --git a/docs/architecture/tech-debt.md b/docs/architecture/tech-debt.md index 738344fd..440e9816 100644 --- a/docs/architecture/tech-debt.md +++ b/docs/architecture/tech-debt.md @@ -1,12 +1,17 @@ # Architecture tech debt (STRA-367) Debt that a hexagonal step moved but did not remove. A line here names the file, the limit it misses, and what -removes it. The size and ratchet numbers themselves live in `architecture-baseline.json`. +removes it. The size and ratchet numbers themselves live in `architecture-baseline.json`; the overview is `hexagonal.md`. Limits for new and changed code: function at most 30 lines, cyclomatic complexity at most 10, nesting at most 4, line at most 120 columns, file at most 400 lines. -## crates/leleka-runtime `backend/` (STRA-338 S5a, S5b) +Crate names after S22: the sections below that say `leleka-runtime` describe code that now lives in `crates/engine-qwen35-cuda` (package +`leleka-engine-qwen35-cuda`); `leleka-runtime` is a one-line facade. The sections keep the wording they had when they were written, paths such as +`backend/` and `settings/` are relative to the new crate, and the ratchet keys read `...:leleka-engine-qwen35-cuda`. The layers, the ports and the +numbers after S22 are on `docs/architecture/hexagonal.md`; the S19 to S22 section below says what the engine recut moved and what it left. + +## crates/engine-qwen35-cuda `backend/` (formerly leleka-runtime; STRA-338 S5a, S5b) `backend.rs` (3797 lines) is a parent of 258 lines plus responsibility-named children. `serve_load` is decomposed into `load.rs` (the order of the phases) and `load_admit`, `load_sources`, `load_identity`, `load_bind`, `load_cuda`, @@ -17,7 +22,7 @@ limits except the one line named first. What was moved verbatim in S5a and is st | Where | Misses | Removed by | | --- | --- | --- | | `load_moe_gates.rs`, the `learned_main_lru` constructor call | one line of 127 columns: the method name of `MoeWeightCache` is 119 characters | renaming the constructor in `qwen_forward/moe_weight_cache` (its own step) | -| `generate_mtp.rs` `generate_mtp_resume` | 250 lines, complexity 44 | splitting the MTP window loop into phases (engine-core step; GPU identity and A/B gates apply) | +| `generate_mtp.rs` `generate_mtp_resume` | 250 lines, complexity 44 | splitting the MTP window loop into phases (still open after S19: the loop holds CUDA owners and stayed in the adapter; GPU identity and A/B gates apply) | | `generate.rs` `prefill_chunk`, `generate`, `step`, `target_step` | 90, 60, 55, 34 lines; complexity 14 and 10 | same step as above | | `spawn.rs` `spawn_backend_configured` | 100 lines; recomputes the policy flags that `PolicyFlags::of` now owns | use `PolicyFlags::of`, split the owner hand-over | | `spawn_optimized.rs` | seven factories of 32 to 39 lines repeating one precondition block | one `OptimizedSelection` check shared by the factories | @@ -34,7 +39,7 @@ Process-wide state and reads that the policy file `architecture.json` counts and `qwen_forward/moe_weight_cache.rs` gained three `pub(crate) use` lines (`AdaptiveWitness`, `LearnedMainWitness`, `SharedPermanentWitness`) so the witness gates in `load_moe_gates.rs` can name the types; no code changed there. -## crates/leleka-runtime `settings/` (STRA-338 S13) +## crates/engine-qwen35-cuda `settings/` (formerly leleka-runtime; STRA-338 S13) Production code in leleka-runtime no longer calls `std::env`. `settings.rs` holds the port (`EnvSource`, with the `ProcessEnv` adapter and the `MapEnv` fixture) and `Settings`: the operator namespace (`LELEKA_*`, `STRATA_*`) is @@ -42,7 +47,7 @@ captured once, the plain switches and numbers are typed fields of five topic str `kv`, `diagnostics`), and the parsers that report errors (conversation cache, PLE reader, expert tier, memory governor, the speculative engine, adaptive config, NaN guard, sampler path) read the capture through `Settings::env()`. Each topic has golden tests with a `MapEnv` (`settings/*_tests.rs`, `tier_env_tests.rs`, -`original_serve_engine/env_tests.rs`). The `env-read:leleka-runtime` ratchet is 1: `ProcessEnv::get_os` is the only +`original_serve_engine/env_tests.rs`). The `env-read:leleka-engine-qwen35-cuda` ratchet (`env-read:leleka-runtime` when this was written) is 1: `ProcessEnv::get_os` is the only `std::env::var_os` left (`vars_os` in `entries_with_prefix` does not match the pattern). The ratchets now count production code only: a file declared under a test cfg, and everything it declares, is skipped. @@ -50,7 +55,7 @@ What is still outside the port, and why: | Where | What | Removed by | | --- | --- | --- | -| `settings::process()` | one `OnceLock`: leaf code (the nine `driver_error` functions, the GDN/prefill switches, the serve loop traces) cannot take a parameter without threading it through hundreds of `map_err(driver_error)` calls; `LoadEnv::settings` carries it on the load path, the rest asks `process()` | injecting the settings (and the clock, S14) into the executors and the stack when the engine core is extracted (S19) | +| `settings::process()` | one `OnceLock`: leaf code (the nine `driver_error` functions, the GDN/prefill switches, the serve loop traces) cannot take a parameter without threading it through hundreds of `map_err(driver_error)` calls; `LoadEnv::settings` carries it on the load path, the rest asks `process()` | injecting the settings (and the clock, S14) into the executors and the stack. S19 extracted the pure policy only and `engine-core` takes no `Settings`, so this is still open | | `leleka-cuda-driver` (76 reads, 96 keys) | the driver parses its own options (`OriginalStagerOptions`, `OriginalResidentOptions`, the draft vocabulary, `logpos_topk_from_environment` and others); runtime never calls them, the driver does | a settings crate below the driver (L1) that both crates use, then the same capture-and-topic move | | `leleka-native-cpu-expert` (19), `leleka-gptoss` (6), `leleka-model-format` (5), `leleka-libc-shim` (4), `leleka-memory` (3), `leleka-deploy` (41), `strata-control` (19), `strata-desktop-core` (15) and the other CPU/iGPU/NPU crates | same pattern in their own crates; deploy sets the child's environment on purpose | follow-up steps per crate, after the settings crate exists | | `memory_governor`, `ResidentPolicy::from_environment` | public or crate-wide entry points keep their signature and read `settings::process().env()` | callers pass the capture once the load path owns a `Settings` reference everywhere | @@ -117,7 +122,7 @@ Where it is injected: Still on `std::time::Instant` on purpose: the per-window and per-miss timers of the CPU expert pool, lookahead, residency lag and the verify engine, the prefill/GDN profile spans, `owner_wall_profile` (diagnostics inside the -decode loop, one reading per kernel or per miss: a clock parameter there is the engine-core step, S19); `load_clock.rs` +decode loop, one reading per kernel or per miss: a clock parameter there is a later step: S19 extracted the pure policy only and `engine-core` has no clock); `load_clock.rs` (a process-wide lap printer behind a `Mutex`); `DBG_T0` (debug trace epoch); `open_tier_fn` (one startup log line); `smi::query` (a subprocess wait loop, real I/O). The gateway and control-plane crates keep their own sites for the gateway track. @@ -137,7 +142,7 @@ Process globals: `GPU_ORDINAL` is gone (the ordinal travels in `Run`, the value `Shared` would make concurrent backends independent, which is a behaviour change for a process that hosts two), `INSTANCE` (the owner id counter that `spawn_backend_configured` draws from; it needs a spawner object that the callers do not have), `Governor::global()` (about twenty calls in the runtime; they need a memory handle on the stack, the -conversation manager and the prefix cache, the same S19 move as `settings::process()`), `serving_cells()` (30 reads of +conversation manager and the prefix cache, the same open move as `settings::process()`, which S19 did not make), `serving_cells()` (30 reads of one validated constant), the two `std::cell::OnceCell` fields (per-instance lazy cells that the pattern also matches), `NO_TRIM_FILE`, `heap::OFF` and `TUNING` (environment caches that belong to the Settings follow-up). @@ -146,7 +151,7 @@ leleka-obs 0 -> 3 for the three adapters), `process-global` 267 -> 265, `dyn-tra touched that were already over the limits and are not made worse: `Governor::with_parts` (35 lines, the old `new` had 34), `seed_residency` (34, as before), `guard_archive_extents`, `residency_tick`, `telemetry::render`, the Original serve `generate` and `run`, `decode_phase`, `OriginalServeStack::open`. -Follow-ups: thread one clock and one memory handle through the engine core when it is extracted (S19), after which +Follow-ups: thread one clock and one memory handle through the engine stack (S19 extracted the pure policy only, so this is still open), after which `StackConfig::clock` and `LoadEnv::clock` become the generic parameter of the stack; a settings crate for the environment caches above; `RECONFIGURING` and `INSTANCE` with a spawner object. @@ -209,6 +214,12 @@ of sharing it (see "What the fake mirrors"). | telemetry and the `PREVIOUS_TIER` static written by `generate` | process-wide, tests assert nothing on them | S19: pass a request sink to `generate` | | `generate` (about 140 lines), `OriginalServeStack::open` | unchanged | S19 | +**Status after S19e, S20 and S22.** The design below was not carried out as drawn. S19e moved the sequencing of one request into +`leleka-engine-core::request` (`Lifecycle`, `run_request`, generic); the adapter's `RequestOwners` reach it through the wrapper struct `Owners` +(`original_serve_request.rs`). `PromptDevice`, `DecodeDevice`, `read_prompt` and `decode_request` do not exist in the code, `prefill_actions` and +`decode_phase` are still methods of `OriginalServeStack`, and `FakeStack` still mirrors them (`lifecycle_fake/stack.rs`), so the gaps in the table +above are open. The design text is kept as the plan for that step. + **S19 design: one generic lifecycle for the stack and the fake.** Move the glue out of `OriginalServeStack` into `qwen_forward/original_serve_lifecycle.rs`, generic over the device (monomorphised, called once per request or per chunk, never per token): @@ -330,6 +341,52 @@ clippy on both crates reports nothing in the new or changed files; the architect moved (`dyn-trait` unchanged: the port is generic); no `unsafe` was added (the only mapping owner stays `FileSpan`). Functions touched and already over the limits, not made worse: `verify_sources_parallel` (42 lines, not edited). +## Engine core, family seam and adapter crate (STRA-338 S19 to S22) + +Layer picture, ports and numbers: `docs/architecture/hexagonal.md`. This section records what each step moved, what it left, and why. + +**What moved to `leleka-engine-core` (L2; depends on `leleka-backend-api` and `serde` only).** Each step is one commit; the old paths +are re-exported by the adapter (`pub use leleka_engine_core::...` in `crates/engine-qwen35-cuda/src/lib.rs` and `crates/engine-qwen35-cuda/src/conversation/mod.rs`). + +| Step | Commit | Module in `engine-core` | Left in the adapter | +|---|---|---|---| +| S19a | `38eb771a4` | `prefix_cache` (hash chain, budget, store, summary), `memory` (pure admission, `memory_admit`) | `PrefixServe` and `PrefixDevice` (`qwen_forward/original_serve_prefix`): they drive the CUDA state | +| S19b | `d717c6977` | `prompt` (`PromptPlan`, `PromptOptions`) | the serving-context cell bound is a separate constructor the adapter calls (it needs `leleka-context`) | +| S19c | `93afb07bf` | `conversation` (cache, manager, snapshot, kv, state, model, binding, retention) | the CUDA-owner bindings (`conversation/original.rs`, `conversation/resident`) | +| S19d | `8987e9ab0` | `spec` (draft policy, adaptive window policy) | `LELEKA_SPEC_*` parsing (a free function reading `Settings`), the controller and the device round | +| S19e | `58e3d864e` | `request` (`admit`, the stop set, `ServeError`, `Lifecycle`, `run_request`) | `RequestOwners` and the `Owners` wrapper that implements `Lifecycle` over them | +| S20 | `e049e24fe` | `family` (`EngineFamily`, `spawn::`) | `Qwen35Cuda` (`backend/family.rs`) wraps `spawn_backend` and `spawn_backend_original_serve` | + +**Why the rest stayed in `leleka-engine-qwen35-cuda`.** It holds CUDA owners and the owner thread (`backend/`, `qwen_forward/`), reads the process +environment through `Settings`, uses `Instant::now()` (17 sites) and process globals (59), includes files with `#[path]` (100), and calls the +driver, the model-format reader and the native CPU expert. None of that can be in a crate that is built and tested without a GPU. The fake lifecycle +device (`lifecycle_fake`, S15) keeps mirroring the glue `prefill_actions` and `decode_phase`. + +**What S19 did not do.** `settings::process()` (a `OnceLock` read by leaf code), `Governor::global()`, `RECONFIGURING`, `INSTANCE`, +`StackConfig::clock` and `LoadEnv::clock` are all still in the adapter, and `engine-core` takes no `Settings`, clock or memory handle. The S13 and S14 +follow-ups that said "when the engine core is extracted (S19)" are therefore open. `generate_mtp_resume` (250 lines, complexity 44) and `generate` +did not move either. + +**The `dyn-trait` increase of S20 (+4).** The commit message of `e049e24fe` says the ratchets were raised by the `Box` signatures of the +seam; the baseline diff of that commit shows `dyn-trait:leleka-engine-core` 17 to 19, `dyn-trait:leleka-engine-fake` 0 to 1 and +`dyn-trait:leleka-runtime` 51 to 52. The four lines are `EngineFamily::spawn` and the free function `spawn` in `crates/engine-core/src/family.rs`, +`EngineFake::spawn`, and `Qwen35Cuda::spawn`. The same commit raised the size baseline of `desktop-core/tests/api_over_runtime.rs` from 644 to 646 +lines (the "2 test lines": the full-chain test starts its engine through `spawn::`); that is a size entry, not a `dyn` count. `Backend` +is the trait object the process already had at its boundary: `RuntimeServer` holds `Box` (`desktop-core/src/runtime_rpc.rs`) and the +existing `spawn_backend*` factories return it. Its methods are request-level and the tokens travel in the returned stream, so the seam adds no +dynamic dispatch per round or per token; the four lines are signatures. S22 renamed the five ratchet keys of `leleka-runtime` to `leleka-engine-qwen35-cuda` with the +same values (`dyn-trait` 52, `env-read` 1, `instant-now` 17, `path-include` 100, `process-global` 59). + +**Found after S22 and fixed in S26 (docs and scripts only).** `scripts/ci-coverage.json` named neither the three engine crates nor +`leleka-gateway-domain`, so `scripts/check-ci-coverage.py` failed on the S22 tip; `scripts/chain/build_rt.sh`, `scripts/decode-sm120/build_rt.sh` and +`scripts/profile/build_rt.sh` still looked for a test binary called `leleka_runtime-`; the bring-up scripts (`remote_sync.sh`, `regress_3080.sh`, +`run_gpu_smokes.sh`, `linux-tests/run.sh`) and the smoke inventory (`smoke_inventory.py`, `smoke-groups.json`) named `leleka-runtime`, whose lib target +has no tests since S22. Several documented commands did too (`docs/memory-safety.md`, `docs/original-serve.md`, `docs/windows.md`, +`docs/prefix-cache.md`, `docs/gpu-bringup.md`). Left on purpose: dated measurement records (`docs/ci-audit.md`, `docs/experiments/`, +`docs/prefill-throughput.md`, `docs/rope-and-memory-plan.md`, `docs/sampler-reference.md`, `docs/memory-safety-unsafe.md`, `docs/port-remaining.md` section 8) +and the doc comments in `crates/` (`crates/engine-core/src/family.rs` names `leleka_runtime::backend::Qwen35Cuda`; the `#[ignore]` text of +`crates/engine-core/src/prefix_cache/store/tests.rs` gives `-p leleka-runtime`). Those are code and stay for a code step. + ## leleka-gateway-domain `responses/` (STRA-338 S21, wider scope) The pure Responses protocol moved from `strata-control` to `crates/gateway-domain/src/responses/` with the code text diff --git a/docs/gpu-bringup.md b/docs/gpu-bringup.md index 42d933ae..5e698d0b 100644 --- a/docs/gpu-bringup.md +++ b/docs/gpu-bringup.md @@ -230,7 +230,7 @@ with `--only a,b,c` (atomic groups must be complete), and fix the rest on the Ma ## d'. Linux test harness (Mac, before the host build) -`scripts/linux-tests/run.sh` runs the Linux x86_64-gated CPU tests of `leleka-cuda-driver`, `leleka-runtime` and +`scripts/linux-tests/run.sh` runs the Linux x86_64-gated CPU tests of `leleka-cuda-driver`, `leleka-engine-qwen35-cuda` and `leleka-native-cpu-expert` in Docker (no GPU, ignored tests stay ignored; 761 non-GPU tests passed when it landed on `claude/port-main`). Run it on the exact commit you sync, and again on the commit that contains the sealed files after step g. Expect, after sealing, only the placeholder tests listed in step c to need flipping; any other red here is a defect in @@ -245,7 +245,7 @@ scripts/gpu-bringup/remote_sync.sh build --host $HOST --remote-dir '~/work/lelek Runs on the host with a log in `$G/logs/`: `cargo fetch --locked` (fails fast if offline), then `cargo build --release --locked -p strata-desktop-core --bin leleka-cli --bin leleka-daemon --bin leleka-inference` (the three binaries the earlier Linux build produced), then `cargo test --no-run --locked` for `leleka-cuda-driver ---features cuda-driver`, `leleka-runtime`, and `leleka-native-cpu-expert`, and prints `sha256sum` of the binaries into +--features cuda-driver`, `leleka-engine-qwen35-cuda`, and `leleka-native-cpu-expert`, and prints `sha256sum` of the binaries into `$G/binaries.sha256`. `native-cpu-expert/build.rs` has no C++ step (the `.cpp` files in that crate are not built); the crate needs only `cc` as linker. `strata-control` (the `cc`-compiled GGML bridge) is not in this set. Do not run `sync` between c and d. First release build is slow; use `--jobs` to leave CPU to a live service. @@ -269,8 +269,15 @@ variables); **mock**: isolated CPU harness protocol tests, not GPU smokes. | group | crate / target | test | class | enabling env | needs (caller supplies) | |---|---|---|---|---|---| -| dispatch | cuda-driver lib | `original_first_queued_gr_read_exact_and_status_reset` | device | LELEKA_STRA169_RUN_QUEUED_GR=yes | - | +| cpu-probes | native-cpu-expert lib | `iq3_single_bench` | device | (ignore only) | - | +| cpu-probes | native-cpu-expert --test borrowed_group_parity | `group_path_cost` | device | (ignore only) | - | +| cpu-probes | native-cpu-expert --test cpu_pool_probe | `cpu_pool_runs_every_expert_format_pair` | device | (ignore only) | - | +| cpu-probes | native-cpu-expert --test cpu_service_bench | `cpu_service_bench` | device | (ignore only) | - | +| cpu-probes | engine-core lib | `twelve_sessions_growing_to_180k_tokens_stay_inside_the_budget_and_the_lookup_stays_fast` | device | (ignore only) | - | +| cpu-probes | engine-qwen35-cuda lib | `scan_against_queue_on_a_full_cache` | device | (ignore only) | - | +| cpu-probes | engine-qwen35-cuda lib | `choose_swaps_timing` | device | (ignore only) | - | | dispatch | cuda-driver lib | `original_first_gdn_full_products_exact_and_whole_owner_guards` | device | LELEKA_STRA169_RUN_GDN_PRODUCTS=yes | - | +| dispatch | cuda-driver lib | `original_first_queued_gr_read_exact_and_status_reset` | device | LELEKA_STRA169_RUN_QUEUED_GR=yes | - | | driver-basic | cuda-driver --test gpu_driver | `installed_driver_fixed_kernels` | device | LELEKA_CUDA_REAL_GPU=1 | - | | driver-basic | cuda-driver --test q5_gpu | `installed_driver_q5_numeric_refusals` | device | LELEKA_CUDA_REAL_GPU=1 | - | | driver-basic | cuda-driver --test q6_gpu | `installed_driver_q6_numeric_refusals` | device | LELEKA_CUDA_REAL_GPU=1 | - | @@ -280,16 +287,6 @@ variables); **mock**: isolated CPU harness protocol tests, not GPU smokes. | gr | cuda-driver lib | `installed_gr_read_guard_matches_all_stage_bits_and_first_nonfinite` | device | LELEKA_STRA169_RUN_GR_DEVICE_GUARD=yes | - | | gr | cuda-driver lib | `original_first_t1_t2_t3_gr_batch_injection_overwrite_refusal_and_cleanup` | device | LELEKA_STRA172_RUN_GR_BATCH_INJECT_WORKSPACE=yes | - | | gr | cuda-driver lib | `original_first_microbank_read_inject_ffn_all_rows_bits_and_cleanup` | device | LELEKA_STRA169_RUN_GR_MICROBATCH=yes | - | -| misc-device | cuda-driver lib | `short_prompts_record_on_the_drafters_own_scalar_owner_not_on_a_standalone_one` | device | LELEKA_MTP_SCALAR_SHORT_GPU=yes | - | -| misc-device | cuda-driver --test original_arena_probe | `arena_probe` | device | (ignore only) | - | -| misc-device | cuda-driver --test original_executor_probe | `executor_probe` | device | (ignore only) | - | -| misc-device | cuda-driver --test original_serve_preflight_probe | `preflight_00_sealed_asset_report` | device | (ignore only) | - | -| misc-device | cuda-driver --test original_serve_preflight_probe | `preflight_01_device_limits` | device | (ignore only) | - | -| misc-device | cuda-driver --test original_serve_preflight_probe | `preflight_10_lazy_constructors` | device | (ignore only) | - | -| misc-device | cuda-driver --test original_serve_preflight_probe | `preflight_20_prefill_arena` | device | (ignore only) | - | -| misc-device | cuda-driver --test original_serve_preflight_probe | `preflight_30_synthetic_mtp_full_owner` | device | (ignore only) | - | -| misc-device | cuda-driver --test original_serve_preflight_probe | `preflight_40_synthetic_verifier_record_all` | device | (ignore only) | - | -| misc-device | native-cpu-expert --test cpu_pool_probe | `cpu_pool_runs_every_expert_format_pair` | device | (ignore only) | - | | mock-only | cuda-driver lib | `family_quantizer_transport_child` | mock | LELEKA_CUDA_MOCK_HARNESS=1 | - | | mock-only | cuda-driver --test mock_driver | `isolated_cpu_elf_matrix` | mock | LELEKA_CUDA_MOCK_HARNESS=1 | - | | mock-only | cuda-driver --test mock_driver | `fixture_child` | mock | LELEKA_CUDA_MOCK_HARNESS=1 | - | @@ -308,28 +305,41 @@ variables); **mock**: isolated CPU harness protocol tests, not GPU smokes. | model-assets | cuda-driver --test q5_gpu | `installed_driver_q5_real_tensor_component` | assets | LELEKA_CUDA_REAL_GPU=1 | LELEKA_Q5_EVIDENCE, LELEKA_Q5_REAL_INPUT, LELEKA_Q5_NATIVE_ORACLE, LELEKA_Q5_TRUSTED_PTX | | model-assets | cuda-driver --test q6_gpu | `installed_driver_q6_native_parity` | assets | LELEKA_CUDA_REAL_GPU=1 | LELEKA_Q6_EVIDENCE, LELEKA_Q6_NATIVE_ORACLE, LELEKA_Q6_TRUSTED_PTX | | model-assets | cuda-driver --test q6_gpu | `installed_driver_q6_real_tensor_component` | assets | LELEKA_CUDA_REAL_GPU=1 | LELEKA_Q6_EVIDENCE, LELEKA_Q6_REAL_INPUT, LELEKA_Q6_NATIVE_ORACLE, LELEKA_Q6_TRUSTED_PTX | -| model-assets | leleka-runtime lib | `original_serve_smoke_prompt_decode_mtp_verify_commit_reset_cancel_sample` | assets | LELEKA_ORIGINAL_SERVE_SMOKE=yes LELEKA_SMOKE_PROMPTS=yes LELEKA_SMOKE_MAX_NEW=yes LELEKA_SMOKE_MIN_P=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | -| model-assets | leleka-runtime lib | `original_serve_long_context_streamed_kv_smoke` | assets | LELEKA_ORIGINAL_SERVE_LONG_SMOKE=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | -| model-assets | leleka-runtime lib | `pinned_single_load_layer0_and_window_boundaries` | assets | LELEKA_STRA169_RUN_COMBINED_BOUNDARIES=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING, LELEKA_STRA169_LAYER0_DIR | -| model-assets | leleka-runtime lib | `pinned_combined_kar_mtp_retained_three_plus_two_matches_full_reference_five` | assets | LELEKA_STRA169_RUN_COMBINED_REUSE=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | -| model-assets | leleka-runtime lib | `pinned_single_load_layer0_native_first_mmq_diagnostic` | assets | LELEKA_STRA169_RUN_LAYER0_MMQ_DIAGNOSTIC=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING, LELEKA_STRA169_LAYER0_DIR | -| model-assets | leleka-runtime lib | `pinned_five_public_cases_strata_adaptive_slots` | assets | LELEKA_STRA169_RUN_PUBLIC_CANDIDATE_ONLY=yes | LELEKA_STRA169_PAIR_OUTPUT, LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING, LELEKA_STRA169_EXPERT_PROFILE | -| model-assets | leleka-runtime lib | `pinned_new_slowpaths_match_completed_public_output` | assets | LELEKA_STRA169_RUN_PUBLIC_CANDIDATE_ONLY=yes | LELEKA_STRA169_PAIR_OUTPUT, LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING, LELEKA_STRA169_EXPERT_PROFILE | -| model-assets | leleka-runtime lib | `pinned_five_public_cases_one_loaded_owner` | assets | LELEKA_STRA169_RUN_PUBLIC_CANDIDATE_ONLY=yes | LELEKA_STRA169_PAIR_OUTPUT, LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING, LELEKA_STRA169_EXPERT_PROFILE | -| model-assets | leleka-runtime lib | `pinned_five_public_cases_retained_qk_qsa_owner` | assets | LELEKA_STRA169_RUN_PUBLIC_CANDIDATE_ONLY=yes | LELEKA_STRA169_PAIR_OUTPUT, LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING, LELEKA_STRA169_EXPERT_PROFILE | -| model-assets | leleka-runtime lib | `pinned_five_public_cases_resident_owners` | assets | LELEKA_STRA169_RUN_PUBLIC_CANDIDATE_ONLY=yes | LELEKA_STRA169_PAIR_OUTPUT, LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING, LELEKA_STRA169_EXPERT_PROFILE | -| model-assets | leleka-runtime lib | `pinned_single_load_public_native_vs_native_down_outer256_pair` | assets | LELEKA_STRA169_RUN_PUBLIC_NATIVE_DOWN_PAIR=yes | LELEKA_STRA169_PAIR_OUTPUT, LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | -| model-assets | leleka-runtime lib | `pinned_single_load_native_resident_mmq_model_numeric` | assets | LELEKA_STRA169_RUN_NATIVE_RESIDENT_MMQ_MODEL=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | -| model-assets | leleka-runtime lib | `pinned_kar_cached_vs_legacy_same_session_reset_replays_all_logits_and_numeric_state` | assets | (ignore only) | LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_ARCHIVE, LELEKA_STRA169_KAR_STAGING | -| model-assets | leleka-runtime lib | `pinned_artifact_refuses_missing_output_before_layers_without_state_commit` | assets | (ignore only) | LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1 | -| model-assets | leleka-runtime lib | `pinned_artifact_two_tokens_finish_all_layers_and_commit_state` | assets | (ignore only) | LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1 | -| model-assets | leleka-runtime lib | `authentic_scalar_first_mtp_batch_prefix_rejection_cancel_and_cleanup` | assets | LELEKA_STRA169_RUN_MTP_BATCH_NUMERIC=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | -| model-assets | leleka-runtime lib | `pinned_candidate_full_forward_capture_two_public_tokens` | assets | (ignore only) | LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_FD, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_KAR_ARCHIVE, LELEKA_STRA169_KAR_STAGING | -| model-assets | leleka-runtime lib | `pinned_single_load_resident_mmq_model_numeric` | assets | LELEKA_STRA169_RUN_RESIDENT_MMQ_MODEL=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | -| model-assets | leleka-runtime lib | `pinned_single_load_capture_two_combined_reuse_and_chunk_numeric` | assets | LELEKA_STRA169_RUN_SINGLELOAD_PROOF=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING, LELEKA_STRA169_CAPTURE_DIR | -| model-assets | leleka-runtime lib | `pinned_single_load_grouped_certified_chunk_numeric` | assets | LELEKA_STRA169_RUN_GROUPED_CHUNK_PROOF=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | -| model-assets | leleka-runtime --test stra168_full_vocabulary | `prepare_independent_full_vocabulary_fixture` | assets | (ignore only) | (fixture files read via a helper; inspect before running) | -| model-assets | leleka-runtime --test stra168_full_vocabulary | `installed_driver_full_vocabulary_matches_original_and_literal_words` | assets | LELEKA_CUDA_REAL_GPU=1 | LELEKA_HEAD_NATIVE_ORACLE, LELEKA_Q6_TRUSTED_PTX, LELEKA_HEAD_NATIVE_SHA256 | +| model-assets | deploy lib | `pinned_sources_serve_the_pinned_table` | assets | (ignore only) | (fixture files read via a helper; inspect before running) | +| model-assets | deploy lib | `provisions_the_pinned_table_from_upstream` | assets | (ignore only) | (fixture files read via a helper; inspect before running) | +| model-assets | engine-qwen35-cuda lib | `original_serve_replay_smoke` | assets | (ignore only) | LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING, LELEKA_STRA169_KAR_FD, LELEKA_STRA169_KAR_PROVENANCE | +| model-assets | engine-qwen35-cuda lib | `original_serve_laptop_bench` | assets | (ignore only) | LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_KAR_FD, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | +| model-assets | engine-qwen35-cuda lib | `original_serve_memory_smoke` | assets | LELEKA_MEM_SMOKE=yes | LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_KAR_FD, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | +| model-assets | engine-qwen35-cuda lib | `memory_archive_guard_probe` | assets | LELEKA_MEM_SMOKE=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_KAR_PROVENANCE | +| model-assets | engine-qwen35-cuda lib | `original_serve_prefix_cache_smoke` | assets | LELEKA_PFX_SMOKE=yes | LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_KAR_FD, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | +| model-assets | engine-qwen35-cuda lib | `original_serve_smoke_prompt_decode_mtp_verify_commit_reset_cancel_sample` | assets | LELEKA_ORIGINAL_SERVE_SMOKE=yes LELEKA_SMOKE_MAX_CONTEXT=yes LELEKA_SMOKE_PROMPT_CACHE=yes LELEKA_SMOKE_PROMPTS=yes LELEKA_SMOKE_MAX_NEW=yes LELEKA_SMOKE_REPEAT=yes LELEKA_SMOKE_ARMS=yes LELEKA_SMOKE_PROMPT_IDS=yes LELEKA_SMOKE_ORDER=yes LELEKA_SMOKE_MIN_P=yes LELEKA_SMOKE_CHAT=1 LELEKA_SMOKE_FORCE_DIR=yes LELEKA_SMOKE_FORCE_PASSES=yes LELEKA_SMOKE_SAMPLED=1 | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | +| model-assets | engine-qwen35-cuda lib | `original_serve_long_context_streamed_kv_smoke` | assets | LELEKA_ORIGINAL_SERVE_LONG_SMOKE=yes LELEKA_SMOKE_MIN_P=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | +| model-assets | engine-qwen35-cuda lib | `original_serve_conversation_smoke_resume_matches_a_full_read` | assets | LELEKA_ORIGINAL_SERVE_SMOKE=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | +| model-assets | engine-qwen35-cuda lib | `original_serve_conversation_coverage_smoke` | assets | (ignore only) | (fixture files read via a helper; inspect before running) | +| model-assets | engine-qwen35-cuda lib | `original_serve_ttft_sweep` | assets | (ignore only) | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | +| model-assets | engine-qwen35-cuda lib | `pinned_single_load_layer0_and_window_boundaries` | assets | LELEKA_STRA169_RUN_COMBINED_BOUNDARIES=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING, LELEKA_STRA169_LAYER0_DIR | +| model-assets | engine-qwen35-cuda lib | `pinned_combined_kar_mtp_retained_three_plus_two_matches_full_reference_five` | assets | LELEKA_STRA169_RUN_COMBINED_REUSE=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | +| model-assets | engine-qwen35-cuda lib | `pinned_single_load_layer0_native_first_mmq_diagnostic` | assets | LELEKA_STRA169_RUN_LAYER0_MMQ_DIAGNOSTIC=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING, LELEKA_STRA169_LAYER0_DIR | +| model-assets | engine-qwen35-cuda lib | `pinned_five_public_cases_strata_adaptive_slots` | assets | LELEKA_STRA169_RUN_PUBLIC_CANDIDATE_ONLY=yes | LELEKA_STRA169_PAIR_OUTPUT, LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING, LELEKA_STRA169_EXPERT_PROFILE | +| model-assets | engine-qwen35-cuda lib | `pinned_new_slowpaths_match_completed_public_output` | assets | LELEKA_STRA169_RUN_PUBLIC_CANDIDATE_ONLY=yes | LELEKA_STRA169_PAIR_OUTPUT, LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING, LELEKA_STRA169_EXPERT_PROFILE | +| model-assets | engine-qwen35-cuda lib | `pinned_five_public_cases_one_loaded_owner` | assets | LELEKA_STRA169_RUN_PUBLIC_CANDIDATE_ONLY=yes | LELEKA_STRA169_PAIR_OUTPUT, LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING, LELEKA_STRA169_EXPERT_PROFILE | +| model-assets | engine-qwen35-cuda lib | `pinned_five_public_cases_retained_qk_qsa_owner` | assets | LELEKA_STRA169_RUN_PUBLIC_CANDIDATE_ONLY=yes | LELEKA_STRA169_PAIR_OUTPUT, LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING, LELEKA_STRA169_EXPERT_PROFILE | +| model-assets | engine-qwen35-cuda lib | `pinned_five_public_cases_resident_owners` | assets | LELEKA_STRA169_RUN_PUBLIC_CANDIDATE_ONLY=yes | LELEKA_STRA169_PAIR_OUTPUT, LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING, LELEKA_STRA169_EXPERT_PROFILE | +| model-assets | engine-qwen35-cuda lib | `pinned_single_load_public_native_vs_native_down_outer256_pair` | assets | LELEKA_STRA169_RUN_PUBLIC_NATIVE_DOWN_PAIR=yes | LELEKA_STRA169_PAIR_OUTPUT, LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | +| model-assets | engine-qwen35-cuda lib | `pinned_single_load_native_resident_mmq_model_numeric` | assets | LELEKA_STRA169_RUN_NATIVE_RESIDENT_MMQ_MODEL=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | +| model-assets | engine-qwen35-cuda lib | `pinned_single_load_resident_mmq_model_numeric` | assets | LELEKA_STRA169_RUN_RESIDENT_MMQ_MODEL=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | +| model-assets | engine-qwen35-cuda lib | `pinned_single_load_capture_two_combined_reuse_and_chunk_numeric` | assets | LELEKA_STRA169_RUN_SINGLELOAD_PROOF=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING, LELEKA_STRA169_CAPTURE_DIR | +| model-assets | engine-qwen35-cuda lib | `pinned_single_load_grouped_certified_chunk_numeric` | assets | LELEKA_STRA169_RUN_GROUPED_CHUNK_PROOF=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | +| model-assets | engine-qwen35-cuda lib | `pinned_kar_cached_vs_legacy_same_session_reset_replays_all_logits_and_numeric_state` | assets | (ignore only) | LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_ARCHIVE, LELEKA_STRA169_KAR_STAGING | +| model-assets | engine-qwen35-cuda lib | `pinned_artifact_refuses_missing_output_before_layers_without_state_commit` | assets | (ignore only) | LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1 | +| model-assets | engine-qwen35-cuda lib | `pinned_artifact_two_tokens_finish_all_layers_and_commit_state` | assets | (ignore only) | LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1 | +| model-assets | engine-qwen35-cuda lib | `dump_decoded_rows_for_original_comparison` | assets | (ignore only) | LELEKA_PLE_PROBE_ARCHIVE, LELEKA_PLE_PROBE_ROWS | +| model-assets | engine-qwen35-cuda lib | `batch_read_equals_the_sixteen_row_reads` | assets | (ignore only) | LELEKA_PLE_PROBE_ARCHIVE | +| model-assets | engine-qwen35-cuda lib | `authentic_scalar_first_mtp_batch_prefix_rejection_cancel_and_cleanup` | assets | LELEKA_STRA169_RUN_MTP_BATCH_NUMERIC=yes | LELEKA_STRA169_KAR_FD, LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_MTP_PACK, LELEKA_STRA169_MTP_STAGING | +| model-assets | engine-qwen35-cuda lib | `pinned_candidate_full_forward_capture_two_public_tokens` | assets | (ignore only) | LELEKA_STRA169_IQ3S_SHARD0, LELEKA_STRA169_IQ3S_SHARD1, LELEKA_STRA169_KAR_FD, LELEKA_STRA169_KAR_PROVENANCE, LELEKA_STRA169_KAR_ARCHIVE, LELEKA_STRA169_KAR_STAGING | +| model-assets | engine-qwen35-cuda --test stra168_full_vocabulary | `prepare_independent_full_vocabulary_fixture` | assets | (ignore only) | (fixture files read via a helper; inspect before running) | +| model-assets | engine-qwen35-cuda --test stra168_full_vocabulary | `installed_driver_full_vocabulary_matches_original_and_literal_words` | assets | LELEKA_CUDA_REAL_GPU=1 | LELEKA_HEAD_NATIVE_ORACLE, LELEKA_Q6_TRUSTED_PTX, LELEKA_HEAD_NATIVE_SHA256 | +| model-assets | model-format --test kar_extents | `write_a_synthetic_archive_for_the_census_example` | assets | (ignore only) | LELEKA_SYNTH_KAR | | moe-mmq | cuda-driver lib | `strata_prefill_moe_program_runs_in_order_refuses_earliest_and_cleans_up` | device | LELEKA_STRA169_RUN_MOE_PREFILL_BATCH=yes | - | | moe-mmq | cuda-driver lib | `installed_grouped_native_gu18_gu22_matches_actual_scalar_columns` | device | LELEKA_STRA169_RUN_MOE_GROUP=yes | - | | moe-mmq | cuda-driver lib | `scalar_first_grouped_swiglu_down_columns_exact_and_closed_guards` | device | LELEKA_STRA169_RUN_GROUPED_DOWN=yes | - | @@ -339,51 +349,85 @@ variables); **mock**: isolated CPU harness protocol tests, not GPU smokes. | moe-mmq | cuda-driver lib | `original_first_group_workspace_all_products_active_spans_reset_and_cleanup` | device | LELEKA_STRA172_RUN_ROUTED_GROUP_WORKSPACE=yes | - | | moe-mmq | cuda-driver lib | `original_first_routed_resident_pipeline_all_products_refusals_reset_and_cleanup` | device | LELEKA_STRA169_RUN_ROUTED_RESIDENT_QUEUE=yes | - | | moe-mmq | cuda-driver lib | `original_first_complete_routed_finite_stages_reset_and_cleanup` | device | LELEKA_STRA172_RUN_ROUTED_FINITE_GUARD=yes | - | +| moe-mmq | cuda-driver lib | `original_group_stream_k_stress` | device | (ignore only) | - | | moe-mmq | cuda-driver lib | `original_first_complete_greedy_ties_finite_reset_guards_and_cleanup` | device | LELEKA_STRA172_RUN_HEAD_GREEDY=yes | - | | moe-mmq | cuda-driver lib | `original_first_shared_tail_all_products_status_reset_and_cleanup` | device | LELEKA_STRA172_RUN_SHARED_TAIL=yes | - | | mtp | cuda-driver lib | `duplicated_ring_same_attention_reload_append_wrap` | device | LELEKA_STRA169_RUN_MTP_KV_RING_PROOF=yes | - | | mtp | cuda-driver lib | `original_first_mtp_input_prefix_products_status_order_and_cleanup` | device | LELEKA_STRA172_RUN_MTP_INPUT_PREFIX=yes | - | +| mtp | cuda-driver lib | `short_prompts_record_on_the_drafters_own_scalar_owner_not_on_a_standalone_one` | device | LELEKA_MTP_SCALAR_SHORT_GPU=yes | - | | new-pins | cuda-driver lib | `experimental_gpu_fwht256_matches_cpu` | device | (ignore only) | - | | new-pins | cuda-driver lib | `experimental_gpu_q4_append_and_gather_match_cpu` | device | (ignore only) | - | | new-pins | cuda-driver lib | `experimental_gpu_keyless_route_matches_cpu` | device | (ignore only) | - | | new-pins | cuda-driver lib | `experimental_gpu_stream_resolve_copies_missed_blocks` | device | (ignore only) | - | | new-pins | cuda-driver lib | `kar_levels_device_decode_matches_cpu_for_levels_2_to_5` | device | (ignore only) | - | | new-pins | cuda-driver lib | `kar_levels_expert_mlp_matches_cpu_within_tolerance` | device | (ignore only) | - | +| new-pins | cuda-driver lib | `kar_levels_expert_cost_probe` | device | (ignore only) | - | | new-pins | cuda-driver lib | `closed_gpu_poison_fills_the_nan_pattern_and_nothing_else` | device | (ignore only) | - | | new-pins | cuda-driver lib | `closed_gpu_native_flash_attn_matches_the_fp64_specification` | device | (ignore only) | - | | new-pins | cuda-driver lib | `closed_gpu_s_gemv_matches_the_shim_executed_golden` | device | (ignore only) | - | +| pcie-copy | cuda-driver lib | `pcie_copy_gpu_production_pageable` | device | (ignore only) | - | +| pcie-copy | cuda-driver lib | `pcie_copy_gpu_production_page_locked` | device | (ignore only) | - | +| pcie-copy | cuda-driver lib | `pcie_copy_gpu_production_mixed` | device | (ignore only) | - | +| pcie-copy | cuda-driver lib | `pcie_copy_gpu_raw_loop_pageable` | device | (ignore only) | - | +| pcie-copy | cuda-driver lib | `pcie_copy_gpu_raw_loop_page_locked` | device | (ignore only) | - | +| pcie-copy | cuda-driver lib | `pcie_copy_gpu_raw_batch_pageable` | device | (ignore only) | - | +| pcie-copy | cuda-driver lib | `pcie_copy_gpu_raw_batch_page_locked` | device | (ignore only) | - | +| pcie-copy | cuda-driver lib | `pcie_copy_gpu_raw_batch_mixed` | device | (ignore only) | - | +| pcie-copy | cuda-driver lib | `pcie_copy_gpu_bandwidth` | device | (ignore only) | - | | ple | cuda-driver lib | `original_first_whole_ple_queue_causal_history_status_reset_and_cleanup` | device | LELEKA_STRA169_RUN_PLE_CLOSED_QUEUE=yes | - | | ple | cuda-driver lib | `whole_value_matches_original_40_tiles_and_refuses_closed_shapes` | device | (ignore only) | - | +| prefill-stage | cuda-driver lib | `gdn_stage_kernels_equal_the_originals_bit_for_bit` | device | LELEKA_PREFILL_STAGE_GPU=yes | - | +| prefill-stage | cuda-driver lib | `gdn_recurrence_equals_the_original_bit_for_bit` | device | LELEKA_PREFILL_STAGE_GPU=yes | - | +| prefill-stage | cuda-driver lib | `gdn_recurrence_kh_equals_the_original_bit_for_bit` | device | LELEKA_PREFILL_STAGE_GPU=yes | - | +| prefill-stage | cuda-driver lib | `staged_input_equals_the_per_token_kernels_bit_for_bit` | device | LELEKA_PREFILL_STAGE_GPU=yes | - | +| prefill-stage | cuda-driver lib | `gr_fused_guards_equal_the_separate_guard_kernels_bit_for_bit` | device | LELEKA_PREFILL_STAGE_GPU=yes | - | +| prefill-stage | cuda-driver lib | `gr_kernels_run_near_their_traffic_floor_at_chunk_size` | device | LELEKA_PREFILL_STAGE_GPU=yes | - | +| prefill-stage | cuda-driver lib | `deferred_status_equals_the_immediate_evaluation_and_poisons` | device | LELEKA_PREFILL_STAGE_GPU=yes | - | | qsa | cuda-driver lib | `original_first_selected_kv_bytes_attention_reorder_refusals_cleanup` | device | LELEKA_STRA172_RUN_QSA_SELECTED_KV=yes | - | | qsa | cuda-driver lib | `int8_kv_append_kernels_match_the_original_host_reference_bit_exactly` | device | (ignore only) | - | | qsa | cuda-driver lib | `streamed_attention_equals_fully_resident_attention_with_a_20480_cell_window` | device | (ignore only) | - | -| runtime-gdn | leleka-runtime lib | `original_first_retained_whole_qk_repeat_tail_reset_guards_cleanup` | device | LELEKA_STRA169_RUN_GDN_QK_SLOT=yes | - | -| runtime-gdn | leleka-runtime lib | `retained_gdn_chain_matches_legacy_intermediates_and_fences_products` | device | (ignore only) | - | -| runtime-gdn | leleka-runtime lib | `sixty_five_actual_recurrences_finite_and_local_abort_match_same_ptx_reference` | device | LELEKA_STRA169_RUN_GDN_CHUNK_COMPONENT=yes | - | -| runtime-gdn | leleka-runtime lib | `batch_adoption_is_consecutive_atomic_and_swaps_the_final_state_once` | device | LELEKA_STRA169_RUN_GDN_CHUNK_COMPONENT=yes | - | -| runtime-gdn | leleka-runtime lib | `one_input_upload_matches_four_legacy_projections_and_preserves_lease_guards` | device | (ignore only) | - | -| runtime-gdn | leleka-runtime lib | `batch_resources_charge_exactly_scratch_and_status_and_release_everything` | device | LELEKA_STRA169_RUN_GDN_BATCH_RESOURCES=yes | - | -| runtime-gdn | leleka-runtime lib | `queued_gdn_chain_matches_scalar_oracles_refuses_and_cleans_up` | device | (ignore only) | - | -| runtime-gdn | leleka-runtime lib | `mirror_matches_uncached_steps_and_exact_rollback_reset_identity` | device | (ignore only) | - | -| runtime-gdn | leleka-runtime lib | `original_first_three_rows_and_each_accepted_replay_full_state_finite_abort_cleanup` | device | LELEKA_STRA169_RUN_GDN_MTP_JOURNAL=yes | - | -| runtime-gr | leleka-runtime lib | `original_first_fixed_outputs_repeat_overwrite_abort_and_cleanup` | device | LELEKA_STRA169_RUN_GR_OUTPUT_WORKSPACE=yes | - | -| runtime-gr | leleka-runtime lib | `retained_residual_matches_original_read_inject_and_fences_abort_sticky_failure` | device | (ignore only) | - | -| runtime-gr | leleka-runtime lib | `retained_attention_injection_to_ffn_gr_matches_original_host_roundtrip` | device | LELEKA_STRA169_RUN_GR_HANDOFF=yes | - | -| runtime-moe | leleka-runtime lib | `retained_gate_up_matches_legacy_chain_and_closes_failed_candidates` | device | (ignore only) | - | -| runtime-moe | leleka-runtime lib | `retained_down_pack_scale_combine_matches_old_uploads_and_fences_abort` | device | (ignore only) | - | -| runtime-moe | leleka-runtime lib | `original_first_fixed_router_all_logits_routes_repeat_reset_and_cleanup` | device | LELEKA_STRA169_RUN_ROUTER_SCRATCH=yes | - | -| runtime-moe | leleka-runtime lib | `retained_mtp_experts_match_original_s2_shared_and_combine_and_clean_abort` | device | (ignore only) | - | -| runtime-moe | leleka-runtime lib | `original_first_fixed_draft_moe_repeat_abort_and_cleanup` | device | LELEKA_STRA169_RUN_FIXED_DRAFT_MOE=yes | - | -| runtime-mtp | leleka-runtime lib | `retained_mtp_attention_gate_out_matches_legacy_transfers_and_cleans_refusals` | device | (ignore only) | - | -| runtime-mtp | leleka-runtime lib | `retained_final_matches_original_reuploads_and_fences_invocation_abort` | device | (ignore only) | - | -| runtime-ple | leleka-runtime lib | `retained_key_and_whole_value_match_original_40_tiles_and_fence_abort` | device | (ignore only) | - | -| runtime-qsa | leleka-runtime lib | `retained_attention_gate_out_matches_legacy_transfers_and_cleans_refusals` | device | (ignore only) | - | -| runtime-qsa | leleka-runtime lib | `original_first_five_role_qsa_scratch_repeat_finite_refusal_and_cleanup` | device | LELEKA_STRA169_RUN_QSA_ATTENTION_SCRATCH=yes | - | -| runtime-qsa | leleka-runtime lib | `resident_index_transport_matches_uncached_at_190k_and_reset` | device | (ignore only) | - | -| runtime-qsa | leleka-runtime lib | `one_input_upload_matches_five_legacy_projections_and_preserves_lease_guards` | device | (ignore only) | - | +| qsa | cuda-driver lib | `selection_kernels_equal_the_originals_at_long_positions` | device | LELEKA_QSA_LATE_GPU=yes | - | +| qsa | cuda-driver lib | `topk_variants_equal_the_original_and_are_timed` | device | LELEKA_QSA_LATE_GPU=yes | - | +| qsa | cuda-driver lib | `decode_scores_are_timed_next_to_the_topk` | device | LELEKA_QSA_LATE_GPU=yes | - | +| qsa | cuda-driver lib | `a_fresh_journal_needs_the_resolver_before_the_window_and_ensure_keeps_the_epoch` | device | (ignore only) | - | +| qsa | cuda-driver lib | `parked_pages_and_index_rows_round_trip_through_the_owners` | device | (ignore only) | - | +| runtime-gdn | engine-qwen35-cuda lib | `original_first_retained_whole_qk_repeat_tail_reset_guards_cleanup` | device | LELEKA_STRA169_RUN_GDN_QK_SLOT=yes | - | +| runtime-gdn | engine-qwen35-cuda lib | `retained_gdn_chain_matches_legacy_intermediates_and_fences_products` | device | (ignore only) | - | +| runtime-gdn | engine-qwen35-cuda lib | `sixty_five_actual_recurrences_finite_and_local_abort_match_same_ptx_reference` | device | LELEKA_STRA169_RUN_GDN_CHUNK_COMPONENT=yes | - | +| runtime-gdn | engine-qwen35-cuda lib | `batch_adoption_is_consecutive_atomic_and_swaps_the_final_state_once` | device | LELEKA_STRA169_RUN_GDN_CHUNK_COMPONENT=yes | - | +| runtime-gdn | engine-qwen35-cuda lib | `one_input_upload_matches_four_legacy_projections_and_preserves_lease_guards` | device | (ignore only) | - | +| runtime-gdn | engine-qwen35-cuda lib | `batch_resources_charge_exactly_scratch_and_status_and_release_everything` | device | LELEKA_STRA169_RUN_GDN_BATCH_RESOURCES=yes | - | +| runtime-gdn | engine-qwen35-cuda lib | `queued_gdn_chain_matches_scalar_oracles_refuses_and_cleans_up` | device | (ignore only) | - | +| runtime-gdn | engine-qwen35-cuda lib | `mirror_matches_uncached_steps_and_exact_rollback_reset_identity` | device | (ignore only) | - | +| runtime-gdn | engine-qwen35-cuda lib | `original_first_three_rows_and_each_accepted_replay_full_state_finite_abort_cleanup` | device | LELEKA_STRA169_RUN_GDN_MTP_JOURNAL=yes | - | +| runtime-gr | engine-qwen35-cuda lib | `original_first_fixed_outputs_repeat_overwrite_abort_and_cleanup` | device | LELEKA_STRA169_RUN_GR_OUTPUT_WORKSPACE=yes | - | +| runtime-gr | engine-qwen35-cuda lib | `retained_residual_matches_original_read_inject_and_fences_abort_sticky_failure` | device | (ignore only) | - | +| runtime-gr | engine-qwen35-cuda lib | `retained_attention_injection_to_ffn_gr_matches_original_host_roundtrip` | device | LELEKA_STRA169_RUN_GR_HANDOFF=yes | - | +| runtime-moe | engine-qwen35-cuda lib | `retained_gate_up_matches_legacy_chain_and_closes_failed_candidates` | device | (ignore only) | - | +| runtime-moe | engine-qwen35-cuda lib | `retained_down_pack_scale_combine_matches_old_uploads_and_fences_abort` | device | (ignore only) | - | +| runtime-moe | engine-qwen35-cuda lib | `original_first_fixed_router_all_logits_routes_repeat_reset_and_cleanup` | device | LELEKA_STRA169_RUN_ROUTER_SCRATCH=yes | - | +| runtime-moe | engine-qwen35-cuda lib | `retained_mtp_experts_match_original_s2_shared_and_combine_and_clean_abort` | device | (ignore only) | - | +| runtime-moe | engine-qwen35-cuda lib | `original_first_fixed_draft_moe_repeat_abort_and_cleanup` | device | LELEKA_STRA169_RUN_FIXED_DRAFT_MOE=yes | - | +| runtime-moe | engine-qwen35-cuda lib | `the_vram_tier_computes_the_resident_experts_and_leaves_the_misses_bit_identical` | device | LELEKA_EXPERT_TIER_GPU=yes | - | +| runtime-mtp | engine-qwen35-cuda lib | `retained_mtp_attention_gate_out_matches_legacy_transfers_and_cleans_refusals` | device | (ignore only) | - | +| runtime-mtp | engine-qwen35-cuda lib | `retained_final_matches_original_reuploads_and_fences_invocation_abort` | device | (ignore only) | - | +| runtime-ple | engine-qwen35-cuda lib | `retained_key_and_whole_value_match_original_40_tiles_and_fence_abort` | device | (ignore only) | - | +| runtime-qsa | engine-qwen35-cuda lib | `retained_attention_gate_out_matches_legacy_transfers_and_cleans_refusals` | device | (ignore only) | - | +| runtime-qsa | engine-qwen35-cuda lib | `original_first_five_role_qsa_scratch_repeat_finite_refusal_and_cleanup` | device | LELEKA_STRA169_RUN_QSA_ATTENTION_SCRATCH=yes | - | +| runtime-qsa | engine-qwen35-cuda lib | `resident_index_transport_matches_uncached_at_190k_and_reset` | device | (ignore only) | - | +| runtime-qsa | engine-qwen35-cuda lib | `one_input_upload_matches_five_legacy_projections_and_preserves_lease_guards` | device | (ignore only) | - | | seal-loads | cuda-driver lib | `sealed_window_assets_load_on_the_device_and_export_every_named_entry` | device | LELEKA_VERIFY_WINDOW_GPU=yes | - | +| seal-loads | cuda-driver lib | `the_pcie_span_copy_stages_gate_up_down_like_the_dma_path` | device | LELEKA_VERIFY_WINDOW_GPU=yes | - | | seal-loads | cuda-driver lib | `rt_bank_places_every_tensor_and_the_expert_chunks_exactly` | device | LELEKA_MTP_RT_BANK_GPU=yes | - | | seal-loads | cuda-driver lib | `draft_head_gather_matches_a_host_gather_for_each_kernel_width` | device | LELEKA_MTP_RT_BANK_GPU=yes | - | +| serve-probes | cuda-driver --test original_arena_probe | `arena_probe` | device | (ignore only) | - | +| serve-probes | cuda-driver --test original_executor_probe | `executor_probe` | device | (ignore only) | - | +| serve-probes | cuda-driver --test original_serve_preflight_probe | `preflight_00_sealed_asset_report` | device | (ignore only) | - | +| serve-probes | cuda-driver --test original_serve_preflight_probe | `preflight_01_device_limits` | device | (ignore only) | - | +| serve-probes | cuda-driver --test original_serve_preflight_probe | `preflight_10_lazy_constructors` | device | (ignore only) | - | +| serve-probes | cuda-driver --test original_serve_preflight_probe | `preflight_20_prefill_arena` | device | (ignore only) | - | +| serve-probes | cuda-driver --test original_serve_preflight_probe | `preflight_30_synthetic_mtp_full_owner` | device | (ignore only) | - | +| serve-probes | cuda-driver --test original_serve_preflight_probe | `preflight_40_synthetic_verifier_record_all` | device | (ignore only) | - | | transport | cuda-driver lib | `original_three_copies_first_owned_event_triplet_bytes_guards_and_cleanup` | device | LELEKA_STRA169_RUN_OWNED_ASYNC_COPY=yes | - | | transport | cuda-driver lib | `poison_while_pending_retains_registered_owners_and_preserves_the_primary_error` | device | LELEKA_STRA169_RUN_OWNED_ASYNC_COPY=yes | - | | transport | cuda-driver lib | `original_first_owned_gate_up_bytes_products_refusals_and_cleanup` | device | LELEKA_STRA172_RUN_OWNED_GATE_UP_UPLOAD=yes | - | @@ -391,15 +435,23 @@ variables); **mock**: isolated CPU harness protocol tests, not GPU smokes. | transport | cuda-driver lib | `fixed_down_pack_matches_original_upload_and_refuses_before_copy` | device | (ignore only) | - | | transport | cuda-driver --test prepared_routed_gate_up_gpu | `prepared_routed_gate_up_reuses_exact_native_q8_and_refuses_invalid_owners` | device | (ignore only) | - | | transport | cuda-driver --test ple_key_bulk_gpu | `ple_key_full_matrix_matches_160_legacy_tiles_and_exposes_late_nonfinite` | device | (ignore only) | - | +| transport | cuda-driver lib | `original_three_uploads_first_triplet_exact_padding_refusals_cleanup` | device | LELEKA_STRA172_RUN_MMQ_TRIPLET=yes | - | | transport | cuda-driver lib | `owned_readback_original_first_preserves_gdn_extents_and_raw_words` | device | (ignore only) | - | | transport | cuda-driver lib | `checked_subspan_real_copy_preserves_untouched_bytes` | device | (ignore only) | - | -| transport | cuda-driver lib | `original_three_uploads_first_triplet_exact_padding_refusals_cleanup` | device | LELEKA_STRA172_RUN_MMQ_TRIPLET=yes | - | +| transport | cuda-driver lib | `device_slab_views_keep_their_bytes_apart_and_charge_only_the_slab` | device | (ignore only) | - | +| transport | cuda-driver lib | `mapped_file_dma_under_working_set_trimming_is_exact` | device | (ignore only) | - | +| transport | cuda-driver lib | `mapped_table_alias_reads_the_host_bytes_and_costs_no_device_memory` | device | (ignore only) | - | +| transport | cuda-driver lib | `native_embed_table_alias_reads_the_same_bytes_and_costs_no_device_memory` | device | (ignore only) | - | Group order and dependencies (`run_gpu_smokes.sh --list`): `driver-basic` first (libcuda, device 0, the fixed kernels); `seal-loads` (needs step c: the sealed window PTX and the RT bank load on the card), `new-pins` (experimental KV/keyless/cvec and KAR level decode vs CPU references; fail closed until sealed) and `transport` depend on it; `gr`, `gdn`, `moe-mmq`, -`qsa`, `ple`, `mtp` depend on `transport`; `dispatch` on `gr`+`gdn`; `runtime-*` on their driver group. +`qsa`, `ple`, `mtp` depend on `transport`; `dispatch` and `prefill-stage` on `gr`+`gdn`; `pcie-copy` on `driver-basic`; +`serve-probes` on `seal-loads`; `runtime-*` on their driver group. `cpu-probes` (kind `cpu`: benchmarks, scale simulations and +timing probes of the CPU crates, no GPU) is left out of the default device run; select it with `--groups cpu-probes`. +`misc-device` is the fallback for a new smoke nobody has placed: a unit test keeps it empty, so give each new smoke a group in +`scripts/gpu-bringup/smoke-groups.json`. ```sh ssh $HOST; cd $R; . ~/.cargo/env diff --git a/docs/memory-safety.md b/docs/memory-safety.md index a007b7f5..3a581d4d 100644 --- a/docs/memory-safety.md +++ b/docs/memory-safety.md @@ -288,7 +288,7 @@ Everything is built in WSL (tar/rsync of the tracked files, never on the server) cargo test -p leleka-memory # parsers, planner, state machine, governor, mapping/mlock, flatness (67 tests) cargo +nightly miri test -p leleka-memory --lib # the same pure modules under Miri cargo test -p strata-control --test memory_gate_http # gate 503 + Retry-After, engine-side refusal, 600-request soak (threads/fds/RSS flat) -cargo test -p leleka-runtime --lib original_serve_stack::prefix # shed/restore and the churn test under random shed directives +cargo test -p leleka-engine-qwen35-cuda --lib original_serve_stack::prefix # shed/restore and the churn test under random shed directives cargo test -p leleka-deploy # profiles carry the memory section # swap A/B under real pressure, fenced into one cgroup (root; WSL2 or a test box) @@ -297,13 +297,13 @@ sudo ARMS="A B C" HOG_RELEASE=20 SWAP_AB_BIN=target/release/examples/swap_ab scr --memfd-mib 6144 --hog-mib 5120 --limit-mib 9216 --secs 60 --reader /path/to/a/12GiB/file # real model on the 5090, through the serial holder queue (one model process at a time) -cargo test --release -p leleka-runtime --lib --no-run # the binary; copy it to ~/work/leleka-mem-bin/ +cargo test --release -p leleka-engine-qwen35-cuda --lib --no-run # the binary; copy it to ~/work/leleka-mem-bin/ cp scripts/memory/jobs/* ~/work/mem-jobs/ # then: cp ~/work/mem-jobs/91x-*.sh ~/work/gpu-runs/holder2/jobs/ # 910 archive probe (model-free, real 55 GB memfd + competing reader), 911 inventory (idle / 180k / prefix full), 912 soak (220 requests), # 913 shed path, 917 reader (decode speed and memfd residency next to a page-cache reader) # real model on the laptop (WSL2, RTX 3080): the same smoke with the laptop profile -cargo test --release -p leleka-runtime --features sm86 --lib --no-run +cargo test --release -p leleka-engine-qwen35-cuda --features sm86 --lib --no-run bash scripts/memory/laptop_run.sh LABEL ~/laptop/BIN LELEKA_MEM_SCENARIO=inventory LELEKA_MEM_TOKENS=24000 LELEKA_MEM_PREFIX_MIB=auto ``` diff --git a/docs/original-serve.md b/docs/original-serve.md index 5c920fc6..4b0e7230 100644 --- a/docs/original-serve.md +++ b/docs/original-serve.md @@ -86,7 +86,7 @@ is built for exactly one capacity; without a loan the prompt path has no cache h from a lent prefix); `expert_cache_cpu_order`, remote caches, layer splits and the resident RAM mode are not ported (`cpu_order` only concerns the S2 hit kernel, not native packs). -Proof without a model: `LELEKA_EXPERT_TIER_GPU=yes cargo test -p leleka-runtime --lib -- --ignored +Proof without a model: `LELEKA_EXPERT_TIER_GPU=yes cargo test -p leleka-engine-qwen35-cuda --lib -- --ignored original_serve_residency_gpu` (synthetic IQ4_XS/IQ4_NL experts: placement, bit-identical CPU entries, GPU entries within 3e-2 relative L1 of the CPU path; RTX 5090 2026-10-16: worst 1.155e-2). Not yet run on a device: the PCIe DMA share and adaptive swaps (they need the registered model bank), and every real-model run. @@ -167,7 +167,7 @@ LELEKA_STRA169_KAR_FD=… LELEKA_STRA169_KAR_PROVENANCE=… \ LELEKA_STRA169_IQ3S_SHARD0=… LELEKA_STRA169_IQ3S_SHARD1=… \ LELEKA_STRA169_MTP_PACK=… LELEKA_STRA169_MTP_STAGING=… \ [LELEKA_ORIGINAL_SERVE_RT_DIR=…] [LELEKA_ORIGINAL_SERVE_CAPACITY=1024] [LELEKA_ORIGINAL_SERVE_BUDGET_GIB=28] \ -cargo test -p leleka-runtime --features cuda-driver -- --ignored original_serve_smoke +cargo test -p leleka-engine-qwen35-cuda -- --ignored original_serve_smoke ``` The long-context variant (`original_serve_long_context_streamed_kv_smoke`, `LELEKA_ORIGINAL_SERVE_LONG_SMOKE=yes`, diff --git a/docs/prefix-cache.md b/docs/prefix-cache.md index cb7ebd9c..4e0340b4 100644 --- a/docs/prefix-cache.md +++ b/docs/prefix-cache.md @@ -351,7 +351,7 @@ tokens average do not fit in 13 GB: the cache keeps the sessions it can and reje ## Tests -* Model-free (`cargo test -p leleka-runtime --lib prefix`): hash chain (pinned values), budget profiles and parsing, store +* Model-free (`cargo test -p leleka-engine-core -p leleka-engine-qwen35-cuda --lib prefix`: the hash chain, budget and store tests are in `leleka-engine-core`, the orchestrator tests in `leleka-engine-qwen35-cuda`): hash chain (pinned values), budget profiles and parsing, store (sharing, refcounts, collisions, eviction by value, caps, thinning, budget enforcement, orphans), the orchestrator over a fake device whose positional buffer is a token per cell (cross-session resume, interleaving, copy-only-what-the-buffer-lost, cancellation, failed import, budget, low host memory, pool queries) and `PromptPlan` grid cuts. diff --git a/docs/windows.md b/docs/windows.md index 0eea581a..cc120d53 100644 --- a/docs/windows.md +++ b/docs/windows.md @@ -509,7 +509,7 @@ Branch `claude/upstream-speed` (docs/upstream-port-plan.md rows 3.1, 2.3, 0.6). | `LELEKA_CB_WARMUP=off` | Linux only; Windows has no such code path (CPU sets are per thread) | n/a here | Build (the `sm86` companions as in the Build section; the branch only adds Rust and docs): `powershell -ExecutionPolicy Bypass -File scripts\windows\build-release.ps1`, or for the replay harness -`cargo test --release -p leleka-runtime --features sm86 --lib --no-run` and use the printed `leleka_runtime-*.exe` as `TEST_BIN`. +`cargo test --release -p leleka-engine-qwen35-cuda --features sm86 --lib --no-run` and use the printed `leleka_engine_qwen35_cuda-*.exe` as `TEST_BIN`. Paired A/B on the laptop (one variable at a time, same model digest, same cache state, same prompts; ABBA order, at least 6 requests per arm, record tokens, tok/s per request, the `expert tier:` line and the engine's `leleka-serve: ... route tail skip` line): diff --git a/scripts/chain/build_rt.sh b/scripts/chain/build_rt.sh index 20d417f5..d2e26f9b 100644 --- a/scripts/chain/build_rt.sh +++ b/scripts/chain/build_rt.sh @@ -17,7 +17,7 @@ rm -rf ~/chain-src && mkdir -p ~/chain-src ~/chain-bin && tar -xf '$tar_wsl' -C cd ~/chain-src export CARGO_TARGET_DIR=\$HOME/chain-target nice -n 10 cargo test --no-run --locked --release -p leleka-engine-qwen35-cuda --lib $* 2>&1 | tee ~/chain-build-$tag.log | grep -E 'Executable|^error|warning: unused' | tail -5 -exe=\$(grep -o 'target/release/deps/leleka_runtime-[0-9a-f]*' ~/chain-build-$tag.log | tail -1) +exe=\$(grep -o 'target/release/deps/leleka_engine_qwen35_cuda-[0-9a-f]*' ~/chain-build-$tag.log | tail -1) cp \$CARGO_TARGET_DIR/\${exe#target/} ~/chain-bin/rt-$tag cp ~/chain-bin/rt-$tag /mnt/c/Users/pavel/work/chain-bin-rt-$tag ls -la ~/chain-bin/rt-$tag diff --git a/scripts/ci-coverage.json b/scripts/ci-coverage.json index a004d4fc..19c339ac 100644 --- a/scripts/ci-coverage.json +++ b/scripts/ci-coverage.json @@ -19,6 +19,9 @@ "strata-control", "strata-desktop-core", "leleka-cuda-driver", + "leleka-engine-core", + "leleka-engine-fake", + "leleka-engine-qwen35-cuda", "leleka-runtime", "leleka-native-cpu-expert", "leleka-cpu-kernels", diff --git a/scripts/decode-sm120/build_rt.sh b/scripts/decode-sm120/build_rt.sh index d6e207b1..17469984 100644 --- a/scripts/decode-sm120/build_rt.sh +++ b/scripts/decode-sm120/build_rt.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Build the leleka-runtime test binary (the replay smoke) of THIS worktree in WSL (never on the server). +# Build the leleka-engine-qwen35-cuda test binary (the replay smoke) of THIS worktree in WSL (never on the server). # scripts/decode-sm120/build_rt.sh TAG run from Git Bash in the worktree # Result: WSL ~/sm120-stack/rt-TAG; copy to rnr5090:/data/leleka-e2e/sm120/rt-TAG. set -euo pipefail @@ -15,8 +15,8 @@ export PATH=\$HOME/cuda-toolkits/13.2.2/bin:\$HOME/.cargo/bin:/usr/local/bin:/us rm -rf ~/sm120-src-rt && mkdir -p ~/sm120-src-rt ~/sm120-stack && tar -xf '$tar_wsl' -C ~/sm120-src-rt cd ~/sm120-src-rt export CARGO_TARGET_DIR=\$HOME/sm120-target-rel -nice -n 10 cargo test --no-run --locked --release -p leleka-runtime --lib > ~/sm120-stack/build-rt-$tag.log 2>&1 -exe=\$(grep -o 'release/deps/leleka_runtime-[0-9a-f]*' ~/sm120-stack/build-rt-$tag.log | tail -1) +nice -n 10 cargo test --no-run --locked --release -p leleka-engine-qwen35-cuda --lib > ~/sm120-stack/build-rt-$tag.log 2>&1 +exe=\$(grep -o 'release/deps/leleka_engine_qwen35_cuda-[0-9a-f]*' ~/sm120-stack/build-rt-$tag.log | tail -1) cp \$CARGO_TARGET_DIR/\$exe ~/sm120-stack/rt-$tag sha256sum ~/sm120-stack/rt-$tag " diff --git a/scripts/e2e/hexagonal/arch-install.sh b/scripts/e2e/hexagonal/arch-install.sh index 11ebd1ee..cbc2c6cd 100644 --- a/scripts/e2e/hexagonal/arch-install.sh +++ b/scripts/e2e/hexagonal/arch-install.sh @@ -3,7 +3,7 @@ # # bash arch-install.sh BASE_DIR CAND_DIR BASE_RT CAND_RT # BASE_DIR / CAND_DIR directories that hold leleka-inference leleka-daemon leleka-cli strata-next (main and the branch) -# BASE_RT / CAND_RT the release test binaries of leleka-runtime (cargo test --no-run --release -p leleka-runtime --lib) +# BASE_RT / CAND_RT the release test binaries of leleka-runtime (cargo test --no-run --release --lib, with -p leleka-runtime on a tree before STRA-338 S22 and -p leleka-engine-qwen35-cuda after it) # # Result under /data/leleka-e2e/hexagonal (the task's own directory; nothing outside it is written): # tools/ draftround-id.sh draftround-ab.sh draftround-idcmp.py ts-wrap.sh (DR=...) diff --git a/scripts/gpu-bringup/regress_3080.sh b/scripts/gpu-bringup/regress_3080.sh index d1ac9f8d..9d0662e5 100755 --- a/scripts/gpu-bringup/regress_3080.sh +++ b/scripts/gpu-bringup/regress_3080.sh @@ -13,7 +13,7 @@ # Items (in this order): # companions sm86_assets.py check (committed sm_86 set matches the sealed sm_120 PTX; no toolkit needed) # unit-driver cargo test -p leleka-cuda-driver --features cuda-driver,sm86 --lib (non-ignored) -# unit-runtime same for leleka-runtime --features sm86 +# unit-runtime same for leleka-engine-qwen35-cuda --features sm86 # build-binaries release build of leleka-inference/leleka-daemon/leleka-cli with --features sm86 # smoke: the 18 model-free run_gpu_smokes.sh groups (SMOKE_SM86=1, --release) # probe-arena original_arena_probe (PROBE_CAPACITY, PROBE_BUDGET_GIB) @@ -134,7 +134,7 @@ nvidia-smi --query-gpu=name,compute_cap,memory.total,memory.used --format=csv,no # ------------------------------------------------------------------ items item companions python3 -B scripts/gpu-bringup/sm86_assets.py check item unit-driver cargo test --locked --release -p leleka-cuda-driver --features cuda-driver,sm86 --lib -item unit-runtime cargo test --locked --release -p leleka-runtime --features sm86 --lib +item unit-runtime cargo test --locked --release -p leleka-engine-qwen35-cuda --features sm86 --lib item build-binaries cargo build --locked --release -p strata-desktop-core --features sm86 --bins # smoke groups: one run of the repo's runner (it orders groups by dependency), reported per group diff --git a/scripts/gpu-bringup/remote_sync.sh b/scripts/gpu-bringup/remote_sync.sh index ff0608e1..e10eef42 100755 --- a/scripts/gpu-bringup/remote_sync.sh +++ b/scripts/gpu-bringup/remote_sync.sh @@ -129,8 +129,8 @@ echo "== release build: leleka-cli leleka-daemon leleka-inference" ${nice}cargo build --release --locked $jf -p strata-desktop-core --bin leleka-cli --bin leleka-daemon --bin leleka-inference echo "== test binaries (not run): cuda-driver with --features cuda-driver" ${nice}cargo test --no-run --locked $jf $test_profile -p leleka-cuda-driver --features cuda-driver -echo "== test binaries (not run): leleka-runtime" -${nice}cargo test --no-run --locked $jf $test_profile -p leleka-runtime +echo "== test binaries (not run): leleka-engine-qwen35-cuda" +${nice}cargo test --no-run --locked $jf $test_profile -p leleka-engine-qwen35-cuda echo "== test binaries (not run): native-cpu-expert (build.rs has no C++ step; Rust only)" ${nice}cargo test --no-run --locked $jf $test_profile -p leleka-native-cpu-expert echo "== digests" diff --git a/scripts/gpu-bringup/run_gpu_smokes.sh b/scripts/gpu-bringup/run_gpu_smokes.sh index 4f899478..87b59ba0 100755 --- a/scripts/gpu-bringup/run_gpu_smokes.sh +++ b/scripts/gpu-bringup/run_gpu_smokes.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Run the #[ignore]d Root-only GPU smokes of leleka-cuda-driver / leleka-runtime on the RTX 5090 host. +# Run the #[ignore]d Root-only GPU smokes of leleka-cuda-driver / leleka-engine-qwen35-cuda on the RTX 5090 host. # # run_gpu_smokes.sh --list # table of every smoke, its group, env flags, needs # run_gpu_smokes.sh --plan [--groups a,b] # print the cargo commands, run nothing (works on macOS) @@ -23,7 +23,7 @@ # Environment: SMOKE_TIMEOUT (seconds per test, default 900), CARGO_PROFILE_FLAG (default empty = debug; use # --release only if remote_sync.sh built with it), RUN_DIR via --run-dir. # SMOKE_SM86=1 adds the `sm86` cargo feature (sm_86 companions of the sealed PTX, docs/sm86-assets.md) to the -# leleka-cuda-driver and leleka-runtime test builds: for an RTX 30-series card such as the laptop RTX 3080 (cc 8.6). +# leleka-cuda-driver and leleka-engine-qwen35-cuda test builds: for an RTX 30-series card such as the laptop RTX 3080 (cc 8.6). set -euo pipefail here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" @@ -45,7 +45,7 @@ sm86="${SMOKE_SM86:-0}" # features for a package: the inventory's, plus `sm86` for the packages that have it when SMOKE_SM86=1 features_for() { # pkg features -> features string, or "-" for none local pkg="$1" f="$2" - if [[ "$sm86" == 1 && ( "$pkg" == leleka-cuda-driver || "$pkg" == leleka-runtime ) ]]; then + if [[ "$sm86" == 1 && ( "$pkg" == leleka-cuda-driver || "$pkg" == leleka-engine-qwen35-cuda ) ]]; then if [[ "$f" == "-" ]]; then f="sm86"; else f="$f,sm86"; fi fi printf '%s' "$f" diff --git a/scripts/gpu-bringup/smoke-groups.json b/scripts/gpu-bringup/smoke-groups.json index b4a04b11..d24257ef 100644 --- a/scripts/gpu-bringup/smoke-groups.json +++ b/scripts/gpu-bringup/smoke-groups.json @@ -47,7 +47,7 @@ "depends_on": [ "driver-basic" ], - "desc": "owned copies, readback, fixed packing, matrix/upload transports (synthetic data)", + "desc": "owned copies, readback, fixed packing, matrix/upload transports, device slab views, mapped-table aliases (synthetic data)", "match": [ "async_owned_copy_gpu\\.rs::", "owned_gate_up_upload_gpu\\.rs::", @@ -56,7 +56,11 @@ "prepared_routed_gate_up_gpu\\.rs::", "ple_key_bulk_gpu\\.rs::", "crates/cuda-driver/src/lib\\.rs::", - "crates/cuda-driver/src/mmq\\.rs::" + "crates/cuda-driver/src/mmq\\.rs::", + "crates/cuda-driver/src/tests\\.rs::", + "device_slab/tests\\.rs::", + "mapped_file_dma_stress_gpu\\.rs::", + "native_head\\.rs::" ] }, { @@ -110,10 +114,12 @@ "depends_on": [ "transport" ], - "desc": "QSA selected-KV proof; INT8 KV append bit-exactness and KV streaming (resolve, miss copy, staging) vs fully resident attention", + "desc": "QSA selected-KV proof; late-position selection/top-k, mapped journal; INT8 KV append bit-exactness and KV streaming (resolve, miss copy, staging) vs fully resident", "match": [ "qsa_selected_kv\\.rs::", - "kv_stream_gpu\\.rs::" + "kv_stream_gpu\\.rs::", + "qsa_late_gpu\\.rs::", + "qsa_mapped_journal\\.rs::" ] }, { @@ -137,7 +143,8 @@ "desc": "MTP dense KV ring and input-prefix proofs", "match": [ "mtp_dense_kv_ring_gpu\\.rs::", - "mtp_input_workspace_gpu\\.rs::" + "mtp_input_workspace_gpu\\.rs::", + "mtp_original_scalar_short_gpu\\.rs::" ] }, { @@ -147,9 +154,9 @@ "gr", "gdn" ], - "desc": "qwen_dispatch queued GR completion and GDN whole products", + "desc": "qwen_dispatch queued GR completion and GDN whole products (installed-driver proofs in qwen_dispatch/)", "match": [ - "qwen_dispatch\\.rs::" + "qwen_dispatch(/[a-z_]+)?\\.rs::" ] }, { @@ -158,9 +165,9 @@ "depends_on": [ "gr" ], - "desc": "leleka-runtime GR proofs", + "desc": "leleka-engine-qwen35-cuda GR proofs", "match": [ - "leleka-runtime/src/qwen_forward/gr[a-z_]*\\.rs::" + "engine-qwen35-cuda/src/qwen_forward/gr[a-z_]*\\.rs::" ] }, { @@ -169,9 +176,9 @@ "depends_on": [ "gdn" ], - "desc": "leleka-runtime GDN proofs", + "desc": "leleka-engine-qwen35-cuda GDN proofs", "match": [ - "leleka-runtime/src/qwen_forward/gdn_[a-z_]*\\.rs::" + "engine-qwen35-cuda/src/qwen_forward/gdn_[a-z_]*\\.rs::" ] }, { @@ -180,11 +187,12 @@ "depends_on": [ "moe-mmq" ], - "desc": "leleka-runtime MoE/router/expert proofs", + "desc": "leleka-engine-qwen35-cuda MoE/router/expert proofs, expert tier residency", "match": [ - "leleka-runtime/src/qwen_forward/moe_[a-z_]*\\.rs::", - "leleka-runtime/src/qwen_forward/router_scratch_gpu\\.rs::", - "leleka-runtime/src/qwen_forward/mtp_expert_[a-z_]*\\.rs::" + "engine-qwen35-cuda/src/qwen_forward/moe_[a-z_]*\\.rs::", + "engine-qwen35-cuda/src/qwen_forward/router_scratch_gpu\\.rs::", + "engine-qwen35-cuda/src/qwen_forward/mtp_expert_[a-z_]*\\.rs::", + "engine-qwen35-cuda/src/qwen_forward/original_serve_residency_gpu\\.rs::" ] }, { @@ -193,9 +201,9 @@ "depends_on": [ "qsa" ], - "desc": "leleka-runtime QSA proofs", + "desc": "leleka-engine-qwen35-cuda QSA proofs", "match": [ - "leleka-runtime/src/qwen_forward/qsa_[a-z_]*\\.rs::" + "engine-qwen35-cuda/src/qwen_forward/qsa_[a-z_]*\\.rs::" ] }, { @@ -204,9 +212,9 @@ "depends_on": [ "ple" ], - "desc": "leleka-runtime PLE proofs", + "desc": "leleka-engine-qwen35-cuda PLE proofs", "match": [ - "leleka-runtime/src/qwen_forward/ple_[a-z_]*\\.rs::" + "engine-qwen35-cuda/src/qwen_forward/ple_[a-z_]*\\.rs::" ] }, { @@ -215,9 +223,56 @@ "depends_on": [ "mtp" ], - "desc": "leleka-runtime MTP proofs", + "desc": "leleka-engine-qwen35-cuda MTP proofs", "match": [ - "leleka-runtime/src/qwen_forward/mtp_[a-z_]*\\.rs::" + "engine-qwen35-cuda/src/qwen_forward/mtp_[a-z_]*\\.rs::" + ] + }, + { + "name": "prefill-stage", + "kind": "device", + "depends_on": [ + "gr", + "gdn" + ], + "desc": "prefill stage kernels (GDN, GR, staged input) bit-for-bit against the originals; deferred status (LELEKA_PREFILL_STAGE_GPU=yes)", + "match": [ + "prefill_stage[a-z_]*_gpu\\.rs::", + "deferred_status_gpu\\.rs::" + ] + }, + { + "name": "pcie-copy", + "kind": "device", + "depends_on": [ + "driver-basic" + ], + "desc": "host-to-device copy paths (production, raw loop, raw batch; pageable, page-locked, mixed) and a bandwidth measurement; the page-locked/mixed raw-batch cases fail with error 700 on the RTX 3080 laptop under Windows", + "match": [ + "original_pcie_copy_gpu_smoke\\.rs::" + ] + }, + { + "name": "serve-probes", + "kind": "device", + "depends_on": [ + "seal-loads" + ], + "desc": "GPU bring-up probes of the Original serve path without a model: arena, executor, preflight (sealed asset report, device limits, lazy constructors, prefill arena, synthetic MTP owner and verifier)", + "match": [ + "crates/cuda-driver/tests/original_(arena|executor|serve_preflight)_probe\\.rs::" + ] + }, + { + "name": "cpu-probes", + "kind": "cpu", + "depends_on": [], + "desc": "CPU-only #[ignore] benchmarks, scale simulations and timing probes (no GPU); excluded from the default device run, select with --groups cpu-probes", + "match": [ + "crates/native-cpu-expert/", + "crates/engine-core/", + "kar_ple_cache\\.rs::scan_against_queue", + "original_serve_residency/tests\\.rs::" ] }, { diff --git a/scripts/gpu-bringup/smoke_inventory.py b/scripts/gpu-bringup/smoke_inventory.py index 29267f2f..411223e6 100755 --- a/scripts/gpu-bringup/smoke_inventory.py +++ b/scripts/gpu-bringup/smoke_inventory.py @@ -30,14 +30,25 @@ GROUPS_FILE = HERE / "smoke-groups.json" TABLE_START = "" TABLE_END = "" -CRATE_PACKAGE = {"cuda-driver": "leleka-cuda-driver", "leleka-runtime": "leleka-runtime", "native-cpu-expert": "leleka-native-cpu-expert", - "context": "leleka-context"} +# crate directory under crates/ -> cargo package (`cargo test -p`); the directory name is the fallback +CRATE_PACKAGE = { + "cuda-driver": "leleka-cuda-driver", + "engine-core": "leleka-engine-core", + "engine-qwen35-cuda": "leleka-engine-qwen35-cuda", + "model-format": "leleka-model-format", + "native-cpu-expert": "leleka-native-cpu-expert", + "deploy": "leleka-deploy", + "context": "leleka-context", +} CRATE_FEATURES = {"cuda-driver": "cuda-driver"} GATE_WORDS = ("_RUN_", "_GPU", "REAL_GPU", "ENABLE", "MOCK_HARNESS", "RT_BANK_GPU", "_SMOKE") -ASSET_WORDS = ("SHARD", "PACK", "STAGING", "KAR_FD", "KAR_ARCHIVE", "PROVENANCE", "REFERENCE", "METADATA", "LAYER0_DIR", "CAPTURE_DIR", - "EVIDENCE", "ORACLE", "TRUSTED_PTX", "REAL_INPUT", "GPU_ROOT", "PAIR_OUTPUT", "EXPERT_PROFILE", "NATIVE_ORACLE", - "FAMILY_MODES", "FAMILY_NATIVE", "FAMILY_QUANTIZER_PTX", "FAMILY_R", "HEAD_NATIVE") +ASSET_WORDS = ( + "SHARD", "PACK", "STAGING", "KAR_FD", "KAR_ARCHIVE", "PROVENANCE", "REFERENCE", "METADATA", "LAYER0_DIR", + "CAPTURE_DIR", "EVIDENCE", "ORACLE", "TRUSTED_PTX", "REAL_INPUT", "GPU_ROOT", "PAIR_OUTPUT", "EXPERT_PROFILE", + "NATIVE_ORACLE", "FAMILY_MODES", "FAMILY_NATIVE", "FAMILY_QUANTIZER_PTX", "FAMILY_R", "HEAD_NATIVE", + "PROBE_ARCHIVE", "PROBE_ROWS", "SYNTH_KAR", +) DEFAULT_VALUE = {"LELEKA_CUDA_REAL_GPU": "1", "LELEKA_FAMILY_REAL_GPU": "1"} @@ -117,43 +128,84 @@ def _value_for(var: str, text: str, file_text: str, consts: Dict[str, str]) -> s return DEFAULT_VALUE.get(var, "yes") +def _module_family(path: Path) -> List[Path]: + """The file plus the rest of its module tree: `x.rs` with the children in `x/` (helpers moved out of a test file + by a split stay visible to it), or `x/y.rs` with its parent `x.rs` and siblings.""" + owner = path.parent.parent / (path.parent.name + ".rs") + root = owner if owner.is_file() else path + kids = sorted(root.with_suffix("").rglob("*.rs")) if root.with_suffix("").is_dir() else [] + return [root] + [k for k in kids if k != root] + + +def _calls(body: str, names: List[str]) -> bool: + return any(re.search(r"\b" + re.escape(n) + r"\s*\(", body) for n in names) + + +def _file_readers(texts: List[str]) -> List[str]: + """Non-test helper functions (in any file of the module tree) that open files, directly or through another + helper: a split may leave the test calling `fixture()` while only `read()` touches the file.""" + helpers: Dict[str, str] = {} + for text in texts: + for fm in _FN_RE.finditer(text): + if not _IGNORE_RE.search(text[max(0, fm.start() - 200) : fm.start()]): + helpers[fm.group(1)] = helpers.get(fm.group(1), "") + _body(text, fm.start()) + readers = [n for n, body in helpers.items() if _READS_FILES.search(body)] + for _ in range(3): + more = [n for n, body in helpers.items() if n not in readers and _calls(body, readers)] + if not more: + break + readers += more + return readers + + +def _classify(body: str, gates: Dict[str, str], needs: List[str], readers: List[str]) -> tuple: + """(class, needs) of one smoke from its enabling variables and the file-reading helpers it calls.""" + if "LELEKA_CUDA_MOCK_HARNESS" in gates and not any("REAL_GPU" in g for g in gates): + return "mock", needs + if needs: + return "assets", needs + if _calls(body, readers): + # synthetic-looking, but a helper it calls opens files: the fixture may be a private artifact + return "assets", ["(fixture files read via a helper; inspect before running)"] + return "device", needs + + +def _enabling(body: str, text: str, consts: Dict[str, str]) -> tuple: + """(gates, needs) of one test body: enabling variables with their values, and caller-supplied path variables.""" + use = _vars_in(body, consts) # no file-level fallback: large files (lib.rs) mention gates of unrelated tests + gates = {v: _value_for(v, body, text, consts) for v in use if any(w in v for w in GATE_WORDS)} + return gates, [v for v in use if v not in gates and any(w in v for w in ASSET_WORDS)] + + +def _read(path: Path) -> str: + return path.read_text(encoding="utf-8", errors="replace") + + +def _smokes_in(path: Path, root: Path) -> List[Smoke]: + text = _read(path) + rel = path.relative_to(root) + target = f"test:{path.stem}" if len(rel.parts) > 3 and rel.parts[2] == "tests" else "lib" + family = [_read(p) for p in _module_family(path)] + consts = dict(_CONST_RE.findall("\n".join(family))) + readers = _file_readers(family) + out: List[Smoke] = [] + for m in _IGNORE_RE.finditer(text): + fm = _FN_RE.search(text, m.end()) + if fm: + body = _body(text, fm.start()) + gates, needs = _enabling(body, text, consts) + klass, needs = _classify(body, gates, needs, readers) + out.append(Smoke(crate=rel.parts[1], file=str(rel), line=text.count("\n", 0, m.start()) + 1, + name=fm.group(1), reason=m.group(1) or "", target=target, gates=gates, needs=needs, + klass=klass)) + return out + + def scan(root: Path) -> List[Smoke]: out: List[Smoke] = [] for path in sorted((root / "crates").rglob("*.rs")): - if "target" in path.parts: - continue - text = path.read_text(encoding="utf-8", errors="replace") - if "#[ignore" not in text: - continue - rel = path.relative_to(root) - crate = rel.parts[1] - target = f"test:{path.stem}" if len(rel.parts) > 3 and rel.parts[2] == "tests" else "lib" - consts = dict(_CONST_RE.findall(text)) - file_vars = _vars_in(text, consts) - file_readers = [fm.group(1) for fm in _FN_RE.finditer(text) - if _READS_FILES.search(_body(text, fm.start())) and not _IGNORE_RE.search(text[max(0, fm.start() - 200) : fm.start()])] - for m in _IGNORE_RE.finditer(text): - fm = _FN_RE.search(text, m.end()) - if not fm: - continue - body = _body(text, fm.start()) - vars_body = _vars_in(body, consts) - gates_body = [v for v in vars_body if any(w in v for w in GATE_WORDS)] - use = vars_body # no file-level fallback: large files (lib.rs) mention gates of unrelated tests - gates = {v: _value_for(v, body, text, consts) for v in use if any(w in v for w in GATE_WORDS)} - needs = [v for v in use if v not in gates and any(w in v for w in ASSET_WORDS)] - klass = "device" - real = any("REAL_GPU" in g for g in gates) - if "LELEKA_CUDA_MOCK_HARNESS" in gates and not real: - klass = "mock" - elif needs: - klass = "assets" - elif any(re.search(r"\b" + re.escape(h) + r"\s*\(", body) for h in file_readers): - # synthetic-looking, but a helper it calls opens files: the fixture may be a private artifact - klass = "assets" - needs = ["(fixture files read via a helper; inspect before running)"] - out.append(Smoke(crate=crate, file=str(rel), line=text.count("\n", 0, m.start()) + 1, name=fm.group(1), - reason=m.group(1) or "", target=target, gates=gates, needs=needs, klass=klass)) + if "target" not in path.parts and "#[ignore" in _read(path): + out += _smokes_in(path, root) by_target: Dict[tuple, List[Smoke]] = {} for s in out: by_target.setdefault((s.crate, s.target), []).append(s) diff --git a/scripts/gpu-bringup/tests/test_gpu_bringup.py b/scripts/gpu-bringup/tests/test_gpu_bringup.py index 9266ff02..d2101830 100644 --- a/scripts/gpu-bringup/tests/test_gpu_bringup.py +++ b/scripts/gpu-bringup/tests/test_gpu_bringup.py @@ -936,7 +936,7 @@ class RemoteSyncScript(unittest.TestCase): script = Path(str(self.log) + ".script").read_text() self.assertIn("cargo build --release --locked -j 4 -p strata-desktop-core --bin leleka-cli --bin leleka-daemon --bin leleka-inference", script) self.assertIn("cargo test --no-run --locked -j 4 -p leleka-cuda-driver --features cuda-driver", script) - self.assertIn("-p leleka-runtime", script) + self.assertIn("-p leleka-engine-qwen35-cuda", script) self.assertIn("nice -n 10", script) self.assertIn("cargo fetch --locked", script) self.assertNotIn("cargo run", script) diff --git a/scripts/laptop/port_bench.sh b/scripts/laptop/port_bench.sh index 88ad714a..54f98376 100644 --- a/scripts/laptop/port_bench.sh +++ b/scripts/laptop/port_bench.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Run the port's Original serve stack (laptop profile) on the same pre-tokenized prompts as original_bench.sh. # port_bench.sh LABEL -# Environment: TEST_BIN (the built leleka-runtime test executable, `cargo test --release -p leleka-runtime +# Environment: TEST_BIN (the built leleka-engine-qwen35-cuda test executable, `cargo test --release -p leleka-engine-qwen35-cuda # --features sm86 --lib --no-run`), MODEL_DIR (the two GGUF shards), KAR (read-only archive file) and # KAR_PROVENANCE, MTP (data/mtp-rt), MTP_STAGING (private 0700 dir), PROMPTS, OUT, CUBLAS12_LIB (dir with # libcublas.so.12). Every LELEKA_* switch of backend_original_serve_laptop.rs passes through (experts mapped or diff --git a/scripts/linux-tests/run.sh b/scripts/linux-tests/run.sh index 0b64552c..30ff1932 100755 --- a/scripts/linux-tests/run.sh +++ b/scripts/linux-tests/run.sh @@ -2,9 +2,9 @@ # Run the Linux x86_64-gated CPU tests of the Rust port inside Docker. # # scripts/linux-tests/run.sh # all three crates, one shard each -# scripts/linux-tests/run.sh -p leleka-runtime # selected crate(s) +# scripts/linux-tests/run.sh -p leleka-engine-qwen35-cuda # selected crate(s) # scripts/linux-tests/run.sh -- # e.g. -- conversation:: -# LELEKA_TEST_FILTER=conversation:: scripts/linux-tests/run.sh -p leleka-runtime +# LELEKA_TEST_FILTER=conversation:: scripts/linux-tests/run.sh -p leleka-engine-qwen35-cuda # scripts/linux-tests/run.sh --mocks # also run the CPU fake-libcuda #[ignore]d mock gates # LELEKA_TEST_CLEAN=1 ... # wipe the cached target volume first # @@ -36,7 +36,7 @@ while (( $# )); do *) echo "unknown argument: $1 (use -p and/or -- )" >&2; exit 2 ;; esac done -(( ${#packages[@]} )) || packages=(leleka-cuda-driver leleka-runtime leleka-native-cpu-expert) +(( ${#packages[@]} )) || packages=(leleka-cuda-driver leleka-engine-qwen35-cuda leleka-native-cpu-expert) if [[ -n "${LELEKA_TEST_FILTER:-}" ]]; then extra=("$LELEKA_TEST_FILTER" ${extra[@]+"${extra[@]}"}); fi command -v docker >/dev/null || { echo "docker not found" >&2; exit 2; } @@ -85,7 +85,7 @@ for pkg in "${packages[@]}"; do start=$SECONDS # --no-fail-fast: keep running every test binary even when one fails. features=() - case "$pkg" in leleka-cuda-driver|leleka-runtime|leleka-native-cpu-expert) features=(--features leleka-cuda-driver/cuda-driver) ;; esac + case "$pkg" in leleka-cuda-driver|leleka-engine-qwen35-cuda|leleka-native-cpu-expert) features=(--features leleka-cuda-driver/cuda-driver) ;; esac docker_run cargo test --locked --no-fail-fast ${features[@]+"${features[@]}"} -p "$pkg" -- ${extra[@]+"${extra[@]}"} 2>&1 | tee "$log" | awk -v v="${LELEKA_TEST_VERBOSE:-}" 'v { print; next } /^warning/ { skip=1 } /^$/ { skip=0 } !skip { print }' status=${PIPESTATUS[0]} elapsed=$((SECONDS - start)) diff --git a/scripts/profile/build_rt.sh b/scripts/profile/build_rt.sh index 2d64d875..a026fce8 100644 --- a/scripts/profile/build_rt.sh +++ b/scripts/profile/build_rt.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Build the leleka-runtime test binary of THIS worktree in WSL (never on the server) and print its path. +# Build the leleka-engine-qwen35-cuda test binary of THIS worktree in WSL (never on the server) and print its path. # scripts/profile/build_rt.sh TAG (run from Windows Git Bash in the worktree; needs WSL distro "Ubuntu") # Result: WSL ~/ledger-bin/rt-TAG. Copy to the server with: scp (see docs/ledger.md). set -euo pipefail @@ -15,8 +15,8 @@ export PATH=\$HOME/cuda-toolkits/13.2.2/bin:\$HOME/.cargo/bin:/usr/local/bin:/us rm -rf ~/ledger-src && mkdir -p ~/ledger-src ~/ledger-bin && tar -xf '$win' -C ~/ledger-src cd ~/ledger-src export CARGO_TARGET_DIR=\$HOME/ledger-target -nice -n 10 cargo test --no-run --locked --release -p leleka-runtime --lib 2>&1 | tee ~/ledger-build-$tag.log | grep -E 'Executable|^error|warning: unused' | tail -5 -exe=\$(grep -o 'target/release/deps/leleka_runtime-[0-9a-f]*' ~/ledger-build-$tag.log | tail -1) +nice -n 10 cargo test --no-run --locked --release -p leleka-engine-qwen35-cuda --lib 2>&1 | tee ~/ledger-build-$tag.log | grep -E 'Executable|^error|warning: unused' | tail -5 +exe=\$(grep -o 'target/release/deps/leleka_engine_qwen35_cuda-[0-9a-f]*' ~/ledger-build-$tag.log | tail -1) cp \$CARGO_TARGET_DIR/\${exe#target/} ~/ledger-bin/rt-$tag ls -la ~/ledger-bin/rt-$tag " diff --git a/scripts/soak/identity-job.sh b/scripts/soak/identity-job.sh index 76b0d295..85d573fb 100755 --- a/scripts/soak/identity-job.sh +++ b/scripts/soak/identity-job.sh @@ -2,7 +2,7 @@ # unattended identity gate (bitwise): the fast cold load changes how the expert bank is read from shard 0 (large O_DIRECT blocks on 32 threads instead of a # sequential read loop). The bank must hold the same bytes, so the teacher-forced replay of the 256k-class capture night5-long-256k must give identical top-16 # logprob rows and an identical draft trace. Adapted from scripts/e2e/decode/draftround-id.sh (same shape, same capture, same tools); ONE test binary for both processes -# (a `cargo test --release --no-run -p leleka-runtime --lib` build of this branch), process 1 with LELEKA_LOAD_READ=legacy (the old loop), process 2 with the default +# (a `cargo test --release --no-run -p leleka-engine-qwen35-cuda --lib` build of this branch; `-p leleka-runtime` before STRA-338 S22), process 1 with LELEKA_LOAD_READ=legacy (the old loop), process 2 with the default # (direct), two identical arms in each (the A/A floor). HOLDER JOB. ~25 GPU-min. # ID_BIN test binary path relative to /data/leleka-e2e/decode/dt (default ../../unattended/bin-rt/rt-unattended) # ID_OUT output directory (default /data/leleka-e2e/unattended/id-)