AMD ROCm for Windows Guide
This guide is a step-by-step instruction for setting up AMD ROCm on Windows for use with SD.Next
Important
AMD ROCm on Windows is marked as EXPERIMENTAL by AMD
Do not create SD.Next GitHub issues before first discussing your setup on SD.Next Discord ROCm channel
For current level of AMD ROCm support on Windows, refer to AMD's official documentation
This guide assumes that appropriate AMD GPU drivers are already installed
Tip
To clean your system from older GPU drivers, you can use DDU: Display Driver Uninstaller
On Windows, you do not install system-level ROCm toolkit runfiles or SDKs
Torch Installation
SD.Next auto-detects presence of ROCm and installs appropriate version of torch for ROCm on first startup
For typical usage, you do not need to manually install torch for ROCm as SD.Next will handle it automatically
However, as AMD's TheRock Torch builds are not stable, the default version of torch installed by SD.Next may not always work correctly with your GPU
in which case, you may need to manually install a compatible version of torch for ROCm as described below
If you want to use latest nightly builds of torch for ROCm,
you can force-reinstall it by starting SD.Next with the --reinstall --use-nightly flag
For example:
venv\Scripts\activate
pip uninstall torch torchvision
pip install torch[device-{arch}]==2.14.0+rocm10.1.0" "torchvision[device-{arch}]==0.29.0a0+rocm10.1.0" "torchaudio==2.11.0.3+rocm10.1.0" -U --index-url https://stable.repo.amd.com/rocm/whl-next/ --extra-index-url https://stable.repo.amd.com/rocm/pytorch/whl-next/
deactivate
where {arch} should be replaced with your target device architecture, for example gfx1201
For a full list of GPU names and corresponding architecture strings, refer to documentation
For details, refer to AMD Torch ROCm Install Documentation
Triton Installation
Triton is required for torch compile features and can also greatly improve performance of quantization and attention operations on AMD GPUs
However, it is NOT required for general usage of SD.Next with ROCm on Windows
Triton is not installed by default with SD.Next as it requires separate installation of build environment
Triton Package
To install triton, follow these steps:
venv/scripts/activate
pip install triton-windows==3.7.1.post27
deactivate
Visual C++ Redistributables
Because compiled binaries (such as libtriton.pyd) link against MSVC, ensure the system runtime is updated:
- Download and run the 64-bit runtime Visual C++ Redistributable
Build Environment
To install build environment, follow these steps:
- Download Microsoft Visual Studio bootstrapper
https://aka.ms/vs/17/release/vs_BuildTools.exe
- Run in elevated command prompt or powershell
vs_BuildTools.exe --passive --wait --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended
Important
After VS build tools installation completes, make sure you use the newly created shortcut to command prompt that has the build tools environment initialized
Running SD.Next without the build tools environment initialized may result in build errors for Triton