ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

Disabling cudnn regresses ImageUpscaleWithModel performance on ROCM 6.4

Open alexheretic opened this issue 1 year ago • 4 comments

Custom Node Testing

Expected Behavior

See https://github.com/comfyanonymous/ComfyUI/pull/10302#issuecomment-3410741865

rocm 6.4 + flash-attn performs significantly better for image upscaling with cudnn left on. This regressed after #10302

cudnn default: ImageUpscaleWithModel(4x-UltraSharp.pth) 1.84s/it

Actual Behavior

cudnn = False: ImageUpscaleWithModel(4x-UltraSharp.pth) 11.95s/it

Steps to Reproduce

Run an image upscale workflow with rocm 6.4 + flash-attn.

Debug Logs

Total VRAM 16368 MB, total RAM 64217 MB                                                                                                                                     
pytorch version: 2.9.0+rocm6.4                                                                                                                                              
AMD arch: gfx1100                                                                                                                                                           
ROCm version: (6, 4)                                                                                                                                                        
Set vram state to: NORMAL_VRAM                                                                                                                                              
Device: cuda:0 AMD Radeon RX 7900 GRE : native                                                                                                                              
Using Flash Attention                                                                                                                                                       
Python version: 3.13.7 (main, Aug 15 2025, 12:34:02) [GCC 15.2.1 20250813]                                                                                                  
ComfyUI version: 0.3.66                                                                                                                                                     
ComfyUI frontend version: 1.28.7

Other

No response

alexheretic avatar Oct 23 '25 09:10 alexheretic

It is not just upscaling speed, but everything: https://github.com/comfyanonymous/ComfyUI/issues/10460. MIOPEN_FIND_MODE=2 (fast) is needed in combination with cudnn for optimal performance on RDNA3. comfyanonymous just forced a curcial setting to the optimal value for RDNA4, for all amd gpus, which is wrong. This is 3 people that claim this is a bad change. cudnn needs a launch option and it should default to True on RDNA3, maybe even 2. MIOPEN_FIND_MODE is also a very obscure setting which is key to optimal performance.

If more of us speak up this issue can't be ignored for much longer.

Reber01Good avatar Oct 25 '25 01:10 Reber01Good

Unfortunately there isn't consensus on the affect of these settings in different environments. See discussion in #10302.

Some people mention better vae perf with cudnn off. I haven't seen that, it's generally similar on or off for me except for this regression with upscale perf.

Even this is only true, for me, on rocm 6.4. I tested on rocm7-nightly and the upscale perf had regressed again even worse, but this time with cudnn on 🫠 (results).

I think everyone wants the best perf by default we just haven't nailed down what that is for all environments.

alexheretic avatar Oct 25 '25 07:10 alexheretic

Now found the cause of miopen upscale perf regression in rocm 7.1: https://github.com/ROCm/TheRock/issues/2485#issuecomment-3666986174

So this means having cudnn disabled is causing this regression also on the latest rocm versions in addition to rocm 6.4.

alexheretic avatar Dec 17 '25 20:12 alexheretic

I guess this issue probably isn't helpful any more as this can be resolved by enabling miopen with COMFYUI_ENABLE_MIOPEN=1.

alexheretic avatar Feb 08 '26 14:02 alexheretic