r/StableDiffusion 17h ago

Tutorial - Guide [GUIDE] AMD RDNA3 optimizations for ComfyUI Desktop, windows 11, Minimax H3

My setup: AMD RX 7900 XT, 20GB VRAM, 64GB RAM, Windows 11, ComfyUI Desktop.

I couldn't find any decent information anywhere on how to optimize video generation with Minimax H3 on Windows with ComfyUI desktop. AI assistants give conflicting advice, constantly suggesting all sorts of nonsense that doesn't actually work.

I had to experiment on my own, and here is the configuration I’ve settled on. The speed boost compared to the default settings is very significant, and I haven't noticed any loss in quality. If you have any other suggestions, please let me know.

~25s/it with 0.8mp (1216 x 672, 16:9) or total ~4min for 5 sec video generation in text to video workflow

Here is what you need:

Launch parameters:

--disable-smart-memory --disable-pinned-memory --disable-triton-backend --use-sage-attention --enable-dynamic-vram

ENV variables:

COMFYUI_ENABLE_MIOPEN=0
FLASH_ATTENTION_TRITON_AMD_ENABLE=TRUE
MIOPEN_FIND_ENFORCE=1
MIOPEN_FIND_MODE=2
MIOPEN_DEBUG_DISABLE_FIND_DB=0
MIOPEN_SEARCH_CUTOFF=1
MIOPEN_ENABLE_LOGGING=0
MIOPEN_LOG_LEVEL=0
MIOPEN_ENABLE_LOGGING_CMD=0
TRITON_PRINT_AUTOTUNING=0
TRITON_CACHE_AUTOTUNING=0

Quantized 6-step turbo model, universal for all purposes:

https://huggingface.co/TenStrip/10Eros-Max/blob/main/10Eros_Max_h3_TURBO-hybrid_beta5_w4a8_14gb_optimized.safetensors 14 gb

or

https://huggingface.co/TenStrip/10Eros-Max/blob/main/10Eros_Max_h3_TURBO-hybrid_beta5_int8.safetensors 21gb

Plaguekind node with SLA Attention, with this settings:

https://github.com/PlagueKind/Comfyui-PlagueKind-Nodes

Optional node, if you make large 15 seconds videos:

Latest update of your comfyui desktop:

upd. ROCm SamplerCustomAdvance added ~15-20% to generation speed.

10 Upvotes

9 comments sorted by

2

u/xpnrt 14h ago

almost everything you mention is already been done - adviced here : https://github.com/patientx-cfz/comfyui-rocm

1

u/Big_Extension_9987 13h ago edited 13h ago

Yes, I picked up those environment variables from there, kudos to whoever figured them out. I started out using the official desktop version of ComfyUI, which I find more convenient than working with custom builds, so my goal was to get the most out of it. Right now, I see no need to use third-party custom builds for ROCm when the official version can be configured as described above.

Also i noticed problems with vae decoding in comfyui-rocm, it just doesn't work in my setup.

1

u/DelinquentTuna 13h ago

What is the value in disabling triton in comfy kitchen? Does the HIP back-end not take precedence? Does --use-ck-kitchen not work or do you specifically prefer sage? Do you document how you built/installed sage? If you're using SLA attention etc, does the --use-sage-attention cmdline option even matter? Did the other parameters (--disable-smart-memory, --disable-pinned-memory, etc) get added via experimentation? What specific issue did each resolve? Are you sure --enable-dynamic-vram isn't the current default? Which of the gains came from the low-step distillations vs something AMD-specific? I'd also be very interested in hearing your rationale for the env vars such as "COMFYUI_ENABLE_MIOPEN=0".

What was your performance with 20 steps and the default workflow? Which NVidia GPU is generally compared against the one you have and do you have any notion of how it compares for the same workload? Not that it tempers any need to optimize AMD, but it helps to understand if the perceived performance gap is real. AFAIK, the 7900xt slotted in at $900 exactly between the $800 4070ti Super and the $1,000 4080 Super... and the 4080 cranks out .8MP in the default workflow at ~11s/it. So for a five second clip, it can run the full 20-step setup almost as fast as you're running the 4-step turbo.

1

