Updated June 2024
TODO
[X] Update table of UIs
[X] Update ROCm bare metal installation instructions
[ ] Add performance optimisations section
SD on AMD
TL;DR
I recommend using ROCm + ZLUDA with SD Next for Windows users. If your card is unsupported by ROCm Windows, e.g. RX 480, use DirectML.
Linux + ROCm is the superior option in performance and compatibility, and I recommend it if you have some experience with Linux or would like to try.
For RDNA3 users, ROCm may also be used with full compatibility under WSL2, however I have not been able to test this myself. Note that while it is technically possible to use ROCm in a VM, this requires some specific configuration using PCI-E passthrough and is beyond the scope of this guide.
Backends
This are the frameworks which do the heavy lifting. Choice depends on hardware/software and UI support.
Backend | Platforms | Inference Speed* (it/s) | SD1.5 VRAM usage** (GB) | LORA Usage | LORA Training | Controlnet | Flash Attention | Notes |
---|---|---|---|---|---|---|---|---|
ROCm | Linux | ~9 | Low (~3GB) | ✓ | ✓ | ✓ | Limited support on RDNA3 | Fully compatible. ROCm is available on Windows, but does not yet support PyTorch, and thus diffusion models. |
ROCm + ZLUDA | Linux, Windows | ~9 | Medium | ✓ | ? | ? | ✗ | Experimental framework which translates CUDA to ROCm-compatible HIP. Allows ROCm to be utilised for diffusion models on windows. |
DirectML | Windows | ~2 | High (~10GB) | ✗ | ✗ | ✗ | ✗ |
*Tested on a 6800 XT at 512x512.
**Rough guide, tested at FP16 and sub-quad attention where available, but without additional options such as Token Merging.
Programs
These are the programs which give you the UI to work with. Consider which backend you want to use.
UI | Supports ROCm | Supports ROCm + ZLUDA | Supports Directml | Notes |
---|---|---|---|---|
Automatic1111 | Yes | ? | No | The OG. Full featured and well supported. |
Comfy | Yes | ? | Yes | Highly customizable and powerful. |
SD Next | Yes | Yes | Yes | "Opinionated" fork of A1111. Useful for providing integrated ZLUDA support. |
stable-diffusion-webui-amdgpu | No | Yes | Yes | Somewhat hacked-together fork of A1111, focusing on adding backends which support AMD. Anecdotally buggy. |
Nod AI Shark | No | No | No | Uses Vulkan - speeds are okay, but note long precompilation times and limited UI features. Appears to be on hold following AMD acqusition and shift in focus towards a general execution engine. |
Forge | ? | ? | No | Fork of A1111 aimed at additional optimisations. Appears targeted at Nvidia systems, unsure how well it functions for AMD. |
ROCm Support
Linux
See here for official support.
I've adapted the official list to provide some guidance about the many more cards which are able to be used beyond those officially supported.
Linux Support | Name | Archictecture | LLVM Target | Official Support | Full support in practice | Hacky Support | Notes |
---|---|---|---|---|---|---|---|
AMD Radeon RX 7900 XTX | RDNA3 | gfx1100 | ✅ | ✅ | - | ||
AMD Radeon RX 7900 XT | RDNA3 | gfx1100 | ✅ | ✅ | - | ||
AMD Radeon RX 7800 XT | RDNA3 | gfx1101 | ❌ | ✅ | - | May require environmental variable: HSA_OVERRIDE_GFX_VERSION=11.0.0 |
|
AMD Radeon RX 7700 XT | RDNA3 | gfx1101 | ❌ | ✅ | - | May require environmental variable: HSA_OVERRIDE_GFX_VERSION=11.0.0 |
|
AMD Radeon RX 7600 | RDNA3 | gfx1102 | ❌ | ✅ | - | May require environmental variable: HSA_OVERRIDE_GFX_VERSION=11.0.0 |
|
AMD Radeon RX 6950 XT | RDNA2 | gfx1030 | ❌ | ✅ | - | ||
AMD Radeon RX 6900 XT | RDNA2 | gfx1030 | ❌ | ✅ | - | ||
AMD Radeon RX 6800 XT | RDNA2 | gfx1030 | ❌ | ✅ | - | ||
AMD Radeon RX 6800 | RDNA2 | gfx1030 | ❌ | ✅ | - | ||
AMD Radeon RX 6750 XT | RDNA2 | gfx1031 | ❌ | ✅ | - | May require environmental variable: HSA_OVERRIDE_GFX_VERSION=10.3.0 |
|
AMD Radeon RX 6700 XT | RDNA2 | gfx1031 | ❌ | ✅ | - | May require environmental variable: HSA_OVERRIDE_GFX_VERSION=10.3.0 |
|
AMD Radeon RX 6700 | RDNA2 | gfx1031 | ❌ | ✅ | - | May require environmental variable: HSA_OVERRIDE_GFX_VERSION=10.3.0 |
|
AMD Radeon RX 6650 XT | RDNA2 | gfx1032 | ❌ | ✅ | - | May require environmental variable: HSA_OVERRIDE_GFX_VERSION=10.3.0 |
|
AMD Radeon RX 6600 XT | RDNA2 | gfx1032 | ❌ | ✅ | - | May require environmental variable: HSA_OVERRIDE_GFX_VERSION=10.3.0 |
|
AMD Radeon RX 6600 | RDNA2 | gfx1032 | ❌ | ✅ | - | May require environmental variable: HSA_OVERRIDE_GFX_VERSION=10.3.0 |
|
AMD Radeon RX 5700 XT | RDNA | gfx1010 | ❌ | ❌ | ✅ | Poor support, various things may not work e.g. FP16. May require environmental variable: HSA_OVERRIDE_GFX_VERSION=10.3.0 |
|
AMD Radeon RX 5700 | RDNA | gfx1010 | ❌ | ❌ | ✅ | Poor support, various things may not work e.g. FP16. May require environmental variable: HSA_OVERRIDE_GFX_VERSION=10.3.0 |
|
AMD Radeon RX 5600 XT | RDNA | gfx1010 | ❌ | ❌ | ✅ | Poor support, various things may not work e.g. FP16. May require environmental variable: HSA_OVERRIDE_GFX_VERSION=10.3.0 |
|
AMD Radeon VII | Vega | gfx906 | ✅ | - | - | ||
AMD Radeon RX 480/470/570/580 | Polaris | gfx803 | ❌ | ❌ | ✅ | May require very old versions of ROCm - last official release was 4.4, although later versions may also work. |
Full support in practice: Might as well be officially supported, as they share dies/archs with officially supported (or formerly supported) models.
Hacky support: Stuff might be broken or require additional workarounds.
Windows
Windows Installation (SD Next + ZLUDA)
Linux Installation
Installing ROCm
Official instructions for Ubuntu, RHEL, SUSE.
Installing Automatic1111
Once ROCm is installed:
- Ensure you have Git and Python 3.10 installed, and 10GB+ of disk space available.
- Clone the UI repository. Run
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
- Move into the newly-cloned repository with
cd stable-diffusion-webui
- Open
webui.sh
with your preferred text editor, e.g.nano webui.sh
, and change theTORCH_COMMAND
variable at line 122 to read:export TORCH_COMMAND='pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/rocm6.0'
, or alternatively the version which matches your ROCm installation. - If your GPU needs it, append
export HSA_OVERRIDE_GFX_VERSION=XX.X.X
to a new line in webui.sh -- see above compatibility notes. - Create and enter a new venv. Run
python -m venv venv
, then. venv/bin/activate
- Start the interface. Run
./webui.sh
. You should see it install a number of dependencies. If successful, it should finish by printing:
- Open a web browser and navigate to
http://127.0.0.1:7860
. You should see the interface. Done!