[GH-ISSUE #4378] [Engine] dsv41 on HIP gfx1030 (2x RX 6900 XT, Linux): 20-300 s stalls (engine_silence, then 503) are SDMA copies that do not complete after GFXOFF; HSA_ENABLE_SDMA=0 gives 28/28 clean sessions #1939

Closed
opened 2026-11-04 01:55:28 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Vop3p on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4378

Area

[Engine]

Desktop app, Terminal or source?

Source (a build)

What happened

On a two-card gfx1030 box the dsv41 engine stalls every few conversations: one window (a decode window, or a chunk of a prompt read) stops for 20-300 s, then continues as if nothing happened; when the stall passes 300 s the server's engine_silence watchdog ends the engine and the next request gets a 503. Over 168 sessions of a fixed 14-prompt loop (GFXOFF at its default) 9 hit the 300 s limit; with a 5 s watchdog in the engine, the 14-session arms showed 0-3 stalls of 20 s or more each (most arms 1-3). Speed between stalls is normal (decode 13-17 tok/s, 3.4K / 4.3K prompts 124 / 167 tok/s).

What the stalls are, from a watchdog I added to the engine (env-gated, off by default; it prints each device thread's layer and stage every 5 s a window stays open, the host-visible values of the hand-off flags and of the CPU lane's answer ring, a VRAM heartbeat that the spin kernels write, and the cards' sysfs busy / power):

  • The CPU lane has already answered: the answer ring in host memory holds every seq the device could be waiting for, and no spin kernel (wait_seq, xfer_get, wait_flags) is polling - the heartbeat's iteration count does not move. The host thread sits inside layer() / layer_chunk() behind a stream wait.
  • sysfs during a stall: the stuck card reads busy 90-99 % at 40-57 W (the CP waiting on a barrier, not computing); in half of the samples the other card is asleep in GFXOFF (0 MHz, 6 W).
  • A 64-byte device-to-host copy that the watchdog issued on its own stream to the sleeping card did not complete within 3 s (the next one, 5 s later, took 2 ms).
  • Every stall is at the first layers a card runs after it idled through the other card's layers (serial decode: CUDA1 layer 21 or CUDA0 layer 0; prompt chunks: CUDA0 layer 1 of a chunk), mostly in the trailing window after a long answer.

The copies in those places (expert DMA into the ring, the routing's D2H, the two-card bounce hand-off, the source-row replicate) all go through SDMA. With HSA_ENABLE_SDMA=0 (ROCr does every copy with a blit kernel) the same loop ran 28 of 28 sessions with no window over 15.4 s (that one is the cold read of a 3.4K prompt), at the same speed. Disabling GFXOFF on both cards (debugfs amdgpu_gfxoff written 0) also gives 0 of 28, which is why I first thought GFXOFF itself was the cause; it is the trigger.

arm (same engine, same 14-prompt loop) sessions stalls >= 20 s sessions that hit the 300 s limit
GFXOFF on (default) 168 0-3 per 14 (most arms 1-3) 9
GFXOFF off on both cards 28 0 0
GFXOFF on + HSA_ENABLE_SDMA=0 28 0 0

Ruled out on the way (arms of 14-28 sessions each, GFXOFF on): the ds4 conversation slots (STRATA_DS4_SLOT_KEEP=0), HIP_HOST_COHERENT=1, the host polling a hand-off flag before the device-side wait is queued, doing the cross-card event waits on the host instead of as CP barriers, the hand-off flags and the lane's rings in fine-grained host memory. The kernel log has no amdgpu message during the stalls; the PCIe AER counters are zero and ASPM is off on both cards. Two standalone programs (a kernel polling a host word after the device idled; a 64-byte SDMA copy after 0.5-3 s of idle) do not reproduce it, so it needs the engine's load pattern (the other card busy, several queues, MB-sized copies).

This looks like the same root as #884 on the Qwen engine on this machine (SDMA was one of its three necessary conditions, and STRATA_HIP_ADAPT_KERNEL_COPY=1 avoids it), and as #3680's finding on gfx1200 that HSA_ENABLE_SDMA=0 stops the resets. #4090 has the same symptom on CUDA / WSL2, probably a different cause. Two things the engine could do: on HIP, make dsv41's copies kernel copies (as the Qwen engine does for its adaptive swaps), or have setup put HSA_ENABLE_SDMA=0 into the environment for gfx103x. The watchdog patch (DS4_STALL_WATCH=1) is in my tree if it is of use.

Smallest steps or command that reproduce it

  1. dsv41 on two gfx1030 cards, layer split (CUDA0 layers 0-20, CUDA1 layers 21-39 + head), DeepSeek-V4.1-Flash ISTA-DASLab IQ2_XXS (2.00 bpw), --experts 5 --max-context 32768 --prefill-chunk 4096 --mmap-experts off --dspark auto, GFXOFF at its default (on).
  2. Loop 14 prompts (short questions, two 1.5-2K token code prompts, a 4K prompt reused twice) through the server; 1-3 of them stall for 20-300 s per pass, usually the request after a 1,200-token answer.
  3. Same loop with HSA_ENABLE_SDMA=0 in the engine's environment: no stall in 28 sessions.

Reproduction status

Reproduced locally

Strata version

Strata 0.2.7 · engine dsv41 built from v0.2.7 for gfx1030 (plus local opt-in patches: the watchdog above and a few env-gated prompt-path switches, all off in the arms unless named)

Graphics card, memory and system

2x RX 6900 XT 16 GB (gfx1030, PCIe 4.0 x8 each) · Ryzen 5 5600X · 128 GB DDR4 · Ubuntu 26.04, kernel 7.0.0-38, ROCm 10.0 (HIP 7.15), amdgpu.gttsize=98304 amdgpu.runpm=0

Developed with an AI coding assistant; every number above was measured on the machine described.

Originally created by @Vop3p on GitHub (Oct 28, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4378 ### Area [Engine] ### Desktop app, Terminal or source? Source (a build) ### What happened On a two-card gfx1030 box the dsv41 engine stalls every few conversations: one window (a decode window, or a chunk of a prompt read) stops for 20-300 s, then continues as if nothing happened; when the stall passes 300 s the server's engine_silence watchdog ends the engine and the next request gets a 503. Over 168 sessions of a fixed 14-prompt loop (GFXOFF at its default) 9 hit the 300 s limit; with a 5 s watchdog in the engine, the 14-session arms showed 0-3 stalls of 20 s or more each (most arms 1-3). Speed between stalls is normal (decode 13-17 tok/s, 3.4K / 4.3K prompts 124 / 167 tok/s). What the stalls are, from a watchdog I added to the engine (env-gated, off by default; it prints each device thread's layer and stage every 5 s a window stays open, the host-visible values of the hand-off flags and of the CPU lane's answer ring, a VRAM heartbeat that the spin kernels write, and the cards' sysfs busy / power): - The CPU lane has already answered: the answer ring in host memory holds every seq the device could be waiting for, and no spin kernel (wait_seq, xfer_get, wait_flags) is polling - the heartbeat's iteration count does not move. The host thread sits inside `layer()` / `layer_chunk()` behind a stream wait. - sysfs during a stall: the stuck card reads busy 90-99 % at 40-57 W (the CP waiting on a barrier, not computing); in half of the samples the other card is asleep in GFXOFF (0 MHz, 6 W). - A 64-byte device-to-host copy that the watchdog issued on its own stream to the sleeping card did not complete within 3 s (the next one, 5 s later, took 2 ms). - Every stall is at the first layers a card runs after it idled through the other card's layers (serial decode: CUDA1 layer 21 or CUDA0 layer 0; prompt chunks: CUDA0 layer 1 of a chunk), mostly in the trailing window after a long answer. The copies in those places (expert DMA into the ring, the routing's D2H, the two-card bounce hand-off, the source-row replicate) all go through SDMA. With `HSA_ENABLE_SDMA=0` (ROCr does every copy with a blit kernel) the same loop ran 28 of 28 sessions with no window over 15.4 s (that one is the cold read of a 3.4K prompt), at the same speed. Disabling GFXOFF on both cards (debugfs `amdgpu_gfxoff` written 0) also gives 0 of 28, which is why I first thought GFXOFF itself was the cause; it is the trigger. | arm (same engine, same 14-prompt loop) | sessions | stalls >= 20 s | sessions that hit the 300 s limit | |---|---:|---:|---:| | GFXOFF on (default) | 168 | 0-3 per 14 (most arms 1-3) | 9 | | GFXOFF off on both cards | 28 | 0 | 0 | | GFXOFF on + `HSA_ENABLE_SDMA=0` | 28 | 0 | 0 | Ruled out on the way (arms of 14-28 sessions each, GFXOFF on): the ds4 conversation slots (`STRATA_DS4_SLOT_KEEP=0`), `HIP_HOST_COHERENT=1`, the host polling a hand-off flag before the device-side wait is queued, doing the cross-card event waits on the host instead of as CP barriers, the hand-off flags and the lane's rings in fine-grained host memory. The kernel log has no amdgpu message during the stalls; the PCIe AER counters are zero and ASPM is off on both cards. Two standalone programs (a kernel polling a host word after the device idled; a 64-byte SDMA copy after 0.5-3 s of idle) do not reproduce it, so it needs the engine's load pattern (the other card busy, several queues, MB-sized copies). This looks like the same root as #884 on the Qwen engine on this machine (SDMA was one of its three necessary conditions, and `STRATA_HIP_ADAPT_KERNEL_COPY=1` avoids it), and as #3680's finding on gfx1200 that `HSA_ENABLE_SDMA=0` stops the resets. #4090 has the same symptom on CUDA / WSL2, probably a different cause. Two things the engine could do: on HIP, make dsv41's copies kernel copies (as the Qwen engine does for its adaptive swaps), or have setup put `HSA_ENABLE_SDMA=0` into the environment for gfx103x. The watchdog patch (`DS4_STALL_WATCH=1`) is in my tree if it is of use. ### Smallest steps or command that reproduce it 1. dsv41 on two gfx1030 cards, layer split (CUDA0 layers 0-20, CUDA1 layers 21-39 + head), DeepSeek-V4.1-Flash ISTA-DASLab IQ2_XXS (2.00 bpw), `--experts 5 --max-context 32768 --prefill-chunk 4096 --mmap-experts off --dspark auto`, GFXOFF at its default (on). 2. Loop 14 prompts (short questions, two 1.5-2K token code prompts, a 4K prompt reused twice) through the server; 1-3 of them stall for 20-300 s per pass, usually the request after a 1,200-token answer. 3. Same loop with `HSA_ENABLE_SDMA=0` in the engine's environment: no stall in 28 sessions. ### Reproduction status Reproduced locally ### Strata version Strata 0.2.7 · engine dsv41 built from v0.2.7 for gfx1030 (plus local opt-in patches: the watchdog above and a few env-gated prompt-path switches, all off in the arms unless named) ### Graphics card, memory and system 2x RX 6900 XT 16 GB (gfx1030, PCIe 4.0 x8 each) · Ryzen 5 5600X · 128 GB DDR4 · Ubuntu 26.04, kernel 7.0.0-38, ROCm 10.0 (HIP 7.15), amdgpu.gttsize=98304 amdgpu.runpm=0 Developed with an AI coding assistant; every number above was measured on the machine described.
Author
Owner

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

Thanks for taking the time to report this.

Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.11. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6660340047 --> @Niko1221 commented on GitHub (Nov 5, 2026): Thanks for taking the time to report this. Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.11. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
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#1939
No description provided.