From 3e8e10ed5ffdd3dc97fc743567f63e093e992a6d Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Fri, 16 Oct 2026 19:20:53 +0200 Subject: [PATCH] perf(serve): default --pcie-frac to the Original's 0.55 with the copy kernel Job 802 (RTX 5090, paired a/b/b/a, one binary, copy-kernel staging, expert tier on, 6 prompts x 2 passes x 128 tokens): pcie_frac 0 decodes at 41.9 / 42.7 tok/s mean, 0.55 at 62.2 / 63.6 (+48%), TTFT unchanged (1214/1209 vs 1212/1207 ms). Placement differs between the two (PCIe experts run on the GPU, which rounds differently from the CPU pool), so outputs differ as documented for the tier; the tier itself stays opt-in. Co-Authored-By: Claude Opus 5.5 --- .../src/qwen_forward/original_serve_residency.rs | 9 ++++----- docs/original-serve.md | 6 ++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/crates/leleka-runtime/src/qwen_forward/original_serve_residency.rs b/crates/leleka-runtime/src/qwen_forward/original_serve_residency.rs index 72072678..b32a7165 100644 --- a/crates/leleka-runtime/src/qwen_forward/original_serve_residency.rs +++ b/crates/leleka-runtime/src/qwen_forward/original_serve_residency.rs @@ -79,9 +79,8 @@ pub(crate) struct ExpertTierConfig { /// Port: the per-request verifier (bank, canonical GDN image, eight window graphs and the commit graph) /// is assembled for every decode phase, after the cache; auto sizing keeps this much more free for it. pub(crate) decode_reserve_mib: usize, - /// `--pcie-frac`: the share of a group's missed experts staged over PCIe (DMA, `pcie_mode` 0, the mode - /// the window graph records). 0 by default: the Original's 0.55 applies to a pinned complement read by - /// its copy kernel, which this port's per-tensor bank cannot feed. + /// `--pcie-frac` (0.55, generate.cpp's default): the share of a group's missed experts staged over PCIe (by the + /// copy kernel or DMA, `pcie_mode`). Only used while the tier is on. pub(crate) pcie_frac: f64, /// `--pcie-mode` (auto). pub(crate) pcie_mode: PcieMode, @@ -101,7 +100,7 @@ impl ExpertTierConfig { profile: None, reserve_mib: 700, decode_reserve_mib: 1024, - pcie_frac: 0.0, + pcie_frac: 0.55, pcie_mode: PcieMode::Auto, adapt_every: 4, adapt_swaps: 96, @@ -701,7 +700,7 @@ mod tests { #[test] fn the_configuration_is_off_by_default_and_refuses_what_it_cannot_honour() { let off = ExpertTierConfig::off(); - assert!(!off.enabled() && off.validate().is_ok() && off.pcie_num() == 0); + assert!(!off.enabled() && off.validate().is_ok() && off.pcie_num() == 141); let with_profile = ExpertTierConfig { profile: Some("p.bin".into()), ..off.clone() }; assert!(with_profile.enabled()); assert_eq!(with_profile.effective_slots(), -1); diff --git a/docs/original-serve.md b/docs/original-serve.md index e1ba4339..c25bc4aa 100644 --- a/docs/original-serve.md +++ b/docs/original-serve.md @@ -49,7 +49,7 @@ The load must be the explicit KAR PLE MTP load, as for the windowed256 modes. | `LELEKA_ORIGINAL_SERVE_EXPERT_SLOTS` = `auto` \| N | `--expert-cache` | off (a profile alone means auto) | | `LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER=yes` | `--expert-cache-per-layer` | global | | `LELEKA_ORIGINAL_SERVE_EXPERT_PROFILE=P` | `--expert-profile` | none | -| `LELEKA_ORIGINAL_SERVE_PCIE_FRAC` | `--pcie-frac` | 0 (see below) | +| `LELEKA_ORIGINAL_SERVE_PCIE_FRAC` | `--pcie-frac` | 0.55 (job 802) | | `LELEKA_ORIGINAL_SERVE_PCIE_MODE` = `auto` \| `dma` \| `kernel` | `--pcie-mode` | auto (the copy kernel when the bank has device aliases) | | `LELEKA_ORIGINAL_SERVE_ADAPT_EVERY` / `_ADAPT_SWAPS` | `--adapt-every` / `--adapt-swaps` | 4 / 96 | | `LELEKA_ORIGINAL_SERVE_VRAM_RESERVE_MIB` / `_DECODE_RESERVE_MIB` | `--vram-reserve-mib` / port only | 700 / 1024 (auto sizing) | @@ -83,9 +83,7 @@ differ slightly from one without it, and a repeated greedy request may differ af Deviations: the loan is sized for the configured chunk, not per request (`Prefill::relayout`): the prompt executor is built for exactly one capacity; without a loan the prompt path has no cache hits (the driver only serves them -from a lent prefix); `pcie_frac` defaults to 0 because the Original's 0.55 is for its copy kernel over a pinned -contiguous complement, while this port stages the three per-tensor spans by DMA (`pcie_mode` 0, the mode the -window graph records); `expert_cache_cpu_order`, remote caches, layer splits and the resident RAM mode are not +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