Skip to content

[Other] setup: keep 3 GB of VRAM for the desktop on an AMD card under Windows - #258

Draft
okada-shogo wants to merge 1 commit into
simplexai-labs:mainfrom
okada-shogo:setup/win-hip-vram-reserve
Draft

okada-shogo wants to merge 1 commit into
simplexai-labs:mainfrom
okada-shogo:setup/win-hip-vram-reserve

Conversation

@okada-shogo

@okada-shogo okada-shogo commented Nov 23, 2026 •

Copy link
Copy Markdown

Problem and result

On Windows with an AMD card, strata-poly fills the VRAM budget Windows gives it (15,419 of an RX 9070 XT's 16,304 MiB),
while the desktop's programs hold 2-3 GB of the same card. Prompts were then read at a third of their speed. Setup
now writes --vram-reserve-mib 3072 (DESKTOP_RESERVE_MIB, the reserve that already keeps a Linux desktop alive) into
a strata-poly config on an AMD card under Windows, unless --vram-reserve-mib was given.

Prompt speed, tokens per second (tok/s), higher is better. Windows 11, RX 9070 XT 16 GB, Inkling 2 Mini IQ4_NL,
--kv fp16, 16K context, no expert profile, each process sent a warm request first, mean of 3 runs:

Card Model Measure engine default this PR alone (3072 MiB) Change
RX 9070 XT 16 GB IQ4_NL prompt 302 151.5 360.1 +138%
RX 9070 XT 16 GB IQ4_NL prompt 2,048 289.8 670.0 +131%
RX 9070 XT 16 GB IQ4_NL prompt 8,192 322.6 1025.7 +218%

Decode speed, tokens per second (tok/s), higher is better. Same runs:

Card Model Measure engine default this PR alone (3072 MiB) Change
RX 9070 XT 16 GB IQ4_NL decode after 302 34.2 33.0 −3.6%
RX 9070 XT 16 GB IQ4_NL decode after 8,192 33.5 29.2 −12.7%

Experts in VRAM: 11.8 GiB → 9.3 GiB. Decode is slower because fewer experts fit; prompts are faster because the card
is no longer over its budget. After 8,192 tokens + 256 written, a request takes 17 s instead of 33 s.

Each run (tok/s)

Prompt tok/s, higher is better, each run:

Card Model Measure Build Run 1 Run 2 Run 3
RX 9070 XT 16 GB IQ4_NL prompt 302 engine default 155.4 149.2 149.9
RX 9070 XT 16 GB IQ4_NL prompt 302 this PR alone 342.9 365.6 371.9
RX 9070 XT 16 GB IQ4_NL prompt 2,048 engine default 291.0 295.4 283.0
RX 9070 XT 16 GB IQ4_NL prompt 2,048 this PR alone 710.7 650.1 649.2
RX 9070 XT 16 GB IQ4_NL prompt 8,192 engine default 324.1 321.9 321.7
RX 9070 XT 16 GB IQ4_NL prompt 8,192 this PR alone 1014.1 1025.6 1037.4

Decode tok/s, higher is better, each run:

Card Model Measure Build Run 1 Run 2 Run 3
RX 9070 XT 16 GB IQ4_NL decode after 302 engine default 34.4 34.6 33.7
RX 9070 XT 16 GB IQ4_NL decode after 302 this PR alone 31.2 33.8 34.0
RX 9070 XT 16 GB IQ4_NL decode after 8,192 engine default 32.9 34.0 33.5
RX 9070 XT 16 GB IQ4_NL decode after 8,192 this PR alone 28.4 28.4 30.8

The two settings alternated. The engine was combined/ready (this repo's main plus our open PRs, #217 among them),
built by setup on that PC. VRAM free at the end: 0 MiB in every default run, 2,436-2,938 MiB with 3072.

Why 3072 and not less: 8,192-token prompts with other reserves

Same card and model, 8,192 tokens + 256 written, 2 runs each, the settings alternated.

As the second request of a process (a 302-token request first). Prompt tok/s, higher is better:

Card Model Measure Reserve Run 1 Run 2
RX 9070 XT 16 GB IQ4_NL prompt 8,192 engine default 320.3 321.7
RX 9070 XT 16 GB IQ4_NL prompt 8,192 2048 MiB 972.5 973.5
RX 9070 XT 16 GB IQ4_NL prompt 8,192 2560 MiB 1027.2 1027.9
RX 9070 XT 16 GB IQ4_NL prompt 8,192 3072 MiB 1019.2 1009.6

Decode tok/s, higher is better:

Card Model Measure Reserve Run 1 Run 2
RX 9070 XT 16 GB IQ4_NL decode after 8,192 engine default 33.9 37.4
RX 9070 XT 16 GB IQ4_NL decode after 8,192 2048 MiB 31.6 31.6
RX 9070 XT 16 GB IQ4_NL decode after 8,192 2560 MiB 29.6 28.9
RX 9070 XT 16 GB IQ4_NL decode after 8,192 3072 MiB 28.4 28.3

As the first request of a process (the engine with #257, so no one-time BLAS wait). Prompt tok/s, higher is
better:

Card Model Measure Reserve Run 1 Run 2
RX 9070 XT 16 GB IQ4_NL prompt 8,192 engine default 318.1 320.8
RX 9070 XT 16 GB IQ4_NL prompt 8,192 2048 MiB 308.4 311.3
RX 9070 XT 16 GB IQ4_NL prompt 8,192 3072 MiB 951.3 944.8

Decode tok/s, higher is better:

Card Model Measure Reserve Run 1 Run 2
RX 9070 XT 16 GB IQ4_NL decode after 8,192 engine default 31.6 32.4
RX 9070 XT 16 GB IQ4_NL decode after 8,192 2048 MiB 32.1 33.1
RX 9070 XT 16 GB IQ4_NL decode after 8,192 3072 MiB 31.3 31.4
  • With 2048 MiB the first long request still ends with 0 MiB of VRAM free and reads at the default speed. Only 3072
    MiB helps there (493-557 MiB free at the end).
  • In the first request, 3072 MiB costs almost no decode speed (31.4 against 32.0). The decode loss shows up in later
    requests (28.4 against 33.9-37.4).
  • Experts in VRAM: 11.8 GiB (default), 10.3 (2048), 9.8 (2560), 9.3 (3072). One-shot runs (8,192 + 64, strata-poly --tokens, no warm request) read 96.3%, 90.8% and 87.1% of their experts from VRAM at default, 2048 and 3072, with
    the same decode speed (31.9, 32.1, 32.9 tok/s). So fewer resident experts alone does not explain the later
    requests' loss; I have not found the cause yet.

Related discussion

none.

Approach

win_hip_reserve() returns --vram-reserve-mib DESKTOP_RESERVE_MIB on Windows with the HIP backend, and nothing
elsewhere. poly_setup() uses it only when the person gave no --vram-reserve-mib, so an explicit value still wins
and is kept as before. Linux, NVIDIA and the main engine's configs are unchanged. A config written by an earlier setup
gets the reserve on its next setup run, not on a plain start.

Class: placement (fewer experts on the card).

Validation

Passed:

  • cd terminal && python3 -m unittest discover -s tools -p 'test_setup*.py': 1358 tests OK (skipped 1), including the
    new VramReserve.test_windows_amd_default.
  • python3 tools/check --only docs: passed.
  • Speed: the tables above (Windows 11, RX 9070 XT, ROCm 10.2.0a20260930, engine built by setup).

Failed: none observed.

Not run:

  • A full Windows setup run of this branch: the speed numbers come from the engine started with and without the flag
    this branch writes.
  • Other models and other AMD cards on Windows (RX 7900, RX 5700 XT): not measured. A card whose desktop holds less
    VRAM loses experts for no gain.

Limits

  • Decode after a long prompt is 12.7% slower on this card from the second request on (not in the first). 2.5 GiB
    fewer experts fit, but one-shot runs with the same reserve decode at full speed, so the cause is not found yet.
    2048 MiB keeps the later requests' prompt gain with less decode loss, but does not help the first long request.
  • 3072 MiB is a flat amount. The desktop's use on this PC was 2.3-2.9 GB; a PC with more open programs may need more,
    one with fewer loses experts for nothing. Reading Windows' per-process usage at start would size it better; that is
    an engine change, not done here.

🤖 Generated with Claude Code

Windows' video memory budget lets strata-poly take nearly the whole card
(15,419 of an RX 9070 XT's 16,304 MiB) while the desktop's programs hold
2-3 GB of it, and the engine filled that budget. Prompts were then read
at a third of their speed. Setup now writes --vram-reserve-mib
DESKTOP_RESERVE_MIB (3072, the reserve that already keeps a Linux
desktop alive beside a full expert cache) into a strata-poly config on
an AMD card under Windows, unless --vram-reserve-mib was given.

Inkling 2 Mini IQ4_NL on that card (Windows 11, ROCm 10.2.0a20260930),
a warm request first, mean of 3 runs: prompts of 302 / 2,048 / 8,192
tokens 151 / 290 / 323 -> 360 / 670 / 1,026 tokens/s; decode after 302
tokens 34.2 -> 33.0, after 8,192 tokens 33.5 -> 29.2 tokens/s (9.3 GiB of
experts on the card instead of 11.8).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant