Repository navigation
Unsloth Studio (AMD/ROCm): don't turn on cudnn.benchmark for image and video generation - #11732
Conversation
…d video generation On ROCm the flag makes MIOpen run its exhaustive search for every new conv shape, so the first VAE decode at a resolution tuned for 10 to 23 minutes and crashed a gfx1030. CUDA is unchanged.
|
@codex review |
|
I added one commit, c3ffacd. It uses the repo's shared ROCm check, which also catches AMD builds that only mark ROCm in the torch version string. Tested on a Strix Halo machine (Linux and Windows):
The first decode on a fresh install, before MIOpen has cached anything, still takes about 4 to 5 minutes, so #11636 is only partly fixed. A new image size after that was not tested, and neither was an R9700 or a gfx1030. CI on the same commit is green on Linux, Mac and Windows: https://github.com/oobabooga/unsloth/pull/295/checks |
|
ran the after on the R9700 row from #11636, one generation each, Qwen-Image-2.1 GGUF Q4_K_M, 1024x1024, 20 steps, seed 1, group offload, fp8 text encoder. torch 2.11.0+rocm7.13.0, Windows 11.
the db check is the one that matters: not re-run: default speed on the pre-fix code at this resolution. it would start the search on fresh shapes and the last one of those reset the gpu on the reporter's card. the Speed Off row is also the first run of the released-build workaround on any of the affected cards. |
…d video generation (unslothai#11732) --------- Co-authored-by: oobabooga <[email protected]>
Fixes #11636.
apply_speed_optimssetstorch.backends.cudnn.benchmark = Truefor any load on device"cuda", which includes ROCm. There the flag makes MIOpen run its exhaustive search for every new conv shape, and a VAE decode is a run of large, unseen conv shapes, so the first image at a resolution sits in tuning after the last denoise step. On Windows that was 9.5 minutes on an R9700 and 23 minutes followed by a device crash on a gfx1030 (#11636 has both logs).The flag is now skipped when
torch.version.hipis set. MIOpen's default find mode still picks a kernel, just without the exhaustive trial runs. CUDA is unchanged. Image and video both go through this path.Verification
tests/test_diffusion_speed.pyNot in scope: diffusion LoRA training sets the same flag in
diffusion_train_common.py:1695; whether it costs the same on ROCm is untested.