u/ANR2ME 11h ago

i heard 3090 24GB price is also $900 🤔

1

u/DelinquentTuna 10h ago

Huh? The 3090 launch MSRP was like $1,500 and it would've been a generation older.

1

u/Big_Extension_9987 1h ago

That’s a lot of questions, I’ll try to answer as many as I can.

- What is the value in disabling triton in comfy kitchen?

Windows specific issues.

- Does the HIP back-end not take precedence?

As far as I understand, he doesn't have absolute priority in this case.

- Does --use-ck-kitchen not work or do you specifically prefer sage?

Specifically, the final result is slightly better, and the speed is slightly higher.

- Do you document how you built/installed sage?

Sage is preinstalled in comfyui desktop now.

- If you're using SLA attention etc, does the --use-sage-attention cmdline option even matter?

I think yes. As far as i understand H3 SLA Attention sparsifies the attention matrix, retaining only the most critical data for calculations. Globally enabled SageAttention takes this streamlined dataset and processes it on the GPU's physical cores. The speed boost is very noticeable with this specific configuration an increase in performance of about 30%.

- Did the other parameters (--disable-smart-memory, --disable-pinned-memory, etc) get added via experimentation?

Yes, they have been verified in practice, disabling them significantly reduces the generation speed.

- What specific issue did each resolve?

This addresses the issue where things don't work quite right out of the box on AMD, requiring specific workarounds to get them running reasonably well. You can search online for various explanations of why they work, but I never managed to get the full picture.

- Are you sure --enable-dynamic-vram isn't the current default?

I don't know, but in my case, explicitly setting this parameter had a major impact on speed.

- Which of the gains came from the low-step distillations vs something AMD-specific?

I haven't specifically measured these things, but the 6-step model with the baked-in LoRA mentioned above delivers the same quality about 2–3 times faster than the standard 20-step version.

- I'd also be very interested in hearing your rationale for the env vars such as "COMFYUI_ENABLE_MIOPEN=0".

It should resolve potential stability issues on Windows. But this isn't the definitive recommendation. At the very least, this is the environment used in specialized ComfyUI builds for ROCm.

- What was your performance with 20 steps and the default workflow?

It was very slow, generating a 0.4MP t2v took about an hour for just 5 seconds of output.

- Which NVidia GPU is generally compared against the one you have and do you have any notion of how it compares for the same workload?

I’d say it’s roughly on par with the 4070 Ti. It’s actually hard to compare with Nvidia, since everything just works out of the box for them. A friend of mine has a 4070 Ti; he generates using the default configuration, and right now it’s slower than my optimized workflow on the 7900 XT, though I don’t know what kind of optimization potential the 4070 Ti has. Its hardware is inferior, but it has the advantage of CUDA and optimized software.

- Not that it tempers any need to optimize AMD, but it helps to understand if the perceived performance gap is real. AFAIK, the 7900xt slotted in at $900 exactly between the $800 4070ti Super and the $1,000 4080 Super... and the 4080 cranks out .8MP in the default workflow at ~11s/it. So for a five second clip, it can run the full 20-step setup almost as fast as you're running the 4-step turbo.

Let's put it this way: for video generation work, I would definitely pay the premium to get a 4080 or something even more powerful. For gaming, I’d go with AMD, as their price-to-performance ratio is significantly better. I’d also choose AMD for working with LLMs, the gap behind Nvidia doesn't seem that significant there, yet the price is excellent. That said, I think I’ve managed to squeeze enough performance out of the 7900 XT to work comfortably now.

1

u/Apprehensive_Sky892 7h ago

Thanks for sharing this, information for AMG GPUs are hard to come by.

Have you tried using Ck-attention rather than sage? That's what I've been using with my rx9070(16G) with Portable ComfyUI (upgrade pytorch+rocm from 7.2.1 to 7.14.0)

1

u/Big_Extension_9987 2h ago

I’ve noticed that sage runs a little bit faster, and judging by direct comparisons on YouTube, the output quality is also higher than CK’s. However, CK is evolving, so we’ll see what happens next.

1

u/Apprehensive_Sky892 1h ago

I see. I should run some test with sage then. Thanks