Background: The CUDA Ecosystem and Compatibility Needs
CUDA, NVIDIA's parallel computing platform released in 2007, dominates GPU-accelerated computing thanks to its mature ecosystem and deeply optimized libraries such as cuBLAS and cuDNN. However, CUDA runs exclusively on NVIDIA hardware, creating vendor lock-in: AMD and Intel GPUs cannot directly execute CUDA programs, limiting software portability and hardware choice.
To break this barrier, the open-source community and vendors have explored CUDA compatibility layers and porting solutions. These fall into two broad categories:
- Runtime compatibility layers — intercept and redirect CUDA runtime/driver API calls so existing CUDA binaries run unmodified on non-NVIDIA GPUs.
- Source porting / compiler solutions — translate CUDA source to another GPU programming model (HIP, OpenCL) or compile it directly to target GPU machine code.
- Supports much of the CUDA 12.x runtime, including memory management, streams, events, and cuBLAS Level-1/2/3 functions; cuDNN support is still pending.
- ZLUDA 5 introduced the offline PTX compiler
zoc(compiling PTX to AMD GPU machine code) and thezluda_traceAPI tracing tool. - Achieved initial support for llama.cpp and llm.c, marking a breakthrough for AI workloads; its llama.cpp performance is reportedly on par with native ROCm.
- Advanced features like multi-GPU parallelism, virtual memory management, and PyTorch/cuDNN-dependent frameworks remain works in progress.
- Supports core CUDA features:
__global__/__device__functions, thread-hierarchy built-ins, shared memory, synchronization, atomics, warp shuffle, most math functions, cooperative groups, and constant memory. - Successfully compiled and ran classic CUDA examples (vector addition, matrix multiplication), proving the approach is viable.
- Still early-stage: limited CUDA 12 features, no dynamic parallelism, streams, or cuBLAS/cuDNN; only basic support for complex C++ features like template instantiation.
- The most mature and widely adopted option: used by MIOpen, rocBLAS, and for porting PyTorch and TensorFlow to AMD GPUs.
- Performance typically close to native CUDA due to compiler optimization.
- Limitations: requires recompilation (cannot run closed-source CUDA binaries); not a perfect match for CUDA-specific features (e.g., certain cuDNN algorithms, OptiX).
- Supports most CUDA 3.2-and-earlier runtime APIs and kernel features; lacks dynamic parallelism, texture memory, CUDA-OpenGL interop, templates, and cuBLAS/cuDNN.
- Mainly of academic reference value; converted code usually needs significant manual fixing, and it does not support modern CUDA versions.
- Reported API coverage: 47% runtime API, 22% driver API, 80% math API.
- Claims performance on AMD GPUs approaching or exceeding HIP — in some Rodinia benchmarks up to 6x faster.
- Handles inline PTX assembly with validation and diagnostics for cross-platform reliability.
- Free for non-commercial use; commercial use requires a license.
- HIP offers the broadest CUDA compatibility and near-native performance, making it the de facto official path.
- SCALE claims several-fold speedups over HIP on some benchmarks, though within a limited supported feature set.
- BarraCUDA has performance potential via direct machine-code generation but has published no detailed performance data yet.
Project Overview
ZLUDA: CUDA Runtime on Non-NVIDIA GPUs
ZLUDA lets CUDA applications run on AMD GPUs without source modification by intercepting driver API calls (e.g., cuMemAlloc, cuLaunchKernel) and redirecting them to AMD ROCm/HIP. Initially funded by AMD, the project was halted over legal concerns, then revived and open-sourced by the community.
BarraCUDA: A From-Scratch CUDA Compiler
BarraCUDA aims to write a CUDA C++ compiler from scratch — no NVIDIA toolchain, no LLVM — implemented entirely in C99. The pipeline includes preprocessing, lexing, recursive-descent parsing, semantic analysis, an intermediate representation (BIR), instruction selection, and register allocation, ultimately emitting AMD RDNA binaries (also able to emit PTX or Tenstorrent Tensix C++).
HIP and HIPIFY: AMD's CUDA Porting Path
HIP is a CUDA-superset programming model offering source-level (not binary) compatibility. Code written once in HIP compiles via hipcc to either NVIDIA (CUDA backend) or AMD (ROCm backend) targets. The HIPIFY tool automatically converts CUDA source to HIP (e.g., cudaMalloc → hipMalloc), supporting most CUDA 12.9.1 APIs including new FP4/FP6/FP128 types.
CU2CL: CUDA-to-OpenCL Source Translation
CU2CL is an academic prototype (circa 2016) that auto-translates CUDA source to OpenCL using the Clang framework, converting kernels to __kernel functions and mapping syntax like <<<...>>> and __shared__ to OpenCL equivalents while generating host-side OpenCL code.
SCALE: A Commercial Cross-Platform CUDA Compiler
SCALE, by Spectral Compute, is a commercial (not open-source) LLVM-based compiler that compiles CUDA source directly to multiple GPU architectures — "write once, run anywhere." It generates both NVIDIA PTX and AMD GCN/RDNA code and provides Drop-in Libraries replacing CUDA runtime calls at link time.
Usability and Performance Analysis
Runtime compatibility (ZLUDA) shines for zero-modification migration of existing binaries, e.g., running AI inference frameworks on AMD GPUs immediately. Performance depends on ROCm maturity; the gap with native CUDA is narrowing, but support for the newest CUDA 12.8+ APIs lags.
Source-level approaches (HIP / BarraCUDA / SCALE) target near-native performance:
Conclusion: Toward a Diverse GPU Computing Future
Each project takes a distinct technical route toward the same goal — breaking CUDA's vendor lock-in. ZLUDA lowers migration barriers at the binary level, HIP/HIPIFY provides the most production-ready source-level path, BarraCUDA demonstrates that an independent compiler free of NVIDIA's EULA and LLVM is feasible, CU2CL offers historical lessons, and SCALE shows commercial investment can achieve near-native cross-vendor performance. Together they signal a more pluralistic future for GPU computing, though all still trail full CUDA compatibility and require continued development to keep pace with CUDA's rapid evolution.
> Note: Figures 1–2 in the original post are charts comparing SCALE's API coverage (47% runtime / 22% driver / 80% math) and HIP vs. SCALE performance on Rodinia benchmarks (illustrative).