CUDA-for-AMD-Windows README

The project's README from github.com/Speedstu/CUDA-for-AMD-Windows. As one markdown file: README.md.

CUDA for AMD on Windows

Windows AMD Radeon verify License: MIT

A reproducible Windows CUDA compatibility stack for AMD GPUs, built around ZLUDA + AMD ROCm/HIP.

Run CUDA-targeted Windows applications on AMD hardware, verify that work really reaches the GPU, and distinguish a correct result from a crash, timeout, CPU fallback, or silently wrong tensor.

[!IMPORTANT] This project is not a complete CUDA implementation. Support is capability- and workload-specific. The validated reference GPU is currently the Radeon RX 9060 XT (gfx1200).

Quick start

1. Install AMD prerequisites

Install a current AMD GPU driver and the AMD HIP SDK for Windows with HIP Libraries.

The required HIP version depends on the GPU architecture. The project checks the architecture-specific floor recorded in manifests/windows-gpu-profiles.json.

2. Clone and install

git clone https://github.com/Speedstu/CUDA-for-AMD-Windows.git
cd CUDA-for-AMD-Windows
powershell -ExecutionPolicy Bypass -File .\scripts\install.ps1

The installer detects the GPU, verifies the HIP environment, downloads pinned assets, stages the runtime, runs a runtime smoke test, and performs numerical checks when a compatible Python/PyTorch environment is available.

3. Run a CUDA-targeted application

.\scripts\run-zluda.ps1 -Program C:\path\to\app.exe

4. Validate the runtime

.\scripts\doctor.ps1
.\scripts\test-runtime.ps1
.\scripts\test-functional.ps1 -PythonExe C:\path\to\venv\Scripts\python.exe

The original low-level setup path is intentionally kept compatible for existing users and old posts:

.\scripts\setup.ps1 -DownloadZluda -DownloadLibTorch

See scripts/README.md for the stable user-facing commands and maintainer tooling.

Current compatibility

GPU Target Project status Notes
Radeon RX 9060 XT gfx1200 ✅ validated reference Main development and integration validation platform
Radeon RX 9070 XT gfx1201 ✅ validated external Separately tested Windows AMD/ZLUDA training setup
Radeon 890M gfx1150 🟡 community partial HIP/GEMM reported working; broader paths still under validation
Other recognized AMD GPUs architecture-dependent ⚪ unverified candidate Detection is not functional validation

Full details, version floors, evidence levels, known limitations, and the CUDA DLL → AMD backend map: docs/COMPATIBILITY.md.

What has been validated?

Stable public reference path

The public reference path uses pinned upstream components and has been tested with:

See docs/VALIDATION.md.

Experimental v7 path

The repository also maintains a pinned, source-based ZLUDA v7-preview.10 patch series for newer CUDA-facing behavior.

Validated work on the reference machine includes areas such as:

The patch set remains separate from the stable installer so experimental work cannot silently redefine the stable path.

See patches/zluda-v7-preview10/README.md.

Real application checks

This project deliberately tests more than tiny API calls.

PyTorch / LibTorch / PPO

The reference workload performs rollout, forward, backward, PPO learning, and optimizer work through the CUDA-facing device.

See docs/VALIDATION.md and docs/BENCHMARKS.md.

llama.cpp

A recent llama.cpp b10978 build has completed an end-to-end GPU smoke on the RX 9060 XT experimental v7 path:

This is evidence for that tested path, not a claim that every llama.cpp kernel or model is supported.

See docs/LLAMA_CPP.md.

Performance snapshot

Performance claims are kept same-GPU and reproducible where possible; this is not an AMD-vs-NVIDIA benchmark.

On the experimental v7/TheRock path, a clean four-pair FP32 SGEMM validation measured paired median overhead versus direct HIP/rocBLAS of +1.79% at 1024², +0.45% at 2048², and +2.20% at 4096². The corresponding throughput ratios were 98.2%, 99.6%, and 97.8%.

A real VelocityRL 512 agents × rollout 16 smoke separated first-use compilation from steady state: the warmed updates reached 72,306 SPS and 70,333 SPS, for 71,319.5 SPS median steady-state.

Methodology and raw results: docs/BENCHMARKS.md and benchmarks/.

Correctness first

A CUDA API returning success is not enough to call something supported.

The test suite distinguishes:

PASS · UNSUPPORTED · INCORRECT · TIMEOUT · ERROR · process failure

The project follows a fail-closed rule: an explicit unsupported result is better than a plausible-looking but incorrect tensor.

That policy already caught fused SDPA fallback paths that could return numerically wrong output instead of failing clearly.

For the evidence model and contribution rules, see CONTRIBUTING.md.

Project map

Area Purpose
scripts/ Installation, launch, diagnostics, tests, staging and maintainer helpers
manifests/ Pinned releases, hashes and GPU architecture metadata
patches/ Reproducible source patches against pinned upstream projects
native/ Small source-built native compatibility components
docs/ Architecture, validation, integrations, benchmarks and troubleshooting
examples/ Small integration/reference snippets
benchmarks/ Raw benchmark data checked into the repository
.github/ CI and structured GPU compatibility reports

