how to use zluda in my comfyui. i am having a rx7900xt and a windows10 pc with a am4 cpu. my comfyui runs in the pinokio enviroment. sofar i couldnt make it use zluda. as far as i understood with zluda my gpu should be able to work as if it would have cuda cores and hence run most processes in comfyui faster
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Okay, I understand you're trying to get ZLUDA working with your ComfyUI setup on Windows 10 with an RX 7900 XT and an AM4 CPU, and that you're currently using Pinokio. Here's a breakdown of how to approach this, based on the provided information, along with some important considerations:
Understanding the Goal
ZLUDA's Role: ZLUDA aims to provide a compatibility layer that allows AMD GPUs to run code written for NVIDIA's CUDA, which is beneficial for software like ComfyUI that often leverages CUDA for performance. You are correct in your assumption that it will allow your GPU to process data in a way similar to CUDA cores.
Performance: While ZLUDA can improve performance on AMD GPUs, it's important to note that it might not always match the speed of native CUDA on comparable NVIDIA GPUs. The primary advantage here is enabling AMD GPUs to function with tools that were primarily developed for CUDA.
Steps to Install and Configure ComfyUI-Zluda
The provided documentation for ComfyUI-Zluda outlines a specific setup process. Since you are using Pinokio, you will need to adapt these steps:
Prerequisites:
Git: You likely have this already with Pinokio, but ensure it's correctly installed and added to your system's PATH.
Important: Make sure you did NOT install the version from the Windows Store.
During installation, check "Add Python to PATH" at the "Customize Python" screen.
Visual C++ Runtime: Install the x64 version from here.
HIP SDK:
Download and install HIP SDK 5.7.1 from the AMD ROCm Hub. Look for the "Windows 10 & 11 5.7.1 HIP SDK"
Important: DO NOT use HIP 6.1.2 as the docs mention there are problems with it.
System Variables:
Set a system variable called HIP_PATH with the value: C:\Program Files\AMD\ROCm\5.7\. Adjust if you installed it elsewhere.
Edit the Path system variable and add: C:\Program Files\AMD\ROCm\5.7\bin.
ROCm Libraries (for GPUs below 6800 series). This is NOT needed for your RX7900XT. You can skip this step.
Cloning the Repository:
Open a command prompt (cmd.exe, NOT PowerShell).
Navigate to a directory where you want to place the ComfyUI-Zluda folder, and run the command below. Note that this folder should NOT be the one that contains the Pinokio install.
* This will set up the necessary environment and dependencies.
Running ComfyUI-Zluda:
To start ComfyUI, run the following from the same command prompt:
bash
comfyui.bat
This will launch the ComfyUI server.
Important Considerations:
Updating:Do not use the update function from the ComfyUI manager. Instead, use git pull to update the base ComfyUI code. The comfyui.bat script does this for you automatically. Update extensions through the ComfyUI manager itself.
RX 480-580 Fix: This fix is not relevant to your RX 7900 XT, so please ignore the fixforrx580.bat file
VAE Decoding: If you experience out-of-memory issues with VAE decoding, add the command line argument --cpu-vae to the comfyui.bat file's commandline_args variable.
First Generation Time: The first time you generate something will take longer (around 10-15 minutes) because ZLUDA needs to create a database for your GPU. Be patient.
ZLUDA patching
If you run into ZLUDA related issues later on after updates, or if torch has been updated you can run:
bash
patchzluda.bat
Integrating with Pinokio
Since you are running Pinokio, these steps will not directly work. Here are the steps you must follow in order to use this installation:
Locate Pinokio Installation:
Find the directory where Pinokio has installed ComfyUI. This may vary depending on your setup.
Create a Custom Script:
Create a new .bat file (or adapt an existing one if you have one).
In this script:
Activate the correct environment: This will be inside the ComfyUI-Zluda you just cloned.
Call the comfyui.bat file from ComfyUI-Zluda.
Run the Script:
Run the .bat script. This should launch ComfyUI using the ComfyUI-Zluda installation and, consequently, ZLUDA.
Troubleshooting
Pip Cache: If you encounter issues, clear your pip cache (C:\Users\USERNAME\AppData\Local\pip\cache) or run pip cache purge within the virtual environment.
Xformers and Flash Attention:xformers and Flash Attention are not compatible with ZLUDA, according to the docs.
Face Restoration:codeformer may not work. Use gfpgan, gpen, or restoreformer instead.
GPU Drivers: Make sure you have the latest drivers installed for your AMD GPU. Completely remove any NVIDIA drivers you might have.
ZLUDA Errors: If you get ZLUDA errors, check that these three files exist inside ComfyUI-Zluda\venv\Lib\site-packages\torch\lib\ : cublas64_11.dll, cusparse64_11.dll, nvrtc64_112_0.dll. If they are there, and are large files, run patchzluda.bat.
Clean Install: If nothing else works, delete the venv folder and rerun install.bat.
Git Pull Problems: If git pull fails, run git fetch --all and then git reset --hard origin/master before git pull.
caffe2_nvrtc.dll issues: If you are sure you have hip installed in the path, make sure you are NOT using the version from the windows store, but the version from python.org. And reinstall venv
rocBLAS error: This should not be an issue with the rx7900xt, but if you get a rocBLAS error make sure to add HIP_VISIBLE_DEVICES=1 to your enviroment variables.
Important Notes
Pinokio Environment: Since you're using Pinokio, the install.bat script may cause conflicts, as Pinokio has its own way of managing environments. The above steps on how to get this to work with Pinokio are just a guide and may need some additional tweaks.
Virtual Environment: Always make sure you activate the correct venv environment located in your cloned ComfyUI-Zluda folder before using patchzluda.bat.
Patience: The first generation and ZLUDA setup can be time-consuming.
In Summary
While using ZLUDA with your setup involves a few extra steps, it should allow your RX 7900 XT to be used more efficiently with ComfyUI. Remember to follow the instructions carefully, and feel free to ask if you have more questions as you go along.