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.

PyTorch attention safety (stable and latest)

Launch CUDA-facing PyTorch through scripts/run-zluda.ps1. On both ZLUDA v6 stable and v7 latest, it now defaults to math-only SDPA (flash=False, mem_efficient=False, math=True). This avoids the finite-but-wrong fused-attention output reported on gfx1100/gfx1150. It is a safe workaround, not proof that the fused kernels work. Use -AllowUnsafeFusedSDPA only for isolated diagnostics.

test-functional.ps1 deliberately probes raw kernels separately and may still report them as incorrect. Running zluda.exe directly bypasses the Python safety hook.

The current prebuilt zluda.exe also splits program arguments containing spaces. A v7 source patch candidate is included for this (#6), built and tested on gfx1200. Upstream prebuilt launchers still need rebuilding with the patch before the fix takes effect.

The launcher argv patch was also independently rebuilt and checked on Radeon 890M / gfx1150 (three passing repeats for the argument round-trip and a multi-word llama.cpp prompt). The patch still needs to be applied to distributed binaries; the separate zluda-launcher-candidate-build workflow creates a candidate-only build, not an automatic replacement for stable/latest.

The conservative llama.cpp smoke now limits its default context to 4096 tokens via -c, rather than inheriting a potentially huge model maximum. Pass -ContextSize to override for intentional larger tests. The other safety flags are unchanged.

Release quality and regression protection

A green build is not a hardware correctness certificate. Before considering a ZLUDA driver candidate for general use, maintainers must verify the candidate DLL SHA-256 and run the CPU-vs-GPU numerical tests for sort, cumsum, matmul and math-only SDPA. The fail-closed, read-only promotion gate (including SHA-256 of the DLL actually loaded by each probe process) rejects missing, stale or mismatched test evidence. Compilation-only artifacts remain experimental, and the known-good runtime is not replaced automatically.

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.

Experimental cuDNN phase 1, gfx1200 hardware results

A narrow source-built cuDNN v8 -> MIOpen bridge (60 overridden exports) now has 16/16 real RX 9060 XT direct-HIP FP32/FP16 numerical checks, covering activations, accurate channel softmax, restricted max pooling and strided tensor operations. The FP16 host-scalar ABI was corrected after real hardware exposed a silent wrong-output case. This is not full cuDNN, cuDNN v9 or PyTorch CUDA application support; see the phase 1 checklist.

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.

Deep-learning compatibility work in progress: Phase 1 release and correctness checklist.

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. llama.cpp / gfx1150 issue #6: a new pinned safe-build candidate avoids the missing F32 mul_mat_f specialization through existing MMVF/cuBLAS fallback. It leaves ZLUDA_CC=8.6 and F16/BF16 MMF unchanged; the Radeon 890M community tester confirmed 3/3 runs for all six formerly failing models; native-answer comparison was checked on the 4B model only. See F32 MMF candidate. This does not address speculative top-k or Nemotron copy faults.

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

Searching Database…

What is this?A Windows compatibility stack that runs CUDA-targeted applications on AMD GPUs via ZLUDA plus AMD ROCm/HIP, with tooling to verify the work truly executes on the GPU instead of silently falling back to CPU or producing wrong results.
Is it a driver, a full CUDA replacement, or something else?Neither — it is a curated stack of pinned ZLUDA builds, AMD HIP SDK setup, reproducible source patches and validation scripts. It is explicitly not a complete CUDA implementation: support is claimed only for workloads backed by test evidence.
How do I set it up?Install a current AMD driver and the AMD HIP SDK for Windows, then run the repo's installer: it detects your GPU, verifies the HIP environment, downloads pinned assets, stages the runtime and runs smoke plus numerical correctness checks.
What do I need before installing?A supported AMD GPU, a current Windows driver, and the AMD HIP SDK for Windows with HIP Libraries. The required HIP version floor depends on your GPU architecture and is checked against a manifest in the repo.
Will my specific AMD GPU actually work?Only a handful are validated: the Radeon RX 9060 XT (gfx1200) is the reference, the RX 9070 XT is externally validated, and the Radeon 890M has partial community reports. Other AMD GPUs are unverified candidates — device detection is not functional validation.
Is this Windows-only, or is there a Linux path too?Windows only. The whole stack is built around the AMD HIP SDK for Windows and ZLUDA on Windows, and the README notes Windows exposes only part of the full ROCm ecosystem.
Is it open source, and can I use it freely?Project-owned scripts and docs are MIT, but the stack bundles third-party components — ZLUDA, ROCm/HIP, NVIDIA CUDA pieces, PyTorch/LibTorch — that keep their own licenses, so the combined setup has mixed licensing.
Which real applications have been proven to run?PyTorch/LibTorch: a real 2.2M-parameter PPO workload ran rollout, forward, backward and optimizer steps through the CUDA-facing device. llama.cpp: build b10978 completed an end-to-end GPU smoke on the RX 9060 XT experimental v7 path with all 6/6 layers, KV cache and compute buffers on the GPU.
What is the performance overhead?Small on the experimental v7 path: FP32 SGEMM measured +0.45% to +2.20% median overhead versus direct HIP/rocBLAS (97.8-99.6% of throughput). Figures are same-GPU; the project deliberately avoids AMD-vs-NVIDIA benchmark claims.
What happens when a CUDA feature is not supported?It fails closed: results are labeled PASS, UNSUPPORTED, INCORRECT, TIMEOUT or ERROR, and an explicit unsupported verdict is preferred over a plausible-looking but wrong tensor. That policy caught fused SDPA fallbacks returning numerically incorrect output.
Does cuDNN work through this stack?Not fully: the stable Windows HIP path has no complete cuDNN/MIOpen equivalent. An experimental v7 bridge covers only a narrow cuDNN v8 2D convolution subset on gfx1200, while NCCL, TensorRT, custom CUDA extensions and unsupported PTX may fail.
Creator
Speedstu
Size
0.7 MB
Stars
334
Updated
CommitOct 20
Age
2mo
Commits · 90 Days