[GH-ISSUE #2281] [0.1.43.1] 2× RTX 3090 CUDA layer split: decode −20.5% vs v0.1.43, and STRATA_ADAPT_OVERLAP=1 cannot re-enable the overlap ('off: not on a layer split') #918

Closed
opened 2026-11-04 01:47:01 +07:00 by bsakaguchi · 9 comments
Owner

Originally created by @ben0112 on GitHub (Oct 13, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2281

Environment

  • Bad: v0.1.43.1 (a0116b2, built from the v0.1.43.1 tag tarball, project(strata VERSION 0.1.43.1), self-reports strata 0.1.43.1)
  • Good: v0.1.43 (7695859, the exact binary our production runs)
  • GPUs: 2× RTX 3090 48 GB (sm_86), driver 610.57.04, CUDA 13.4.92, Debian 13 container (LXC), PCIe 3.0 x16, measured link 7.9 GB/s
  • CPU: Xeon, 24 physical cores, cpuset 0-23,48-71, memlock unlimited
  • Model: Qwen3.8-Flash-Next UD-Q4_K_XL (4-part GGUF, 103.69 GiB), native pack, PLE table on the 2nd shard
  • Layer split auto (2 stages: CUDA0 then CUDA1)

Serving flags (identical for every arm, this is our production config verbatim):

--pack <pack> --native <shard1.gguf> --expert-profile <profile.bin>
--expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5 --mtp <rt>
--max-context 262144 --kv k8v4 --kv-resident 32768 --ple-io ram
--gpu 0,1 --layer-split auto

Summary

On this machine v0.1.43.1 is ~20.5% slower than v0.1.43 on decode and ~10% slower on a long prompt, and no environment variable recovers it. This is the opposite direction from #2038 / #1964 / #1975 / #2010, where 0.1.43's adaptive overlap was the problem and 0.1.43.1 was the fix. For us the overlap (default on in 0.1.43) is a +28% win, and 0.1.43.1 loses that win while STRATA_ADAPT_OVERLAP=1 no longer turns it back on.

Measured (official tools/ab_engine.py, interleaved arms, order reversed each round)

Each arm n=8 decode samples (4 requests × 2 rounds). Request set: 3 short chats + one 6,345-token long prompt, greedy, --max-new 256.

Arm Binary / env decode median long-prompt prefill Δ vs 0.1.43
V43 v0.1.43 (overlap default on) 82.2–82.7 tok/s 1074 tok/s baseline
V431 v0.1.43.1 (overlap default off) 64.7 tok/s 74.7 −21.7%
OVL1 v0.1.43.1 + STRATA_ADAPT_OVERLAP=1 64.4 tok/s 75.7 −22.1%
OVLH v0.1.43.1 + OVERLAP=1 + STRATA_ADAPT_SIGNAL=host 65.3 tok/s 73.3 −20.5%
OVLHW OVLH + STRATA_ADAPT_CALLBACK_WARMUP=1 65.4 tok/s 73.1 −20.5%

Per-request medians (arm 4 run, n=8 per cell):

request V43 decode / prefill OVLH decode / prefill
chat0 83.7 / 91.0 69.1 / 71.4
chat1 81.9 / 82.8 58.5 / 70.2
chat2 77.5 / 59.9 61.2 / 76.9
long (6,345 tok) 82.7 / 1074.4 70.8 / 717.9

The regression is repeatable and order-independent: round 0 vs round 1 (arms reversed) — V43 82.6 → 82.7, V431 64.3 → 66.5, OVL1 64.2 → 64.6. Not thermal/state drift.

Baseline sanity: the V43 binary is the one our production serves with, and production measures 72–86 tok/s on the same flags — so 82 tok/s is the true 0.1.43 number here, not a lucky run.

Key evidence: the overlap cannot be re-enabled in 0.1.43.1

Start-up log with STRATA_ADAPT_OVERLAP=1 explicitly set:

strata serve: STRATA_ADAPT_OVERLAP=1 is off: not on a layer split

…even though the same run logs layer split across 2 GPUs: CUDA0, then CUDA1. So the overlap's code path in 0.1.43.1 is not reachable in this configuration, and STRATA_ADAPT_SIGNAL=host does not restore the 0.1.43 speed (65.3 vs 64.7 without it).

This suggests the 20.5% is not the overlap itself but something else in the 0.1.43.1 range that is on our hot path. Our leading suspect from the commit list is 7bab660b "Prompt path: every pageable async host-to-device copy goes up through pinned bounce slots (#1996)" — at 7.9 GB/s PCIe with a 2-stage layer split, that is exactly the kind of change that could cost ~20%. We have not bisected this, so treat it as a hypothesis, not a finding.

Ruled out

  • Not the adaptive overlap being enabled (it is off in every 0.1.43.1 arm, and forcing it on changes nothing)
  • Not STRATA_ADAPT_SIGNAL (host callback restored: no change)
  • Not STRATA_ADAPT_CALLBACK_WARMUP (no change)
  • Not the config: both binaries run the same 24-argument config file, same cwd, same serve/server.py, only exe= differs
  • Not --batch / --batch-mtp: we use neither (single request, no parallel)
  • Not #2038's cause: our run has no --batch-mtp, and the log shows --batch-groups is not involved
  • Not PLE I/O: --ple-io ram, table locked in RAM in 2.5 s in both versions

Impact / decision

We are a production deployment on this exact hardware. We are staying on v0.1.43 and skipping 0.1.43.1 — giving up the fixes we would otherwise want (#2026 </tool_call> handling, #2040 PLE auto-mmap, the serve-side BGEN/crash-recovery fixes) because a 20.5% decode regression is not an acceptable trade.

Ask

  1. Does the log line STRATA_ADAPT_OVERLAP=1 is off: not on a layer split on a 2-stage CUDA layer split look correct to you? If the overlap is meant to be usable on a split, this may be a second bug on top of the regression.
  2. Is there a knob to test the #1996 pinned-bounce-slot path, or a commit to bisect between 7695859 (v0.1.43) and the 0.1.43.1 tag? We can run any interleaved A/B you want — we have the harness, the machine, and reproducible order-independent numbers (a full 3-arm × 2-round sweep takes ~26 minutes of exclusive GPU time).

Raw data

Full JSONL (one row per request: round, arm, decode, prompt, prompt_n, completion n) available on request, as are the engine start-up logs for each arm.

Originally created by @ben0112 on GitHub (Oct 13, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/2281 ## Environment - **Bad:** v0.1.43.1 (`a0116b2`, built from the `v0.1.43.1` tag tarball, `project(strata VERSION 0.1.43.1)`, self-reports `strata 0.1.43.1`) - **Good:** v0.1.43 (`7695859`, the exact binary our production runs) - GPUs: **2× RTX 3090 48 GB** (sm_86), driver 610.57.04, CUDA 13.4.92, Debian 13 container (LXC), PCIe 3.0 x16, measured link **7.9 GB/s** - CPU: Xeon, 24 physical cores, `cpuset 0-23,48-71`, `memlock unlimited` - Model: Qwen3.8-Flash-Next **UD-Q4_K_XL** (4-part GGUF, 103.69 GiB), native pack, PLE table on the 2nd shard - Layer split auto (2 stages: CUDA0 then CUDA1) Serving flags (**identical for every arm**, this is our production config verbatim): ``` --pack <pack> --native <shard1.gguf> --expert-profile <profile.bin> --expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5 --mtp <rt> --max-context 262144 --kv k8v4 --kv-resident 32768 --ple-io ram --gpu 0,1 --layer-split auto ``` ## Summary **On this machine v0.1.43.1 is ~20.5% slower than v0.1.43 on decode and ~10% slower on a long prompt, and no environment variable recovers it.** This is the *opposite* direction from #2038 / #1964 / #1975 / #2010, where 0.1.43's adaptive overlap was the problem and 0.1.43.1 was the fix. For us the overlap (default on in 0.1.43) is a **+28% win**, and 0.1.43.1 loses that win while `STRATA_ADAPT_OVERLAP=1` no longer turns it back on. ## Measured (official `tools/ab_engine.py`, interleaved arms, order reversed each round) Each arm n=8 decode samples (4 requests × 2 rounds). Request set: 3 short chats + one 6,345-token long prompt, greedy, `--max-new 256`. | Arm | Binary / env | decode median | long-prompt prefill | Δ vs 0.1.43 | |---|---|---:|---:|---:| | **V43** | v0.1.43 (overlap default **on**) | **82.2–82.7 tok/s** | **1074 tok/s** | baseline | | **V431** | v0.1.43.1 (overlap default **off**) | **64.7 tok/s** | 74.7 | **−21.7%** | | **OVL1** | v0.1.43.1 + `STRATA_ADAPT_OVERLAP=1` | **64.4 tok/s** | 75.7 | **−22.1%** | | **OVLH** | v0.1.43.1 + `OVERLAP=1` + `STRATA_ADAPT_SIGNAL=host` | **65.3 tok/s** | 73.3 | **−20.5%** | | **OVLHW** | OVLH + `STRATA_ADAPT_CALLBACK_WARMUP=1` | **65.4 tok/s** | 73.1 | **−20.5%** | Per-request medians (arm 4 run, n=8 per cell): | request | V43 decode / prefill | OVLH decode / prefill | |---|---|---| | chat0 | 83.7 / 91.0 | 69.1 / 71.4 | | chat1 | 81.9 / 82.8 | 58.5 / 70.2 | | chat2 | 77.5 / 59.9 | 61.2 / 76.9 | | long (6,345 tok) | 82.7 / **1074.4** | 70.8 / **717.9** | **The regression is repeatable and order-independent**: round 0 vs round 1 (arms reversed) — V43 82.6 → 82.7, V431 64.3 → 66.5, OVL1 64.2 → 64.6. Not thermal/state drift. Baseline sanity: the V43 binary is the one our production serves with, and production measures 72–86 tok/s on the same flags — so 82 tok/s is the true 0.1.43 number here, not a lucky run. ## Key evidence: the overlap cannot be re-enabled in 0.1.43.1 Start-up log with `STRATA_ADAPT_OVERLAP=1` explicitly set: ``` strata serve: STRATA_ADAPT_OVERLAP=1 is off: not on a layer split ``` …even though the same run logs `layer split across 2 GPUs: CUDA0, then CUDA1`. So the overlap's code path in 0.1.43.1 is not reachable in this configuration, and `STRATA_ADAPT_SIGNAL=host` does **not** restore the 0.1.43 speed (65.3 vs 64.7 without it). This suggests **the 20.5% is not the overlap itself** but something else in the 0.1.43.1 range that is on our hot path. Our leading suspect from the commit list is `7bab660b` *"Prompt path: every pageable async host-to-device copy goes up through pinned bounce slots (#1996)"* — at 7.9 GB/s PCIe with a 2-stage layer split, that is exactly the kind of change that could cost ~20%. **We have not bisected this**, so treat it as a hypothesis, not a finding. ## Ruled out - Not the adaptive overlap being *enabled* (it is off in every 0.1.43.1 arm, and forcing it on changes nothing) - Not `STRATA_ADAPT_SIGNAL` (host callback restored: no change) - Not `STRATA_ADAPT_CALLBACK_WARMUP` (no change) - Not the config: both binaries run the **same 24-argument config file**, same `cwd`, same `serve/server.py`, only `exe=` differs - Not `--batch` / `--batch-mtp`: we use neither (single request, no `parallel`) - Not #2038's cause: our run has no `--batch-mtp`, and the log shows `--batch-groups` is not involved - Not PLE I/O: `--ple-io ram`, table locked in RAM in 2.5 s in both versions ## Impact / decision We are a production deployment on this exact hardware. **We are staying on v0.1.43** and skipping 0.1.43.1 — giving up the fixes we would otherwise want (#2026 `</tool_call>` handling, #2040 PLE auto-mmap, the serve-side BGEN/crash-recovery fixes) because a 20.5% decode regression is not an acceptable trade. ## Ask 1. Does the log line `STRATA_ADAPT_OVERLAP=1 is off: not on a layer split` on a 2-stage CUDA layer split look correct to you? If the overlap is meant to be usable on a split, this may be a second bug on top of the regression. 2. Is there a knob to test the #1996 pinned-bounce-slot path, or a commit to bisect between `7695859` (v0.1.43) and the 0.1.43.1 tag? We can run any interleaved A/B you want — we have the harness, the machine, and reproducible order-independent numbers (a full 3-arm × 2-round sweep takes ~26 minutes of exclusive GPU time). ## Raw data Full JSONL (one row per request: round, arm, decode, prompt, prompt_n, completion n) available on request, as are the engine start-up logs for each arm.
Author
Owner

@Niko1221 commented on GitHub (Oct 13, 2026):

Thank you for the careful numbers and for the offer of the harness.

To your question 1: the log line is correct, and it is not a second bug. The overlap has never run on a layer split. Its gate's first check is "not on a layer split" in v0.1.43 as well (same expression in 7695859a and in v0.1.43.1). v0.1.43 only printed the line when the variable was set, so a default 0.1.43 run on a split said nothing. I checked it on a 2-card split (2x RTX A4000): v0.1.43 with STRATA_ADAPT_OVERLAP=1 logs STRATA_ADAPT_OVERLAP=1 is off: not on a layer split, exactly like your 0.1.43.1. So your V43 arm ran without the overlap too, and the 28% cannot come from it (it also needs adaptive swaps, and with 96 GB of VRAM your expert hit rate leaves almost nothing to swap). That is why OVL1/OVLH/OVLHW did not move anything.

So the 20% is something else, and I could not reproduce it. On 2x A4000 (CUDA layer split, IQ3_XXS, default flags, 5 interleaved pairs) v0.1.43, v0.1.43.1 and v0.1.43.1 with STRATA_ADAPT_OVERLAP=1 decode within 0.6% of each other (story 72.1 / 72.2 / 71.8, code 82.6 / 82.2 / 82.7 tok/s) and prefill a 6K prompt at 1081 / 1082 / 1083 tok/s. UD-Q4_K_XL on the same split (streamed from SSD, 5 pairs) decodes equal as well. I also tried: every CPU busy (the CUDA callback thread started before host pinning on and off), --ple-io ram with the table locked, with and without the PLE prefetch hint. All equal. Our cards are 2x16 GB, so I cannot reproduce an all-resident 2x48 GB regime.

To your question 2, there is no commit-level switch for #1996, but these three runs of the same v0.1.43.1 binary would split the suspects (one run each is enough to see 82 vs 65):

  1. STRATA_ADAPT_CALLBACK_WARMUP=0 (0.1.43.1 starts the CUDA host-callback thread before the host is pinned; your OVLHW arm set it to 1, which is already the default).
  2. --no-ple-prefetch (your config uses --ple-io ram; 0.1.43.1 added a per-row prefetch hint on the mapped table).
  3. STRATA_TEST_PAGEABLE=1 (the pinned bounce slots of #1996 off).
    Please also send, for V43 and V431: the start-up logs (diffable), STRATA_DECODE_TIMING=1 output for one decode (the per-window verify / stage / GPU-wait split), the draft acceptance and expert hit rate per arm, and the cmake line each binary was built with (CUDA arch, ggml dir, compiler, CUDA 13.4 for both?). A different build of the two binaries would show as a difference there, and a stage time that grows on one card points at the hand-off.

If one of the three toggles brings 82 tok/s back, that is the commit, and I will fix that one. Until then I would not skip 0.1.43.1 for the overlap's sake: on a layer split it changes nothing.

<!-- gh-comment-id:6153521935 --> @Niko1221 commented on GitHub (Oct 13, 2026): Thank you for the careful numbers and for the offer of the harness. To your question 1: the log line is correct, and it is not a second bug. The overlap has never run on a layer split. Its gate's first check is "not on a layer split" in v0.1.43 as well (same expression in 7695859a and in v0.1.43.1). v0.1.43 only printed the line when the variable was set, so a default 0.1.43 run on a split said nothing. I checked it on a 2-card split (2x RTX A4000): v0.1.43 with STRATA_ADAPT_OVERLAP=1 logs `STRATA_ADAPT_OVERLAP=1 is off: not on a layer split`, exactly like your 0.1.43.1. So your V43 arm ran without the overlap too, and the 28% cannot come from it (it also needs adaptive swaps, and with 96 GB of VRAM your expert hit rate leaves almost nothing to swap). That is why OVL1/OVLH/OVLHW did not move anything. So the 20% is something else, and I could not reproduce it. On 2x A4000 (CUDA layer split, IQ3_XXS, default flags, 5 interleaved pairs) v0.1.43, v0.1.43.1 and v0.1.43.1 with STRATA_ADAPT_OVERLAP=1 decode within 0.6% of each other (story 72.1 / 72.2 / 71.8, code 82.6 / 82.2 / 82.7 tok/s) and prefill a 6K prompt at 1081 / 1082 / 1083 tok/s. UD-Q4_K_XL on the same split (streamed from SSD, 5 pairs) decodes equal as well. I also tried: every CPU busy (the CUDA callback thread started before host pinning on and off), `--ple-io ram` with the table locked, with and without the PLE prefetch hint. All equal. Our cards are 2x16 GB, so I cannot reproduce an all-resident 2x48 GB regime. To your question 2, there is no commit-level switch for #1996, but these three runs of the same v0.1.43.1 binary would split the suspects (one run each is enough to see 82 vs 65): 1. `STRATA_ADAPT_CALLBACK_WARMUP=0` (0.1.43.1 starts the CUDA host-callback thread before the host is pinned; your OVLHW arm set it to 1, which is already the default). 2. `--no-ple-prefetch` (your config uses `--ple-io ram`; 0.1.43.1 added a per-row prefetch hint on the mapped table). 3. `STRATA_TEST_PAGEABLE=1` (the pinned bounce slots of #1996 off). Please also send, for V43 and V431: the start-up logs (diffable), `STRATA_DECODE_TIMING=1` output for one decode (the per-window verify / stage / GPU-wait split), the draft acceptance and expert hit rate per arm, and the cmake line each binary was built with (CUDA arch, ggml dir, compiler, CUDA 13.4 for both?). A different build of the two binaries would show as a difference there, and a stage time that grows on one card points at the hand-off. If one of the three toggles brings 82 tok/s back, that is the commit, and I will fix that one. Until then I would not skip 0.1.43.1 for the overlap's sake: on a layer split it changes nothing.
Author
Owner

@ben0112 commented on GitHub (Oct 14, 2026):

Thank you — you were right on both counts, and your toggle 2 found it. --no-ple-prefetch restores the full speed.

1. You were right about the overlap — my attribution was wrong

Accepted: the overlap never ran on a layer split in either build, so our V43 arm ran without it too, and the +28% I credited to it was wrong. I should have read the gate in v0.1.43's source instead of assuming "default on" meant "active on a split". Scratch that part of my report.

2. The two binaries were built the same way

Both engine/strata, same machine, same toolchain — so a build difference is out:

v0.1.43 v0.1.43.1
CMAKE_BUILD_TYPE / CMAKE_CUDA_ARCHITECTURES Release / 86 Release / 86
CMAKE_CUDA_COMPILER / CMAKE_CXX_COMPILER /usr/local/cuda/bin/nvcc / /bin/c++ same
compiler string in the binary GCC (Debian 14.2.0-19) 14.2.0 identical
CUDA string in the binary cuda_13.4 cuda_13.4
STRATA_ENABLE_CUDA / STRATA_NATIVE_EXPERTS ON / ON ON / ON
STRATA_ISA_FLOOR / STRATA_PORTABLE empty / OFF empty / OFF
GGML_NATIVE / GGML_CUDA / GGML_AVX2 / GGML_AVX512 ON / OFF / OFF / OFF ON / OFF / OFF / OFF

Only CMAKE_MAKE_PROGRAM and STRATA_GGML_DIR differ, and only in their paths — the two third_party/llama.cpp trees are byte-identical (diff -rq clean).

3. Your toggle 2 is the fix: --no-ple-prefetch, on its own

Same ab-config.json for every arm (24 args: 2×3090 layer split, --ple-io ram, --expert-cache auto, --spec 4, --kv-resident 32768, --max-context 262144); only exe=/xargs=/env differ. One fresh server per arm, n=4 requests (3 short chats + one 6,345-token prompt, --max-new 256, greedy).

Arm What it is decode median 6,345-tok prefill
V43 v0.1.43 80.8 tok/s 974.6 tok/s
NPP v0.1.43.1 --no-ple-prefetch 80.4 tok/s (−0.4%) 962.3 tok/s
NPPW0 NPP + STRATA_ADAPT_CALLBACK_WARMUP=0 80.5 tok/s (−0.3%) 957.4 tok/s
W0 v0.1.43.1 CALLBACK_WARMUP=0 only 74.6 tok/s (−7.7%) 803.8 tok/s
PAGE v0.1.43.1 STRATA_TEST_PAGEABLE=1 75.8 tok/s (−6.3%) 768.1 tok/s
earlier v0.1.43.1, defaults 64.7 tok/s (−21.7%) 717.9 tok/s
earlier v0.1.43.1 STRATA_ADAPT_OVERLAP=1 64.4 tok/s (−22.1%) 750.2 tok/s
earlier v0.1.43.1 STRATA_ADAPT_SIGNAL=host 65.3 tok/s (−20.5%) 717.9 tok/s

So: --no-ple-prefetch alone puts 0.1.43.1 back inside noise of 0.1.43 (−0.4%, and it is not worse on any individual request). STRATA_TEST_PAGEABLE=1 does not recover it, so #1996 is not the cause. CALLBACK_WARMUP=0 recovers about two-thirds of it on its own but adds nothing once the prefetch is off — i.e. the warmup is a second, smaller effect on the same host path, not the cause.

4. Mechanism (your read was exactly right)

Our config is --ple-io ram, so the PLE table is mlock'd and resident from start-up. 0.1.43.1 issues a per-row PrefetchVirtualMemory hint on the mapped table — sixteen rows per token, on the token path — which in this regime prefetches pages that are already locked in RAM. Pure overhead, and it shows up as a decode and prefill loss of the same order, which matches the D2/D3 rows above.

It also explains why you cannot reproduce on 2×16 GB: at 96 GB of VRAM our decode expert-cache hit rate is 94.6% and the caches hold ~97.9% of the routed mass, so almost nothing is streamed and the PLE rows are the one remaining per-token host touch. On a 2×16 GB split the extra hint hides in the streaming noise.

Suggested fix: skip the per-row prefetch when the table came from --ple-io ram (or more generally when the mapping is known locked/resident). We are happy to test a patch build.

5. The data you asked for

Start-up logs: V43 and v0.1.43.1 arms are line-for-line identical except the engine path and the --ple-io ram lock time (13.8 s vs 2.2 s on the first arm after a cold page cache) — same layer split across 2 GPUs, same pcie_frac 0.22, same K=24 ... caches hold 11776 of 24576 profiled pairs (~97.9% of the routed mass), same KV streaming: 32768 of 262144 cells, same MTP draft load. Saved verbatim under /root/evidence/ on the test container.

Per-arm counters, same run:

V43 NPP W0 PAGE
decode expert cache hit rate 94.6% 94.6% 94.6% 94.6%
KV streaming VRAM hit (long req) 99.41% 99.34% 99.41% 99.41%
drafts accepted (long req) 68/107 68/117 68/107 68/107
drafts accepted (34-tok chat) 183/208 183/211 183/208 183/208

Hit rates and draft acceptance are identical across arms, so this is not a cache or spec-decode difference — it is per-token host time.

STRATA_DECODE_TIMING=1 output for V43 vs v0.1.43.1 is being collected now and I will paste the per-window verify/stage/GPU-wait split as soon as it is done.

6. Where this leaves us

We are on this exact hardware in production. With --no-ple-prefetch in the config, 0.1.43.1 becomes usable for us, so we can take the #2026 / #2040 / serve-side fixes after all. We are also about to test 0.1.44.1 on the same harness — I will report whether the per-row prefetch is still there and whether the new "keep every expert in RAM" rule does anything for a 2×48 GB, 176 GiB host.

Thanks for pointing at the right knob instead of the one I guessed.

<!-- gh-comment-id:6174206343 --> @ben0112 commented on GitHub (Oct 14, 2026): Thank you — you were right on both counts, and your toggle 2 found it. **`--no-ple-prefetch` restores the full speed.** ## 1. You were right about the overlap — my attribution was wrong Accepted: the overlap never ran on a layer split in either build, so our V43 arm ran without it too, and the +28% I credited to it was wrong. I should have read the gate in v0.1.43's source instead of assuming "default on" meant "active on a split". Scratch that part of my report. ## 2. The two binaries were built the same way Both `engine/strata`, same machine, same toolchain — so a build difference is out: | | v0.1.43 | v0.1.43.1 | |---|---|---| | `CMAKE_BUILD_TYPE` / `CMAKE_CUDA_ARCHITECTURES` | Release / 86 | Release / 86 | | `CMAKE_CUDA_COMPILER` / `CMAKE_CXX_COMPILER` | `/usr/local/cuda/bin/nvcc` / `/bin/c++` | same | | compiler string in the binary | GCC (Debian 14.2.0-19) 14.2.0 | identical | | CUDA string in the binary | `cuda_13.4` | `cuda_13.4` | | `STRATA_ENABLE_CUDA` / `STRATA_NATIVE_EXPERTS` | ON / ON | ON / ON | | `STRATA_ISA_FLOOR` / `STRATA_PORTABLE` | empty / OFF | empty / OFF | | `GGML_NATIVE` / `GGML_CUDA` / `GGML_AVX2` / `GGML_AVX512` | ON / OFF / OFF / OFF | ON / OFF / OFF / OFF | Only `CMAKE_MAKE_PROGRAM` and `STRATA_GGML_DIR` differ, and only in their paths — the two `third_party/llama.cpp` trees are byte-identical (`diff -rq` clean). ## 3. Your toggle 2 is the fix: `--no-ple-prefetch`, on its own Same `ab-config.json` for every arm (24 args: 2×3090 layer split, `--ple-io ram`, `--expert-cache auto`, `--spec 4`, `--kv-resident 32768`, `--max-context 262144`); only `exe=`/`xargs=`/env differ. One fresh server per arm, n=4 requests (3 short chats + one 6,345-token prompt, `--max-new 256`, greedy). | Arm | What it is | decode median | 6,345-tok prefill | |---|---|---:|---:| | **V43** | v0.1.43 | 80.8 tok/s | 974.6 tok/s | | **NPP** | v0.1.43.1 **`--no-ple-prefetch`** | **80.4 tok/s (−0.4%)** | 962.3 tok/s | | **NPPW0** | NPP + `STRATA_ADAPT_CALLBACK_WARMUP=0` | 80.5 tok/s (−0.3%) | 957.4 tok/s | | W0 | v0.1.43.1 `CALLBACK_WARMUP=0` only | 74.6 tok/s (−7.7%) | 803.8 tok/s | | PAGE | v0.1.43.1 `STRATA_TEST_PAGEABLE=1` | 75.8 tok/s (−6.3%) | 768.1 tok/s | | *earlier* | v0.1.43.1, defaults | 64.7 tok/s (−21.7%) | 717.9 tok/s | | *earlier* | v0.1.43.1 `STRATA_ADAPT_OVERLAP=1` | 64.4 tok/s (−22.1%) | 750.2 tok/s | | *earlier* | v0.1.43.1 `STRATA_ADAPT_SIGNAL=host` | 65.3 tok/s (−20.5%) | 717.9 tok/s | So: **`--no-ple-prefetch` alone puts 0.1.43.1 back inside noise of 0.1.43 (−0.4%, and it is not worse on any individual request).** `STRATA_TEST_PAGEABLE=1` does not recover it, so #1996 is not the cause. `CALLBACK_WARMUP=0` recovers about two-thirds of it on its own but adds nothing once the prefetch is off — i.e. the warmup is a second, smaller effect on the same host path, not the cause. ## 4. Mechanism (your read was exactly right) Our config is `--ple-io ram`, so the PLE table is `mlock`'d and resident from start-up. 0.1.43.1 issues a **per-row `PrefetchVirtualMemory` hint on the mapped table** — sixteen rows per token, on the token path — which in this regime prefetches pages that are already locked in RAM. Pure overhead, and it shows up as a decode *and* prefill loss of the same order, which matches the D2/D3 rows above. It also explains why you cannot reproduce on 2×16 GB: at 96 GB of VRAM our decode expert-cache hit rate is 94.6% and the caches hold ~97.9% of the routed mass, so almost nothing is streamed and the PLE rows are the one remaining per-token host touch. On a 2×16 GB split the extra hint hides in the streaming noise. **Suggested fix:** skip the per-row prefetch when the table came from `--ple-io ram` (or more generally when the mapping is known locked/resident). We are happy to test a patch build. ## 5. The data you asked for **Start-up logs:** V43 and v0.1.43.1 arms are **line-for-line identical** except the engine path and the `--ple-io ram` lock time (13.8 s vs 2.2 s on the first arm after a cold page cache) — same `layer split across 2 GPUs`, same `pcie_frac 0.22`, same `K=24 ... caches hold 11776 of 24576 profiled pairs (~97.9% of the routed mass)`, same `KV streaming: 32768 of 262144 cells`, same MTP draft load. Saved verbatim under `/root/evidence/` on the test container. **Per-arm counters, same run:** | | V43 | NPP | W0 | PAGE | |---|---|---|---|---| | decode expert cache hit rate | 94.6% | 94.6% | 94.6% | 94.6% | | KV streaming VRAM hit (long req) | 99.41% | 99.34% | 99.41% | 99.41% | | drafts accepted (long req) | 68/107 | 68/117 | 68/107 | 68/107 | | drafts accepted (34-tok chat) | 183/208 | 183/211 | 183/208 | 183/208 | Hit rates and draft acceptance are identical across arms, so this is not a cache or spec-decode difference — it is per-token host time. `STRATA_DECODE_TIMING=1` output for V43 vs v0.1.43.1 is being collected now and I will paste the per-window verify/stage/GPU-wait split as soon as it is done. ## 6. Where this leaves us We are on this exact hardware in production. With `--no-ple-prefetch` in the config, **0.1.43.1 becomes usable for us**, so we can take the #2026 / #2040 / serve-side fixes after all. We are also about to test **0.1.44.1** on the same harness — I will report whether the per-row prefetch is still there and whether the new "keep every expert in RAM" rule does anything for a 2×48 GB, 176 GiB host. Thanks for pointing at the right knob instead of the one I guessed.
Author
Owner

@ben0112 commented on GitHub (Oct 14, 2026):

One refinement after reading the code — and I think it makes the fix smaller than "special-case --ple-io ram".

On POSIX the per-row prefetch is one madvise(MADV_WILLNEED) syscall per row, sixteen per token; on Windows the same code path is a single PrefetchVirtualMemory for all sixteen. From src/kernels/ngram.cpp in v0.1.44.1:

// line 551-552 (comment)
// is what the stall watchdog stops.  Ask the OS for the next window's pages in one go (PrefetchVirtualMemory /
// MADV_WILLNEED, a hint that cannot change a value: an unfetched page is faulted by the read) while this window is read.

// line 555
if (impl_->data == nullptr || !g_ple_prefetch) return;

// line 565 — Windows: one call for the whole window
if (k > 0) (void) PrefetchVirtualMemory(GetCurrentProcess(), k, ranges, 0);

// line 571 — POSIX: per row
(void) madvise((void*) p0, (size_t) (r0 + impl_->rb - p0), MADV_WILLNEED);

and the note at line 624 confirms the intent was the Windows shape: "PrefetchVirtualMemory issues all sixteen in ONE call and lets them complete in parallel."

The Windows call is explicitly described as "a hint that cannot change a value"; on Linux the equivalent is sixteen separate madvise calls per token, each taking mmap_lock on a process that is running 24 decode threads plus the CUDA callback thread. On a locked (--ple-io ram) mapping every one of those ranges is already resident, so the hint can only cost the syscall plus the lock contention — which is the shape of the loss (decode and prefill, no change in hit rates or draft acceptance).

Caveat: this last paragraph is my reading of the code, not a measurement. If it is useful I can strace -c -f one decode window on both versions and post the syscall counts, which would settle whether it is the syscall count or the prefetch itself. Happy to do that if you want the number.

<!-- gh-comment-id:6174215601 --> @ben0112 commented on GitHub (Oct 14, 2026): One refinement after reading the code — and I think it makes the fix smaller than "special-case `--ple-io ram`". **On POSIX the per-row prefetch is one `madvise(MADV_WILLNEED)` syscall per row, sixteen per token; on Windows the same code path is a single `PrefetchVirtualMemory` for all sixteen.** From `src/kernels/ngram.cpp` in v0.1.44.1: ```cpp // line 551-552 (comment) // is what the stall watchdog stops. Ask the OS for the next window's pages in one go (PrefetchVirtualMemory / // MADV_WILLNEED, a hint that cannot change a value: an unfetched page is faulted by the read) while this window is read. // line 555 if (impl_->data == nullptr || !g_ple_prefetch) return; // line 565 — Windows: one call for the whole window if (k > 0) (void) PrefetchVirtualMemory(GetCurrentProcess(), k, ranges, 0); // line 571 — POSIX: per row (void) madvise((void*) p0, (size_t) (r0 + impl_->rb - p0), MADV_WILLNEED); ``` and the note at line 624 confirms the intent was the Windows shape: *"`PrefetchVirtualMemory` issues all sixteen in ONE call and lets them complete in parallel."* The Windows call is explicitly described as "a hint that cannot change a value"; on Linux the equivalent is sixteen separate `madvise` calls per token, each taking `mmap_lock` on a process that is running 24 decode threads plus the CUDA callback thread. On a locked (`--ple-io ram`) mapping every one of those ranges is already resident, so the hint can only cost the syscall plus the lock contention — which is the shape of the loss (decode *and* prefill, no change in hit rates or draft acceptance). **Caveat:** this last paragraph is my reading of the code, not a measurement. If it is useful I can `strace -c -f` one decode window on both versions and post the syscall counts, which would settle whether it is the syscall count or the prefetch itself. Happy to do that if you want the number.
Author
Owner

@ben0112 commented on GitHub (Oct 14, 2026):

Part 1 — two corrections to my own report (please read first)

1. "2× RTX 3090 48 GB" meant 48 GB in total, not 48 GB per card. The two cards are 24 GB each
(nvidia-smi: 24576 MiB ×2). I wrote it the way we say it internally and it read as 96 GB. So:

  • We are not in an all-resident regime. 48 GB of VRAM for a 103.69 GiB model leaves roughly half
    of the expert mass to be streamed, and the engine's own log confirms swapping is happening:
    resident RAM: 45.18 GiB of experts in RAM, 15631 exchanged with the VRAM tier.
  • Your inference "with 96 GB of VRAM your expert hit rate leaves almost nothing to swap" does not
    hold for us, and it is the reason the OVL1/OVLH/OVLHW arms could not move anything.
  • Your 2× 16 GB (32 GB) test bed is therefore 1.5× away from us, not 3× — much closer than you
    thought, and I think the regime is reproducible for you.

2. "the exact binary our production runs" is wrong and I should not have written it.
The two v0.1.43 binaries are different builds of the same commit:

sha256 (first 16) size built
CT103 test box 2b2079c1e22ec877 58,580,632 2026-10-12 13:33
CT104 production a7087157018e95ae 58,580,632 2026-10-12 15:03

Same source commit 7695859, independently built 1.5 h apart. The A/B used the CT103 one.

Part 2 — the three toggles: one of them is the answer

All five arms, same config, n=16 decode samples each (4 requests × 2 rounds, order reversed in
round 1), tools/ab_engine.py, --rounds 2 --max-new 256 --long-words 6000:

Arm env / args decode median (R0 / R1) Δ vs V43 long-prompt prefill
V43 v0.1.43 80.2 / 80.3 baseline 1082.8 / 1100.5
V431 v0.1.43.1 66.1 / 64.4 −19.8 % 757.2 / 687.1
W0 V431 + STRATA_ADAPT_CALLBACK_WARMUP=0 65.2 / 63.8 −19.1 % 717.5 / 702.8
NOPF V431 + --no-ple-prefetch 80.1 / 80.2 −0.1 % 1100.9 / 1098.7
PAGE V431 + STRATA_TEST_PAGEABLE=1 65.4 / 64.7 −19.4 % 679.4 / 681.0

Per request, NOPF tracks V43 sample for sample:

arm chat0 chat1 chat2 long
V43 84.0 81.4 78.7 78.9
NOPF 84.1 81.4 78.8 78.6
V431 69.6 60.8 62.6 70.3

--no-ple-prefetch restores 100 % of the regression, on both rounds, and the long-prompt prefill
comes back slightly above V43 (1100.9 vs 1082.8).
STRATA_ADAPT_CALLBACK_WARMUP=0 and
STRATA_TEST_PAGEABLE=1 change nothing.

Why this fits, and why your 2× A4000 could not see it

Our config is --ple-io ram, and on this box memlock is unlimited, so the PLE table really is
locked:

strata generate: PLE table locked in RAM (--ple-io ram) in 3.2 s

v0.1.43.1 added the per-row prefetch hint on the mapped table (you named it as suspect 2). If the
table is already resident and locked, that hint is pure overhead on our hot path. On a machine where
the table is not fully resident — smaller RAM, or no mlock — the same hint is a win, which is
exactly the direction that would hide the regression from your test bed.

This also explains why the overlap question was a red herring on both sides: on a layer split the
gate is closed in both versions, so V43 and V431 both ran without it, and the 28 % I attributed to it
in the original report was wrong.

Part 3 — what we are doing next

We are running the same A/B against v0.1.44.1 and will post that result here as well. Two
questions for you while we do:

  1. Is the PLE prefetch hint supposed to be a no-op when the table is already mlocked, or is the
    overhead expected? If it is expected, would you take a patch that skips the hint when
    --ple-io ram succeeded in locking the table?
  2. If you want the regime on your test bed: 2× 16 GB with --ple-io mmap (no mlock) should behave
    like our V431 arm; the same box with the table pinned should behave like NOPF. If you can hold the
    table resident, you should be able to reproduce both sides.

Artifacts on request: start-up logs for every arm (diffable), STRATA_DECODE_TIMING=1 output for one
decode, draft acceptance and expert hit rate per arm, and the cmake line for each binary
(CMAKE_CUDA_ARCHITECTURES=86, /usr/local/cuda/bin/nvcc, CUDA 13.4.92, /bin/c++, Release, ninja —
identical for both).

Part 4 — v0.1.44.1 does not fix it either

Same box, same config, one interleaved round, tools/ab_engine.py:

Arm chat0 chat1 chat2 long long-prompt prefill
V43 (v0.1.43) 88.6 81.7 80.5 79.6 995.4
V441 (v0.1.44.1) 66.6 55.8 60.9 70.5 520.4
V431 (v0.1.43.1, reference) 69.6 60.8 62.6 70.3 757.2

v0.1.44.1 is in the same place as v0.1.43.1 (within noise of it, −19 % vs V43). The long-prompt
prefill is even lower than 0.1.43.1 in this round (520 vs 757), so 0.1.44/0.1.44.1 did not fix the
PLE-prefetch regression on a locked PLE table. The --no-ple-prefetch arm of this same round is what
we are waiting on to confirm the workaround still applies in 0.1.44.1; we will post it here.

Consequence for us: we stay on v0.1.43, or move to 0.1.44.1 with --no-ple-prefetch, pending that
last arm.

Part 5 — separate defect in tools/ab_engine.py itself (not about the regression)

This one is worth its own issue; it is not related to the PLE work and it made our runs fail in a way
that looked like an engine bug.

Symptom. With 2+ arms and --rounds 2, the second or later arm fails at startup:

RuntimeError: server exited with 1

Cause. The per-arm teardown (v0.1.44.1 tools/ab_engine.py, lines ~119-125) only terminates the
launcher process:

finally:
    proc.terminate()          # this is `serve/server.py`
    try:
        proc.wait(60)
    except subprocess.TimeoutExpired:
        proc.kill()
    time.sleep(5)             # the engine child is now an orphan

serve/server.py starts the engine as its child. When the launcher goes away the engine often
survives it, still holding both the GPU memory and ~125 GiB of host RAM. The next arm's server
then starts against a machine whose RAM and VRAM are still occupied and dies immediately — on this
48 GB box the python process is also OOM-killed (rc=137).

Minimal fix we applied locally (happy to send it as a PR if you want it):

finally:
    proc.terminate()
    try:
        proc.wait(60)
    except subprocess.TimeoutExpired:
        proc.kill()
        try:
            proc.wait(15)
        except subprocess.TimeoutExpired:
            pass
    for pat in ("engine/strata", "serve/server.py"):      # sweep orphans
        subprocess.run(["pkill", "-9", "-f", pat], check=False,
                       stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
    for _ in range(90):                                   # wait for VRAM *and* RAM
        ...   # nvidia-smi < 200 MiB on the used cards, /proc/meminfo MemAvailable >= 60 GiB
    time.sleep(3)

Note it is intermittent — our first 5-arm × 2-round run on the same code completed cleanly, the
next two did not. A machine with more RAM headroom would likely never see it, which is probably why
it has gone unnoticed.

Reproduce: any A/B on a box where the engine's RSS is a large fraction of total RAM, with
--rounds 2 and 2+ arms.


Status note on Part 5: I applied the sweep-and-wait patch above to our local copy and the three-arm run that is going now is using it; I will confirm here whether it completed cleanly, which would be the reproducer you want.

<!-- gh-comment-id:6174792760 --> @ben0112 commented on GitHub (Oct 14, 2026): ## Part 1 — two corrections to my own report (please read first) **1. "2× RTX 3090 48 GB" meant 48 GB *in total*, not 48 GB per card.** The two cards are 24 GB each (`nvidia-smi`: `24576 MiB` ×2). I wrote it the way we say it internally and it read as 96 GB. So: - We are **not** in an all-resident regime. 48 GB of VRAM for a 103.69 GiB model leaves roughly half of the expert mass to be streamed, and the engine's own log confirms swapping is happening: `resident RAM: 45.18 GiB of experts in RAM, 15631 exchanged with the VRAM tier`. - Your inference *"with 96 GB of VRAM your expert hit rate leaves almost nothing to swap"* does not hold for us, and it is the reason the OVL1/OVLH/OVLHW arms could not move anything. - Your 2× 16 GB (32 GB) test bed is therefore **1.5× away** from us, not 3× — much closer than you thought, and I think the regime is reproducible for you. **2. "the exact binary our production runs" is wrong and I should not have written it.** The two v0.1.43 binaries are *different builds of the same commit*: | | sha256 (first 16) | size | built | |---|---|---|---| | CT103 test box | `2b2079c1e22ec877` | 58,580,632 | 2026-10-12 13:33 | | CT104 production | `a7087157018e95ae` | 58,580,632 | 2026-10-12 15:03 | Same source commit `7695859`, independently built 1.5 h apart. The A/B used the CT103 one. ## Part 2 — the three toggles: one of them is the answer All five arms, same config, n=16 decode samples each (4 requests × 2 rounds, order reversed in round 1), `tools/ab_engine.py`, `--rounds 2 --max-new 256 --long-words 6000`: | Arm | env / args | decode median (R0 / R1) | Δ vs V43 | long-prompt prefill | |---|---|---:|---:|---:| | **V43** | v0.1.43 | **80.2 / 80.3** | baseline | 1082.8 / 1100.5 | | **V431** | v0.1.43.1 | 66.1 / 64.4 | **−19.8 %** | 757.2 / 687.1 | | **W0** | V431 + `STRATA_ADAPT_CALLBACK_WARMUP=0` | 65.2 / 63.8 | −19.1 % | 717.5 / 702.8 | | **NOPF** | V431 + `--no-ple-prefetch` | **80.1 / 80.2** | **−0.1 %** | **1100.9 / 1098.7** | | **PAGE** | V431 + `STRATA_TEST_PAGEABLE=1` | 65.4 / 64.7 | −19.4 % | 679.4 / 681.0 | Per request, NOPF tracks V43 sample for sample: | arm | chat0 | chat1 | chat2 | long | |---|---:|---:|---:|---:| | V43 | 84.0 | 81.4 | 78.7 | 78.9 | | NOPF | 84.1 | 81.4 | 78.8 | 78.6 | | V431 | 69.6 | 60.8 | 62.6 | 70.3 | **`--no-ple-prefetch` restores 100 % of the regression, on both rounds, and the long-prompt prefill comes back slightly above V43 (1100.9 vs 1082.8).** `STRATA_ADAPT_CALLBACK_WARMUP=0` and `STRATA_TEST_PAGEABLE=1` change nothing. ### Why this fits, and why your 2× A4000 could not see it Our config is `--ple-io ram`, and on this box `memlock` is `unlimited`, so the PLE table really is locked: ``` strata generate: PLE table locked in RAM (--ple-io ram) in 3.2 s ``` v0.1.43.1 added the per-row prefetch hint on the mapped table (you named it as suspect 2). If the table is already resident and locked, that hint is pure overhead on our hot path. On a machine where the table is *not* fully resident — smaller RAM, or no `mlock` — the same hint is a win, which is exactly the direction that would hide the regression from your test bed. This also explains why the overlap question was a red herring on both sides: on a layer split the gate is closed in both versions, so V43 and V431 both ran without it, and the 28 % I attributed to it in the original report was wrong. ## Part 3 — what we are doing next We are running the same A/B against **v0.1.44.1** and will post that result here as well. Two questions for you while we do: 1. Is the PLE prefetch hint supposed to be a no-op when the table is already `mlock`ed, or is the overhead expected? If it is expected, would you take a patch that skips the hint when `--ple-io ram` succeeded in locking the table? 2. If you want the regime on your test bed: 2× 16 GB with `--ple-io mmap` (no `mlock`) should behave like our V431 arm; the same box with the table pinned should behave like NOPF. If you can hold the table resident, you should be able to reproduce both sides. Artifacts on request: start-up logs for every arm (diffable), `STRATA_DECODE_TIMING=1` output for one decode, draft acceptance and expert hit rate per arm, and the cmake line for each binary (`CMAKE_CUDA_ARCHITECTURES=86`, `/usr/local/cuda/bin/nvcc`, CUDA 13.4.92, `/bin/c++`, Release, ninja — identical for both). ## Part 4 — v0.1.44.1 does **not** fix it either Same box, same config, one interleaved round, `tools/ab_engine.py`: | Arm | chat0 | chat1 | chat2 | long | long-prompt prefill | |---|---:|---:|---:|---:|---:| | **V43** (v0.1.43) | 88.6 | 81.7 | 80.5 | 79.6 | 995.4 | | **V441** (v0.1.44.1) | 66.6 | 55.8 | 60.9 | 70.5 | 520.4 | | **V431** (v0.1.43.1, reference) | 69.6 | 60.8 | 62.6 | 70.3 | 757.2 | **v0.1.44.1 is in the same place as v0.1.43.1** (within noise of it, −19 % vs V43). The long-prompt prefill is even lower than 0.1.43.1 in this round (520 vs 757), so 0.1.44/0.1.44.1 did **not** fix the PLE-prefetch regression on a locked PLE table. The `--no-ple-prefetch` arm of this same round is what we are waiting on to confirm the workaround still applies in 0.1.44.1; we will post it here. Consequence for us: we stay on v0.1.43, or move to 0.1.44.1 **with `--no-ple-prefetch`**, pending that last arm. ## Part 5 — separate defect in `tools/ab_engine.py` itself (not about the regression) This one is worth its own issue; it is not related to the PLE work and it made our runs fail in a way that looked like an engine bug. **Symptom.** With 2+ arms and `--rounds 2`, the second or later arm fails at startup: ``` RuntimeError: server exited with 1 ``` **Cause.** The per-arm teardown (v0.1.44.1 `tools/ab_engine.py`, lines ~119-125) only terminates the launcher process: ```python finally: proc.terminate() # this is `serve/server.py` try: proc.wait(60) except subprocess.TimeoutExpired: proc.kill() time.sleep(5) # the engine child is now an orphan ``` `serve/server.py` starts the engine as its child. When the launcher goes away the engine often survives it, still holding **both** the GPU memory and ~125 GiB of host RAM. The next arm's server then starts against a machine whose RAM and VRAM are still occupied and dies immediately — on this 48 GB box the python process is also OOM-killed (`rc=137`). **Minimal fix we applied locally** (happy to send it as a PR if you want it): ```python finally: proc.terminate() try: proc.wait(60) except subprocess.TimeoutExpired: proc.kill() try: proc.wait(15) except subprocess.TimeoutExpired: pass for pat in ("engine/strata", "serve/server.py"): # sweep orphans subprocess.run(["pkill", "-9", "-f", pat], check=False, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) for _ in range(90): # wait for VRAM *and* RAM ... # nvidia-smi < 200 MiB on the used cards, /proc/meminfo MemAvailable >= 60 GiB time.sleep(3) ``` Note it is **intermittent** — our first 5-arm × 2-round run on the same code completed cleanly, the next two did not. A machine with more RAM headroom would likely never see it, which is probably why it has gone unnoticed. **Reproduce:** any A/B on a box where the engine's RSS is a large fraction of total RAM, with `--rounds 2` and 2+ arms. --- **Status note on Part 5:** I applied the sweep-and-wait patch above to our local copy and the three-arm run that is going now is using it; I will confirm here whether it completed cleanly, which would be the reproducer you want.
Author
Owner

@ben0112 commented on GitHub (Oct 14, 2026):

Final data — the workaround also fixes v0.1.44.1, and the harness patch is verified

Two follow-ups to the comment above.

1. --no-ple-prefetch restores v0.1.44.1 as well

Same box, same 24-arg config, one interleaved round, three arms (tools/ab_engine.py), after the sweep patch below:

Arm decode median (n=4) Δ vs V43 long-prompt decode / prefill
V43 (v0.1.43) 80.8 tok/s baseline 79.3 / 1024.9
V441 (v0.1.44.1, defaults) 76.7 tok/s −5.1 % 76.8 / 831.3 (−19 %)
V441N (v0.1.44.1 + --no-ple-prefetch) 81.7 tok/s +1.1 % 81.9 / 1037.4 (+1.2 %)

So on a locked (--ple-io ram) PLE table:

  • v0.1.44.1's default is better than v0.1.43.1's was on decode (−5 % vs −20 %) but the long-prompt prefill is still −19 %, i.e. the per-row prefetch hint is still costing us on both paths.
  • --no-ple-prefetch recovers both paths fully, and in this round slightly better than v0.1.43 (prefill 1037.4 vs 1024.9).

Consequence for us: we can move to v0.1.44.1 with --no-ple-prefetch in the config, which means we get the #2026 / #2040 / serve-side fixes after all. If you would rather fix it in the engine, the one-line shape still looks like "do not issue the per-row hint when the table is locked/resident" — but the flag is enough for us in the meantime.

2. The ab_engine.py sweep patch is verified

I applied the sweep-and-wait fix from Part 5 and re-ran the three-arm test above with it: all three arms started and completed (ready in 211 s, 253 s, …), where the same run without it died on arm 2 with RuntimeError: server exited with 1. That is the reprodu cer you asked for, and it also confirms the diagnosis: without the sweep, serve/server.py's engine child survives the launcher and holds both the VRAM and ~125 GiB of RAM.

Two notes on our local patch, in case you take it upstream verbatim — both were mistakes I made first and had to fix:

  • Do not use a bare "engine/strata" pattern for the sweep. The harness's own argv contains arm specs like V43:exe=/opt/strata/engine/strata, so pkill -9 -f "engine/strata" kills the harness itself. Use "engine/strata --serve" (and "serve/server.py --engine").
  • Do not reuse the name out in the wait loop. It is already the JSONL result handle opened earlier in main(); assigning subprocess.run(...).stdout to it makes the next out.write(...) raise AttributeError: 'str' object has no attribute 'write', which looks like an engine failure but is not.

Happy to send the whole thing as a PR if useful.

<!-- gh-comment-id:6175509803 --> @ben0112 commented on GitHub (Oct 14, 2026): ## Final data — the workaround also fixes v0.1.44.1, and the harness patch is verified Two follow-ups to the comment above. ### 1. `--no-ple-prefetch` restores v0.1.44.1 as well Same box, same 24-arg config, one interleaved round, three arms (`tools/ab_engine.py`), after the sweep patch below: | Arm | decode median (n=4) | Δ vs V43 | long-prompt decode / prefill | |---|---:|---:|---:| | **V43** (v0.1.43) | 80.8 tok/s | baseline | 79.3 / **1024.9** | | **V441** (v0.1.44.1, defaults) | 76.7 tok/s | **−5.1 %** | 76.8 / **831.3** (−19 %) | | **V441N** (v0.1.44.1 + `--no-ple-prefetch`) | **81.7 tok/s** | **+1.1 %** | 81.9 / **1037.4** (+1.2 %) | So on a **locked** (`--ple-io ram`) PLE table: - v0.1.44.1's *default* is better than v0.1.43.1's was on decode (−5 % vs −20 %) but the **long-prompt prefill is still −19 %**, i.e. the per-row prefetch hint is still costing us on both paths. - **`--no-ple-prefetch` recovers both paths fully**, and in this round slightly *better* than v0.1.43 (prefill 1037.4 vs 1024.9). Consequence for us: **we can move to v0.1.44.1 with `--no-ple-prefetch` in the config**, which means we get the #2026 / #2040 / serve-side fixes after all. If you would rather fix it in the engine, the one-line shape still looks like "do not issue the per-row hint when the table is locked/resident" — but the flag is enough for us in the meantime. ### 2. The `ab_engine.py` sweep patch is verified I applied the sweep-and-wait fix from Part 5 and re-ran the three-arm test above with it: **all three arms started and completed** (`ready in 211 s`, `253 s`, …), where the same run without it died on arm 2 with `RuntimeError: server exited with 1`. That is the reprodu cer you asked for, and it also confirms the diagnosis: without the sweep, `serve/server.py`'s engine child survives the launcher and holds both the VRAM and ~125 GiB of RAM. Two notes on our local patch, in case you take it upstream verbatim — both were mistakes I made first and had to fix: - **Do not use a bare `"engine/strata"` pattern for the sweep.** The harness's own argv contains arm specs like `V43:exe=/opt/strata/engine/strata`, so `pkill -9 -f "engine/strata"` kills the harness itself. Use `"engine/strata --serve"` (and `"serve/server.py --engine"`). - **Do not reuse the name `out` in the wait loop.** It is already the JSONL result handle opened earlier in `main()`; assigning `subprocess.run(...).stdout` to it makes the next `out.write(...)` raise `AttributeError: 'str' object has no attribute 'write'`, which looks like an engine failure but is not. Happy to send the whole thing as a PR if useful.
Author
Owner

@ben0112 commented on GitHub (Oct 15, 2026):

Deployed in production — and it is faster than 0.1.43, not just equal

Following the data above we upgraded our production box (the same 2× RTX 3090, 176 GiB host, UD-Q4_K_XL, layer split, --ple-io ram) to v0.1.44.1 with --no-ple-prefetch.

v0.1.43 v0.1.44.1 + --no-ple-prefetch
first request after start (420-token prose) 72.4 tok/s (5.8 s wall) 85.8 tok/s (engine-reported) / 99.9 tok/s wall
warm — 101.9 / 105.1 / 109.0 tok/s (engine-reported)
decode expert-cache hit rate 94.6 % 99.2 %
service active, 0 restarts active, 0 restarts, :8080 200 in 8.8 ms

The cold-start comparison is like-for-like (both are the first request after a start): +18.5 %. The warm numbers are much higher, and I think the extra comes from 0.1.44's "keep every expert in RAM" rule — the hit rate moved 94.6 % → 99.2 % on this box, which the 48 GB of VRAM plus 176 GiB of host RAM can afford.

So the --no-ple-prefetch flag is not a workaround that merely gets us back to parity: with it, 0.1.44.1 is the fastest of the three versions we have measured here. Thank you for pointing at suspect 2.

Two operational notes from the upgrade, in case they are useful to anyone else:

  1. serve/server.py must move with the engine. Between 0.1.43 and 0.1.44.1 it grew 385,229 → 417,811 bytes, so swapping only engine/strata is not a valid upgrade. We installed the new version as a second tree (/opt/strata-01441) and pointed the service's ExecStart at it, leaving the old tree untouched — rollback is a one-line ExecStart change.
  2. Anything that watches the engine's paths needs the same change. Our watchdog script had /opt/strata/... hardcoded for the config, the engine log and the venv's python; after the upgrade it was happily sampling a frozen old log and reporting PARSE_FAIL. It now reads the tree from one STRATA_DIR variable.

Happy to send the ab_engine.py sweep patch as a PR if you want it (it also needs the two notes from my last comment: do not use a bare "engine/strata" pattern, and do not reuse the name out).

<!-- gh-comment-id:6181524071 --> @ben0112 commented on GitHub (Oct 15, 2026): ## Deployed in production — and it is faster than 0.1.43, not just equal Following the data above we upgraded our production box (the same 2× RTX 3090, 176 GiB host, UD-Q4_K_XL, layer split, `--ple-io ram`) to **v0.1.44.1 with `--no-ple-prefetch`**. | | v0.1.43 | v0.1.44.1 + `--no-ple-prefetch` | |---|---:|---:| | first request after start (420-token prose) | 72.4 tok/s (5.8 s wall) | **85.8 tok/s** (engine-reported) / 99.9 tok/s wall | | warm | — | **101.9 / 105.1 / 109.0 tok/s** (engine-reported) | | decode expert-cache hit rate | 94.6 % | **99.2 %** | | service | active, 0 restarts | active, 0 restarts, `:8080` 200 in 8.8 ms | The cold-start comparison is like-for-like (both are the first request after a start): **+18.5 %**. The warm numbers are much higher, and I think the extra comes from 0.1.44's "keep every expert in RAM" rule — the hit rate moved 94.6 % → 99.2 % on this box, which the 48 GB of VRAM plus 176 GiB of host RAM can afford. So the `--no-ple-prefetch` flag is not a workaround that merely gets us back to parity: with it, 0.1.44.1 is the fastest of the three versions we have measured here. Thank you for pointing at suspect 2. Two operational notes from the upgrade, in case they are useful to anyone else: 1. **`serve/server.py` must move with the engine.** Between 0.1.43 and 0.1.44.1 it grew 385,229 → 417,811 bytes, so swapping only `engine/strata` is not a valid upgrade. We installed the new version as a second tree (`/opt/strata-01441`) and pointed the service's `ExecStart` at it, leaving the old tree untouched — rollback is a one-line `ExecStart` change. 2. **Anything that watches the engine's paths needs the same change.** Our watchdog script had `/opt/strata/...` hardcoded for the config, the engine log and the venv's python; after the upgrade it was happily sampling a frozen old log and reporting `PARSE_FAIL`. It now reads the tree from one `STRATA_DIR` variable. Happy to send the `ab_engine.py` sweep patch as a PR if you want it (it also needs the two notes from my last comment: do not use a bare `"engine/strata"` pattern, and do not reuse the name `out`).
Author
Owner

@Niko1221 commented on GitHub (Oct 15, 2026):

Thanks for following this through to production, @ben0112. 0.1.44.1 with --no-ple-prefetch on the same 2x RTX 3090 layer split is 85.8 tok/s cold against 72.4 on 0.1.43 (+18.5%), and 102-109 tok/s warm. So the decode drop is gone on your box, and I'm closing this. If it comes back on a later version, reply here with the server log and we'll reopen it.

<!-- gh-comment-id:6184662978 --> @Niko1221 commented on GitHub (Oct 15, 2026): Thanks for following this through to production, @ben0112. 0.1.44.1 with `--no-ple-prefetch` on the same 2x RTX 3090 layer split is 85.8 tok/s cold against 72.4 on 0.1.43 (+18.5%), and 102-109 tok/s warm. So the decode drop is gone on your box, and I'm closing this. If it comes back on a later version, reply here with the server log and we'll reopen it.
Author
Owner

@thc1006 commented on GitHub (Oct 16, 2026):

TL;DR: on a ZFS root, the per-row MADV_WILLNEED hint in PleTable::gather_batch makes ZFS read parts of the PLE table from disk on every prompt, even with --ple-io ram. On this machine (4x P100, IQ3_XXS, 0.1.44.1), each new ~16K-token prompt read 16-18 GB from disk and prefilled at 458-504 tok/s. With --no-ple-prefetch, it read 0.00 GB and prefilled at 704-709 tok/s.

This is the same hint this issue found, measured on 0.1.44.1, with one more cost on ZFS: disk reads. --no-ple-prefetch still fixes it, so I am not asking to reopen. If you would rather track the ZFS side in a new issue, I can open one.

Per new ~16K-token prompt, 0.1.44.1, --ple-io ram, same binary:

PLE prefetch hint prefill tok/s TTFT s disk read engine madvise calls zpl_fadvise calls
on (default) 458-504 31.8-35.0 16.4-18.3 GB ~256,000 ~256,000
off (--no-ple-prefetch) 704-709 22.6-22.8 0.00 GB 64 ~2

How the hint reaches the disk:

  1. On Linux, gather_batch calls madvise(MADV_WILLNEED) once per row of a mapped table (--ple-io mmap or ram). It checks g_ple_prefetch but not impl_->locked (ngram.cpp#L554-L577). The prompt path and the decode verify windows both make this call.
  2. For a file mapping, the kernel passes the hint on as vfs_fadvise(..., POSIX_FADV_WILLNEED) (mm/madvise.c#L261-L307).
  3. OpenZFS's zpl_fadvise then calls dmu_prefetch for that range, even when the pages are already in the page cache (zpl_file.c#L943-L960). dmu_prefetch checks only ZFS's own caches, so locked pages do not stop it. Each hint becomes an ARC prefetch of the 128 KiB record that holds the row. The ARC here is 8 GiB and the table is 26.8 GiB, so most of those records are read from disk again on every prompt.

The call counts come from perf and ftrace on three more prompts of the same size: 16 madvise calls per prompt token, and one zpl_fadvise and one dmu_prefetch for each. ben0112 offered above to measure whether the cost is the syscall or the prefetch. Here, each call spent 92 µs on average inside zpl_fadvise.

ben0112's report in #2571 says their model is on ZFS too. Their machine has much more RAM, so the cost there may be time in zpl_fadvise more than disk reads; I have not measured that. If your 2x A4000 machine does not use ZFS, that may be part of why the hint slowed their machine and not yours.

A possible fix is the one ben0112 suggested above: skip the per-row hint when the table is locked. On Linux, only hint() checks g_ple_prefetch (the other three checks are inside #if defined(_WIN32)). So for a locked table, that change should behave like --no-ple-prefetch, the "off" row above. If you post a patch, I will test it here with the same prompts.

Environment and method
  • Strata 0.1.44.1 (296b59d) and 0.1.43.1 (a0116b2), both built from source with CUDA 12.9.1 for sm_60, with the flags setup.py uses for a CUDA 12 build (Release, STRATA_EXPERIMENTAL_SM60=ON). The "on" and "off" rows above use the same 0.1.44.1 binary; only --no-ple-prefetch differs.
  • 4x Tesla P100 PCIe 16 GB (driver 535.230.02). VMware VM with 8 vCPUs (Xeon E5-2696 v4) and 62.8 GiB of RAM.
  • Ubuntu 22.04.5, kernel 6.8.0-138. Root on ZFS: OpenZFS 2.2.2-0ubuntu9.4 (Ubuntu's zfs-linux 2.2.2 source has the same zpl_fadvise as upstream 2.2.2), recordsize 128K, lz4. I set zfs_arc_max to 8 GiB to leave RAM for the locked table and the experts. A larger ARC would change the disk numbers.
  • Qwen3.8-Flash-Next GSQ-RCO IQ3_XXS. The PLE table is the second shard: 320,001,536 rows x 90 B = 26.8 GiB.
  • Server: 4 slots, layer split 13,26,38 over the four cards. Engine flags (abridged, paths left out): --max-context 32768 --kv int8 --expert-cache auto --prefill 2048 --pool-workers 6 --batch-groups auto --vram-reserve-mib 1536 --ple-io ram --spec 4 --spec-min-p 0.5 --resident-experts --trim-stage-weights --no-kv-grow --conversation-cache-mib 8192, plus --no-ple-prefetch for the "off" row.
  • Every run is a fresh server start under systemd with LimitMEMLOCK=infinity. Order of the runs: 0.1.43.1, 0.1.44.1, 0.1.44.1 with the hint on, 0.1.44.1, 0.1.43.1.
  • Prompts: slices of Strata's own docs, ~16K tokens each, with a random nonce first so no prefix is reused. Thinking off, temperature 0, 32 tokens out, one request at a time. Speed and TTFT come from three slices without tracing. The call counts come from three other slices with perf and ftrace on.
  • Disk reads: /sys/block/sda/sda4/stat (the pool's partition) before and after each request. ARC misses: prefetch_data_misses in /proc/spl/kstat/zfs/arcstats.
  • Calls: perf stat -e syscalls:sys_enter_madvise -p <engine pid>, and the ftrace function profiler on vfs_fadvise, zpl_fadvise and dmu_prefetch (all CPUs; the time includes waits).
  • OpenZFS 2.3.4 and 2.4.4 call dmu_prefetch the same way. Master calls dmu_prefetch_user, the same prefetch with a cap on the bytes in flight.
  • Not tested: a filesystem other than ZFS on this machine, a larger ARC, --ple-io mmap (where the hint is meant to help, #1984), and ben0112's machine.
All numbers, and 0.1.44.1 against 0.1.43.1

Untraced prompts, one at a time (prefill rate as the engine reports it; disk = the pool's partition; misses = ARC prefetch misses):

run hint tokens prefill tok/s TTFT s disk read GB ARC prefetch misses
0.1.44.1 on 15,985 503.6 31.79 16.39 125,028
0.1.44.1 on 16,012 458.3 34.99 18.05 137,679
0.1.44.1 on 16,000 470.9 34.03 18.29 139,565
0.1.44.1, 1st start off 15,986 708.3 22.63 0.00 0
0.1.44.1, 1st start off 16,012 703.7 22.81 0.00 0
0.1.44.1, 1st start off 16,000 707.5 22.67 0.00 1
0.1.44.1, 2nd start off 15,987 706.7 22.67 0.00 2
0.1.44.1, 2nd start off 16,012 703.8 22.81 0.00 0
0.1.44.1, 2nd start off 16,001 709.2 22.62 0.00 0

Misses x 128 KiB match the disk reads (125,028 x 131,072 B = 16.39 GB).

Traced prompts (three other slices; perf counts the engine's system calls, ftrace counts on all CPUs, so the few zpl_fadvise calls in the "off" row need not be the engine's):

hint tokens, 3 prompts madvise (engine) vfs_fadvise zpl_fadvise dmu_prefetch time in zpl_fadvise prefill tok/s while traced disk read GB per prompt
on 47,885 768,048 767,856 767,864 767,892 70.8 s, 92 µs per call 464.8-470.8 15.65-16.35
off (2nd start) 47,883 192 0 5 102 0.1 ms 702.8-704.8 0.00-0.01

With the hint on, the time inside zpl_fadvise is about 24 s per prompt and TTFT is 9-12 s longer. The gather runs beside the GPU work, so only part of that time adds to TTFT.

The engine's own file tier I/O this request: the OS read ... line showed 0.59-1.05 GB per prompt with the hint on, against 16-18 GB read from the disk. Most of the reads are ZFS's asynchronous prefetch, which /proc/self/io does not charge to the engine (an earlier probe here put them on ZFS's z_rd_int threads). So that line does not show the size of the problem.

0.1.43.1 shows the same. Earlier the same day, with the same three prompts but an earlier config (12,24,36 split, --batch-groups 4, no conversation cache) and the whole-disk counter: 407-440 tok/s and 15.5-17.8 GB read per prompt with the hint, 670-682 tok/s and 0.00-0.04 GB without it.

Short prompts (tools/serve_load.py, 512 tokens out, total tok/s for 1 / 2 / 4 clients): hint on 32.9 / 59.4 / 100.5; off 35.6 / 60.3 / 100.2 and 33.9 / 60.4 / 100.6 (two fresh starts). There is only one run with the hint on, and the two "off" starts differ by 1.7 tok/s, so I would not read a decode difference into this.

0.1.44.1 against 0.1.43.1, both with --no-ple-prefetch, two fresh starts each (run order 0.1.43.1, 0.1.44.1, 0.1.44.1, 0.1.43.1; the hint-on run sat between the two 0.1.44.1 runs):

0.1.43.1 0.1.44.1
short prompts, total tok/s, 1 / 4 clients 34.0 / 100.3, 33.4 / 100.3 35.6 / 100.2, 33.9 / 100.6
~4.4K prompt, prefill tok/s (median of 3) 392.3, 391.4 394.8, 397.0
~32K prompt, prefill tok/s (median of 3) 778.0, 782.0 784.1, 783.8
new ~16K prompts, prefill tok/s 699.0-707.0, 699.8-706.6 703.7-708.3, 703.8-709.2
four ~16K prompts at once, last TTFT s 94.6, 94.5 94.0, 94.2

Within about 1% everywhere except one-client short prompts, where two starts of the same version already differ by up to 1.7 tok/s. 0.1.44.1 is ahead in both pairs on the ~4.4K prompt (0.6-1.4%), and by less on the ~32K prompt and the four-prompt burst.

Server log lines (0.1.44.1, excerpt)
# --ple-io ram, hint on (default)
strata generate: layer split across 4 GPUs: CUDA0, then CUDA1,2,3 (split 13,26,38)
strata generate: PLE table locked in RAM (--ple-io ram) in 7.0 s
strata generate: session is up (engine 0.1.44.1)
strata serve: prompt 15985 tokens = 0 reused + 15985 read in 31741 ms (503.6 tok/s), 32 generated in 724 ms (44.2 tok/s), drafts accepted 17 of 21, 1 checkpoints
strata serve: file tier I/O this request: the OS read 1054.3 MB from storage (405 major faults) for 0.0 MB of expert reads
strata serve: prompt 16012 tokens = 0 reused + 16012 read in 34938 ms (458.3 tok/s), 32 generated in 664 ms (48.2 tok/s), drafts accepted 22 of 27, 1 checkpoints
strata serve: file tier I/O this request: the OS read 629.3 MB from storage (23 major faults) for 0.0 MB of expert reads
strata serve: prompt 16000 tokens = 0 reused + 16000 read in 33976 ms (470.9 tok/s), 32 generated in 983 ms (32.5 tok/s), drafts accepted 14 of 32, 1 checkpoints
strata serve: file tier I/O this request: the OS read 591.9 MB from storage (0 major faults) for 0.0 MB of expert reads

# same binary, --no-ple-prefetch (second start)
strata generate: session is up (engine 0.1.44.1)
strata serve: prompt 15987 tokens = 0 reused + 15987 read in 22622 ms (706.7 tok/s), 32 generated in 764 ms (41.9 tok/s), drafts accepted 16 of 24, 1 checkpoints
strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 0.0 MB of expert reads
strata serve: prompt 16012 tokens = 0 reused + 16012 read in 22751 ms (703.8 tok/s), 32 generated in 661 ms (48.4 tok/s), drafts accepted 21 of 27, 1 checkpoints
strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 0.0 MB of expert reads
strata serve: prompt 16001 tokens = 0 reused + 16001 read in 22561 ms (709.2 tok/s), 32 generated in 783 ms (40.8 tok/s), drafts accepted 21 of 32, 1 checkpoints
strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 0.0 MB of expert reads
<!-- gh-comment-id:6216816902 --> @thc1006 commented on GitHub (Oct 16, 2026): TL;DR: on a ZFS root, the per-row `MADV_WILLNEED` hint in `PleTable::gather_batch` makes ZFS read parts of the PLE table from disk on every prompt, even with `--ple-io ram`. On this machine (4x P100, IQ3_XXS, 0.1.44.1), each new ~16K-token prompt read 16-18 GB from disk and prefilled at 458-504 tok/s. With `--no-ple-prefetch`, it read 0.00 GB and prefilled at 704-709 tok/s. This is the same hint this issue found, measured on 0.1.44.1, with one more cost on ZFS: disk reads. `--no-ple-prefetch` still fixes it, so I am not asking to reopen. If you would rather track the ZFS side in a new issue, I can open one. Per new ~16K-token prompt, 0.1.44.1, `--ple-io ram`, same binary: | PLE prefetch hint | prefill tok/s | TTFT s | disk read | engine `madvise` calls | `zpl_fadvise` calls | |---|---:|---:|---:|---:|---:| | on (default) | 458-504 | 31.8-35.0 | 16.4-18.3 GB | ~256,000 | ~256,000 | | off (`--no-ple-prefetch`) | 704-709 | 22.6-22.8 | 0.00 GB | 64 | ~2 | How the hint reaches the disk: 1. On Linux, `gather_batch` calls `madvise(MADV_WILLNEED)` once per row of a mapped table (`--ple-io mmap` or `ram`). It checks `g_ple_prefetch` but not `impl_->locked` ([ngram.cpp#L554-L577](https://github.com/Niko1221/Strata/blob/296b59d2f73c8f04a805df29c2fa97655adace78/src/kernels/ngram.cpp#L554-L577)). The prompt path and the decode verify windows both make this call. 2. For a file mapping, the kernel passes the hint on as `vfs_fadvise(..., POSIX_FADV_WILLNEED)` ([mm/madvise.c#L261-L307](https://github.com/torvalds/linux/blob/v6.8/mm/madvise.c#L261-L307)). 3. OpenZFS's `zpl_fadvise` then calls `dmu_prefetch` for that range, even when the pages are already in the page cache ([zpl_file.c#L943-L960](https://github.com/openzfs/zfs/blob/zfs-2.2.2/module/os/linux/zfs/zpl_file.c#L943-L960)). `dmu_prefetch` checks only ZFS's own caches, so locked pages do not stop it. Each hint becomes an ARC prefetch of the 128 KiB record that holds the row. The ARC here is 8 GiB and the table is 26.8 GiB, so most of those records are read from disk again on every prompt. The call counts come from perf and ftrace on three more prompts of the same size: 16 `madvise` calls per prompt token, and one `zpl_fadvise` and one `dmu_prefetch` for each. ben0112 offered above to measure whether the cost is the syscall or the prefetch. Here, each call spent 92 µs on average inside `zpl_fadvise`. ben0112's report in #2571 says their model is on ZFS too. Their machine has much more RAM, so the cost there may be time in `zpl_fadvise` more than disk reads; I have not measured that. If your 2x A4000 machine does not use ZFS, that may be part of why the hint slowed their machine and not yours. A possible fix is the one ben0112 suggested above: skip the per-row hint when the table is locked. On Linux, only `hint()` checks `g_ple_prefetch` (the other three checks are inside `#if defined(_WIN32)`). So for a locked table, that change should behave like `--no-ple-prefetch`, the "off" row above. If you post a patch, I will test it here with the same prompts. <details><summary>Environment and method</summary> - Strata 0.1.44.1 (`296b59d`) and 0.1.43.1 (`a0116b2`), both built from source with CUDA 12.9.1 for sm_60, with the flags setup.py uses for a CUDA 12 build (Release, `STRATA_EXPERIMENTAL_SM60=ON`). The "on" and "off" rows above use the same 0.1.44.1 binary; only `--no-ple-prefetch` differs. - 4x Tesla P100 PCIe 16 GB (driver 535.230.02). VMware VM with 8 vCPUs (Xeon E5-2696 v4) and 62.8 GiB of RAM. - Ubuntu 22.04.5, kernel 6.8.0-138. Root on ZFS: OpenZFS 2.2.2-0ubuntu9.4 (Ubuntu's zfs-linux 2.2.2 source has the same `zpl_fadvise` as upstream 2.2.2), recordsize 128K, lz4. I set `zfs_arc_max` to 8 GiB to leave RAM for the locked table and the experts. A larger ARC would change the disk numbers. - Qwen3.8-Flash-Next GSQ-RCO IQ3_XXS. The PLE table is the second shard: 320,001,536 rows x 90 B = 26.8 GiB. - Server: 4 slots, layer split 13,26,38 over the four cards. Engine flags (abridged, paths left out): `--max-context 32768 --kv int8 --expert-cache auto --prefill 2048 --pool-workers 6 --batch-groups auto --vram-reserve-mib 1536 --ple-io ram --spec 4 --spec-min-p 0.5 --resident-experts --trim-stage-weights --no-kv-grow --conversation-cache-mib 8192`, plus `--no-ple-prefetch` for the "off" row. - Every run is a fresh server start under systemd with `LimitMEMLOCK=infinity`. Order of the runs: 0.1.43.1, 0.1.44.1, 0.1.44.1 with the hint on, 0.1.44.1, 0.1.43.1. - Prompts: slices of Strata's own docs, ~16K tokens each, with a random nonce first so no prefix is reused. Thinking off, temperature 0, 32 tokens out, one request at a time. Speed and TTFT come from three slices without tracing. The call counts come from three other slices with perf and ftrace on. - Disk reads: `/sys/block/sda/sda4/stat` (the pool's partition) before and after each request. ARC misses: `prefetch_data_misses` in `/proc/spl/kstat/zfs/arcstats`. - Calls: `perf stat -e syscalls:sys_enter_madvise -p <engine pid>`, and the ftrace function profiler on `vfs_fadvise`, `zpl_fadvise` and `dmu_prefetch` (all CPUs; the time includes waits). - OpenZFS 2.3.4 and 2.4.4 call `dmu_prefetch` the same way. Master calls `dmu_prefetch_user`, the same prefetch with a cap on the bytes in flight. - Not tested: a filesystem other than ZFS on this machine, a larger ARC, `--ple-io mmap` (where the hint is meant to help, #1984), and ben0112's machine. </details> <details><summary>All numbers, and 0.1.44.1 against 0.1.43.1</summary> Untraced prompts, one at a time (prefill rate as the engine reports it; disk = the pool's partition; misses = ARC prefetch misses): | run | hint | tokens | prefill tok/s | TTFT s | disk read GB | ARC prefetch misses | |---|---|---:|---:|---:|---:|---:| | 0.1.44.1 | on | 15,985 | 503.6 | 31.79 | 16.39 | 125,028 | | 0.1.44.1 | on | 16,012 | 458.3 | 34.99 | 18.05 | 137,679 | | 0.1.44.1 | on | 16,000 | 470.9 | 34.03 | 18.29 | 139,565 | | 0.1.44.1, 1st start | off | 15,986 | 708.3 | 22.63 | 0.00 | 0 | | 0.1.44.1, 1st start | off | 16,012 | 703.7 | 22.81 | 0.00 | 0 | | 0.1.44.1, 1st start | off | 16,000 | 707.5 | 22.67 | 0.00 | 1 | | 0.1.44.1, 2nd start | off | 15,987 | 706.7 | 22.67 | 0.00 | 2 | | 0.1.44.1, 2nd start | off | 16,012 | 703.8 | 22.81 | 0.00 | 0 | | 0.1.44.1, 2nd start | off | 16,001 | 709.2 | 22.62 | 0.00 | 0 | Misses x 128 KiB match the disk reads (125,028 x 131,072 B = 16.39 GB). Traced prompts (three other slices; perf counts the engine's system calls, ftrace counts on all CPUs, so the few `zpl_fadvise` calls in the "off" row need not be the engine's): | hint | tokens, 3 prompts | `madvise` (engine) | `vfs_fadvise` | `zpl_fadvise` | `dmu_prefetch` | time in `zpl_fadvise` | prefill tok/s while traced | disk read GB per prompt | |---|---:|---:|---:|---:|---:|---:|---:|---:| | on | 47,885 | 768,048 | 767,856 | 767,864 | 767,892 | 70.8 s, 92 µs per call | 464.8-470.8 | 15.65-16.35 | | off (2nd start) | 47,883 | 192 | 0 | 5 | 102 | 0.1 ms | 702.8-704.8 | 0.00-0.01 | With the hint on, the time inside `zpl_fadvise` is about 24 s per prompt and TTFT is 9-12 s longer. The gather runs beside the GPU work, so only part of that time adds to TTFT. The engine's own `file tier I/O this request: the OS read ...` line showed 0.59-1.05 GB per prompt with the hint on, against 16-18 GB read from the disk. Most of the reads are ZFS's asynchronous prefetch, which `/proc/self/io` does not charge to the engine (an earlier probe here put them on ZFS's `z_rd_int` threads). So that line does not show the size of the problem. 0.1.43.1 shows the same. Earlier the same day, with the same three prompts but an earlier config (12,24,36 split, `--batch-groups 4`, no conversation cache) and the whole-disk counter: 407-440 tok/s and 15.5-17.8 GB read per prompt with the hint, 670-682 tok/s and 0.00-0.04 GB without it. Short prompts (`tools/serve_load.py`, 512 tokens out, total tok/s for 1 / 2 / 4 clients): hint on 32.9 / 59.4 / 100.5; off 35.6 / 60.3 / 100.2 and 33.9 / 60.4 / 100.6 (two fresh starts). There is only one run with the hint on, and the two "off" starts differ by 1.7 tok/s, so I would not read a decode difference into this. 0.1.44.1 against 0.1.43.1, both with `--no-ple-prefetch`, two fresh starts each (run order 0.1.43.1, 0.1.44.1, 0.1.44.1, 0.1.43.1; the hint-on run sat between the two 0.1.44.1 runs): | | 0.1.43.1 | 0.1.44.1 | |---|---|---| | short prompts, total tok/s, 1 / 4 clients | 34.0 / 100.3, 33.4 / 100.3 | 35.6 / 100.2, 33.9 / 100.6 | | ~4.4K prompt, prefill tok/s (median of 3) | 392.3, 391.4 | 394.8, 397.0 | | ~32K prompt, prefill tok/s (median of 3) | 778.0, 782.0 | 784.1, 783.8 | | new ~16K prompts, prefill tok/s | 699.0-707.0, 699.8-706.6 | 703.7-708.3, 703.8-709.2 | | four ~16K prompts at once, last TTFT s | 94.6, 94.5 | 94.0, 94.2 | Within about 1% everywhere except one-client short prompts, where two starts of the same version already differ by up to 1.7 tok/s. 0.1.44.1 is ahead in both pairs on the ~4.4K prompt (0.6-1.4%), and by less on the ~32K prompt and the four-prompt burst. </details> <details><summary>Server log lines (0.1.44.1, excerpt)</summary> ```text # --ple-io ram, hint on (default) strata generate: layer split across 4 GPUs: CUDA0, then CUDA1,2,3 (split 13,26,38) strata generate: PLE table locked in RAM (--ple-io ram) in 7.0 s strata generate: session is up (engine 0.1.44.1) strata serve: prompt 15985 tokens = 0 reused + 15985 read in 31741 ms (503.6 tok/s), 32 generated in 724 ms (44.2 tok/s), drafts accepted 17 of 21, 1 checkpoints strata serve: file tier I/O this request: the OS read 1054.3 MB from storage (405 major faults) for 0.0 MB of expert reads strata serve: prompt 16012 tokens = 0 reused + 16012 read in 34938 ms (458.3 tok/s), 32 generated in 664 ms (48.2 tok/s), drafts accepted 22 of 27, 1 checkpoints strata serve: file tier I/O this request: the OS read 629.3 MB from storage (23 major faults) for 0.0 MB of expert reads strata serve: prompt 16000 tokens = 0 reused + 16000 read in 33976 ms (470.9 tok/s), 32 generated in 983 ms (32.5 tok/s), drafts accepted 14 of 32, 1 checkpoints strata serve: file tier I/O this request: the OS read 591.9 MB from storage (0 major faults) for 0.0 MB of expert reads # same binary, --no-ple-prefetch (second start) strata generate: session is up (engine 0.1.44.1) strata serve: prompt 15987 tokens = 0 reused + 15987 read in 22622 ms (706.7 tok/s), 32 generated in 764 ms (41.9 tok/s), drafts accepted 16 of 24, 1 checkpoints strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 0.0 MB of expert reads strata serve: prompt 16012 tokens = 0 reused + 16012 read in 22751 ms (703.8 tok/s), 32 generated in 661 ms (48.4 tok/s), drafts accepted 21 of 27, 1 checkpoints strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 0.0 MB of expert reads strata serve: prompt 16001 tokens = 0 reused + 16001 read in 22561 ms (709.2 tok/s), 32 generated in 783 ms (40.8 tok/s), drafts accepted 21 of 32, 1 checkpoints strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 0.0 MB of expert reads ``` </details>
Author
Owner

@ben0112 commented on GitHub (Oct 17, 2026):

I believe it's a ZFS arc issue competing for disk I/O and memory bandwidth.

秀吉 @.***>于2026年10月16日 周五21:43写道:

thc1006 left a comment (Niko1221/Strata#2281)
https://github.com/Niko1221/Strata/issues/2281#issuecomment-6216816902

TL;DR: on a ZFS root, the per-row MADV_WILLNEED hint in
PleTable::gather_batch makes ZFS read parts of the PLE table from disk on
every prompt, even with --ple-io ram. On this machine (4x P100, IQ3_XXS,
0.1.44.1), each new ~16K-token prompt read 16-18 GB from disk and prefilled
at 458-504 tok/s. With --no-ple-prefetch, it read 0.00 GB and prefilled
at 704-709 tok/s.

This is the same hint this issue found, measured on 0.1.44.1, with one
more cost on ZFS: disk reads. --no-ple-prefetch still fixes it, so I am
not asking to reopen. If you would rather track the ZFS side in a new
issue, I can open one.

Per new ~16K-token prompt, 0.1.44.1, --ple-io ram, same binary:
PLE prefetch hint prefill tok/s TTFT s disk read engine madvise calls
zpl_fadvise calls
on (default) 458-504 31.8-35.0 16.4-18.3 GB ~256,000 ~256,000
off (--no-ple-prefetch) 704-709 22.6-22.8 0.00 GB 64 ~2

How the hint reaches the disk:

  1. On Linux, gather_batch calls madvise(MADV_WILLNEED) once per row of
    a mapped table (--ple-io mmap or ram). It checks g_ple_prefetch but
    not impl_->locked (ngram.cpp#L554-L577
    https://github.com/Niko1221/Strata/blob/296b59d2f73c8f04a805df29c2fa97655adace78/src/kernels/ngram.cpp#L554-L577).
    The prompt path and the decode verify windows both make this call.
  2. For a file mapping, the kernel passes the hint on as vfs_fadvise(...,
    POSIX_FADV_WILLNEED) (mm/madvise.c#L261-L307
    https://github.com/torvalds/linux/blob/v6.8/mm/madvise.c#L261-L307).
  3. OpenZFS's zpl_fadvise then calls dmu_prefetch for that range, even
    when the pages are already in the page cache (zpl_file.c#L943-L960
    https://github.com/openzfs/zfs/blob/zfs-2.2.2/module/os/linux/zfs/zpl_file.c#L943-L960).
    dmu_prefetch checks only ZFS's own caches, so locked pages do not stop
    it. Each hint becomes an ARC prefetch of the 128 KiB record that holds the
    row. The ARC here is 8 GiB and the table is 26.8 GiB, so most of those
    records are read from disk again on every prompt.

The call counts come from perf and ftrace on three more prompts of the
same size: 16 madvise calls per prompt token, and one zpl_fadvise and one
dmu_prefetch for each. ben0112 offered above to measure whether the cost
is the syscall or the prefetch. Here, each call spent 92 µs on average
inside zpl_fadvise.

ben0112's report in #2571 https://github.com/Niko1221/Strata/pull/2571
says their model is on ZFS too. Their machine has much more RAM, so the
cost there may be time in zpl_fadvise more than disk reads; I have not
measured that. If your 2x A4000 machine does not use ZFS, that may be part
of why the hint slowed their machine and not yours.

A possible fix is the one ben0112 suggested above: skip the per-row hint
when the table is locked. On Linux, only hint() checks g_ple_prefetch
(the other three checks are inside #if defined(_WIN32)). So for a locked
table, that change should behave like --no-ple-prefetch, the "off" row
above. If you post a patch, I will test it here with the same prompts.
Environment and method

  • Strata 0.1.44.1 (296b59d) and 0.1.43.1 (a0116b2), both built from
    source with CUDA 12.9.1 for sm_60, with the flags setup.py uses for a CUDA
    12 build (Release, STRATA_EXPERIMENTAL_SM60=ON). The "on" and "off"
    rows above use the same 0.1.44.1 binary; only --no-ple-prefetch
    differs.
  • 4x Tesla P100 PCIe 16 GB (driver 535.230.02). VMware VM with 8 vCPUs
    (Xeon E5-2696 v4) and 62.8 GiB of RAM.
  • Ubuntu 22.04.5, kernel 6.8.0-138. Root on ZFS: OpenZFS
    2.2.2-0ubuntu9.4 (Ubuntu's zfs-linux 2.2.2 source has the same
    zpl_fadvise as upstream 2.2.2), recordsize 128K, lz4. I set zfs_arc_max
    to 8 GiB to leave RAM for the locked table and the experts. A larger ARC
    would change the disk numbers.
  • Qwen3.8-Flash-Next GSQ-RCO IQ3_XXS. The PLE table is the second
    shard: 320,001,536 rows x 90 B = 26.8 GiB.
  • Server: 4 slots, layer split 13,26,38 over the four cards. Engine
    flags (abridged, paths left out): --max-context 32768 --kv int8
    --expert-cache auto --prefill 2048 --pool-workers 6 --batch-groups auto
    --vram-reserve-mib 1536 --ple-io ram --spec 4 --spec-min-p 0.5
    --resident-experts --trim-stage-weights --no-kv-grow
    --conversation-cache-mib 8192, plus --no-ple-prefetch for the "off"
    row.
  • Every run is a fresh server start under systemd with
    LimitMEMLOCK=infinity. Order of the runs: 0.1.43.1, 0.1.44.1, 0.1.44.1
    with the hint on, 0.1.44.1, 0.1.43.1.
  • Prompts: slices of Strata's own docs, ~16K tokens each, with a
    random nonce first so no prefix is reused. Thinking off, temperature 0, 32
    tokens out, one request at a time. Speed and TTFT come from three slices
    without tracing. The call counts come from three other slices with perf and
    ftrace on.
  • Disk reads: /sys/block/sda/sda4/stat (the pool's partition) before
    and after each request. ARC misses: prefetch_data_misses in
    /proc/spl/kstat/zfs/arcstats.
  • Calls: perf stat -e syscalls:sys_enter_madvise -p , and
    the ftrace function profiler on vfs_fadvise, zpl_fadvise and
    dmu_prefetch (all CPUs; the time includes waits).
  • OpenZFS 2.3.4 and 2.4.4 call dmu_prefetch the same way. Master calls
    dmu_prefetch_user, the same prefetch with a cap on the bytes in flight.
  • Not tested: a filesystem other than ZFS on this machine, a larger
    ARC, --ple-io mmap (where the hint is meant to help, #1984
    https://github.com/Niko1221/Strata/issues/1984), and ben0112's
    machine.

All numbers, and 0.1.44.1 against 0.1.43.1

Untraced prompts, one at a time (prefill rate as the engine reports it;
disk = the pool's partition; misses = ARC prefetch misses):
run hint tokens prefill tok/s TTFT s disk read GB ARC prefetch misses
0.1.44.1 on 15,985 503.6 31.79 16.39 125,028
0.1.44.1 on 16,012 458.3 34.99 18.05 137,679
0.1.44.1 on 16,000 470.9 34.03 18.29 139,565
0.1.44.1, 1st start off 15,986 708.3 22.63 0.00 0
0.1.44.1, 1st start off 16,012 703.7 22.81 0.00 0
0.1.44.1, 1st start off 16,000 707.5 22.67 0.00 1
0.1.44.1, 2nd start off 15,987 706.7 22.67 0.00 2
0.1.44.1, 2nd start off 16,012 703.8 22.81 0.00 0
0.1.44.1, 2nd start off 16,001 709.2 22.62 0.00 0

Misses x 128 KiB match the disk reads (125,028 x 131,072 B = 16.39 GB).

Traced prompts (three other slices; perf counts the engine's system calls,
ftrace counts on all CPUs, so the few zpl_fadvise calls in the "off" row
need not be the engine's):
hint tokens, 3 prompts madvise (engine) vfs_fadvise zpl_fadvise
dmu_prefetch time in zpl_fadvise prefill tok/s while traced disk read GB
per prompt
on 47,885 768,048 767,856 767,864 767,892 70.8 s, 92 µs per call
464.8-470.8 15.65-16.35
off (2nd start) 47,883 192 0 5 102 0.1 ms 702.8-704.8 0.00-0.01

With the hint on, the time inside zpl_fadvise is about 24 s per prompt
and TTFT is 9-12 s longer. The gather runs beside the GPU work, so only
part of that time adds to TTFT.

The engine's own file tier I/O this request: the OS read ... line showed
0.59-1.05 GB per prompt with the hint on, against 16-18 GB read from the
disk. Most of the reads are ZFS's asynchronous prefetch, which
/proc/self/io does not charge to the engine (an earlier probe here put
them on ZFS's z_rd_int threads). So that line does not show the size of
the problem.

0.1.43.1 shows the same. Earlier the same day, with the same three prompts
but an earlier config (12,24,36 split, --batch-groups 4, no conversation
cache) and the whole-disk counter: 407-440 tok/s and 15.5-17.8 GB read per
prompt with the hint, 670-682 tok/s and 0.00-0.04 GB without it.

Short prompts (tools/serve_load.py, 512 tokens out, total tok/s for 1 / 2
/ 4 clients): hint on 32.9 / 59.4 / 100.5; off 35.6 / 60.3 / 100.2 and 33.9
/ 60.4 / 100.6 (two fresh starts). There is only one run with the hint on,
and the two "off" starts differ by 1.7 tok/s, so I would not read a decode
difference into this.

0.1.44.1 against 0.1.43.1, both with --no-ple-prefetch, two fresh starts
each (run order 0.1.43.1, 0.1.44.1, 0.1.44.1, 0.1.43.1; the hint-on run sat
between the two 0.1.44.1 runs):
0.1.43.1 0.1.44.1
short prompts, total tok/s, 1 / 4 clients 34.0 / 100.3, 33.4 / 100.3 35.6
/ 100.2, 33.9 / 100.6
~4.4K prompt, prefill tok/s (median of 3) 392.3, 391.4 394.8, 397.0
~32K prompt, prefill tok/s (median of 3) 778.0, 782.0 784.1, 783.8
new ~16K prompts, prefill tok/s 699.0-707.0, 699.8-706.6 703.7-708.3,
703.8-709.2
four ~16K prompts at once, last TTFT s 94.6, 94.5 94.0, 94.2

Within about 1% everywhere except one-client short prompts, where two
starts of the same version already differ by up to 1.7 tok/s. 0.1.44.1 is
ahead in both pairs on the ~4.4K prompt (0.6-1.4%), and by less on the ~32K
prompt and the four-prompt burst.
Server log lines (0.1.44.1, excerpt)

--ple-io ram, hint on (default)

strata generate: layer split across 4 GPUs: CUDA0, then CUDA1,2,3 (split 13,26,38)
strata generate: PLE table locked in RAM (--ple-io ram) in 7.0 s
strata generate: session is up (engine 0.1.44.1)
strata serve: prompt 15985 tokens = 0 reused + 15985 read in 31741 ms (503.6 tok/s), 32 generated in 724 ms (44.2 tok/s), drafts accepted 17 of 21, 1 checkpoints
strata serve: file tier I/O this request: the OS read 1054.3 MB from storage (405 major faults) for 0.0 MB of expert reads
strata serve: prompt 16012 tokens = 0 reused + 16012 read in 34938 ms (458.3 tok/s), 32 generated in 664 ms (48.2 tok/s), drafts accepted 22 of 27, 1 checkpoints
strata serve: file tier I/O this request: the OS read 629.3 MB from storage (23 major faults) for 0.0 MB of expert reads
strata serve: prompt 16000 tokens = 0 reused + 16000 read in 33976 ms (470.9 tok/s), 32 generated in 983 ms (32.5 tok/s), drafts accepted 14 of 32, 1 checkpoints
strata serve: file tier I/O this request: the OS read 591.9 MB from storage (0 major faults) for 0.0 MB of expert reads

same binary, --no-ple-prefetch (second start)

strata generate: session is up (engine 0.1.44.1)
strata serve: prompt 15987 tokens = 0 reused + 15987 read in 22622 ms (706.7 tok/s), 32 generated in 764 ms (41.9 tok/s), drafts accepted 16 of 24, 1 checkpoints
strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 0.0 MB of expert reads
strata serve: prompt 16012 tokens = 0 reused + 16012 read in 22751 ms (703.8 tok/s), 32 generated in 661 ms (48.4 tok/s), drafts accepted 21 of 27, 1 checkpoints
strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 0.0 MB of expert reads
strata serve: prompt 16001 tokens = 0 reused + 16001 read in 22561 ms (709.2 tok/s), 32 generated in 783 ms (40.8 tok/s), drafts accepted 21 of 32, 1 checkpoints
strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 0.0 MB of expert reads

—
Reply to this email directly, view it on GitHub
https://github.com/Niko1221/Strata/issues/2281?email_source=notifications&email_token=ACQ6I4UM5UDHPZEAL3BFG5L5UIQXPA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMMRRGY4DCNRZGAZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-6216816902,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ACQ6I4Q6PRVMOHNYPKJFM3D5UIQXPAVCNFSNUABGKJSXA33TNF2G64TZHMYTGOBVHE2DMMZQGE5US43TOVSTWNJYGMZDAMJYGAZTTILWAI
.
You are receiving this because you were mentioned.Message ID:
@.***>

<!-- gh-comment-id:6228514958 --> @ben0112 commented on GitHub (Oct 17, 2026): I believe it's a ZFS arc issue competing for disk I/O and memory bandwidth. 秀吉 ***@***.***>于2026年10月16日 周五21:43写道: > *thc1006* left a comment (Niko1221/Strata#2281) > <https://github.com/Niko1221/Strata/issues/2281#issuecomment-6216816902> > > TL;DR: on a ZFS root, the per-row MADV_WILLNEED hint in > PleTable::gather_batch makes ZFS read parts of the PLE table from disk on > every prompt, even with --ple-io ram. On this machine (4x P100, IQ3_XXS, > 0.1.44.1), each new ~16K-token prompt read 16-18 GB from disk and prefilled > at 458-504 tok/s. With --no-ple-prefetch, it read 0.00 GB and prefilled > at 704-709 tok/s. > > This is the same hint this issue found, measured on 0.1.44.1, with one > more cost on ZFS: disk reads. --no-ple-prefetch still fixes it, so I am > not asking to reopen. If you would rather track the ZFS side in a new > issue, I can open one. > > Per new ~16K-token prompt, 0.1.44.1, --ple-io ram, same binary: > PLE prefetch hint prefill tok/s TTFT s disk read engine madvise calls > zpl_fadvise calls > on (default) 458-504 31.8-35.0 16.4-18.3 GB ~256,000 ~256,000 > off (--no-ple-prefetch) 704-709 22.6-22.8 0.00 GB 64 ~2 > > How the hint reaches the disk: > > 1. On Linux, gather_batch calls madvise(MADV_WILLNEED) once per row of > a mapped table (--ple-io mmap or ram). It checks g_ple_prefetch but > not impl_->locked (ngram.cpp#L554-L577 > <https://github.com/Niko1221/Strata/blob/296b59d2f73c8f04a805df29c2fa97655adace78/src/kernels/ngram.cpp#L554-L577>). > The prompt path and the decode verify windows both make this call. > 2. For a file mapping, the kernel passes the hint on as vfs_fadvise(..., > POSIX_FADV_WILLNEED) (mm/madvise.c#L261-L307 > <https://github.com/torvalds/linux/blob/v6.8/mm/madvise.c#L261-L307>). > 3. OpenZFS's zpl_fadvise then calls dmu_prefetch for that range, even > when the pages are already in the page cache (zpl_file.c#L943-L960 > <https://github.com/openzfs/zfs/blob/zfs-2.2.2/module/os/linux/zfs/zpl_file.c#L943-L960>). > dmu_prefetch checks only ZFS's own caches, so locked pages do not stop > it. Each hint becomes an ARC prefetch of the 128 KiB record that holds the > row. The ARC here is 8 GiB and the table is 26.8 GiB, so most of those > records are read from disk again on every prompt. > > The call counts come from perf and ftrace on three more prompts of the > same size: 16 madvise calls per prompt token, and one zpl_fadvise and one > dmu_prefetch for each. ben0112 offered above to measure whether the cost > is the syscall or the prefetch. Here, each call spent 92 µs on average > inside zpl_fadvise. > > ben0112's report in #2571 <https://github.com/Niko1221/Strata/pull/2571> > says their model is on ZFS too. Their machine has much more RAM, so the > cost there may be time in zpl_fadvise more than disk reads; I have not > measured that. If your 2x A4000 machine does not use ZFS, that may be part > of why the hint slowed their machine and not yours. > > A possible fix is the one ben0112 suggested above: skip the per-row hint > when the table is locked. On Linux, only hint() checks g_ple_prefetch > (the other three checks are inside #if defined(_WIN32)). So for a locked > table, that change should behave like --no-ple-prefetch, the "off" row > above. If you post a patch, I will test it here with the same prompts. > Environment and method > > - Strata 0.1.44.1 (296b59d) and 0.1.43.1 (a0116b2), both built from > source with CUDA 12.9.1 for sm_60, with the flags setup.py uses for a CUDA > 12 build (Release, STRATA_EXPERIMENTAL_SM60=ON). The "on" and "off" > rows above use the same 0.1.44.1 binary; only --no-ple-prefetch > differs. > - 4x Tesla P100 PCIe 16 GB (driver 535.230.02). VMware VM with 8 vCPUs > (Xeon E5-2696 v4) and 62.8 GiB of RAM. > - Ubuntu 22.04.5, kernel 6.8.0-138. Root on ZFS: OpenZFS > 2.2.2-0ubuntu9.4 (Ubuntu's zfs-linux 2.2.2 source has the same > zpl_fadvise as upstream 2.2.2), recordsize 128K, lz4. I set zfs_arc_max > to 8 GiB to leave RAM for the locked table and the experts. A larger ARC > would change the disk numbers. > - Qwen3.8-Flash-Next GSQ-RCO IQ3_XXS. The PLE table is the second > shard: 320,001,536 rows x 90 B = 26.8 GiB. > - Server: 4 slots, layer split 13,26,38 over the four cards. Engine > flags (abridged, paths left out): --max-context 32768 --kv int8 > --expert-cache auto --prefill 2048 --pool-workers 6 --batch-groups auto > --vram-reserve-mib 1536 --ple-io ram --spec 4 --spec-min-p 0.5 > --resident-experts --trim-stage-weights --no-kv-grow > --conversation-cache-mib 8192, plus --no-ple-prefetch for the "off" > row. > - Every run is a fresh server start under systemd with > LimitMEMLOCK=infinity. Order of the runs: 0.1.43.1, 0.1.44.1, 0.1.44.1 > with the hint on, 0.1.44.1, 0.1.43.1. > - Prompts: slices of Strata's own docs, ~16K tokens each, with a > random nonce first so no prefix is reused. Thinking off, temperature 0, 32 > tokens out, one request at a time. Speed and TTFT come from three slices > without tracing. The call counts come from three other slices with perf and > ftrace on. > - Disk reads: /sys/block/sda/sda4/stat (the pool's partition) before > and after each request. ARC misses: prefetch_data_misses in > /proc/spl/kstat/zfs/arcstats. > - Calls: perf stat -e syscalls:sys_enter_madvise -p <engine pid>, and > the ftrace function profiler on vfs_fadvise, zpl_fadvise and > dmu_prefetch (all CPUs; the time includes waits). > - OpenZFS 2.3.4 and 2.4.4 call dmu_prefetch the same way. Master calls > dmu_prefetch_user, the same prefetch with a cap on the bytes in flight. > - Not tested: a filesystem other than ZFS on this machine, a larger > ARC, --ple-io mmap (where the hint is meant to help, #1984 > <https://github.com/Niko1221/Strata/issues/1984>), and ben0112's > machine. > > All numbers, and 0.1.44.1 against 0.1.43.1 > > Untraced prompts, one at a time (prefill rate as the engine reports it; > disk = the pool's partition; misses = ARC prefetch misses): > run hint tokens prefill tok/s TTFT s disk read GB ARC prefetch misses > 0.1.44.1 on 15,985 503.6 31.79 16.39 125,028 > 0.1.44.1 on 16,012 458.3 34.99 18.05 137,679 > 0.1.44.1 on 16,000 470.9 34.03 18.29 139,565 > 0.1.44.1, 1st start off 15,986 708.3 22.63 0.00 0 > 0.1.44.1, 1st start off 16,012 703.7 22.81 0.00 0 > 0.1.44.1, 1st start off 16,000 707.5 22.67 0.00 1 > 0.1.44.1, 2nd start off 15,987 706.7 22.67 0.00 2 > 0.1.44.1, 2nd start off 16,012 703.8 22.81 0.00 0 > 0.1.44.1, 2nd start off 16,001 709.2 22.62 0.00 0 > > Misses x 128 KiB match the disk reads (125,028 x 131,072 B = 16.39 GB). > > Traced prompts (three other slices; perf counts the engine's system calls, > ftrace counts on all CPUs, so the few zpl_fadvise calls in the "off" row > need not be the engine's): > hint tokens, 3 prompts madvise (engine) vfs_fadvise zpl_fadvise > dmu_prefetch time in zpl_fadvise prefill tok/s while traced disk read GB > per prompt > on 47,885 768,048 767,856 767,864 767,892 70.8 s, 92 µs per call > 464.8-470.8 15.65-16.35 > off (2nd start) 47,883 192 0 5 102 0.1 ms 702.8-704.8 0.00-0.01 > > With the hint on, the time inside zpl_fadvise is about 24 s per prompt > and TTFT is 9-12 s longer. The gather runs beside the GPU work, so only > part of that time adds to TTFT. > > The engine's own file tier I/O this request: the OS read ... line showed > 0.59-1.05 GB per prompt with the hint on, against 16-18 GB read from the > disk. Most of the reads are ZFS's asynchronous prefetch, which > /proc/self/io does not charge to the engine (an earlier probe here put > them on ZFS's z_rd_int threads). So that line does not show the size of > the problem. > > 0.1.43.1 shows the same. Earlier the same day, with the same three prompts > but an earlier config (12,24,36 split, --batch-groups 4, no conversation > cache) and the whole-disk counter: 407-440 tok/s and 15.5-17.8 GB read per > prompt with the hint, 670-682 tok/s and 0.00-0.04 GB without it. > > Short prompts (tools/serve_load.py, 512 tokens out, total tok/s for 1 / 2 > / 4 clients): hint on 32.9 / 59.4 / 100.5; off 35.6 / 60.3 / 100.2 and 33.9 > / 60.4 / 100.6 (two fresh starts). There is only one run with the hint on, > and the two "off" starts differ by 1.7 tok/s, so I would not read a decode > difference into this. > > 0.1.44.1 against 0.1.43.1, both with --no-ple-prefetch, two fresh starts > each (run order 0.1.43.1, 0.1.44.1, 0.1.44.1, 0.1.43.1; the hint-on run sat > between the two 0.1.44.1 runs): > 0.1.43.1 0.1.44.1 > short prompts, total tok/s, 1 / 4 clients 34.0 / 100.3, 33.4 / 100.3 35.6 > / 100.2, 33.9 / 100.6 > ~4.4K prompt, prefill tok/s (median of 3) 392.3, 391.4 394.8, 397.0 > ~32K prompt, prefill tok/s (median of 3) 778.0, 782.0 784.1, 783.8 > new ~16K prompts, prefill tok/s 699.0-707.0, 699.8-706.6 703.7-708.3, > 703.8-709.2 > four ~16K prompts at once, last TTFT s 94.6, 94.5 94.0, 94.2 > > Within about 1% everywhere except one-client short prompts, where two > starts of the same version already differ by up to 1.7 tok/s. 0.1.44.1 is > ahead in both pairs on the ~4.4K prompt (0.6-1.4%), and by less on the ~32K > prompt and the four-prompt burst. > Server log lines (0.1.44.1, excerpt) > > # --ple-io ram, hint on (default) > strata generate: layer split across 4 GPUs: CUDA0, then CUDA1,2,3 (split 13,26,38) > strata generate: PLE table locked in RAM (--ple-io ram) in 7.0 s > strata generate: session is up (engine 0.1.44.1) > strata serve: prompt 15985 tokens = 0 reused + 15985 read in 31741 ms (503.6 tok/s), 32 generated in 724 ms (44.2 tok/s), drafts accepted 17 of 21, 1 checkpoints > strata serve: file tier I/O this request: the OS read 1054.3 MB from storage (405 major faults) for 0.0 MB of expert reads > strata serve: prompt 16012 tokens = 0 reused + 16012 read in 34938 ms (458.3 tok/s), 32 generated in 664 ms (48.2 tok/s), drafts accepted 22 of 27, 1 checkpoints > strata serve: file tier I/O this request: the OS read 629.3 MB from storage (23 major faults) for 0.0 MB of expert reads > strata serve: prompt 16000 tokens = 0 reused + 16000 read in 33976 ms (470.9 tok/s), 32 generated in 983 ms (32.5 tok/s), drafts accepted 14 of 32, 1 checkpoints > strata serve: file tier I/O this request: the OS read 591.9 MB from storage (0 major faults) for 0.0 MB of expert reads > > # same binary, --no-ple-prefetch (second start) > strata generate: session is up (engine 0.1.44.1) > strata serve: prompt 15987 tokens = 0 reused + 15987 read in 22622 ms (706.7 tok/s), 32 generated in 764 ms (41.9 tok/s), drafts accepted 16 of 24, 1 checkpoints > strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 0.0 MB of expert reads > strata serve: prompt 16012 tokens = 0 reused + 16012 read in 22751 ms (703.8 tok/s), 32 generated in 661 ms (48.4 tok/s), drafts accepted 21 of 27, 1 checkpoints > strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 0.0 MB of expert reads > strata serve: prompt 16001 tokens = 0 reused + 16001 read in 22561 ms (709.2 tok/s), 32 generated in 783 ms (40.8 tok/s), drafts accepted 21 of 32, 1 checkpoints > strata serve: file tier I/O this request: the OS read 0.0 MB from storage (0 major faults) for 0.0 MB of expert reads > > — > Reply to this email directly, view it on GitHub > <https://github.com/Niko1221/Strata/issues/2281?email_source=notifications&email_token=ACQ6I4UM5UDHPZEAL3BFG5L5UIQXPA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMMRRGY4DCNRZGAZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-6216816902>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/ACQ6I4Q6PRVMOHNYPKJFM3D5UIQXPAVCNFSNUABGKJSXA33TNF2G64TZHMYTGOBVHE2DMMZQGE5US43TOVSTWNJYGMZDAMJYGAZTTILWAI> > . > You are receiving this because you were mentioned.Message ID: > ***@***.***> >
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#918
No description provided.