laptop profile and workstation preset: ship the measured defaults (chunk 6144, grid 6144, tail prompt, context 262144), clamp the chunk to the GPU budget
Paired 256k sessions on this laptop (docs/laptop-vs-vanilla.md sections 4, 10, 11, 12): prefill 110 -> 176-290 tok/s, TTFT sum about 2,100 s -> 998-1,083 s. Gates: 6144 changes the rounding order of the prompt path and has NO quality gate yet (q_pair / residual-hash arms 2048 vs 6144 not run); the tail mode and the context move no number. prefill_capacity_for_budget lowers the chunk when the budget cannot lend it (14+ GiB 8192, 13 6144, 12 3072, else 2048). Tests updated; leleka-deploy 120 unit + e2e pass. Also: section 11 (vanilla with STRATA_ROUTE_TAIL_SKIP=0: 9.0-13.0 tok/s, wall 1,417 s). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
daa6a4f144
commit
621d35276d
@@ -460,14 +460,16 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn laptop_uses_the_file_source_and_a_small_context() {
|
||||
fn laptop_uses_the_file_source_the_256k_context_and_the_6144_chunk() {
|
||||
let config = config("rtx3080-16g");
|
||||
assert_eq!(config.kar_arg(), KarArg::File);
|
||||
let text = flat(&config.engine_args(config.kar_arg()));
|
||||
assert!(
|
||||
text.contains("--kar-archive-file /data/leleka/qwen-iq3-s-l2-v4.kar --kar-provenance")
|
||||
);
|
||||
assert!(text.contains("--gpu-budget 16106127360 --context-tokens 8192"));
|
||||
assert!(text.contains("--gpu-budget 16106127360 --context-tokens 262144"));
|
||||
assert!(text.contains("--original-prefill-capacity 6144"), "{text}");
|
||||
assert!(text.contains("--prefix-cache-tail prompt") && text.contains("--prefix-cache-block 6144"), "{text}");
|
||||
assert!(text.contains("--expert-source mapped"));
|
||||
assert!(!text.contains("{FD}"));
|
||||
}
|
||||
@@ -497,8 +499,11 @@ mod tests {
|
||||
);
|
||||
assert_eq!(strata["runtime"]["max_context"], 262144);
|
||||
assert_eq!(strata["runtime"]["max_output_tokens"], 32768);
|
||||
// The 8K laptop context needs a ceiling below it, or `strata-next check-config` refuses the file.
|
||||
assert_eq!(config_of("rtx3080-16g").strata_json()["runtime"]["max_output_tokens"], 8191);
|
||||
// A context of 8K needs a ceiling below it, or `strata-next check-config` refuses the file (the laptop profile used to have one).
|
||||
let mut small = config_of("rtx3080-16g");
|
||||
small.profile.context_tokens = 8192;
|
||||
assert_eq!(small.strata_json()["runtime"]["max_output_tokens"], 8191);
|
||||
assert_eq!(config_of("rtx3080-16g").strata_json()["runtime"]["max_output_tokens"], 32768);
|
||||
// No secret is ever part of a generated config.
|
||||
let text = to_file_text(&strata) + &to_file_text(&daemon) + &to_file_text(&config);
|
||||
assert!(!text.to_ascii_lowercase().contains("secret"));
|
||||
|
||||
@@ -1130,7 +1130,7 @@ mod tests {
|
||||
let text = render_plan(&ctx, &steps).replace('\\', "/");
|
||||
assert!(
|
||||
text.contains("--kar-archive-file /data/leleka/qwen-iq3-s-l2-v4.kar")
|
||||
&& text.contains("--context-tokens 8192"),
|
||||
&& text.contains("--context-tokens 262144"),
|
||||
"{text}"
|
||||
);
|
||||
assert!(text.contains("rtx3080-16g"));
|
||||
|
||||
@@ -460,7 +460,9 @@ mod tests {
|
||||
.unwrap();
|
||||
assert_eq!(laptop.name, "rtx3080-16g");
|
||||
assert_eq!(laptop.kar_source, KarSource::File);
|
||||
assert_eq!(laptop.context_tokens, 8192);
|
||||
assert_eq!(laptop.context_tokens, 262144, "the owner's real work is 256k");
|
||||
assert_eq!((laptop.prefill_capacity, laptop.memory.prefix_cache_block), (Some(6144), Some(6144)));
|
||||
assert_eq!(laptop.memory.prefix_cache_tail.as_deref(), Some("prompt"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -116,6 +116,19 @@ fn gib_text(bytes: u64) -> String {
|
||||
format!("{:.1} GiB", bytes as f64 / GIB as f64)
|
||||
}
|
||||
|
||||
/// The largest prompt chunk an expert cache of this GPU budget can lend to the prompt path (measured on the 3080 laptop with the pinned Qwen3.8
|
||||
/// IQ3_S pack: a budget of 13 GiB holds 2,234 expert slots of 1.97 MiB, about 520 more per GiB; the loan of a chunk plus the 128-slot floor is
|
||||
/// 1,282 slots at 2048, 1,497 at 3072, 1,713 at 4096, 2,144 at 6144 and about 2,575 at 8192; a chunk that does not fit stops the engine from opening).
|
||||
/// Whole GiB, rounded down, with the margin the 1-GiB steps leave: 14+ GiB carry 8192, 13 carry 6144, 12 carry 3072, less keeps 2048.
|
||||
pub fn prefill_capacity_for_budget(gpu_budget_bytes: u64) -> u32 {
|
||||
match gpu_budget_bytes / GIB {
|
||||
14.. => 8192,
|
||||
13 => 6144,
|
||||
12 => 3072,
|
||||
_ => 2048,
|
||||
}
|
||||
}
|
||||
|
||||
/// RAM the workstation preset keeps free: 8 GiB on small hosts up to 16 GiB from 64 GiB of RAM.
|
||||
pub fn workstation_ram_target(total: u64) -> u64 {
|
||||
if total >= 64 * GIB {
|
||||
@@ -293,6 +306,19 @@ pub fn apply(
|
||||
if let Some(resident) = plan.resident_budget_gib {
|
||||
profile.memory.resident_budget_gib.get_or_insert(resident);
|
||||
}
|
||||
// The prompt chunk borrows its buffers from the expert cache, so a smaller VRAM budget (the workstation preset's, or `--gpu-budget-gib`)
|
||||
// that cannot hold the profile's chunk would stop the engine from starting: lower the chunk (and the grid with it) to what the budget carries.
|
||||
if let Some(chunk) = profile.prefill_capacity {
|
||||
let fits = prefill_capacity_for_budget(profile.gpu_budget_bytes);
|
||||
if chunk > fits {
|
||||
profile.prefill_capacity = Some(fits);
|
||||
if let Some(block) = profile.memory.prefix_cache_block
|
||||
&& block > fits
|
||||
{
|
||||
profile.memory.prefix_cache_block = Some(fits);
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some((soft, hard)) = plan.windows_floors_mib {
|
||||
// only ever lowered, and only when the profile asks for more than the Windows values
|
||||
if profile.memory.soft_floor_mib.is_none_or(|current| current > soft) {
|
||||
@@ -374,6 +400,34 @@ mod tests {
|
||||
Profile::builtin("rtx3080-16g").unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_prompt_chunk_follows_what_the_gpu_budget_can_lend() {
|
||||
assert_eq!(prefill_capacity_for_budget(15 * GIB), 8192);
|
||||
assert_eq!(prefill_capacity_for_budget(14 * GIB), 8192);
|
||||
assert_eq!(prefill_capacity_for_budget(13 * GIB), 6144);
|
||||
assert_eq!(prefill_capacity_for_budget(13 * GIB + 900 * MIB), 6144);
|
||||
assert_eq!(prefill_capacity_for_budget(12 * GIB), 3072);
|
||||
assert_eq!(prefill_capacity_for_budget(10 * GIB), 2048);
|
||||
// the laptop profile ships 6144 / 6144: it stays at the workstation preset's 13 GiB budget, goes down on a smaller one and is
|
||||
// never raised; the server profile (30 GiB) keeps its 8192
|
||||
let apply_with = |budget_gib: u64| {
|
||||
let mut profile = laptop();
|
||||
let mut env = BTreeMap::new();
|
||||
let plan = compute(&host(16, 48, 36), Some(&gpu(16384, 16384)), &profile, Preset::Dedicated);
|
||||
profile.gpu_budget_bytes = budget_gib * GIB;
|
||||
apply(&plan, &mut profile, &mut env, true);
|
||||
(profile.prefill_capacity, profile.memory.prefix_cache_block)
|
||||
};
|
||||
assert_eq!(apply_with(13), (Some(6144), Some(6144)));
|
||||
assert_eq!(apply_with(15), (Some(6144), Some(6144)));
|
||||
assert_eq!(apply_with(12), (Some(3072), Some(3072)));
|
||||
assert_eq!(apply_with(10), (Some(2048), Some(2048)));
|
||||
let mut server = server();
|
||||
let plan = compute(&host(32, 121, 100), Some(&gpu(32607, 32100)), &server, Preset::Dedicated);
|
||||
apply(&plan, &mut server, &mut BTreeMap::new(), false);
|
||||
assert_eq!(server.prefill_capacity, Some(8192));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn workers_never_exceed_the_physical_cores_but_the_hosts_where_those_are_known() {
|
||||
let mut laptop_host = host(16, 48, 36);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{
|
||||
"name": "rtx3080-16g",
|
||||
"description": "RTX 3080 Laptop class (sm_86, 16 GB VRAM, 24-48 GB RAM, typically WSL2). The KAR archive stays an ordinary read-only file (no 55 GB memfd), routed experts are served from the memory-mapped shards, context is capped at 8192. Experimental (docs/laptop-profile.md): measured on one laptop, slower than the server profile, no quality claim.",
|
||||
"description": "RTX 3080 Laptop class (sm_86, 16 GB VRAM, 24-48 GB RAM, typically WSL2). The KAR archive stays an ordinary read-only file (no 55 GB memfd), routed experts are served from the memory-mapped shards. Context 262144 (the owner's real work; measured natively under the workstation preset), prompt chunk and prefix-cache grid 6144 and prompt-end checkpoints (paired 256k session on this laptop, docs/laptop-vs-vanilla.md: prefill 110 -> 176-290 tok/s, TTFT sum 2,100+ s -> 998-1,083 s against vanilla's 1,248 s; 6144 changes the rounding order of the prompt path and has no quality gate yet). Experimental (docs/laptop-profile.md): measured on one laptop, no quality claim.",
|
||||
"select": {"sm_min": 80, "sm_max": 120, "vram_mib_min": 14000, "vram_mib_max": 24000},
|
||||
"gpu_budget_bytes": 16106127360,
|
||||
"context_tokens": 8192,
|
||||
"context_tokens": 262144,
|
||||
"prefill_capacity": 6144,
|
||||
"kar_source": "file",
|
||||
"expert_source": "mapped",
|
||||
"min_driver_major": 595,
|
||||
@@ -15,5 +16,5 @@
|
||||
"expert_profile": "data/expert-profile.bin",
|
||||
"expert_profile_sha256": "8f59b4aa8873209dff11c11e37bcda9529a1335b724a1afeea37bf6388975baf",
|
||||
"engine_env": {},
|
||||
"memory": {"prefix_cache_mib": "auto", "prefix_cache_tail": "reply", "soft_floor_mib": 4096, "hard_floor_mib": 2048, "reserve_mib": 1024, "lock": "off", "heal": false}
|
||||
"memory": {"prefix_cache_mib": "auto", "prefix_cache_tail": "prompt", "prefix_cache_block": 6144, "soft_floor_mib": 4096, "hard_floor_mib": 2048, "reserve_mib": 1024, "lock": "off", "heal": false}
|
||||
}
|
||||
|
||||
@@ -127,3 +127,35 @@ New finding in the turn-1 decode: with the prefetch pass skipped the first decod
|
||||
Prefill 290 / 273 / 231 / 211 / 190 tok/s (A: 285 / 260 / 269 / 253 / 222). No guard fired (max 68 C, max 92 W, no P5), **but the GPU was power-limited again from turn 3 on**: mean draw 54 / 56 / 42 / 45 / 49 W and mean SM clock 1894 / 1665 / 1275 / 1268 / 1063 MHz over the five fifths of the run, `SW Power Cap` active, `gdn` 26-29 s per turn against 12-13 s in turns 1-2 (and in run A). So turns 3-5 of A3 are not comparable with run A; turns 1-2 are (TTFT -2 and -13 s against A, wall -2.6 and -14.7 s). The ratio gdn(turn 3)/gdn(turn 2) = 2.2 explains the 30-40 s of extra prefill per turn; the rest of A3 matches A.
|
||||
|
||||
Decode: 6.97 / 6.67 / 7.88 / 8.86 / 8.19 tok/s. The first decode of a fresh engine (6.97) kept run A's value (A2 without the pass: 5.22), turns 3-5 are 15-45 % above run A's 6.1-6.9, with a slower GPU. The policy log (every 64 groups, 621 lines): preferred = pass in 458, skip in 163; the per-group averages are noisy (pass 0.36-0.65, skip 0.21-0.80 ms per expert) and the choice flips between the two about every 1,000-2,000 groups, 29 % of the groups ran the skip (12,020 of 41,733). So in this run the policy mostly sat on the pass with excursions to the skip, and did not reproduce the 0.34-0.43 ms per expert of the all-skip arm of section 7 (window/expert 0.455-0.559 in A3), though the throttled GPU lengthens every window and the two effects cannot be separated from this run. A decode A/B at depth (adaptive / always on / always off) would tell; not run.
|
||||
|
||||
## 11. Vanilla with `STRATA_ROUTE_TAIL_SKIP=0` (exact), clean run `g2-vanilla-noskip`, 2026-10-27 23:31-23:55
|
||||
|
||||
The first attempt (23:24) overlapped a Balanced OEM profile and was stopped in turn 1; this run started at 23:31 with the limit at 110 W rising to 127 W in the first minutes (`Current Power Limit` is now a column of `mon.csv`: 110.0-126.6 W over the whole run, max 67 C, max 95 W, no P5). The engine log of this run has no "ROUTE_TAIL_SKIP=7 is ON" line and no skip counters, so the skip was off.
|
||||
|
||||
| turn | TTFT (s) exact / default vanilla / our A3 | decode tok/s exact / default / A3 | wall (s) exact / default |
|
||||
| --- | --- | --- | --- |
|
||||
| 1 | 238.1 / 230 / 171.7 | 9.03 / 15.8 / 6.97 | 271.3 / 249.0 |
|
||||
| 2 | 261.9 / 260 / 191.0 | 10.97 / 17.5 / 6.67 | 289.2 / 277.8 |
|
||||
| 3 | 297.8 / 279 / 239.7 | 12.02 / 16.1 / 7.88 | 322.7 / 295.4 |
|
||||
| 4 | 238.5 / 236 / 231.7 | 11.23 / 15.0 / 8.86 | 265.2 / 255.4 |
|
||||
| 5 | 245.3 / 243 / 249.3 | 13.00 / 17.1 / 8.19 | 268.3 / 262.5 |
|
||||
| sum | 1,281.6 / 1,248 / 1,083 | | **1,416.6** / 1,341 / 1,281 (A3), 1,226 (A) |
|
||||
|
||||
Vanilla's prefill is the same with or without the skip (192 / 192 / 179 / 197 / 186 tok/s; the skip only acts in decode). **Its decode is 9.0-13.0 tok/s without the skip against 15.0-17.6 with it: the lossy default is worth 30-40 % of its decode speed** (about 33 s instead of 18-20 s per 300 tokens), and the expert-cache hit rate it reports falls from 62-70 % to 53-60 % (more lookups: 178-189 k per turn against 150-168 k). Against this exact vanilla: our wall 1,226 s (run A) / 1,281 s (A3, GPU power-limited from turn 3) is 10-13 % lower than 1,417 s, TTFT sum 998-1,083 s against 1,282 s; decode is still behind (ours 6.1-8.9, vanilla exact 9.0-13.0, 1.4-1.5x).
|
||||
|
||||
## 12. Shipped defaults of the laptop profile and the `workstation` preset: the audit
|
||||
|
||||
Rule of the owner: the defaults are the speed-optimal ones. For each setting, what the measurements say and what was done (`deploy/rust-runtime/profiles/rtx3080-16g.json`, `crates/deploy/src/resources.rs`):
|
||||
|
||||
| setting | before | measured | now | gate / risk |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| `prefill_capacity` + `memory.prefix_cache_block` (the grid caps the chunk) | 2048 / 2048 (unset) | prefill 110 tok/s at 2048, 176-290 at 6144; TTFT sum 2,100+ s -> 998-1,083 s (runs b, A, A3); 8192 needs about 2,575 cache slots and the workstation budget has 2,234 (refused) | **6144 / 6144**; the preset lowers it when the GPU budget cannot lend it (`prefill_capacity_for_budget`: 14+ GiB 8192, 13 GiB 6144, 12 GiB 3072, less 2048; never raises), so a smaller budget cannot stop the engine from opening | **no quality gate yet**: the chunk size changes the rounding order of the prompt path (docs/prefill-throughput.md: identical greedy ids at 2048 / 4096 / 6144 on one 16k prompt, different at 8192); q_pair / R-hash arms 2048 against 6144 not run. Rounding-level, not lossy |
|
||||
| `memory.prefix_cache_tail` | reply | `prompt` reuses 45,761 of 45,766 tokens (exact); `reply` before `85fd803` re-read 1.7k-5k tokens per turn; `reply` with `85fd803` was **not measured** on the laptop | **prompt** | no numerics (only where a checkpoint is taken). The cost: a reply that the next request repeats verbatim (an agent echoing text) is re-read (about 300 tokens, 1-2 s) |
|
||||
| `context_tokens` | 8192 | the owner's work is 256k; every run in this document ran `--context-tokens 262144` under the workstation preset (KV: 0.65 GiB VRAM, 3.1 GiB pinned host; the preset's 11 GiB engine-fixed figure was measured at 256k) | **262144**; the preset needs nothing else for 256k | none; `max_output_tokens` follows (32768). A host with less than the preset assumes still fails the preflight |
|
||||
| CPU workers | 12 (preset: logical cores - 4) | 7 pinned workers, one per physical core (vanilla's choice); +5 to +18 % decode in the partial A/B | **7** (`449b7a1`, already on main); 15 on the 16-core server | none |
|
||||
| PLE read-ahead + own file objects | - | `input.ple` 39-77 s per turn -> 1 s | on by default on Windows (`ee4cb59`) | non-lossy, 1.36M rows compared |
|
||||
| prefetch pass | always on | 8.70 -> 10.58 tok/s warm, 6.85 -> 5.22 cold | adaptive (`824f3c3`); `LELEKA_CPU_PREFETCH=on/off` override | non-lossy; A3: the policy flips between the modes, no gain over the pass shown yet |
|
||||
| `LELEKA_STAGE_PRIORITY` | off | the cyclic-scan microbench says 4x on the scan; end-to-end effect not measured (run d invalid) | **off** | non-lossy, unmeasured -> stays opt-in |
|
||||
| `resident_budget_gib` (pinned experts), RAM left to the desktop (18 GiB), `gpu_budget` (13 GiB, margin 2 GiB) | planner values | not varied in any run; the decode page-in (gap 4) suggests more pinned RAM, the 8192 chunk and a bigger cache suggest 14 GiB | unchanged | owner's policy (desktop headroom against speed) |
|
||||
| route tail skip | off | vanilla's default is worth 30-40 % of its decode (section 11) | **off** | lossy, quality gate failed on the 5090 |
|
||||
| PcieAuto / `pcie_frac` | 0 (pageable bank) | pageable-source PCIe was slower than the CPU pool (docs/windows.md); vanilla's auto share not tried here | unchanged | not done |
|
||||
|
||||
Reference in New Issue
Block a user