mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #3770] [Engine] HIP gfx1201 (R9700): GPU stays at 100 % busy, max shader clock and ~92 W while the server is idle #1586
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#1586
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 @sbstnh on GitHub (Oct 22, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3770
Area
[Engine] (speed, kernels, models, the server and API)
Desktop app, Terminal or source?
Docker
What happened
With the
0.2.2-rocm-gfx120ximage, the GPU does not go idle while the server is idle. With no request in flight (/metrics→live.state: "idle"),gpu_busy_percentreads 100 %, the shader clock stays at ~3.47 GHz andamd-smireports 92-95 W. The engine's host threads are asleep at the same time (process CPU 0.0 % intop).Threads of the engine process (comm + wchan from /proc) while idle:
Expected: the GPU idles between requests. On the same machine, driver and GPU, vLLM and llama.cpp (HIP) idle at about 3 % / 12 W. The state lasts until the container is stopped.
Not the same as #2921 (Intel Arc, telemetry keeping the device out of runtime suspend). Here the GPU reports full load at maximum shader clock.
Smallest steps or command that reproduce it
Serving on port 8080. Send no requests./sys/class/drm/card1/device/gpu_busy_percent,pp_dpm_sclkandamd-smi metric -p.Seen on two starts in a row (
docker restart). After the restart, the only request in/metricswas the startup check (53 prompt tokens, 1 generated, 0.7 s), 46 s after start. I did not measure the GPU between engine load and that request, so I can't say whether the load starts before or after it.Reproduction status
Reproduced locally
Strata version
Strata 0.2.2 · engine 0.1.47 (
0.1.47-linux-x86_64-hip-rx9070), imageghcr.io/niko1221/strata:0.2.2-rocm-gfx120xGraphics card, memory and system
Radeon AI PRO R9700 32 GB · 62 GB RAM · Ubuntu 24.04 VM on Proxmox (KVM, GPU passed through), kernel 6.8.0-142-generic, amdgpu-dkms 6.16.13 (AMD repo 30.30.4), CPU 7 cores without AVX-512
Model, size and settings
Qwen3.8-Flash-Next IQ3_XXS · 128K context (auto) · pictures off ·
--kv int8,--batch 4(auto)Logs
Attached:
strata-engine-start.log
(engine log from
engine startedto the first request after the restart; no keys in it).Additional notes: unconfirmed static analysis
Everything in this section comes from reading the source. I did not profile the GPU and did not see these kernels running.
The pattern (full shader clock, memory clock at minimum, fabric clock high, host threads asleep, two threads in
kfd_wait_on_events) would fit a kernel spinning on a flag in mapped host memory. The HIP path has GPU-side spin-waits of that kind:doorbell_wait_kernel(src/kernels/cuda/elementwise.cu),wait_flag_ge_kernel/wait_flag_ge_or_kernel(src/kernels/cuda/verify_kernels.cu) and thewait_flagloop incopy_rows_from_mapped_kernel. Whether one of them is the cause is not verified.From the source, these do not look like the cause:
STRATA_HC_PERSIST(off by default),STRATA_HIP_QUEUE_PRIME(one-time at startup), the gfx12 default switches (GDN_HEAD GDN_PP GDN_CONVL2 GDN_NOY CVEC_FUSE, compute kernels). I have not tried any of them as an environment setting.Happy to run a build or a setting and report the result.
@sbstnh commented on GitHub (Oct 26, 2026):
Cause found: more compute queues than the card has hardware slots for (workaround inside)
I narrowed this down on the same machine (R9700, Proxmox VM, kernel 6.8, amdgpu-dkms 6.16.13). This run used image
0.2.3-rocm-gfx120xwith engine 0.1.48,PARALLEL=1, 128K context.What the measurements show
1. The load starts at startup, not after a request. I sampled
gpu_busy_percentevery 0.5 s across a restart. The GPU goes to 100 % duringwarmed the BF16 and FP16 GEMM librariesand stays there through the expert-arena load (CPU only) and every later idle period. WithSTRATA_PREFILL_WARM=0, the GPU stays at ~3 % through the whole load phase. It then goes to 100 % at the first prompt instead. So the trigger is the first hipBLAS/hipBLASLt use, which creates additional streams. It is not one of the spin-wait kernels from my static analysis.2. The bundled ROCm is not the cause. I ran the same engine against the host's ROCm 7.2.4 (
libamdhip64,libhsa-runtime64, hipBLAS, hipBLASLt and rocBLAS from/opt/rocm-7.2.4, checked in/proc/<pid>/maps). The result was identical: 100 % busy while idle.3. It depends on the number of compute queues. While the engine is idle,
/sys/kernel/debug/kfd/mqdslists 6 compute queues + 2 SDMA queues for the engine process./sys/kernel/debug/kfd/hqdslists only 4 user HQD slots (CP pipe 0/1, queues 2/3). Capping the HIP runtime's queues:GPU_MAX_HW_QUEUES=3GPU_MAX_HW_QUEUES=2GPU_MAX_HW_QUEUES=1STRATA_HIP_QUEUE_PRIME=0The cutoff sits exactly at the number of HQD slots. My reading, which is not verified at the firmware level: with more than 4 user compute queues, the scheduler runs oversubscribed, keeps switching queues, and the GFX block never goes idle. vLLM and llama.cpp idle normally on this machine, presumably because they open fewer queues.
Workaround
STRATA_HIP_QUEUE_PRIME=nnis needed. WithGPU_MAX_HW_QUEUES=2the engine skips queue priming (#3480), which costs about 20 % prefill here. Forcing the priming back on restores the speed.Benchmark: temperature 0, thinking off,
PARALLEL=1, 300 generated tokens (200 for 16K/32K), fresh prompts each time:GPU_MAX_HW_QUEUES=2+PRIME=nnGPU_MAX_HW_QUEUES=2onlyWith the workaround, the GPU drops to 3 % / 13–17 W / 41 MHz shader clock after requests and stays there. Two parallel requests may be ~4 % slower, which is close to noise.
Suggestion
On gfx12, the engine could keep its total number of compute queues within the available HQD slots by default. Another option is to reuse the primed queues for the GEMM warm-up and library handles instead of creating new streams. Comparing the number of compute queues in
/sys/kernel/debug/kfd/mqdsagainsthqdsis enough to check a build.I can run a test build or other settings on this machine if that helps.
@herosea commented on GitHub (Nov 1, 2026):
I'm experiencing the same issue.