Skip to content

[Bug] AMD: Unsloth Studio / Desktop image generation turns on cudnn.benchmark under ROCm, so the first VAE decode runs MIOpen's exhaustive tuning for 10 to 23 minutes and crashed a gfx1030 #11636

Closed

Description

@LeoBorcherding

What happens

On Windows ROCm, a Qwen-Image-2.1 generation finishes denoising and then goes silent for 10+ minutes in the VAE decode. The request stays open, the UI gives up ("Could not save image: Failed to fetch"), and on one machine the backend crashed at the end of it and the image was lost.

Also reported by a user, whose diagnostics trace is the gfx1030 row below.

Why

diffusion_speed.py:277 enables torch.backends.cudnn.benchmark for any load whose device is "cuda", which includes ROCm. Under ROCm that flag turns on MIOpen's exhaustive search for every new conv shape. The Qwen-Image-2.1 VAE decode is a run of large, unseen conv shapes, so the first decode at a resolution tunes all of them. The reporter's log shows it directly:

MIOpen(HIP): Warning [SearchImpl] Searching the best solution in the 9 dim space. Please, be patient...
MIOpen(HIP): Warning [SearchImpl] Runs left: 366, min time so far: 120.078, curr time: 949.031

16 searches over 23 minutes, followed by:

MIOpen(HIP): Error [EvaluateInvokers] handlehip.cpp:142: Error setting device 0: unspecified launch failure
Exception Code: 0x80000003
... at::cuda::miopen_convolution
File ".../diffusers/models/autoencoders/autoencoder_kl_qwenimage21.py", line 1356 in decode
File ".../studio/backend/core/inference/diffusion.py", line 7455 in generate

Where it was seen

No hosted runner has an AMD GPU, and the self-hosted Strix Halo runner is Linux gfx1151, so it can't see a Windows RDNA2/RDNA4 decode. This table is the test report.

machine denoise (40 steps, 1280x736) decode outcome
AMD Radeon AI PRO R9700 (gfx1201, 32 GB), Windows 11, torch 2.11.0+rocm7.13.0, Unsloth Desktop 0.1.813-beta, unsloth 2026.9.10 62 s 9.5 min, no MIOpen output, but the MIOpen user db was written 6 s before the image returned image returned, UI had already dropped the request
Radeon RX 6800-class (gfx1030, 16 GB) + gfx1036 iGPU, Windows, Unsloth Desktop 0.1.814-beta 19 min (math-only attention, group offload) 23 min of exhaustive search backend crashed, image lost

Not run: a decode with cudnn.benchmark off on either card, which is the test that confirms the fix. Linux ROCm, where MIOpen find behaviour and the GPU watchdog differ. A second decode at the same resolution, which should be fast once the db is warm.

Guess, not verified

The crash looks like a Windows GPU timeout (TDR): single trial kernels during the search run close to a second on a card that is also streaming offloaded weights. The trace shows the launch failure, not its cause.

Expected

Don't set cudnn.benchmark when torch.version.hip is set, or at least not for the VAE, and report the decode as a phase so the UI doesn't sit at 100% for ten minutes.

Bottom line: the mechanism is solid from the reporter's log and the code, and the slow decode is measured on both cards; the crash cause and the fix itself are unrun.

Activity

  1. kamilon commented on Sep 23, 2026

    @kamilon

    I'm seeing this with ROCm on Linux as well.

  2. LeoBorcherding commented on Sep 24, 2026

    @LeoBorcherding
    CollaboratorAuthor

    two more machines from the discord help thread, both Windows on gfx1151 (Radeon 8060S), both Unsloth Desktop, both reported not measured (no diagnostics yet, asked for them):

    machine model reported
    Ryzen AI Max+ 392, 32 GB VRAM / 32 GB RAM Qwen-Image-2.1 GGUF Q4_K_M "AMD driver not responding" popup on generate, then the desktop error screen
    Ryzen AI Max+ 395, 128 GB Qwen-Image-2.1 bf16 every step completes, stuck at the end, Adrenaline GPU error, backend crashed

    the second one is the decode by description. with kamilon's Linux report above, that is Windows on gfx1201, gfx1030 and gfx1151 plus Linux, so neither the OS nor the chip is the axis, the flag is.

    and four runs on the gfx1030 row now (RX 6800, Windows 11, HIP 7.13, Unsloth Desktop 0.1.814 then 0.1.815-beta), Qwen-Image-2.1 GGUF Q4_K_M at 1024x1024, every one the same way: the denoise finishes at ~27 s/step, the decode starts, and the last line the backend writes is

    MIOpen(HIP): Error [EvaluateInvokers] .../miopen/src/hip/handlehip.cpp:142: Error setting device 0: unspecified launch failure
    
    steps decode ran for then
    30 3 min 36 s hung, the desktop watchdog killed it after 5 min of failed probes
    20 5 min 15 s hung, watchdog killed it
    40 5 min 13 s process aborted (exit code 3)
    40 1 min 56 s process aborted, windows showed the AMD driver-timeout dialog

    the two aborts left a faulthandler trace with the current thread in autoencoder_kl_qwenimage21 decode → conv._conv_forward, so it is the decode conv inside MIOpen's solver evaluation. step count doesn't change it.

    workaround on the released build, from the code, not yet run on any of these cards: Speed set to Off before the load skips apply_speed_optims entirely (diffusion_speed.py:266), so the flag never goes on and the decode runs without the search.

    (#11732 merged while this was being written. until a release carries it, Speed Off is the route.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions