[GH-ISSUE #2344] [Bug]: Linux/HIP prefill regression from file-cache heuristic 805088d5, still present in v0.1.44 #948

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

Originally created by @yorunoken on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2344

Summary

Linux/HIP prefill regressed after v0.1.40.1 and remains affected in v0.1.44 (ed4773eb). Testing 805088d5 against its immediate parent isolates the slowdown to Linux expert file-cache selection. STRATA_UNBUFFERED_LOAD=1 restores performance on the unmodified latest build.

Related: #1682 and #1407, closed when v0.1.44 shipped. This adds current-version reproduction and a consecutive-commit comparison on one GPU.

Environment

RX 9060 XT 16 GiB (gfx1200), Ryzen 5 9600X, 32 GiB RAM, approximately 30 GiB swap; CachyOS kernel 7.2.9-2-cachyos; ROCm 7.2.4. Model: Qwen3.8-Flash-Next-GSQ-RCO IQ3_XXS. Identical pack, GGUF shards, expert profile, MTP and control vector across arms.

Measurements

4096 input / 64 output tokens, five fresh-process runs per commit:

Commit Prefill median (range), tok/s Decode median tok/s Request major faults, median
Parent 58b1ea221aad1950597b40462be19daae24bc45a 361.15 (357.23–363.40) 31.41 0
805088d5b61a95912c5d19797053339b9aa979f7 154.16 (55.48–194.34) 11.34 61,104

57.31% lower median prefill, with the same 4901 expert-cache slots / 7.95 GiB and no intervening HIP kernel change. Median peak RSS rises from 18,580 to 27,342 MiB.

At 4096 tokens, five warm repetitions, v0.1.40.1 defaults give 367.42 tok/s; v0.1.44 with direct I/O gives 343.51 tok/s, or 361.83 with --aux-cpus auto.

On v0.1.44 defaults, repeated 1024-token fresh requests deteriorate through 71.25, 81.30, 33.43, 17.73, 7.96 tok/s, then the next request hits the 60-second watchdog at layer 33. Fresh restarts can initially exceed 100 tok/s; the deterioration depends on cache/memory history.

Cause and workaround

The changed Linux heuristic requires cache room for only 5% of file-tier reads, at least 1.5 GiB, with a 1 GiB margin. Logs show it selecting buffered reads with about 9.7 GiB available for a 24 GiB read set after the 16 GiB resident copy. The parent instead selects unbuffered reads.

Broad prefill appears to defeat the decode-oriented hot-set assumption. During a stall, perf stat records 88,625 major faults in five seconds, copy threads wait in folio_wait_bit_common, and swap/reclaim counters rise sharply. The mode switch also changes staging concurrency, so its separate contribution remains uncertain.

Reproduction

  • Build both commits with identical Release/HIP/gfx1200 settings and the same ggml archive (3cf03257f219afbe7334045ff7c6a06ac68c627d): PREFILL_MMQ/Q6K_EXPERTS on, MMQ_KQUANTS/CUDA off.
  • Reuse identical model assets and fixed token IDs. Core settings:
--resident-budget-gib 16 --expert-cache auto --prefill auto
--max-context 131072 --kv int8 --vram-reserve-mib 1000
--spec 4 --spec-min-p 0.70 --pcie-frac 0.75 --pool-workers 2
--prompt-cache 0 --prompt-cache-root 0
--conversation-cache-mib 0 --conversation-cache-slots 0
  • Use native --serve, sending GEN 64 ckpt=0 temperature=0 <token-IDs> after READY. Check zero reused tokens and exact fresh counts. Restart five times for cold comparisons; use first request plus five repetitions for warm comparisons. Loading is excluded; OS caches are not globally flushed. Run sequentially without competing inference/builds.
  • Repeat v0.1.44 with STRATA_UNBUFFERED_LOAD=1, keeping a resident budget. Unset timing/IO diagnostics for throughput.

A fixed-cache check (--expert-cache 3000 --adapt-every 0) gives 5/5 identical buffered/direct token-output hashes at 1024 input / 64 output tokens.

Separately, direct I/O + aux affinity + the gfx1200 hipBLASLt 100202 tuning table reaches 604.16 tok/s prefill / 45.06 tok/s decode at 4096 tokens. Tuning changes some logits/output wording and is not required for the conservative workaround.

Could automatic expert I/O selection account for broad prefill working sets or measured I/O behavior? Full raw measurements/scripts are retained locally. Investigation was assisted by Codex; all performance numbers are from actual local runs.

Originally created by @yorunoken on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/2344 ## Summary Linux/HIP prefill regressed after **v0.1.40.1** and remains affected in **v0.1.44 (`ed4773eb`)**. Testing [805088d5](https://github.com/Niko1221/Strata/commit/805088d5b61a95912c5d19797053339b9aa979f7) against its immediate parent isolates the slowdown to Linux expert file-cache selection. `STRATA_UNBUFFERED_LOAD=1` restores performance on the unmodified latest build. Related: #1682 and #1407, closed when v0.1.44 shipped. This adds current-version reproduction and a consecutive-commit comparison on one GPU. ## Environment RX 9060 XT 16 GiB (gfx1200), Ryzen 5 9600X, 32 GiB RAM, approximately 30 GiB swap; CachyOS kernel 7.2.9-2-cachyos; ROCm 7.2.4. Model: Qwen3.8-Flash-Next-GSQ-RCO **IQ3_XXS**. Identical pack, GGUF shards, expert profile, MTP and control vector across arms. ## Measurements **4096 input / 64 output tokens, five fresh-process runs per commit:** | Commit | Prefill median (range), tok/s | Decode median tok/s | Request major faults, median | |---|---:|---:|---:| | Parent `58b1ea221aad1950597b40462be19daae24bc45a` | 361.15 (357.23–363.40) | 31.41 | 0 | | `805088d5b61a95912c5d19797053339b9aa979f7` | 154.16 (55.48–194.34) | 11.34 | 61,104 | **57.31% lower median prefill**, with the same 4901 expert-cache slots / 7.95 GiB and no intervening HIP kernel change. Median peak RSS rises from 18,580 to 27,342 MiB. At **4096 tokens, five warm repetitions**, v0.1.40.1 defaults give **367.42 tok/s**; v0.1.44 with direct I/O gives **343.51 tok/s**, or **361.83** with `--aux-cpus auto`. On v0.1.44 defaults, repeated **1024-token** fresh requests deteriorate through **71.25, 81.30, 33.43, 17.73, 7.96 tok/s**, then the next request hits the 60-second watchdog at layer 33. Fresh restarts can initially exceed 100 tok/s; the deterioration depends on cache/memory history. ## Cause and workaround The changed Linux heuristic requires cache room for only **5% of file-tier reads**, at least **1.5 GiB**, with a 1 GiB margin. Logs show it selecting buffered reads with about **9.7 GiB available for a 24 GiB read set** after the 16 GiB resident copy. The parent instead selects unbuffered reads. Broad prefill appears to defeat the decode-oriented hot-set assumption. During a stall, `perf stat` records **88,625 major faults in five seconds**, copy threads wait in `folio_wait_bit_common`, and swap/reclaim counters rise sharply. The mode switch also changes staging concurrency, so its separate contribution remains uncertain. ## Reproduction - Build both commits with identical Release/HIP/gfx1200 settings and the same ggml archive (`3cf03257f219afbe7334045ff7c6a06ac68c627d`): PREFILL_MMQ/Q6K_EXPERTS on, MMQ_KQUANTS/CUDA off. - Reuse identical model assets and fixed token IDs. Core settings: ```text --resident-budget-gib 16 --expert-cache auto --prefill auto --max-context 131072 --kv int8 --vram-reserve-mib 1000 --spec 4 --spec-min-p 0.70 --pcie-frac 0.75 --pool-workers 2 --prompt-cache 0 --prompt-cache-root 0 --conversation-cache-mib 0 --conversation-cache-slots 0 ``` - Use native `--serve`, sending `GEN 64 ckpt=0 temperature=0 <token-IDs>` after READY. Check zero reused tokens and exact fresh counts. Restart five times for cold comparisons; use first request plus five repetitions for warm comparisons. Loading is excluded; OS caches are not globally flushed. Run sequentially without competing inference/builds. - Repeat v0.1.44 with **`STRATA_UNBUFFERED_LOAD=1`**, keeping a resident budget. Unset timing/IO diagnostics for throughput. A fixed-cache check (`--expert-cache 3000 --adapt-every 0`) gives **5/5 identical buffered/direct token-output hashes** at 1024 input / 64 output tokens. Separately, direct I/O + aux affinity + the gfx1200 hipBLASLt 100202 tuning table reaches **604.16 tok/s prefill / 45.06 tok/s decode** at 4096 tokens. Tuning changes some logits/output wording and is not required for the conservative workaround. Could automatic expert I/O selection account for broad prefill working sets or measured I/O behavior? Full raw measurements/scripts are retained locally. Investigation was assisted by Codex; all performance numbers are from actual local runs.
Author
Owner

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

Confirming this on NVIDIA/CUDA, so it is not HIP-specific.

Setup: i7-8700, 31.9 GB RAM, RTX 4070 SUPER 12 GB, Q2_0 pack on an ntfs3 partition (DRAM-less NVMe), engine 0.1.44.1.

Method: engine stopped, every model file evicted with fadvise (advice defaults to dontneed), coldness verified with fincore before each measurement, one identical 17,280-token prompt, two rounds with the arm order reversed on round 2. Medians of 2:

  • default (buffered, current heuristic): prefill 439.9 tok/s (437.4–442.4) · decode 56.8 · 44,596 major faults (44,114–45,079) · page cache held 35,758 MB
  • STRATA_UNBUFFERED_LOAD=1: prefill 629.3 tok/s (628.6–630.0) · decode 69.2 · 340 major faults (338–343) · page cache held 0 MB
  • STRATA_IO_PREFETCH=1: prefill 460.9 · 42,559 faults
  • STRATA_IO_PREFETCH=1 + STRATA_IO_PF_STAGE=1: prefill 447.8 · 43,335 faults

That is +43% prefill and 131× fewer major faults, reproducing across both round orders.

The part I think is most useful for the heuristic: the byte volumes are the same in every arm. Per request the file tier wanted ~44.2 GB of expert bytes and the OS delivered 66.0–67.1 GB from storage in all four arms. Only the read shape differs — buffered through the page cache versus unbuffered direct. Same bytes, 131× the major faults, 43% of the prefill.

The same prompt under each setting, from the engine's own per-request line:

default:      the OS read 66117.1 MB from storage (45079 major faults) for 44388.9 MB of expert reads; page cache held 36173.8 MB at the read, not 25394.2 MB
UNBUFFERED=1: the OS read 66413.0 MB from storage (343 major faults) for 44312.8 MB of expert reads; page cache held 0.0 MB at the read, not 0.0 MB

Worth noting this is the box from #1194 — the 5% / 1.5 GiB rule came out of that report, and on 0.1.44.1 it is now the thing costing this machine 43% of its prompt speed.

One related observation: with STRATA_LOOKAHEAD=0 set, STRATA_IO_PREFETCH=1 did essentially nothing here — the per-request counter read 0–3 read ahead (0.0–4.1 MB by pread), 0 used. The prefetch path reads the layer's uncached experts and the router-predicted ones of the next layer, so with the lookahead off it has nothing to work with. Worth knowing before recommending prefetch as the fix for 32 GB boxes (as in #1407).

Given #1682, is the intended direction still to time the drive at start and pick direct reads when the drive is fast and the cache covers only part of the read set? If it helps, I can run the same controlled protocol against a build with that timing in it.

<!-- gh-comment-id:6173829412 --> @willthehuman commented on GitHub (Oct 14, 2026): Confirming this on NVIDIA/CUDA, so it is not HIP-specific. Setup: i7-8700, 31.9 GB RAM, RTX 4070 SUPER 12 GB, Q2_0 pack on an ntfs3 partition (DRAM-less NVMe), engine `0.1.44.1`. Method: engine stopped, every model file evicted with `fadvise` (advice defaults to `dontneed`), coldness verified with `fincore` before each measurement, one identical 17,280-token prompt, two rounds with the arm order reversed on round 2. Medians of 2: - **default (buffered, current heuristic):** prefill **439.9 tok/s** (437.4–442.4) · decode 56.8 · **44,596 major faults** (44,114–45,079) · page cache held 35,758 MB - **`STRATA_UNBUFFERED_LOAD=1`:** prefill **629.3 tok/s** (628.6–630.0) · decode 69.2 · **340 major faults** (338–343) · page cache held 0 MB - `STRATA_IO_PREFETCH=1`: prefill 460.9 · 42,559 faults - `STRATA_IO_PREFETCH=1` + `STRATA_IO_PF_STAGE=1`: prefill 447.8 · 43,335 faults That is **+43% prefill and 131× fewer major faults**, reproducing across both round orders. The part I think is most useful for the heuristic: **the byte volumes are the same in every arm.** Per request the file tier wanted ~44.2 GB of expert bytes and the OS delivered 66.0–67.1 GB from storage in all four arms. Only the read shape differs — buffered through the page cache versus unbuffered direct. Same bytes, 131× the major faults, 43% of the prefill. The same prompt under each setting, from the engine's own per-request line: ``` default: the OS read 66117.1 MB from storage (45079 major faults) for 44388.9 MB of expert reads; page cache held 36173.8 MB at the read, not 25394.2 MB UNBUFFERED=1: the OS read 66413.0 MB from storage (343 major faults) for 44312.8 MB of expert reads; page cache held 0.0 MB at the read, not 0.0 MB ``` Worth noting this is the box from #1194 — the 5% / 1.5 GiB rule came out of that report, and on 0.1.44.1 it is now the thing costing this machine 43% of its prompt speed. One related observation: with `STRATA_LOOKAHEAD=0` set, `STRATA_IO_PREFETCH=1` did essentially nothing here — the per-request counter read `0–3 read ahead (0.0–4.1 MB by pread), 0 used`. The prefetch path reads the layer's uncached experts *and the router-predicted ones of the next layer*, so with the lookahead off it has nothing to work with. Worth knowing before recommending prefetch as the fix for 32 GB boxes (as in #1407). Given #1682, is the intended direction still to time the drive at start and pick direct reads when the drive is fast and the cache covers only part of the read set? If it helps, I can run the same controlled protocol against a build with that timing in it.
Author
Owner

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

Thanks for taking the time to report this.

We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6270973735 --> @Niko1221 commented on GitHub (Oct 19, 2026): Thanks for taking the time to report this. We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
Author
Owner

@vthomasino commented on GitHub (Oct 19, 2026):

Re-tested on 0.2.0-beta (CUDA, RTX 5090 Laptop, 62 GB, UD-Q6_K_XL, caches dropped, two rounds): still happens. The default picks the file cache and reads prompts at about half the speed of STRATA_UNBUFFERED_LOAD=1 (179-185 vs 366-373 tok/s at ~4.5K tokens), and decodes at 3.4-6.0 vs 18.3-19.2 tok/s. Details, raw logs and a possible opt-in fix in #3237.

<!-- gh-comment-id:6275726197 --> @vthomasino commented on GitHub (Oct 19, 2026): Re-tested on 0.2.0-beta (CUDA, RTX 5090 Laptop, 62 GB, UD-Q6_K_XL, caches dropped, two rounds): still happens. The default picks the file cache and reads prompts at about half the speed of `STRATA_UNBUFFERED_LOAD=1` (179-185 vs 366-373 tok/s at ~4.5K tokens), and decodes at 3.4-6.0 vs 18.3-19.2 tok/s. Details, raw logs and a possible opt-in fix in #3237.
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#948
No description provided.