CUDA for AMD on Windows
CUDA for AMD on Windows
This project provides a method to execute Windows applications designed for NVIDIA CUDA on AMD hardware by leveraging ZLUDA in conjunction with ROCm/HIP. It is specifically tailored for compute-heavy workloads, including those utilizing CUDA-enabled LibTorch.
[!IMPORTANT] Hardware Compatibility: Currently, the only fully validated hardware is the AMD Radeon RX 9060 XT (architecture
gfx1200). While other AMD GPUs may work, they are considered "candidates" and are not guaranteed. Please submit a GPU compatibility report if you test other cards.
🛠️ Technical Validation
As of the latest update, the public upstream path has been verified using the following stack:
- ZLUDA:
v6-preview.69(Official release) - AMD HIP SDK:
6.4 - LibTorch:
2.3.0 + cu118 - Hardware: RX 9060 XT /
gfx1200
Integration Results
The following components passed the cuda_check utility: nvcuda, cuBLAS, cuBLASLt, cuSPARSE, and cuFFT.
Furthermore, a real-world PPO network consisting of parameters successfully completed:
- Forward pass/inference.
- PPO learning and optimizer functions.
- A full validation iteration of timesteps.
⚙️ How it Works
The system acts as a translation layer, redirecting CUDA calls to AMD-compatible libraries.
🚀 Installation Guide
Step 1: Prerequisites
- Install the latest AMD GPU Driver.
- Install the AMD HIP SDK for Windows (including HIP Libraries).
- Note: Versions newer than 6.4 may work but are unverified.
- Official AMD Windows HIP SDK Guide
Step 2: Setup the Environment
Clone the repository and execute the installation script via PowerShell:
git clone https://github.com/Speedstu/CUDA-for-AMD-Windows.git
cd CUDA-for-AMD-Windows
powershell -ExecutionPolicy Bypass -File .\scripts\install.ps1
The install.ps1 script performs the following:
- Detects the native
gfxXXXXtarget and AMD GPU. - Validates the HIP SDK and necessary math libraries.
- Fetches the pinned official ZLUDA build.
- Downloads LibTorch 2.3.0+cu118 ().
- Verifies files via SHA-256 hashes.
- Creates
.runtime\runtime-config.jsonand.runtime\gpu-report.json. - Runs
cuda_check.exeto verify the stack.
Tip: If LibTorch is not required for your application, use: .\scripts\install.ps1 -SkipLibTorch
🏃 Running Applications
To launch a CUDA-targeted program:
.\scripts\run-zluda.ps1 -Program "C:\path\to\app.exe"
This launcher places the necessary ZLUDA DLLs alongside the executable and configures the HIP/ROCm runtime paths.
Alternative Options:
- Manual Staging:
.\scripts\stage-runtime.ps1 -TargetDir "C:\path\to\your-app" - Diagnostics:
.\scripts\doctor.ps1.\scripts\gpu-scan.ps1(Logs GPU model, architecture, and driver info; does not collect personal data)..\scripts\test-runtime.ps1
📊 Compatibility & Performance
Hardware Status
| GPU Model | Target | Status |
|---|---|---|
| Radeon RX 9060 XT | gfx1200 | ✅ Validated Reference |
| Other HIP GPUs | Various | ⚠️ Unverified Candidates |
Runtime Coverage
| CUDA Component | Result | Implementation |
|---|---|---|
nvcuda (Driver) | ✅ | Native |
cuBLAS | ✅ | via rocBLAS |
cuBLASLt | ✅ | via hipBLASLt |
cuSPARSE | ✅ | via rocSPARSE |
cuFFT | ✅ | Native |
cuDNN | ⚠️ | Unavailable in stable Windows HIP SDK |
Note: Software requiring heavy convolution (cuDNN) may need a nightly HIP stack. However, GEMM-heavy LibTorch training (like the PPO workload) functions without it.
Performance Benchmarks
A controlled A/B test was conducted on 2026-09-13 using the RX 9060 XT (10 iterations, first iteration discarded as warmup).
| Runtime Path | Median Overall SPS |
|---|---|
| Public Upstream | |
The public upstream path was approximately faster than the custom overlay. Historical tuned runs have reached between and steps/s.
📜 Additional Notes
Custom Overlay: The project previously experimented with a custom cuBLAS/HIP overlay. This is not required for the validated path and is slower for the reference workload. These artifacts are fingerprinted in manifests/recovered-artifacts.sha256 but are not provided as binaries due to incomplete provenance and the inclusion of third-party AMD binaries.
Repository Structure:
scripts/: Containsinstall.ps1,run-zluda.ps1, etc.manifests/: SHA-256 fingerprints.docs/,examples/,benchmarks/: Supporting materials.