Generated runtime files stay under .runtime/ and are ignored by Git.

Documentation

Start with docs/README.md instead of searching through the repository.

Historical reconstruction material is still preserved, but it is no longer part of the recommended path.

Found a bug or tested another GPU?

Both successful and failed reports are useful.

.\scripts\gpu-scan.ps1 -OutputPath .\gpu-report.json
.\scripts\test-runtime.ps1
.\scripts\test-functional.ps1 -PythonExe C:\path\to\venv\Scripts\python.exe

Then open a GPU compatibility report.

Please include the GPU model, gfxXXXX target, driver, HIP version, ZLUDA channel/build, exact workload, and proof that the AMD/ZLUDA device actually executed the work rather than falling back to CPU.

Known limitations

More detail: docs/COMPATIBILITY.md.

Contributing

The project is evidence-driven. New compatibility claims should include a focused reproducer, numerical validation where applicable, exact versions/hashes, and a real workload when possible.

Read CONTRIBUTING.md before changing support claims or promoting experimental patches.

License

Project-owned scripts and documentation are MIT licensed.

ZLUDA, AMD ROCm/HIP, NVIDIA CUDA components, PyTorch/LibTorch and other third-party projects retain their own licenses. See THIRD_PARTY_NOTICES.md.

CUDA-for-AMD-Windows (Speedstu/CUDA-for-AMD-Windows)

Searching Database…

这是做什么用的?这是一套 Windows 兼容方案,通过 ZLUDA 加上 AMD ROCm/HIP,让原本针对 CUDA 的应用跑在 AMD 显卡上,还附带工具用来验证计算确实在 GPU 上执行,而不是悄悄回退到 CPU 或算出错误结果。
它是一个驱动、一个完整的 CUDA 替代品,还是别的什么?都不是——它是一套精心整理的方案,包括固定版本的 ZLUDA 构建、AMD HIP SDK 的安装配置、可复现的源码补丁和验证脚本。它明确不是一个完整的 CUDA 实现:只有经过测试证据支持的工作负载才声称可用。
怎么安装配置?先安装最新的 AMD 显卡驱动和 AMD HIP SDK for Windows,然后运行仓库里的安装程序:它会检测你的显卡、验证 HIP 环境、下载固定版本的资源、部署运行时,并运行冒烟测试和数值正确性检查。
安装之前需要准备什么?需要一块受支持的 AMD 显卡、最新的 Windows 驱动,以及带 HIP Libraries 的 AMD HIP SDK for Windows。所需的 HIP 最低版本取决于你的显卡架构,安装时会对照仓库中的清单进行检查。
我这块 AMD 显卡到底能不能用?经过验证的只有少数几款:Radeon RX 9060 XT(gfx1200)是参考基准,RX 9070 XT 有外部验证,Radeon 890M 有部分社区反馈。其他 AMD 显卡都只是未经证实的候选——能被检测到并不代表功能上真的可用。
只能在 Windows 上用,还是有 Linux 方案?只有 Windows。整套方案都围绕 AMD HIP SDK for Windows 和 Windows 上的 ZLUDA 构建,而且 README 也提到 Windows 只能用到完整 ROCm 生态的一部分。
它是开源的吗?我可以随便用吗?项目自有的脚本和文档采用 MIT 许可证,但整套方案捆绑了第三方组件——ZLUDA、ROCm/HIP、NVIDIA CUDA 的部分内容、PyTorch/LibTorch——它们各自保留自己的许可证,所以整体安装是混合许可的。
有哪些真实应用被证明能跑起来?PyTorch/LibTorch:一个真实的 220 万参数 PPO 工作负载完整跑通了 rollout、前向、反向和优化器步骤,全部走 CUDA 接口设备。llama.cpp:b10978 版本在 RX 9060 XT 的实验性 v7 路径上完成了端到端 GPU 冒烟测试,全部 6/6 层、KV cache 和计算缓冲区都放在 GPU 上。
性能损耗有多大?在实验性 v7 路径上损耗很小:FP32 SGEMM 实测相比直接使用 HIP/rocBLAS 的中位数开销为 +0.45% 到 +2.20%(吞吐量达到 97.8%–99.6%)。这些数据都是在同一块 GPU 上测的;该项目刻意避免做 AMD 与 NVIDIA 之间的性能对比。
遇到不支持的 CUDA 功能会怎样?它会明确报错而不是含糊带过:结果会标注为 PASS、UNSUPPORTED、INCORRECT、TIMEOUT 或 ERROR,宁可给出明确的不支持结论,也不给出看似合理但错误的张量。正是这套策略揪出了融合 SDPA 回退返回数值错误输出的问题。
cuDNN 在这套方案里能用吗?不能完全用:稳定的 Windows HIP 路径没有完整的 cuDNN/MIOpen 等价物。实验性的 v7 桥接层只覆盖 gfx1200 上很窄的 cuDNN v8 二维卷积子集,而 NCCL、TensorRT、自定义 CUDA 扩展和不支持的 PTX 可能会失败。
Creator
Speedstu
Size
0.7 MB
Stars
321
Updated
CommitOct 18
Age
1mo
Commits · 90 Days