[GH-ISSUE #3770] [Engine] HIP gfx1201 (R9700): GPU stays at 100 % busy, max shader clock and ~92 W while the server is idle #1586

Open
opened 2026-11-04 01:52:26 +07:00 by bsakaguchi · 2 comments
Owner

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-gfx120x image, the GPU does not go idle while the server is idle. With no request in flight (/metrics → live.state: "idle"), gpu_busy_percent reads 100 %, the shader clock stays at ~3.47 GHz and amd-smi reports 92-95 W. The engine's host threads are asleep at the same time (process CPU 0.0 % in top).

live.state:        idle
gpu_busy_percent:  100
pp_dpm_sclk:       1: 3466Mhz *
pp_dpm_mclk:       0: 96Mhz *
pp_dpm_fclk:       1: 2007Mhz *
SOCKET_POWER:      95 W
power profile:     BOOTUP_DEFAULT, power_dpm_force_performance_level auto

Threads of the engine process (comm + wchan from /proc) while idle:

17 strata          futex_wait_queue
 2 strata-stage    futex_wait_queue
 2 strata          kfd_wait_on_events
 1 strata-host     futex_wait_queue
 6 strata-pool-0..5 futex_wait_queue
 1 strata-watchdog hrtimer_nanosleep
 1 strata-stdin    pipe_read

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

  1. Start the container (no other settings):
    docker run -d --name strata --device /dev/kfd --device /dev/dri \
      --group-add video --group-add <render gid> -p 127.0.0.1:8000:8080 \
      --ulimit memlock=-1:-1 --shm-size 2g --stop-timeout 120 \
      -v /srv/strata:/data -e MODEL=IQ3_XXS -e VISION=off -e API_KEY=<key> \
      ghcr.io/niko1221/strata:0.2.2-rocm-gfx120x
    
  2. Wait for Serving on port 8080. Send no requests.
  3. Read /sys/class/drm/card1/device/gpu_busy_percent, pp_dpm_sclk and amd-smi metric -p.

Seen on two starts in a row (docker restart). After the restart, the only request in /metrics was 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), image ghcr.io/niko1221/strata:0.2.2-rocm-gfx120x

Graphics 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 started to 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 the wait_flag loop in copy_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.

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-gfx120x` image, the GPU does not go idle while the server is idle. With no request in flight (`/metrics` → `live.state: "idle"`), `gpu_busy_percent` reads 100 %, the shader clock stays at ~3.47 GHz and `amd-smi` reports 92-95 W. The engine's host threads are asleep at the same time (process CPU 0.0 % in `top`). ``` live.state: idle gpu_busy_percent: 100 pp_dpm_sclk: 1: 3466Mhz * pp_dpm_mclk: 0: 96Mhz * pp_dpm_fclk: 1: 2007Mhz * SOCKET_POWER: 95 W power profile: BOOTUP_DEFAULT, power_dpm_force_performance_level auto ``` Threads of the engine process (comm + wchan from /proc) while idle: ``` 17 strata futex_wait_queue 2 strata-stage futex_wait_queue 2 strata kfd_wait_on_events 1 strata-host futex_wait_queue 6 strata-pool-0..5 futex_wait_queue 1 strata-watchdog hrtimer_nanosleep 1 strata-stdin pipe_read ``` 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 1. Start the container (no other settings): ```sh docker run -d --name strata --device /dev/kfd --device /dev/dri \ --group-add video --group-add <render gid> -p 127.0.0.1:8000:8080 \ --ulimit memlock=-1:-1 --shm-size 2g --stop-timeout 120 \ -v /srv/strata:/data -e MODEL=IQ3_XXS -e VISION=off -e API_KEY=<key> \ ghcr.io/niko1221/strata:0.2.2-rocm-gfx120x ``` 2. Wait for `Serving on port 8080`. Send no requests. 3. Read `/sys/class/drm/card1/device/gpu_busy_percent`, `pp_dpm_sclk` and `amd-smi metric -p`. Seen on two starts in a row (`docker restart`). After the restart, the only request in `/metrics` was 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`), image `ghcr.io/niko1221/strata:0.2.2-rocm-gfx120x` ## Graphics 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](https://github.com/user-attachments/files/33846793/strata-engine-start.log) (engine log from `engine started` to 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 the `wait_flag` loop in `copy_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.
Author
Owner

