This guide explains how to build and run TurboDiffusion on Windows with AMD GPUs using ROCm.
Note: These steps should also work on Linux with minor modifications (use bash commands instead of PowerShell,
source venv/bin/activateinstead of.\venv\Scripts\Activate.ps1, and skip the Visual Studio environment setup). However, Linux support has not been tested yet and may have issues.
TurboDiffusion on Windows has been tested with RDNA3/RDNA3.5 GPUs (gfx1100, gfx1101, gfx1102, gfx1151).
- Windows 10/11
- Python 3.11, 3.12, or 3.13
- Visual Studio 2022 with C++ build tools
- AMD Adrenaline driver (latest recommended)
Follow the instructions at ROCm/TheRock RELEASES.md to install ROCm and PyTorch wheels for your GPU architecture.
python -m venv venv
.\venv\Scripts\Activate.ps1For gfx1151 (AMD Strix Halo iGPU):
pip install --index-url https://rocm.nightlies.amd.com/v2/gfx1151/ --pre torch torchaudio torchvisionFor gfx110X (RX 7900 XTX, RX 7800 XT, RX 7700S, Radeon 780M):
pip install --index-url https://rocm.nightlies.amd.com/v2/gfx110X-all/ --pre torch torchaudio torchvisionFor gfx120X (RX 9060, RX 9070):
pip install --index-url https://rocm.nightlies.amd.com/v2/gfx120X-all/ --pre torch torchaudio torchvisionrocm-sdk initpip install triton-windowsOpen a PowerShell terminal and run:
# Activate Visual Studio environment
cmd /c '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" >nul 2>&1 && set' | ForEach-Object { if ($_ -match '^([^=]+)=(.*)$') { [System.Environment]::SetEnvironmentVariable($matches[1], $matches[2], 'Process') } }
# Activate the virtual environment
.\venv\Scripts\Activate.ps1
# Set ROCm paths using rocm-sdk
$ROCM_ROOT = (rocm-sdk path --root).Trim()
$ROCM_BIN = (rocm-sdk path --bin).Trim()
$env:ROCM_HOME = $ROCM_ROOT
$env:PATH = "$ROCM_ROOT\lib\llvm\bin;$ROCM_BIN;$env:PATH"
# Set compiler and build settings
$env:CC = "clang-cl"
$env:CXX = "clang-cl"
$env:DISTUTILS_USE_SDK = "1"
# Enable experimental features
$env:FLASH_ATTENTION_TRITON_AMD_ENABLE = "TRUE"
$env:TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL = "1"
# Set PYTHONPATH for TurboDiffusion
$env:PYTHONPATH = "turbodiffusion"cd <path_to_turbodiffusion>
pip install --no-build-isolation -e .If you want to use sparse attention with TurboDiffusion, clone the AMD Windows fork:
git clone --branch jam/amd_windows https://github.com/jammm/SpargeAttn.git
cd SpargeAttn
pip install --no-build-isolation -v .# Make sure environment variables are set (see step 2)
python turbodiffusion/inference/wan2.1_t2v_infer.py `
--model Wan2.1-1.3B `
--dit_path checkpoints/TurboWan2.1-T2V-1.3B-480P-quant.pth `
--resolution 480p `
--prompt "A stylish woman walks down a Tokyo street filled with warm glowing neon and animated city signage." `
--num_samples 1 `
--num_steps 4 `
--quant_linear `
--attention_type sagesla `
--sla_topk 0.1sdpa- PyTorch Scaled Dot Product Attentionsagesla- SageAttention with Sparse Linear Attention (requires SpargeAttn)
| Variable | Value | Description |
|---|---|---|
CC |
clang-cl |
C compiler |
CXX |
clang-cl |
C++ compiler |
DISTUTILS_USE_SDK |
1 |
Use SDK for distutils |
ROCM_HOME |
<rocm-sdk path --root> |
ROCm SDK root path |
PATH |
Include LLVM and ROCm bin | Required for hipcc, clang, lld-link |
FLASH_ATTENTION_TRITON_AMD_ENABLE |
TRUE |
Enable Triton Flash Attention on AMD |
TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL |
1 |
Enable experimental aotriton kernels |
PYTHONPATH |
turbodiffusion |
Include turbodiffusion module |
-
Triton compiler warnings - You may see
clang-cl: warning: unknown argument ignoredwarnings during first run. These are harmless. -
First run is slow - Triton and MIOpen kernels are compiled on first use and cached. Subsequent runs will be faster.
-
No FP8 support on RDNA3 - RDNA3 GPUs don't support FP8, so FP16/BF16 kernels are used.
Make sure you ran rocm-sdk init after installing the ROCm SDK packages.
Ensure Visual Studio environment is activated before building:
cmd /c '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" >nul 2>&1 && set' | ForEach-Object { if ($_ -match '^([^=]+)=(.*)$') { [System.Environment]::SetEnvironmentVariable($matches[1], $matches[2], 'Process') } }This is a known Windows issue with temp file handling. Make sure you're using the latest triton-windows package (pip install --upgrade triton-windows).
This warning is expected. Flash Attention is not available on AMD GPUs, but Triton-based attention is used instead when FLASH_ATTENTION_TRITON_AMD_ENABLE=TRUE is set.