mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #5162] [Engine] RX 9070: prompts slow down after the first request; DEBUG_HIP_DYNAMIC_QUEUES=0 fixes it #3073
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3073
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mhhayashi on GitHub (Nov 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5162
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 single RX 9070 (RDNA4, gfx1201), prompts after the first one of a server start usually read 10-25% slower, and stay slow. With
DEBUG_HIP_DYNAMIC_QUEUES=0in the engine's environment they stay fast and decode is unchanged (in rare cases the first prompt itself was slow, and every later one fast).Measured on 0.2.10 (Swift 1.5 IQ4_XS, MTP, ~6,100-token prompts). Prompt speed in tok/s, one row per fresh server start; each start reads 3 prompts, decodes 100 tokens, then reads 2 more prompts. Slow prompts in bold:
DEBUG_HIP_DYNAMIC_QUEUES=0Slow prompts: 8 of 15 with the runtime default, 0 of 15 with
DEBUG_HIP_DYNAMIC_QUEUES=0.Same on 0.2.7.1 (20K prompts ~1,460 fast vs ~1,100 slow; with the setting, 25 of 25 ~6K prompts fast over 5 starts), and decode speed is unchanged with it. With a real prompt (16.5K tokens of C source, 0.2.10, 2 starts each) the drop is smaller: ~1,760 tok/s for the first prompt, then ~1,570 (one 1,423) without the setting; 1,756-1,795 throughout with it.
GPU trace (
rocprofv3, a fast and a slow 20K prompt on one server, 0.2.7.1):The host submits the copies tens of milliseconds early in both, so they are held on the GPU. In
STRATA_PREFILL_TIMING=1this idle time shows up asdequant(~1.4 -> ~5.5 s).Did not fix it (tested on 0.2.7.1):
GPU_MAX_HW_QUEUES=16,HSA_ENABLE_SDMA=0,ROC_CPU_WAIT_FOR_SIGNAL=0,ROC_SIGNAL_POOL_SIZE=4096,STRATA_PREFILL_ISSUER=0,STRATA_PREFILL_GROUP_GATHER=0,--adapt-swaps 0,--no-prefill-borrow, TheRock 7.14.0a20260612, and a high-priority prompt copy stream (local patch).STRATA_HIP_QUEUE_PRIME=nnnhavoids it (15 of 15 fast), but in one decode benchmark its first four requests after a start ran ~25% slower.Related: #2305 (R9700: MTP draft fast or slow per start, streams sharing a hardware queue), #3480 (RX 9060 XT: prompt speed and the queue priming), #5001 (RX 9060 XT: prompt time turning into copy waits; possibly the same thing, not checked).
Not tested: other cards (including gfx1200), other models or quantizations, Windows, the desktop app, DFlash2, more than one card.
Suggestion. It would help if others with RDNA4 cards ran the repro below with and without
DEBUG_HIP_DYNAMIC_QUEUES=0. If it holds there, set it for the engine on gfx12 by default, like the queue priming. Other repos set it too, mostly for hangs (ROCm's JAX image,Dockerfile.base-therock-ubu24) or stream overlap (vLLM's MiniMax-M3.1-Flash recipe, on its dual-batch-overlap configs); ROCm/rocm-systems#9249 fixed a deadlock in the runtime's dynamic queue selection, where a stream was put on a queue that was already blocked.Smallest steps or command that reproduce it
max_tokens: 1), one request that decodes 100 tokens, then two more prompts, and prints each prompt's speed. On most starts one or more of the later prompts are 10-25% slower than the first.--text FILEsends a file of your own instead.DEBUG_HIP_DYNAMIC_QUEUES=0and run it again: all prompts run at about the first prompt's speed.strata-issue-repro.py
Reproduction status
Reproduced locally
Strata version
Strata 0.2.10 (tag
v0.2.10,ffa80d73) · engine 0.1.56, built from source for gfx1201 (also reproduced on 0.2.7.1)Graphics card, memory and system
RX 9070 16 GB (gfx1201) on PCIe 3.0 x16 · Xeon W-2140B · 256 GB RAM · Fedora 44 (kernel 7.2.5) · ROCm from TheRock wheels 7.13.0a20260422 (gfx120X)
Model, size and settings
Swift 1.5 (Qwen3.8-Flash-Next fine-tune) IQ4_XS, native pack ·
--max-context 262144 --kv int8 --kv-resident 32768 --expert-cache auto --prefill auto --vram-reserve-mib 448· MTP (--spec 3 --spec-min-p 0.5) ·STRATA_ROUTE_TAIL_SKIP=8 STRATA_ROUTE_PRIOR=0.5 STRATA_SH_STREAM=1 STRATA_PREFILL_EQUAL=1· power cap 180 W · pictures offLogs
STRATA_PREFILL_TIMING=1, 0.2.7.1, fast then slow 20K prompt on one server (trimmed):Note: this looks like the "R9700 / RX 9000 bimodal prompt speed" described above
prime_hw_queues()insrc/program/generate.cpp, but the queue priming doesn't prevent it here: the switch to slow happens mid-session.@github-actions[bot] commented on GitHub (Nov 3, 2026):
Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:
Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment
/reopen.Details: CONTRIBUTING.md
@github-actions[bot] commented on GitHub (Nov 3, 2026):
Thanks, this follows the format now.
@mhhayashi commented on GitHub (Nov 4, 2026):
This was measured on TheRock 7.13 (and reproduced on 7.14). On 10.1.0a20260822 the behavior is different, and not necessarily better.