[GH-ISSUE #3518] [Engine] the host-aware prompt plan picks smaller chunks that make 16K-32K prompts 7-67% slower (RX 9070 XT, Windows, Coder) #1445

Closed
opened 2026-11-04 01:51:20 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @facundopanizza on GitHub (Oct 20, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3518

Area

[Engine]

Desktop app, Terminal or source?

Source (START-HERE.bat, setup.sh or a build)

What happened

With --prefill auto, the host-aware prompt plan (#2824, include/strata/program/prefill_plan.hpp) changed the chunk for long prompts on this PC on every start where it engaged (to 1024, 3072 or 4096 tokens), and each time long prompts read slower than with the chunk it replaced (6144). It predicted a faster prompt each time. Short prompts and decode were unchanged.

A/B in one boot, alternating starts, the same config and binary; only STRATA_PREFILL_HOST_PLAN differs (unset = on, 0 = off). tools/strata_bench.py --long, 3 fresh prompts per length, medians, prompt tok/s from the engine's timings:

Start Plan Chunk for prompts > 6144 16K prompt tok/s 16K first token (s) 32K prompt tok/s 32K first token (s) chat decode tok/s
1 off 6144 1,296 12.43 1,281 25.07 56.6
2 on 3072 947 (-27%) 17.00 985 (-23%) 32.60 58.9
3 off 6144 1,306 12.34 1,277 25.13 58.3
4 on 4096 1,205 (-8%) 13.37 1,193 (-7%) 26.90 55.6

An earlier start the same evening (plan on) chose 1024 with a 16-slot ring: 16K 429 tok/s (37.5 s), 32K 685 tok/s (46.8 s), against 1,314 and 1,398 tok/s in the start before it, which kept 6144 (that pair is not a controlled A/B: the two starts had 3,263 vs 3,118 GPU cache slots and 14.25 vs 15.43 GiB of RAM copy).

The two "off" starts agree within 1% on the long prompts, so the differences above are not run-to-run noise.

What the plan predicted for a 32,768-token prompt, against what was measured (32K first token):

Start Predicted, kept 6144 Predicted, plan's pick Measured, 6144 (starts 1 and 3) Measured, plan's pick
2 (-> 3072) 44 s, ~21.4 GB from the drive 31 s, ~0.0 GB 25.1 s 32.6 s
4 (-> 4096) 38 s, ~12.8 GB 30 s, ~0.0 GB 25.1 s 26.9 s
earlier (-> 1024, ring 16) 51 s, ~32.3 GB 40 s, ~0.0 GB 23.0 s (start before it) 46.8 s

Expected: the plan keeps 6144 when it is faster, as its "near-ties keep the established behaviour" rule intends.

Unconfirmed static analysis (read, not tested): on Windows drive_read_gbps() (src/program/generate.cpp:1356-1370) has no measurement and returns 1.5 GB/s ("drive 1.50 GB/s (assumed)" in every plan line here); the model files are on a PCIe 4.0 NVMe (Kingston NV3). The baseline's predicted time (38-51 s) is well above the measured 23-25 s, which is what a drive-cost overestimate would do. I did not test STRATA_SSD_GBPS, and the page-cache figure (3.5 GiB available) may also be under what Windows actually keeps.

Workaround in use: "STRATA_PREFILL_HOST_PLAN": "0" in the config's "env"; after it the engine prints prompt chunk auto: 6144 tokens, a 96-slot ring and no plan line.

Smallest steps or command that reproduce it

  1. Windows, a 16 GB card, ~31 GB of RAM, Coder IQ1_M at 65,536 context with setup's config (--prefill auto, --resident-experts, the low-RAM mode).
  2. Start the server and read a fresh 16K and 32K prompt (python tools/strata_bench.py --config strata-coder-iq1_m.json --url http://127.0.0.1:8080 --long against a running server; the self-start path fails, #3235).
  3. Restart with STRATA_PREFILL_HOST_PLAN=0 and repeat. Whether the plan engages depends on the free RAM at start (it did on every plan-on start here).

Reproduction status

Reproduced locally

Strata version

Commit e88ee39d (0.2.0-beta + 12) · engine 0.1.45.3, built on this PC with tools\hip\build_windows.bat (gfx1201 only, ROCm 10.2.0a20260930)

Graphics card, memory and system

RX 9070 XT 16 GB (gfx1201, HIP device 1; device 0 is the integrated Radeon) · Ryzen 9 9950X · 31.1 GiB RAM (2x16 GB DDR5 at 5600, EXPO on) · Kingston NV3 2 TB NVMe · Windows 11 (10.0.26300), AMD driver 32.0.31041.1004

Model, size and settings

Coder IQ1_M · 65,536 context · KV int8 · --prefill auto --resident-experts --spec 4 --mtp · pictures on (CPU reader) · experimental speed projection on (same in every arm)

Logs

The plan lines of each start (paths removed):

## start 1 (off)
strata generate: expert cache 3094 slots, 5.92 GiB of VRAM
FileExpertSource: RAM budget 16.24 GiB
strata serve: prompt chunk auto: 6144 tokens, a 96-slot ring
## start 2 (on)
strata generate: expert cache 3127 slots, 5.98 GiB of VRAM
FileExpertSource: RAM budget 16.33 GiB
strata: prefill plan: chunk 6144 -> 3072, ring 96 -> 96: today's choice has a 4.1 GiB file set against a 3.5 GiB page cache (about 21.4 GB read from the drive per 32768-token prompt, 44 s); this one 3.0 GiB, about 0.0 GB read, 31 s. --prefill N keeps your own chunk
strata: prefill plan inputs: 23.4 GiB experts, 6.0 GiB in the GPU caches, 16.3 GiB RAM copy (0 lend slots kept), file tier 1.1 GiB; 3.5 GiB available for the page cache; PCIe 54.9 GB/s; drive 1.50 GB/s (assumed); a 32768-token prompt
strata serve: prompt chunk auto: 6144 tokens, a 96-slot ring
strata serve: prompts longer than 6144 tokens read in equal chunks of at most 3072 (the host-aware plan); shorter ones in one chunk
## start 3 (off)
strata generate: expert cache 3118 slots, 5.96 GiB of VRAM
FileExpertSource: RAM budget 16.44 GiB
strata serve: prompt chunk auto: 6144 tokens, a 96-slot ring
## start 4 (on)
strata generate: expert cache 3051 slots, 5.83 GiB of VRAM
FileExpertSource: RAM budget 16.89 GiB
strata: prefill plan: chunk 6144 -> 4096, ring 96 -> 96: today's choice has a 3.7 GiB file set against a 3.5 GiB page cache (about 12.8 GB read from the drive per 32768-token prompt, 38 s); this one 2.9 GiB, about 0.0 GB read, 30 s. --prefill N keeps your own chunk
strata: prefill plan inputs: 23.4 GiB experts, 5.8 GiB in the GPU caches, 16.9 GiB RAM copy (0 lend slots kept), file tier 0.7 GiB; 3.5 GiB available for the page cache; PCIe 55.0 GB/s; drive 1.50 GB/s (assumed); a 32768-token prompt
strata serve: prompt chunk auto: 6144 tokens, a 96-slot ring
strata serve: prompts longer than 6144 tokens read in equal chunks of at most 4096 (the host-aware plan); shorter ones in one chunk
## earlier start (on, -> 1024)
strata: prefill plan: chunk 6144 -> 1024, ring 96 -> 16: today's choice has a 5.0 GiB file set against a 3.5 GiB page cache (about 32.3 GB read from the drive per 32768-token prompt, 51 s); this one 3.0 GiB, about 0.0 GB read, 40 s. --prefill N keeps your own chunk
strata: prefill plan inputs: 23.4 GiB experts, 6.0 GiB in the GPU caches, 15.4 GiB RAM copy (0 lend slots kept), file tier 2.0 GiB; 3.5 GiB available for the page cache; PCIe 55.0 GB/s; drive 1.50 GB/s (assumed); a 32768-token prompt
strata serve: prompt chunk auto: 6144 tokens, a 16-slot ring
strata serve: prompts longer than 6144 tokens read in equal chunks of at most 1024 (the host-aware plan); shorter ones in one chunk

Engine timings of the earlier start's long prompts:

strata serve: prompt 16058 tokens = 0 reused + 16058 read in 37648 ms (426.5 tok/s), 24 generated in 488 ms (49.2 tok/s), drafts accepted 7 of 18, 1 checkpoints
strata serve: prompt 32049 tokens = 0 reused + 32049 read in 46790 ms (685.0 tok/s), 24 generated in 542 ms (44.2 tok/s), drafts accepted 7 of 18, 2 checkpoints

Not tested: Linux; other cards, models or RAM sizes; STRATA_SSD_GBPS; more than one suite per start. The machine and the first benchmark of this setup are in #3375.

Originally created by @facundopanizza on GitHub (Oct 20, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/3518 ### Area [Engine] ### Desktop app, Terminal or source? Source (START-HERE.bat, setup.sh or a build) ### What happened With `--prefill auto`, the host-aware prompt plan (#2824, `include/strata/program/prefill_plan.hpp`) changed the chunk for long prompts on this PC on every start where it engaged (to 1024, 3072 or 4096 tokens), and each time **long prompts read slower** than with the chunk it replaced (6144). It predicted a faster prompt each time. Short prompts and decode were unchanged. A/B in one boot, alternating starts, the same config and binary; only `STRATA_PREFILL_HOST_PLAN` differs (unset = on, `0` = off). `tools/strata_bench.py --long`, 3 fresh prompts per length, medians, prompt tok/s from the engine's timings: | Start | Plan | Chunk for prompts > 6144 | 16K prompt tok/s | 16K first token (s) | 32K prompt tok/s | 32K first token (s) | chat decode tok/s | | --- | --- | --- | ---: | ---: | ---: | ---: | ---: | | 1 | off | 6144 | 1,296 | 12.43 | 1,281 | 25.07 | 56.6 | | 2 | on | 3072 | 947 (-27%) | 17.00 | 985 (-23%) | 32.60 | 58.9 | | 3 | off | 6144 | 1,306 | 12.34 | 1,277 | 25.13 | 58.3 | | 4 | on | 4096 | 1,205 (-8%) | 13.37 | 1,193 (-7%) | 26.90 | 55.6 | An earlier start the same evening (plan on) chose 1024 with a 16-slot ring: 16K 429 tok/s (37.5 s), 32K 685 tok/s (46.8 s), against 1,314 and 1,398 tok/s in the start before it, which kept 6144 (that pair is not a controlled A/B: the two starts had 3,263 vs 3,118 GPU cache slots and 14.25 vs 15.43 GiB of RAM copy). The two "off" starts agree within 1% on the long prompts, so the differences above are not run-to-run noise. What the plan predicted for a 32,768-token prompt, against what was measured (32K first token): | Start | Predicted, kept 6144 | Predicted, plan's pick | Measured, 6144 (starts 1 and 3) | Measured, plan's pick | | --- | ---: | ---: | ---: | ---: | | 2 (-> 3072) | 44 s, ~21.4 GB from the drive | 31 s, ~0.0 GB | 25.1 s | 32.6 s | | 4 (-> 4096) | 38 s, ~12.8 GB | 30 s, ~0.0 GB | 25.1 s | 26.9 s | | earlier (-> 1024, ring 16) | 51 s, ~32.3 GB | 40 s, ~0.0 GB | 23.0 s (start before it) | 46.8 s | Expected: the plan keeps 6144 when it is faster, as its "near-ties keep the established behaviour" rule intends. **Unconfirmed static analysis** (read, not tested): on Windows `drive_read_gbps()` (`src/program/generate.cpp:1356-1370`) has no measurement and returns 1.5 GB/s ("drive 1.50 GB/s (assumed)" in every plan line here); the model files are on a PCIe 4.0 NVMe (Kingston NV3). The baseline's predicted time (38-51 s) is well above the measured 23-25 s, which is what a drive-cost overestimate would do. I did not test `STRATA_SSD_GBPS`, and the page-cache figure (3.5 GiB available) may also be under what Windows actually keeps. Workaround in use: `"STRATA_PREFILL_HOST_PLAN": "0"` in the config's `"env"`; after it the engine prints `prompt chunk auto: 6144 tokens, a 96-slot ring` and no plan line. ### Smallest steps or command that reproduce it 1. Windows, a 16 GB card, ~31 GB of RAM, Coder IQ1_M at 65,536 context with setup's config (`--prefill auto`, `--resident-experts`, the low-RAM mode). 2. Start the server and read a fresh 16K and 32K prompt (`python tools/strata_bench.py --config strata-coder-iq1_m.json --url http://127.0.0.1:8080 --long` against a running server; the self-start path fails, #3235). 3. Restart with `STRATA_PREFILL_HOST_PLAN=0` and repeat. Whether the plan engages depends on the free RAM at start (it did on every plan-on start here). ### Reproduction status Reproduced locally ### Strata version Commit e88ee39d (0.2.0-beta + 12) · engine 0.1.45.3, built on this PC with `tools\hip\build_windows.bat` (gfx1201 only, ROCm 10.2.0a20260930) ### Graphics card, memory and system RX 9070 XT 16 GB (gfx1201, HIP device 1; device 0 is the integrated Radeon) · Ryzen 9 9950X · 31.1 GiB RAM (2x16 GB DDR5 at 5600, EXPO on) · Kingston NV3 2 TB NVMe · Windows 11 (10.0.26300), AMD driver 32.0.31041.1004 ### Model, size and settings Coder IQ1_M · 65,536 context · KV int8 · `--prefill auto --resident-experts --spec 4 --mtp` · pictures on (CPU reader) · experimental speed projection on (same in every arm) ### Logs The plan lines of each start (paths removed): ```text ## start 1 (off) strata generate: expert cache 3094 slots, 5.92 GiB of VRAM FileExpertSource: RAM budget 16.24 GiB strata serve: prompt chunk auto: 6144 tokens, a 96-slot ring ## start 2 (on) strata generate: expert cache 3127 slots, 5.98 GiB of VRAM FileExpertSource: RAM budget 16.33 GiB strata: prefill plan: chunk 6144 -> 3072, ring 96 -> 96: today's choice has a 4.1 GiB file set against a 3.5 GiB page cache (about 21.4 GB read from the drive per 32768-token prompt, 44 s); this one 3.0 GiB, about 0.0 GB read, 31 s. --prefill N keeps your own chunk strata: prefill plan inputs: 23.4 GiB experts, 6.0 GiB in the GPU caches, 16.3 GiB RAM copy (0 lend slots kept), file tier 1.1 GiB; 3.5 GiB available for the page cache; PCIe 54.9 GB/s; drive 1.50 GB/s (assumed); a 32768-token prompt strata serve: prompt chunk auto: 6144 tokens, a 96-slot ring strata serve: prompts longer than 6144 tokens read in equal chunks of at most 3072 (the host-aware plan); shorter ones in one chunk ## start 3 (off) strata generate: expert cache 3118 slots, 5.96 GiB of VRAM FileExpertSource: RAM budget 16.44 GiB strata serve: prompt chunk auto: 6144 tokens, a 96-slot ring ## start 4 (on) strata generate: expert cache 3051 slots, 5.83 GiB of VRAM FileExpertSource: RAM budget 16.89 GiB strata: prefill plan: chunk 6144 -> 4096, ring 96 -> 96: today's choice has a 3.7 GiB file set against a 3.5 GiB page cache (about 12.8 GB read from the drive per 32768-token prompt, 38 s); this one 2.9 GiB, about 0.0 GB read, 30 s. --prefill N keeps your own chunk strata: prefill plan inputs: 23.4 GiB experts, 5.8 GiB in the GPU caches, 16.9 GiB RAM copy (0 lend slots kept), file tier 0.7 GiB; 3.5 GiB available for the page cache; PCIe 55.0 GB/s; drive 1.50 GB/s (assumed); a 32768-token prompt strata serve: prompt chunk auto: 6144 tokens, a 96-slot ring strata serve: prompts longer than 6144 tokens read in equal chunks of at most 4096 (the host-aware plan); shorter ones in one chunk ## earlier start (on, -> 1024) strata: prefill plan: chunk 6144 -> 1024, ring 96 -> 16: today's choice has a 5.0 GiB file set against a 3.5 GiB page cache (about 32.3 GB read from the drive per 32768-token prompt, 51 s); this one 3.0 GiB, about 0.0 GB read, 40 s. --prefill N keeps your own chunk strata: prefill plan inputs: 23.4 GiB experts, 6.0 GiB in the GPU caches, 15.4 GiB RAM copy (0 lend slots kept), file tier 2.0 GiB; 3.5 GiB available for the page cache; PCIe 55.0 GB/s; drive 1.50 GB/s (assumed); a 32768-token prompt strata serve: prompt chunk auto: 6144 tokens, a 16-slot ring strata serve: prompts longer than 6144 tokens read in equal chunks of at most 1024 (the host-aware plan); shorter ones in one chunk ``` Engine timings of the earlier start's long prompts: ```text strata serve: prompt 16058 tokens = 0 reused + 16058 read in 37648 ms (426.5 tok/s), 24 generated in 488 ms (49.2 tok/s), drafts accepted 7 of 18, 1 checkpoints strata serve: prompt 32049 tokens = 0 reused + 32049 read in 46790 ms (685.0 tok/s), 24 generated in 542 ms (44.2 tok/s), drafts accepted 7 of 18, 2 checkpoints ``` Not tested: Linux; other cards, models or RAM sizes; `STRATA_SSD_GBPS`; more than one suite per start. The machine and the first benchmark of this setup are in #3375.
Author
Owner

@Niko1221 commented on GitHub (Nov 5, 2026):

Thanks for taking the time to report this.

Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.11. 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:6659531646 --> @Niko1221 commented on GitHub (Nov 5, 2026): Thanks for taking the time to report this. Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.11. 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).
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#1445
No description provided.