@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-gfx120x with 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_percent every 0.5 s across a restart. The GPU goes to 100 % during warmed the BF16 and FP16 GEMM libraries and stays there through the expert-arena load (CPU only) and every later idle period. With STRATA_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/mqds lists 6 compute queues + 2 SDMA queues for the engine process. /sys/kernel/debug/kfd/hqds lists only 4 user HQD slots (CP pipe 0/1, queues 2/3). Capping the HIP runtime's queues:

Setting Compute queues Idle busy Idle power
default 6 100 % ~82–93 W
GPU_MAX_HW_QUEUES=3 5 99 % 83 W
GPU_MAX_HW_QUEUES=2 4 3 % 13 W
GPU_MAX_HW_QUEUES=1 3 3 % 13 W
STRATA_HIP_QUEUE_PRIME=0 6 100 % 82 W

The 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

-e GPU_MAX_HW_QUEUES=2 -e STRATA_HIP_QUEUE_PRIME=nn

STRATA_HIP_QUEUE_PRIME=nn is needed. With GPU_MAX_HW_QUEUES=2 the 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:

default GPU_MAX_HW_QUEUES=2 + PRIME=nn GPU_MAX_HW_QUEUES=2 only
decode 69–75 tok/s 68–73 tok/s 67–76 tok/s
prompt 6K 1,776–1,820 tok/s 1,791–1,833 tok/s 1,372–1,402 tok/s
prompt 16K / 32K 2,259 / 2,307 tok/s 2,268 / 2,313 tok/s 1,911 / 1,938 tok/s
2 parallel requests (wall) 9.4–9.6 s 9.8–10.0 s 9.9 s

With 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/mqds against hqds is enough to check a build.

I can run a test build or other settings on this machine if that helps.

<!-- gh-comment-id:6423138868 --> @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-gfx120x` with 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_percent` every 0.5 s across a restart. The GPU goes to 100 % during `warmed the BF16 and FP16 GEMM libraries` and stays there through the expert-arena load (CPU only) and every later idle period. With `STRATA_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/mqds` lists **6 compute queues + 2 SDMA queues** for the engine process. `/sys/kernel/debug/kfd/hqds` lists only **4 user HQD slots** (CP pipe 0/1, queues 2/3). Capping the HIP runtime's queues: | Setting | Compute queues | Idle busy | Idle power | |---|---:|---:|---:| | default | 6 | 100 % | ~82–93 W | | `GPU_MAX_HW_QUEUES=3` | 5 | 99 % | 83 W | | `GPU_MAX_HW_QUEUES=2` | 4 | 3 % | 13 W | | `GPU_MAX_HW_QUEUES=1` | 3 | 3 % | 13 W | | `STRATA_HIP_QUEUE_PRIME=0` | 6 | 100 % | 82 W | The 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 ```sh -e GPU_MAX_HW_QUEUES=2 -e STRATA_HIP_QUEUE_PRIME=nn ``` `STRATA_HIP_QUEUE_PRIME=nn` is needed. With `GPU_MAX_HW_QUEUES=2` the 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: | | default | `GPU_MAX_HW_QUEUES=2` + `PRIME=nn` | `GPU_MAX_HW_QUEUES=2` only | |---|---:|---:|---:| | decode | 69–75 tok/s | 68–73 tok/s | 67–76 tok/s | | prompt 6K | 1,776–1,820 tok/s | 1,791–1,833 tok/s | 1,372–1,402 tok/s | | prompt 16K / 32K | 2,259 / 2,307 tok/s | 2,268 / 2,313 tok/s | 1,911 / 1,938 tok/s | | 2 parallel requests (wall) | 9.4–9.6 s | 9.8–10.0 s | 9.9 s | With 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/mqds` against `hqds` is enough to check a build. I can run a test build or other settings on this machine if that helps.
Author
Owner

@herosea commented on GitHub (Nov 1, 2026):

I'm experiencing the same issue.

<!-- gh-comment-id:6559587583 --> @herosea commented on GitHub (Nov 1, 2026): I'm experiencing the same issue.
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#1586
No description provided.