Repository navigation
AMD ROCm Windows
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
Note
If you're switching from older ZLUDA setup
it is recommended to perform a clean installation of SD.Next or at least remove existing venv folder before proceeding
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/
deactivatewhere {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 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
To install triton, follow these steps:
venv/scripts/activate
pip install triton-windows==3.7.1.post27
deactivateBecause 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
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
For example, VS Build Tools will create a shortcut to the build tools named "x64 Native Tools Command Prompt for VS"
Start the shortcut and then start SD.Next from that Command prompt
Alternatively, invoke the VS build tools script that sets up the environment for compilation before running SD.Next manually (exact path may vary depending on your installation):
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64