[PR #4972] [CLOSED] generate: the file tier's Linux defaults stay off when the GPU caches… #5272

Closed
opened 2026-11-07 16:33:59 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4972
Author: @01xjw
Created: 11/2/2026
Status: ❌ Closed

Base: main ← Head: pr/file-tier-all-resident


📝 Commits (1)

  • a522992 generate: the file tier's Linux defaults stay off when the GPU caches hold every expert

📊 Changes

2 files changed (+31 additions, -2 deletions)

View changed files

📝 src/core/expert_source.cpp (+1 -0)
📝 src/program/generate.cpp (+30 -2)

📄 Description

Problem and result

Since 0.2.1, an experts.bin pack on Linux gets io prefetch and its decode gate by default when the page cache has room for 55% of the experts, and the routing-aware prefetch starts with them. That check does not look at the GPU caches. When they hold every expert, the decode reads nothing from the file tier: every request logs the OS read 0.0 MB from storage (0 major faults) ... io prefetch: 0 read ahead (0.0 MB by pread). The defaults still cost decode time: 57.3 tok/s, against 79.6 with STRATA_IO_PREFETCH=0.

With this PR, once the caches are filled and hold every expert, those defaults are off and the startup log says so. Decode is 80.4 tok/s with no variables set, the same as setting the switch by hand. The answers do not change.

Setup. One machine, every arm on the same two cards, one server start per arm:

  • GPUs: 2x AMD Radeon PRO W7900D 48 GB (gfx1100), layer split (layers 0-23 on the first card, 24-47 and the head on the second).
  • Software: ROCm 7.2.1 in a Linux container, 32 CPUs and a 110 GiB memory limit. The page cache passes the 55% room test.
  • Model: Qwen3.8-Flash-Next IQ3_S experts.bin, --mmap-experts, an expert profile that fills 12,288 slots per card: 24,576 of 24,576 experts resident.
  • Server flags: --batch 8 --pipeline-windows 1 --spec 4 --kv int8 --max-context 65536.
  • Environment in every arm: STRATA_HIPBLASLT_TUNING=tools/hip/gfx1100-hipblaslt-100202.txt, STRATA_SLOT_COPY_DIRECT=1, STRATA_SLOT_COPY_BATCHSYNC=1.
  • Suite: python tools/strata_bench.py --url <server> --long --clients 8.
Before, defaults Before, STRATA_IO_PREFETCH=0 STRATA_COLD_OVERLAP=0 This PR, defaults
Short-chat decode tok/s, median (min-max), n=9 57.3 (36.7-105.3) 79.6 (62.6-104.6) 80.4 (50.3-108.5)
Agent-session decode tok/s, median (min-max), n=15 57.3 (21.5-102.1) 75.0 (28.9-107.9) 84.0 (40.2-88.9)
Prompt 4K tok/s, median (min-max), n=3 1294 (1241-1370) 1320 (1282-1321) 1340 (1296-1378)
Prompt 16K tok/s, median (min-max), n=3 1453 (1374-1686) 1581 (1472-1825) 1631 (1598-1724)
Prompt 32K tok/s, median (min-max), n=3 1747 (1739-1788) 1776 (1594-1932) 1580 (1494-1765)
Short-chat first token s, median 0.31 0.34 0.35
8 clients total tok/s, median (min-max), n=3 137.0 (92.1-137.0) 139.6 (111.8-141.0) 83.8 (77.5-92.6)
Failed requests 0 0 0
Greedy probe, 5 prompts, sha256 of the output reference identical identical
  • Probe: 3 short prompts and prompts of about 4K and 16K tokens, temperature 0, 160 tokens.
  • One extra setting: the first arm also had STRATA_HIPBLASLT_VERBOSE=1, which only logs prompt-GEMM fallbacks (src/prefill/gemm.cu). The STRATA_LOOKAHEAD=0 arm below ran without it.
  • The routing-aware prefetch alone: one more pre-PR arm with only STRATA_LOOKAHEAD=0 decoded at 70.2 tok/s. The routing-aware prefetch is part of the cost, and io prefetch with its gate is the rest.

The 32K and 8-client figures of this PR's suite run. After the fill, this PR leaves the file tier in the same state as STRATA_IO_PREFETCH=0:

  • io_stop() clears io_pf_;
  • this PR also clears the gate flag;
  • neither path starts the routing-aware prefetch.

So I read the two lower figures (1580 at 32K, 83.8 at 8 clients) as variation between server starts. The 32K ranges overlap. 8-client totals on this build vary between starts, from about 80 to 140 tok/s: the STRATA_LOOKAHEAD=0 arm, before this PR, got 82.5.

To check the 8-client figure, I reran the 8-client test alone, alternating the two builds on fresh starts. Each start did 5 rounds:

Order Build Total tok/s, rounds 1-5 Median of rounds 2-5 Failed
1 this PR, defaults 108.0, 112.6, 114.1, 114.5, 116.0 114.3 0
2 before, STRATA_IO_PREFETCH=0 STRATA_COLD_OVERLAP=0 110.8, 117.0, 114.2, 106.7, 111.6 112.9 0
3 this PR, defaults 119.6, 125.2, 127.7, 128.4, 124.1 126.5 0
4 before, STRATA_IO_PREFETCH=0 STRATA_COLD_OVERLAP=0 107.4, 110.4, 118.6, 110.9, 117.9 114.4 0

Per-run JSON for every arm, the probe hashes and the repeat are in 01xjw/Strata.

  • No upstream issue. This narrows the 0.2.1 experts.bin default (ecf2bdcb) to the case it can help. Every setup whose GPU caches miss an expert keeps the 0.2.1 behaviour. If you would rather agree the scope in an issue first, the write-up is at 01xjw/Strata#1.
  • Precedent: #1595 leaves the CPU prefill share unarmed by default when the cache holds every expert.

Approach

Two files, +31/-2.

After the GPU caches are filled, the engine counts the (layer, expert) pairs they hold. On a layer split it checks each layer in its own stage's cache, the same way the device residency table is built. If every pair is held, and io prefetch came from the Linux default (STRATA_IO_PREFETCH unset):

  • io prefetch is turned off, and the decode gate's flag with it;
  • the routing-aware prefetch is not started;
  • one line is logged.

Compatibility:

  • Other setups: every setup whose GPU caches do not hold every expert keeps its current path (gpu_holds_all is false). The 0.2.1 default was measured to help there.
  • Overrides: STRATA_IO_PREFETCH=1 keeps io prefetch and the gate. STRATA_LOOKAHEAD=1 keeps the routing-aware prefetch.
  • Answers: neither prefetch changes them; both only change when pages are read.

Open point: with every expert resident, STRATA_IO_PREFETCH=1 alone no longer brings the routing-aware prefetch with it, so today's behaviour needs STRATA_IO_PREFETCH=1 STRATA_LOOKAHEAD=1. Should an explicit STRATA_IO_PREFETCH=1 keep both?

Validation

Passed:

  • Build of this PR alone: main 870aedd9 plus this commit (a522992c), HIP gfx1100, ROCm 7.2.0.
    • Command: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_HIP=ON -DCMAKE_HIP_ARCHITECTURES=gfx1100 -DSTRATA_BUILD_TESTS=ON, then cmake --build build -j 96.
    • Result: builds and links. The two touched files show the same 4 warnings as main, none in the changed lines.
  • Tests: ctest on the same build: 106 of 174 pass, on main and on this PR alike.
    • Same build host as above, which has no GPU.
    • The 68 failures are the same tests on both revisions. 57 report no ROCm-capable device. The others need model files or device memory, plus isa_guard_check on libstrata_kernels_cpu.a.
    • Passing tests include file_expert_source_test, arch_defaults_test, expert_multi_test, pool_plan_test, warm_policy_test and direct_file_async_test.
  • GPU run:
    • Setup and arms: as above.
    • Startup log: every expert is in the GPU caches (24576 of 24576), and no routing-aware prefetch on.
    • Revision: the "this PR" arms ran main 870aedd9 plus a local commit not in this PR (--pipeline-windows 1 beside --batch) plus the first revision of this commit. The "before" arms ran the same tree without this commit.
    • The final revision adds one line, which clears the gate flag in set_io_prefetch. In this config the flag is not read once io prefetch is off: begin_layer returns early when the source is not staged.

Failed:

  • none observed

Limits

  • One machine, one model, one configuration. Other all-resident experts.bin setups on Linux get the same change untested. There the file tier also has nothing to read.
  • Run order: the suite arms ran in sequence. Only the 8-client repeat was interleaved.
  • Local commit in the tested tree: the arms used --pipeline-windows 1 beside --batch, which needs a local commit that is not in main. This change does not depend on it.
  • Residency check: done once, after the fill. Experts held only by --peer-device or the helper caches are not counted, so those setups keep today's defaults.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4972 **Author:** [@01xjw](https://github.com/01xjw) **Created:** 11/2/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/file-tier-all-resident` --- ### 📝 Commits (1) - [`a522992`](https://github.com/Niko1221/Strata/commit/a522992ceac2ca639670b9186edfa84cb4e4a9b2) generate: the file tier's Linux defaults stay off when the GPU caches hold every expert ### 📊 Changes **2 files changed** (+31 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/core/expert_source.cpp` (+1 -0) 📝 `src/program/generate.cpp` (+30 -2) </details> ### 📄 Description ## Problem and result Since 0.2.1, an `experts.bin` pack on Linux gets io prefetch and its decode gate by default when the page cache has room for 55% of the experts, and the routing-aware prefetch starts with them. That check does not look at the GPU caches. When they hold every expert, the decode reads nothing from the file tier: every request logs `the OS read 0.0 MB from storage (0 major faults) ... io prefetch: 0 read ahead (0.0 MB by pread)`. The defaults still cost decode time: 57.3 tok/s, against 79.6 with `STRATA_IO_PREFETCH=0`. With this PR, once the caches are filled and hold every expert, those defaults are off and the startup log says so. Decode is 80.4 tok/s with no variables set, the same as setting the switch by hand. The answers do not change. **Setup.** One machine, every arm on the same two cards, one server start per arm: - **GPUs:** 2x AMD Radeon PRO W7900D 48 GB (gfx1100), layer split (layers 0-23 on the first card, 24-47 and the head on the second). - **Software:** ROCm 7.2.1 in a Linux container, 32 CPUs and a 110 GiB memory limit. The page cache passes the 55% room test. - **Model:** Qwen3.8-Flash-Next IQ3_S `experts.bin`, `--mmap-experts`, an expert profile that fills 12,288 slots per card: 24,576 of 24,576 experts resident. - **Server flags:** `--batch 8 --pipeline-windows 1 --spec 4 --kv int8 --max-context 65536`. - **Environment in every arm:** `STRATA_HIPBLASLT_TUNING=tools/hip/gfx1100-hipblaslt-100202.txt`, `STRATA_SLOT_COPY_DIRECT=1`, `STRATA_SLOT_COPY_BATCHSYNC=1`. - **Suite:** `python tools/strata_bench.py --url <server> --long --clients 8`. | | Before, defaults | Before, `STRATA_IO_PREFETCH=0 STRATA_COLD_OVERLAP=0` | This PR, defaults | | --- | ---: | ---: | ---: | | Short-chat decode tok/s, median (min-max), n=9 | **57.3** (36.7-105.3) | 79.6 (62.6-104.6) | **80.4** (50.3-108.5) | | Agent-session decode tok/s, median (min-max), n=15 | 57.3 (21.5-102.1) | 75.0 (28.9-107.9) | 84.0 (40.2-88.9) | | Prompt 4K tok/s, median (min-max), n=3 | 1294 (1241-1370) | 1320 (1282-1321) | 1340 (1296-1378) | | Prompt 16K tok/s, median (min-max), n=3 | 1453 (1374-1686) | 1581 (1472-1825) | 1631 (1598-1724) | | Prompt 32K tok/s, median (min-max), n=3 | 1747 (1739-1788) | 1776 (1594-1932) | 1580 (1494-1765) | | Short-chat first token s, median | 0.31 | 0.34 | 0.35 | | 8 clients total tok/s, median (min-max), n=3 | 137.0 (92.1-137.0) | 139.6 (111.8-141.0) | 83.8 (77.5-92.6) | | Failed requests | 0 | 0 | 0 | | Greedy probe, 5 prompts, sha256 of the output | reference | identical | identical | - **Probe:** 3 short prompts and prompts of about 4K and 16K tokens, temperature 0, 160 tokens. - **One extra setting:** the first arm also had `STRATA_HIPBLASLT_VERBOSE=1`, which only logs prompt-GEMM fallbacks (`src/prefill/gemm.cu`). The `STRATA_LOOKAHEAD=0` arm below ran without it. - **The routing-aware prefetch alone:** one more pre-PR arm with only `STRATA_LOOKAHEAD=0` decoded at 70.2 tok/s. The routing-aware prefetch is part of the cost, and io prefetch with its gate is the rest. **The 32K and 8-client figures of this PR's suite run.** After the fill, this PR leaves the file tier in the same state as `STRATA_IO_PREFETCH=0`: - `io_stop()` clears `io_pf_`; - this PR also clears the gate flag; - neither path starts the routing-aware prefetch. So I read the two lower figures (1580 at 32K, 83.8 at 8 clients) as variation between server starts. The 32K ranges overlap. 8-client totals on this build vary between starts, from about 80 to 140 tok/s: the `STRATA_LOOKAHEAD=0` arm, before this PR, got 82.5. To check the 8-client figure, I reran the 8-client test alone, alternating the two builds on fresh starts. Each start did 5 rounds: | Order | Build | Total tok/s, rounds 1-5 | Median of rounds 2-5 | Failed | | --- | --- | --- | ---: | ---: | | 1 | this PR, defaults | 108.0, 112.6, 114.1, 114.5, 116.0 | 114.3 | 0 | | 2 | before, `STRATA_IO_PREFETCH=0 STRATA_COLD_OVERLAP=0` | 110.8, 117.0, 114.2, 106.7, 111.6 | 112.9 | 0 | | 3 | this PR, defaults | 119.6, 125.2, 127.7, 128.4, 124.1 | 126.5 | 0 | | 4 | before, `STRATA_IO_PREFETCH=0 STRATA_COLD_OVERLAP=0` | 107.4, 110.4, 118.6, 110.9, 117.9 | 114.4 | 0 | Per-run JSON for every arm, the probe hashes and the repeat are in [01xjw/Strata](https://github.com/01xjw/Strata/tree/main/bench/results/2026-10-30-community-2x-w7900d-48gb-qwen3-8-flash-next-iq3-s/runs-2026-10-30). ## Related discussion - **No upstream issue.** This narrows the 0.2.1 `experts.bin` default (ecf2bdcb) to the case it can help. Every setup whose GPU caches miss an expert keeps the 0.2.1 behaviour. If you would rather agree the scope in an issue first, the write-up is at 01xjw/Strata#1. - **Precedent:** #1595 leaves the CPU prefill share unarmed by default when the cache holds every expert. ## Approach Two files, +31/-2. After the GPU caches are filled, the engine counts the (layer, expert) pairs they hold. On a layer split it checks each layer in its own stage's cache, the same way the device residency table is built. If every pair is held, and io prefetch came from the Linux default (`STRATA_IO_PREFETCH` unset): - io prefetch is turned off, and the decode gate's flag with it; - the routing-aware prefetch is not started; - one line is logged. Compatibility: - **Other setups:** every setup whose GPU caches do not hold every expert keeps its current path (`gpu_holds_all` is false). The 0.2.1 default was measured to help there. - **Overrides:** `STRATA_IO_PREFETCH=1` keeps io prefetch and the gate. `STRATA_LOOKAHEAD=1` keeps the routing-aware prefetch. - **Answers:** neither prefetch changes them; both only change when pages are read. Open point: with every expert resident, `STRATA_IO_PREFETCH=1` alone no longer brings the routing-aware prefetch with it, so today's behaviour needs `STRATA_IO_PREFETCH=1 STRATA_LOOKAHEAD=1`. Should an explicit `STRATA_IO_PREFETCH=1` keep both? ## Validation **Passed:** - **Build of this PR alone:** `main` 870aedd9 plus this commit (a522992c), HIP gfx1100, ROCm 7.2.0. - Command: `cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_HIP=ON -DCMAKE_HIP_ARCHITECTURES=gfx1100 -DSTRATA_BUILD_TESTS=ON`, then `cmake --build build -j 96`. - Result: builds and links. The two touched files show the same 4 warnings as `main`, none in the changed lines. - **Tests:** `ctest` on the same build: 106 of 174 pass, on `main` and on this PR alike. - Same build host as above, which has no GPU. - The 68 failures are the same tests on both revisions. 57 report `no ROCm-capable device`. The others need model files or device memory, plus `isa_guard_check` on `libstrata_kernels_cpu.a`. - Passing tests include `file_expert_source_test`, `arch_defaults_test`, `expert_multi_test`, `pool_plan_test`, `warm_policy_test` and `direct_file_async_test`. - **GPU run:** - Setup and arms: as above. - Startup log: `every expert is in the GPU caches (24576 of 24576)`, and no `routing-aware prefetch on`. - Revision: the "this PR" arms ran `main` 870aedd9 plus a local commit not in this PR (`--pipeline-windows 1` beside `--batch`) plus the first revision of this commit. The "before" arms ran the same tree without this commit. - The final revision adds one line, which clears the gate flag in `set_io_prefetch`. In this config the flag is not read once io prefetch is off: `begin_layer` returns early when the source is not staged. **Failed:** - none observed ## Limits - **One machine, one model, one configuration.** Other all-resident `experts.bin` setups on Linux get the same change untested. There the file tier also has nothing to read. - **Run order:** the suite arms ran in sequence. Only the 8-client repeat was interleaved. - **Local commit in the tested tree:** the arms used `--pipeline-windows 1` beside `--batch`, which needs a local commit that is not in `main`. This change does not depend on it. - **Residency check:** done once, after the fill. Experts held only by `--peer-device` or the helper caches are not counted, so those setups keep today's defaults. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:33:59 +07:00
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#5272
No description provided.