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.
To enable ZLUDA on your Windows 10 PC with an AMD RX 7900 XT GPU and make it work with ComfyUI, follow these steps carefully:
1. Understand ZLUDA
ZLUDA is a compatibility layer that allows AMD GPUs to execute CUDA-like workloads by mimicking CUDA cores. This is particularly useful for applications like ComfyUI, which are optimized for NVIDIA CUDA but can now run on AMD GPUs with ZLUDA.
2. Pre-requisites
Ensure the following are installed or configured on your system:
Windows 10/11: Ensure you are running a supported version of Windows.
Python (3.10.11 or 3.11):
Install the official Python version from python.org.
Avoid the Microsoft Store version.
During installation, check the Add Python to PATH option.
Git: Install Git from git-scm.com and configure it to work from the command line.
Download and install the AMD HIP SDK 5.7.1 from the AMD ROCm Hub: HIP SDK.
During installation, note the installation path (default: C:\Program Files\AMD\ROCm\5.7\).
AMD GPU Drivers:
Ensure you have the latest AMD GPU drivers installed.
Uninstall any old NVIDIA GPU drivers if present.
3. Set Up System Environment Variables
After installing the HIP SDK, configure the following environment variables:
Add HIP_PATH:
Go to System Properties > Advanced > Environment Variables.
Under "System Variables," click New.
Set:
Variable Name: HIP_PATH
Variable Value: C:\Program Files\AMD\ROCm\5.7\ (or your HIP SDK installation path).
Edit Path:
Find and edit the Path variable under "System Variables."
Add the following:
code
C:\Program Files\AMD\ROCm\5.7\bin
Optional for Integrated GPUs:
If you have an AMD iGPU alongside your RX 7900 XT, add the following environment variable to ensure ZLUDA uses the discrete GPU:
Variable Name: HIP_VISIBLE_DEVICES
Variable Value: 1
4. Install ComfyUI-ZLUDA
Open Command Prompt in an admin mode (PowerShell is not supported).
Locate the comfyui.bat file in the ComfyUI-ZLUDA folder.
Add the following argument to optimize performance for AMD GPUs:
bash
--[Redacted Person]
This ensures that VAE decoding uses your CPU memory, reducing GPU VRAM usage.
6. Run ComfyUI-ZLUDA
Start ComfyUI with the following command:
bash
comfyui.bat
The first run may take time (10–15 minutes) as ZLUDA initializes its database for your GPU.
7. Test ZLUDA
To confirm that ZLUDA is working:
Check for reduced errors and improved performance in ComfyUI.
Ensure that ZLUDA-related DLL files (cublas64_11.dll, cusparse64_11.dll, nvrtc64_112_0.dll) are located in the following directory:
code
ComfyUI-Zluda\venv\Lib\site-packages\torch\lib\
If the files are missing or larger than expected, run:
bash
patchzluda.bat
8. Address Common Issues
"Out of Memory" Errors:
Add --reserve-vram 0.9 to the comfyui.bat file to reserve 90% of GPU memory.
Use --cpu-vae to reduce GPU VRAM load.
Torch or HIP SDK Errors:
Clear the pip cache:
bash
pip cache purge
Reinstall dependencies:
bash
install.bat
Slow Performance:
Use the fixforrx580.bat script (optional for older RDNA GPUs).
Ensure you are not using the latest HIP SDK (stick to version 5.7.1).
9. Keep ComfyUI-ZLUDA Updated
To update ComfyUI-ZLUDA:
bash
git pull
To update Python dependencies (if needed):
bash
update_comfyui_and_python_dependencies.bat
10. Verify GPU Utilization
To verify that your RX 7900 XT is being utilized effectively:
Use Task Manager or tools like Radeon Software to monitor GPU usage.
Ensure that the GPU load increases when generating images in ComfyUI.
By following these steps, you should be able to use ZLUDA with your ComfyUI installation on your RX 7900 XT for improved performance and compatibility. Let me know if you encounter any issues!