[GH-ISSUE #5322] [Engine] HIP config on a host that also has NVIDIA cards: the start-time VRAM fit sizes the iGPU by the NVIDIA card and adds --kv-resident 4096 #3173

Open
opened 2026-11-07 14:38:39 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @KTKR-DSK on GitHub (Nov 5, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5322

Area

[Engine] (speed, kernels, models, the server and API)

Desktop app, Terminal or source?

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

What happened

On a Strix Halo host that also has two NVIDIA cards, a server config with "backend": "hip" and "gpu": 0 (the Radeon 8060S) is sized by the start-time VRAM fit as if it ran on a 16 GB NVIDIA card. The server adds --kv-resident 4096 and prints:

[strata] <model> on this 16 GB card: short of GPU memory: more is read from RAM and the SSD, expect it to be slower (KV window 4096 tokens in VRAM, the rest read from RAM)

The iGPU has a 112 GiB GTT pool here; the same start holds a 49.80 GiB expert cache with all 24,576 experts resident plus two 3.65 GiB slot sessions, so the 16 GB figure is not this card's.

In serve/server.py engine_args(), the backend comes from drafting.detect_hardware(), not from the config. On this host it returns ('cuda', ['sm_120', 'sm_120', 'gfx1151']) because nvidia-smi answers first. drafting_vram_mib() then returns 16311 (an RTX 5060 Ti), and vram_fit.fit_start(cfg, args, 16311, 'cuda') adds the 4096-cell window.

Expected: a config that names "backend": "hip" (and its card) is sized by that card, or the fit is skipped when the detected backend differs from the config's backend.

Effect on answers (measured on 0.2.10 / engine 0.1.56, same code path, 262,144 context, 2 slots, temperature 0):

  • With the added --kv-resident 4096, the engine log reported KV streaming: 4096 of 262144 cells per QSA layer in VRAM and, on prompts of 32K tokens and more, lines such as KV streaming: 88.01% of 400536 block reads hit VRAM, 193.4 MiB read from RAM - OVERFLOW (too few resident cells) (22 OVERFLOW lines in one run).
  • A cold 64K-token extraction prompt misread a code placed at the start of the document in 3 of 3 runs on one start and 1 of 3 on another start of the same config; outputs also differed between restarts.
  • With "user_args": ["--kv-resident", "262144"] (which wins over the fit), the same prompts gave 0 of 3 misreads and identical outputs across restarts.

Workaround in use: the user_args entry above.

Smallest steps or command that reproduce it

No engine start is needed. From the source tree, with a HIP config like the one below on a computer where nvidia-smi also answers:

import json, sys
sys.path[:0] = ['.', 'serve']
from strata_control import drafting, vram_fit
import server
cfg = json.load(open('config.json'))   # "backend": "hip", "gpu": 0, "parallel": 2, --max-context 262144, no user_args
backend, archs = drafting.detect_hardware()
mib = server.drafting_vram_mib(cfg, backend, archs)
print(backend, archs, mib)
print(vram_fit.fit_start(cfg, list(cfg['args']), mib, backend))

Output on 0.2.11 (commit c3b3f50):

cuda ['sm_120', 'sm_120', 'gfx1151'] 16311.0
([... '--kv-resident', '4096'], None, '<model> on this 16 GB card: short of GPU memory: ... (KV window 4096 tokens in VRAM, the rest read from RAM)')

Relevant config arguments: --expert-cache 24576 --resident-experts --prefill 16384 --spec 4 --mtp <dir> --max-context 262144 --kv int8 --mtp-window 8192, "parallel": 2, "backend": "hip", "gpu": 0.

Reproduction status

Reproduced locally

Strata version

Strata 0.2.11 · engine 0.1.57 (source build, commit c3b3f50, gfx1151 HIP build with TheRock 7.14.1). First seen on 0.2.10 · engine 0.1.56.

Graphics card, memory and system

AMD Ryzen AI MAX+ 395 with Radeon 8060S (gfx1151), 128 GB RAM with a 112 GiB GTT pool (ttm.pages_limit), plus 2 x NVIDIA GeForce RTX 5060 Ti 16 GB not used by this config · Ubuntu 26.04.1 LTS, kernel 7.0

Model, size and settings

Qwen3.8-Flash-Next IQ3_XXS (orcarouter/Qwen3.8-Flash-Next-Uncensored-GGUF) · 262,144 context · 2 slots · MTP · pictures off

Logs

The two lines quoted above are from the server and engine logs of the affected starts. The engine's own start line for the same config with the workaround shows --kv-resident 262144 and no KV streaming: line.

Originally created by @KTKR-DSK on GitHub (Nov 5, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/5322 ### Area [Engine] (speed, kernels, models, the server and API) ### Desktop app, Terminal or source? Source (START-HERE.bat, setup.sh or a build) ### What happened On a Strix Halo host that also has two NVIDIA cards, a server config with `"backend": "hip"` and `"gpu": 0` (the Radeon 8060S) is sized by the start-time VRAM fit as if it ran on a 16 GB NVIDIA card. The server adds `--kv-resident 4096` and prints: ``` [strata] <model> on this 16 GB card: short of GPU memory: more is read from RAM and the SSD, expect it to be slower (KV window 4096 tokens in VRAM, the rest read from RAM) ``` The iGPU has a 112 GiB GTT pool here; the same start holds a 49.80 GiB expert cache with all 24,576 experts resident plus two 3.65 GiB slot sessions, so the 16 GB figure is not this card's. In `serve/server.py` `engine_args()`, the backend comes from `drafting.detect_hardware()`, not from the config. On this host it returns `('cuda', ['sm_120', 'sm_120', 'gfx1151'])` because `nvidia-smi` answers first. `drafting_vram_mib()` then returns 16311 (an RTX 5060 Ti), and `vram_fit.fit_start(cfg, args, 16311, 'cuda')` adds the 4096-cell window. Expected: a config that names `"backend": "hip"` (and its card) is sized by that card, or the fit is skipped when the detected backend differs from the config's backend. Effect on answers (measured on 0.2.10 / engine 0.1.56, same code path, 262,144 context, 2 slots, temperature 0): - With the added `--kv-resident 4096`, the engine log reported `KV streaming: 4096 of 262144 cells per QSA layer in VRAM` and, on prompts of 32K tokens and more, lines such as `KV streaming: 88.01% of 400536 block reads hit VRAM, 193.4 MiB read from RAM - OVERFLOW (too few resident cells)` (22 OVERFLOW lines in one run). - A cold 64K-token extraction prompt misread a code placed at the start of the document in 3 of 3 runs on one start and 1 of 3 on another start of the same config; outputs also differed between restarts. - With `"user_args": ["--kv-resident", "262144"]` (which wins over the fit), the same prompts gave 0 of 3 misreads and identical outputs across restarts. Workaround in use: the `user_args` entry above. ### Smallest steps or command that reproduce it No engine start is needed. From the source tree, with a HIP config like the one below on a computer where `nvidia-smi` also answers: ```python import json, sys sys.path[:0] = ['.', 'serve'] from strata_control import drafting, vram_fit import server cfg = json.load(open('config.json')) # "backend": "hip", "gpu": 0, "parallel": 2, --max-context 262144, no user_args backend, archs = drafting.detect_hardware() mib = server.drafting_vram_mib(cfg, backend, archs) print(backend, archs, mib) print(vram_fit.fit_start(cfg, list(cfg['args']), mib, backend)) ``` Output on 0.2.11 (commit c3b3f50): ``` cuda ['sm_120', 'sm_120', 'gfx1151'] 16311.0 ([... '--kv-resident', '4096'], None, '<model> on this 16 GB card: short of GPU memory: ... (KV window 4096 tokens in VRAM, the rest read from RAM)') ``` Relevant config arguments: `--expert-cache 24576 --resident-experts --prefill 16384 --spec 4 --mtp <dir> --max-context 262144 --kv int8 --mtp-window 8192`, `"parallel": 2`, `"backend": "hip"`, `"gpu": 0`. ### Reproduction status Reproduced locally ### Strata version Strata 0.2.11 · engine 0.1.57 (source build, commit c3b3f50, gfx1151 HIP build with TheRock 7.14.1). First seen on 0.2.10 · engine 0.1.56. ### Graphics card, memory and system AMD Ryzen AI MAX+ 395 with Radeon 8060S (gfx1151), 128 GB RAM with a 112 GiB GTT pool (`ttm.pages_limit`), plus 2 x NVIDIA GeForce RTX 5060 Ti 16 GB not used by this config · Ubuntu 26.04.1 LTS, kernel 7.0 ### Model, size and settings Qwen3.8-Flash-Next IQ3_XXS (orcarouter/Qwen3.8-Flash-Next-Uncensored-GGUF) · 262,144 context · 2 slots · MTP · pictures off ### Logs The two lines quoted above are from the server and engine logs of the affected starts. The engine's own start line for the same config with the workaround shows `--kv-resident 262144` and no `KV streaming:` line.
Author
Owner

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

Same code path here on a PC with two discrete cards (Radeon RX 9070 + GeForce GTX 1660 SUPER), and on this one the AMD card cannot be sized at all, so the fit falls to the smallest NVIDIA card present.

Hardware: Radeon RX 9070 (gfx1201, 16 GB) + GeForce GTX 1660 SUPER (6 GB), Ryzen 9 5900X, 64 GB RAM, Windows 11 (10.0.26300).
Install: app 0.2.11, engine 0.1.57 from the hip-rx9070 package (BUILD.json: backend: hip, archs: [gfx1200, gfx1201], commit 0bdcef4682c5), source tree from main.
Config: "backend": "hip", --max-context 262144 --kv int8 --kv-resident 32768 --resident-experts, no user_args.

The start prints:

[strata] qwen3.8-flash-next-iq2_xs on this 6 GB card: short of GPU memory: more is read from RAM and the SSD, expect it to be slower (KV window 4096 tokens in VRAM, the rest read from RAM)

and the live strata.exe command line carries --kv-resident 4096 although the config says 32768. The engine itself reads the right card, so the 6 GB figure is the fit's, not the engine's:

strata: Windows budgets 15419 of this card's 16304 MiB for this process (STRATA_WDDM_BUDGET=0: off)
prefill gemm: hipBLASLt tuning enabled (32 rows, gfx1201, version 100500)
strata generate: expert cache 5749 slots, 7.71 GiB of VRAM

The difference from your report: here the AMD probe answers nothing, and only the config's backend would have told the fit to stop:

engine_component.detect_backend()   -> ('cuda', 'display adapters')
cuda_archs_present()                -> ['sm_75']       # the 1660
hip_archs_present()                 -> ['gfx1201']     # the 9070
server.gpu_vram_mib([0], hip=True)  -> None            # nothing to size by
server.gpu_vram_mib([0], hip=False) -> {0: 6144}       # the 6 GB card

So the HIP start is sized by the smallest card in the machine (6 GB here, the 16 GB NVIDIA card in yours). If drafting_vram_mib() were called with the config's backend, the fit would have nothing to work with and should skip.

FWIW Windows does report the AMD adapter's memory (this box, model loaded, without extra tooling):

\GPU Adapter Memory(luid_0x00000000_0x00014782_phys_0)\Dedicated Usage  -> 12.86 GiB   # the 9070
\GPU Adapter Memory(luid_0x00000000_0x00013424_phys_0)\Dedicated Usage  ->  2.29 GiB   # the 1660

so a HIP figure for the fit is not impossible to get, unlike the load/temperature readings the server's own /metrics gives up on ("no GPU load or VRAM readings for AMD cards on Windows yet").

Confirmed workaround, same as yours: "user_args": ["--kv-resident", "32768"] wins over the fit - the live command line then keeps 32768. The plan's line still names the wrong card ("6 GB card") when it is printed.

Same class as #4861 (the updater's child fetching the CUDA package on this PC; #4894 fixes that one) - the run's own backend is not what the probes consult.

Repro is yours (no engine start needed), with the numbers above for an AMD-only start on a computer that also has an NVIDIA card.

<!-- gh-comment-id:6671089222 --> @exploitmenot commented on GitHub (Nov 5, 2026): Same code path here on a PC with two **discrete** cards (Radeon RX 9070 + GeForce GTX 1660 SUPER), and on this one the AMD card cannot be sized at all, so the fit falls to the smallest NVIDIA card present. **Hardware:** Radeon RX 9070 (gfx1201, 16 GB) + GeForce GTX 1660 SUPER (6 GB), Ryzen 9 5900X, 64 GB RAM, Windows 11 (10.0.26300). **Install:** app 0.2.11, engine 0.1.57 from the `hip-rx9070` package (`BUILD.json`: `backend: hip`, `archs: [gfx1200, gfx1201]`, commit `0bdcef4682c5`), source tree from `main`. **Config:** `"backend": "hip"`, `--max-context 262144 --kv int8 --kv-resident 32768 --resident-experts`, no `user_args`. The start prints: ``` [strata] qwen3.8-flash-next-iq2_xs on this 6 GB card: short of GPU memory: more is read from RAM and the SSD, expect it to be slower (KV window 4096 tokens in VRAM, the rest read from RAM) ``` and the live `strata.exe` command line carries `--kv-resident 4096` although the config says 32768. The engine itself reads the right card, so the 6 GB figure is the fit's, not the engine's: ``` strata: Windows budgets 15419 of this card's 16304 MiB for this process (STRATA_WDDM_BUDGET=0: off) prefill gemm: hipBLASLt tuning enabled (32 rows, gfx1201, version 100500) strata generate: expert cache 5749 slots, 7.71 GiB of VRAM ``` The difference from your report: here the AMD probe answers nothing, and only the config's backend would have told the fit to stop: ```python engine_component.detect_backend() -> ('cuda', 'display adapters') cuda_archs_present() -> ['sm_75'] # the 1660 hip_archs_present() -> ['gfx1201'] # the 9070 server.gpu_vram_mib([0], hip=True) -> None # nothing to size by server.gpu_vram_mib([0], hip=False) -> {0: 6144} # the 6 GB card ``` So the HIP start is sized by the smallest card in the machine (6 GB here, the 16 GB NVIDIA card in yours). If `drafting_vram_mib()` were called with the config's backend, the fit would have nothing to work with and should skip. FWIW Windows does report the AMD adapter's memory (this box, model loaded, without extra tooling): ``` \GPU Adapter Memory(luid_0x00000000_0x00014782_phys_0)\Dedicated Usage -> 12.86 GiB # the 9070 \GPU Adapter Memory(luid_0x00000000_0x00013424_phys_0)\Dedicated Usage -> 2.29 GiB # the 1660 ``` so a HIP figure for the fit is not impossible to get, unlike the load/temperature readings the server's own `/metrics` gives up on (`"no GPU load or VRAM readings for AMD cards on Windows yet"`). Confirmed workaround, same as yours: `"user_args": ["--kv-resident", "32768"]` wins over the fit - the live command line then keeps 32768. The plan's line still names the wrong card ("6 GB card") when it is printed. Same class as #4861 (the updater's child fetching the CUDA package on this PC; #4894 fixes that one) - the run's own `backend` is not what the probes consult. Repro is yours (no engine start needed), with the numbers above for an AMD-only start on a computer that also has an NVIDIA card.
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#3173
No description provided.