Based on the provided files, here's how you can approach using ZLUDA with your RX 7900 XT in a ComfyUI environment, particularly within a Pinokio setup on Windows 10.
Understanding the Context
ZLUDA: ZLUDA is a compatibility layer that allows AMD GPUs to run CUDA code, which is typically designed for NVIDIA GPUs. This is crucial because many machine learning libraries, like those used in ComfyUI, rely heavily on CUDA.
[Redacted Person]: Pinokio appears to be an environment that simplifies the setup and execution of AI-related tools, including ComfyUI.
SD.Next: The provided files are from the SD.Next project, which is a fork of the AUTOMATIC1111 Stable Diffusion web UI. It has extended support for multiple platforms and backends, including ZLUDA. This gives a good perspective on how ZLUDA might be used.
Automatic1111: The README.md indicates that SD.Next is a fork of the Automatic1111 webui.
Steps to Enable ZLUDA
Here's a breakdown of the steps you'll need to take, combining information from the files:
Install ZLUDA:
The modules/zluda_installer.py file contains the logic for downloading and installing ZLUDA. The install function downloads a zip archive based on the ZLUDA_HASH environment variable (or a default value) and extracts it to the .zluda directory. This is done automatically by cli/zluda-python.py
Pinokio Specific: Pinokio likely manages its environments and dependencies. You'll need to ensure that the necessary environment variables are set for ZLUDA to be installed correctly within the Pinokio environment. Look for configuration options in Pinokio. [Redacted Person] might run the cli/zluda-python.py which contains the install logic.
Set Environment Variables:
The ZLUDA path is determined by the ZLUDA environment variable or defaults to .zluda.
code
os.environ.get('ZLUDA', '.zluda')
Make sure this environment variable is set to the correct path within your Pinokio environment, so it knows where to find the ZLUDA files.
The ZLUDA_COMGR_LOG_LEVEL is set to 1 in modules/zluda_installer.py. This may be useful for debugging.
If you are having trouble, verify that the ZLUDA_HASH environment variable is set to a valid commit hash for the version of ZLUDA you intend to use.
[Redacted Person] might automatically set these, verify how it launches ComfyUI.
Load ZLUDA Libraries:
The modules/zluda_installer.py file has the logic for loading the required ZLUDA and ROCm libraries into the process via ctypes.windll.LoadLibrary(). This is done by calling the load function within modules/zluda_installer.py.
This step is crucial because it makes the ZLUDA runtime accessible to the application.
Configure ComfyUI:
ComfyUI needs to be configured to use the ZLUDA device. This usually means selecting CUDA as the device, ZLUDA presents the AMD GPU as a CUDA device via the compatibility layer, but you'll need to ensure the correct libraries are loaded as described above.
Pinokio Specific: Since Pinokio is involved, look for specific settings related to hardware acceleration or device selection within the Pinokio interface for ComfyUI.
ZLUDA Hijacks:
modules/zluda_hijacks.py shows that some torch functions are overridden to run on the CPU first and then moved back to the GPU, this could help with compatibility.
modules/zluda.py disables certain cudnn features and also forces the use of the CPU execution provider for ONNX in ort. These changes will be applied on start if the has_zluda function in modules/devices.py returns true.
The test function in modules/zluda.py executes a basic tensor calculation to verify ZLUDA's basic functionality. If this test fails, ZLUDA will be disabled.
Troubleshooting:
Verify ZLUDA Installation: Double-check that the .zluda directory exists and that all files were successfully extracted. Check logs from Pinokio or the console for ZLUDA specific messages.
Check for Errors: Pay close attention to any error messages when launching ComfyUI or using ZLUDA. The modules/errors.py file in the project provides error handling, which could show relevant information.
Device Selection: Make sure that ComfyUI is correctly identifying your AMD GPU as a CUDA-compatible device via the ZLUDA layer.
Torch Version: The modules/zluda_installer.py file has a get_default_torch_version function which specifies the minimum supported version. Verify that your Pinokio enviroment is using a compatible version of torch as this may cause ZLUDA to fail.
The initialize_zluda function will disable CUDA if the basic ZLUDA operations test fails, this may give some insight into why it's not working.
Pinokio Specific Notes
Environment Management: Pinokio likely has its method for managing Python environments. Ensure that ZLUDA libraries and settings are applied to the correct environment for your ComfyUI install managed by [Redacted Person].
Pinokio Scripts: Check any Pinokio scripts or configurations that might affect device selection or library loading for ComfyUI.
Logging: Enable verbose logging in Pinokio and ComfyUI to get more detailed information about the ZLUDA setup process.
Updates: Check for updates from Pinokio and any relevant ComfyUI extensions for the latest ZLUDA support.
In Summary
To get your RX 7900 XT working with ZLUDA in ComfyUI through Pinokio:
Make sure Pinokio has correctly installed ZLUDA using the cli/zluda-python.py script or install manually.
Verify that any environment variables needed by ZLUDA are set in the Pinokio environment.
Configure ComfyUI inside Pinokio to use the CUDA device, which should now be your AMD GPU.
Check for specific settings in Pinokio related to GPU usage.
Troubleshoot by checking for errors, validating device detection, and verifying library loads.
By working through these steps, you should be able to get your RX 7900 XT working with ZLUDA in ComfyUI within the Pinokio environment on Windows 10.