Skip to content

New Readme suggestions #234

Description

@jeremymeyers

New version looks much clearer! There must be some kind of synchronicity because I was literally working on a rewrite yesterday evening. @patientx feel free to grab anything from this version you'd like, since it seems its now mostly unnecessary

ComfyUI-ZLUDA

Windows-only version of ComfyUI which uses ZLUDA to get better performance with AMD GPUs.

Table of Contents

NOTE RE: ANTI-VIRUS WARNINGS ABOUT NCCL.DLL

From the dev: nccl.dll is a dummy file, it does nothing. when one of its functions is called, it will just return "not supported" status. nccl.dll, cufftw.dll are dummy. they are introduced only for compatibility (to run applications that reject to start without them, but rarely or never use them).zluda.exe hijacks windows api and injects some dlls. its behavior can be considered as malicious by some antiviruses, but it does not hurt the user.
The antiviruses, including windows defender on my computer, didn't detect them as malicious when I made nightly build. but somehow the nightly build is now detected as virus on my end too. " SO IGNORE THE WARNING AND MAYBE EXCLUDE THE ZLUDA FOLDER FROM DEFENDER.

What's New? (Version x.x.x)

Installer

  • Added custom selection of ZLUDA patches for 6.x versions (instructions in install notes)
  • Updated zluda version for old install method and for old amd devices to 3.9.5 (latest).
  • Updated included zluda version for the new install method to 3.9.5 nightly aka latest version available. You MUST use latest amd gpu drivers with this setup otherwise there would be problems later, (drivers >= 25.5.1) """ WIPE THE CACHES , READ BELOW """ I recommend using "patchzluda-n.bat" to install it , it uninstalls torch's and reinstalls and patches them with new zluda.ALSO you need to uninstall hip 6.2.4 completely, delete the folder , and reinstall it and again download and unzip the NEW Hip addon (this is not the same as the one I shared before , this is new for 3.9.5) for this 3.9.5 version (hopefully this won't happen that much) new hip addon for zluda 3.9.5 : (https://drive.google.com/file/d/1Gvg3hxNEj2Vsd2nQgwadrUEY6dYXy0H9/view?usp=sharing)

Additions

  • Added a "small flux guide." This aims to use low vram and provides the very basic necessary files needed to get flux generation running. HERE
  • Added "cfz-vae-loader" node to cfz folder, it enables changing vae precision on the fly without using "--fp16-vae" etc. on the starting commandline. This is important because while "wan" works faster with fp16 , flux produces black output if fp16 vae is used. So, start comfy normally and add this node to your wan workflow to change it only with that model type.
  • Added two workflows for wan text to video and image to video. They are on CFZ folder. From now on I will try to share other workflows that works good on zluda at least on my setup, it could be a starting point for new users if nothing else. Text-to-video has some notes please read them.
  • Added "CFZ Cudnn Toggle" node, it is for some of the audio models, not working with cudnn -which is enabled by default on new install method- to use it just connect it before ksampler -latent_image input or any latent input- disable cudnn, THEN after the vae decoding -which most of these problems occur- to re-enable cudnn , add it after vae-decoding, select audio_output and connect it save audio node of course enable cudnn now.This way within that workflow you are disabling cudnn when working with models that are not compatible with it, so instead of completely disabling it in comfy we can do it locally like this.

Fixes

  • flash-attention download error fixed, also added sage-attention fix, especially for vae out of memory errors that occurs a lot with sage-attention enabled. NOTE : this doesn't require any special packages or hardware as far as I know so it could work with everything.
  • "CFZ Checkpoint Loader"was broken, it might corrupt the models if you load with it and quit halfway, I completely redone it and it now works outside the checkpoint loading so doesn't touch the file and when it does quantize the model, it makes a copy and quantizes it. Please delete the "cfz_checkpoint_loader.py" and use the newly added "cfz_patcher.py" it got three seperate nodes and much safer and better.
  • BOTH of these nodes are inside "cfz" folder, to use them copy them into custom_nodes, they would appear next time you open comfy, to find them searh for "cfz" you will see both nodes.
  • install-n.bat now not only installs everything needed for MIOPEN and Flash-Attention use, it also automates installing triton (only supported for python 3.10.x and 3.11.x) and flash-attention. So if you especially have 6000+ gpu , have HIP 6.2.4 and libraries if necessary, try it. But beware, there are lots of errors yet to be unsolved. So it is still not the default installed version.
  • If you want to enable MIOPEN , Triton and Flash-Attention use the install-n.bat . This will install torch 2.7 , with latest nightly zluda and patch the correct files into comfyui-zluda. This features do not work very well and you are on your own if you want to try these. (---- You have to install HIP 6.2.4 - Download and extract HIP Addon inside the folder (information down below on installation section). ---)
  • Florance2 is now fixed , (probably some other nodes too) you need to disable "do_sample" meaning change it from True to False, now it would work without needing to edit it's node.
  • Added onnxruntime fix so that it now uses cpu-only regardless of node. So now nodes like pulid, reactor, infiniteyou etc works without problems and can now use codeformer too.

HARDWARE AND DRIVER REQUIREMENTS

Read the ComfyUI requirements.
The NEW INSTALL method requires AMD drivers 5.5.1 or newer, or you will have problems down the line.

If you have a Pre-RDNA GPU (e.g. the 480-580 series or earlier), the version of torch required by ComfyUI is not optimized for pre-RDNA GPUs anymore. If you are having memory and slowdown problems, you can optionally run

fixforrx580.bat

Note that this will not speed up performance, but it will likely make your installation more stable

LIMITATIONS AND INCOMPATIBILITIES

  • xformers isn't usable with zluda so any nodes / packages that require it won't work.
  • Flash attention doesn't work.

UPDATING THE APP

Do not update ComfyUI through its interface, it may break some components. ComfyUI-ZLUDA checks for updates to this fork every time 'start.bat' or 'comfyui.bat' are run, and will pull new files down.

Use update.bat if comfyui.bat or comfyui-n.bat can't update. (as when they are the files that needs to be updated, so delete them, run update.bat) When you run your comfyui(-n).bat afterwards, it now copies correct zluda and uses that.

The latest version updated ZLUDA to 3.9.5 (to fix compatibility with newer AMD GPU drivers).

If you installed via the OLD INSTALLER METHOD and want to re-install:

  • Delete everything in : "C:\Users\yourusername\AppData\Local\ZLUDA\ComputeCache" so new zluda can create its database from scratch.

If you installed via the NEW INSTALLER METHOD

Running

patchzluda-n.bat

will uninstall the old torch packages and reinstall and patch the new ones with the current nightly ZLUDA.

This update requires a Mandatory: HIP 6.2.4 reinstall and patch (hopefully this won't happen too much)

  • Uninstall HIP 6.2.4 completely (using the uninstaller)
  • Delete the AMD\ROCm folder
  • Reinstall HIP 6.2.4
  • Download the 3.9.5 patch from GDrive and Install the ZLUDA 3.9.5 patch for HIP 6.2.4

SETUP PART 1: DEPENDENCIES AND PRE-INSTALL

Pre-requisites for installation are:

  1. Git: Download from git-scm.com
  • Be sure to check the box for "Use Git from the Windows Command line and also from 3rd-party-software" to add Git to your system's PATH.
  1. Python (3.11.9) or higher. Do not use the Windows Store version. Uninstall that if you have it.
  • During installation, be sure to check the box for "Add Python to PATH" on the "Customize Python" screen.
  1. Visual C++ Runtime: Download vc_redist.x64.exe and install it.

SETUP PART 2: NEW INSTALL METHOD (Includes miopen and triton, experimental)

New Features enabled with this method:

  • It will change the attention to pytorch-attention which is flash-attention compatible
  • Uses torch 2.7 with latest nightly zluda and will automatically patch the correct files into comfyui-zluda. These features do not yet work very well and are considered experimental.

ThIs version requires HIP SDK 6.2.4 and AMD Drivers 25.5.1 or later.

  1. Install the Visual Studio C++ Build Tools from Microsoft. Desktop Development with C++ is the only package you should need.
  2. Install HIP SDK 6.2.4 from AMD.COM the correct version, "Windows 10 & 11 6.2.4 HIP SDK".
  3. Download the ZLUDA 3.9.5 HIP add-on from GDrive or Mediafire
    3.1 Extract the files into C:\Program Files\AMD\ROCm\6.2

2.1 Environment Variables

To open the Environment Variables control panel, press Windows Key+R to open the Run menu and enter

rundll32.exe sysdm.cpl,EditEnvironmentVariables
  1. In the System Variables box (on the bottom half)
  • Add the variable "HIP_PATH" with the value C:\Program Files\AMD\ROCm\x.x\ (where your version of the SDK was installed.
  • Double click on "Path" (be sure you're editing system and not users)
  • Hit "New" and add 'C:\Program Files\AMD\ROCm\x.x\bin` (where your version of the SDK is installed) (Note the \bin at the end)

2.2 Installing and Running

git clone https://github.com/patientx/ComfyUI-Zluda
cd ComfyUI-Zluda
install-n.bat
comfyui-n.bat

Attention configuration options

  • To use sage-attention , you have to change the "--use-pytorch-cross-attention" to "--use-sage-attention". My advice is make a seperate batch file for all different attention types instead of changing them.
  • You can use "--use-pytorch-cross-attention", "--use-quad-cross-attention" , "--use-flash-attention" and "--use-sage-attention" . Also you can activate flash or sage with the help of some nodes from pytorch attention.

Note: Pre-RDNA and Newest GPUs

If you have an AMD GPU below 6800 (6700,6600 etc.) OR an 9070-9070xt, you will need to download additional files to ensure HIP 6.2.4 support. Note that the current GPUs have very poor performance with ZLUDA even when set up correctly., download the recommended library files for your gpu

For HIP 5.7.1, get the patch from Brknsoul Repository
For HIP 6.2.4, get the patch from likelovewant Repository

  1. Go to folder "C:\Program Files\AMD\ROCm\x.x\bin\rocblas" and copy the contents of the 'library' folder somewhere as a backup.
  2. Open the patch zip file and put the contents inside "C:\Program Files\AMD\ROCm\x.x\bin\rocblas\library" (overwriting if necessary): "C:\Program Files\AMD\ROCm\5.7\bin\rocblas\library" (or 6.2 if you have installed that)
  3. If rocblas.dll is in the archive as well, copy that to "C:\Program Files\AMD\ROCm\x.x\bin\rocblas"

Repairing ZLUDA

If for any reason your ZLUDA install gets changed or corrupted (for instance with ZLUDA, torch or graphics driver version changes, you can restore it to base install settings by running

patchzluda-n.bat

TROUBLESHOOTING

First Steps

  • DO NOT install ComfyUI-ZLUDA into a folder with non-english characters.
  • Wipe your pip cache "C:\Users\USERNAME\AppData\Local\pip\cache" You can also do this when venv is active with :
    pip cache purge
  • Have the latest drivers installed for your amd gpu. Also, Remove Any NVIDIA Drivers you might have using Display Driver Uninstaller

Common Error Messagse

  • CUDA device detected: None , if seeing this error with the new install-n , make sure you are NOT using the amd driver 25.5.1 . Use a previous driver, it has problems with zluda.
  • Problems with caffe2_nvrtc.dll: if you are sure you properly installed hip and can see it on path, please DON'T use python from windows store, use the link provided or 3.11 from the official website. After uninstalling python from windows store and installing the one from the website, be sure the delete venv folder, and run install.bat once again.
  • rocBLAS-error: This often means that due to a bug in the ROCm driver, ComfyUI is attempting to use your integrated video chip rather than your video card. To resolve, add HIP_VISIBLE_DEVICES=1 to your system environment variables. You may also need to add: ROCR_VISIBLE_DEVICES=1 HCC_AMDGPU_TARGET=1 . This tells ComfyUI to use the first 1st gpu (note that this number could be different if you have multiple gpu's)
  • RuntimeError: CUDNN_BACKEND_OPERATIONGRAPH_DESCRIPTOR: cudnnFinalize FailedmiopenStatusInternalError cudnn_status: miopenStatusUnknownError: If this comes up while VAE decoding, use the Tiled-VAE node (or my preference, the Tile Diffusion custom node in your workflow, VAE decoding is generally improved with this method.
  • If you see zluda errors make sure these three files are inside "ComfyUI-Zluda\venv\Lib\site-packages\torch\lib" (the file sizes are accurate for ZLUDA 3.8.4)
  `cublas64_11.dll (231kb)` 
  `cusparse64_11.dll (199kb)`
  `nvrtc64_112_0.dll (129kb)` 

If they are there but much bigger in size, repair your ZLUDA installation by running

patchzluda.bat
  • If you are getting 'out of memory' errors at the end of your workflows, most of the time it has to do with VAE Decoding.

To address this, you can run VAEs through your CPU and system ram by editing comfyui.bat and adding this to the commandline_args section

--cpu-vae

You can now decode using your system memory (the more the memory the better) and your cpu power. This might be slower but at least it works.

Miopen-Triton Specific Errors

If you have problems with triton , try uninstalling visual studio 2022 (if you have already installed it and getting errors) and install Just the C++ Build Toold

Then from the start menu, run "Developer Command Prompt" and launch ComfyUI-ZLUDA. This sometimes works.

  • ":: Triton core imported successfully , :: Running Triton kernel test... , :: Triton test failed , :: Triton available but failed verification":

  • If you installed miopen-triton setup with install.n.bat , getting Do this to fix it :

    • Copy "libs" folder from python install directory under(C:\Users\username\AppData\Local\Programs\Python\Python310) Or 311 , whatever python you are using, to under "comfyui-zluda\venv" so ,
    • For example : "C:\Users\username\AppData\Local\Programs\Python\Python310\libs" to "d:\Comfyui-Zluda\venv* Beware, there are two similar folders under venv , "Lib" and "Library" , so this would be a similarly named folder , don't mistake them.
      Then try running comfy again.

Resetting The Installation / Reinstalling

  • If for some reason you can't solve with these and want to start from zero, delete "venv" folder and re-run
    install.bat
  • If you can't git pull to the latest version, run these commands, git fetch --all and then
    git reset --hard origin/master now you can git pull
  • WIPING CACHES FOR A CLEAN REINSTALL :: There are three caches to delete if you want to start anew -it is recommended if you want a painless zluda experience:
    • "C:\Users\yourusername\AppData\Local\ZLUDA\ComputeCache"
    • "C:\Users\ yourusername\ .miopen"
    • "C:\ Users \ yourusername \ .triton"

Updating Custom Nodes and Extensions

Only use comfy manager to update the extensions

(Manager -> Custom Nodes Manager -> Set Filter To Installed -> Click Check Update On The Bottom Of The Window)
otherwise it breaks the basic installation, and in that case run install.bat once again.

CREDITS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions