HeadlinesBriefing favicon HeadlinesBriefing.com

BarraCUDA: Open-Source CUDA Compiler Targets AMD GPUs

Hacker News: Front Page •
×

A developer has built BarraCUDA, an open-source compiler that translates CUDA C code directly to AMD RDNA 3 machine code without relying on LLVM or HIP translation layers. The project compiles .cu files to GFX11 binaries, producing ELF .hsaco files that run on AMD GPUs. Written in 15,117 lines of C99, the compiler implements a complete pipeline from preprocessing through ELF emission.

BarraCUDA supports core CUDA features including global and device functions, thread indexing builtins, shared memory, atomic operations, warp intrinsics, and cooperative groups. The compiler handles C control flow, structs, templates, and operator overloading while maintaining source location tracking throughout the compilation process. Its instruction selection and encoding have been validated against LLVM's objdump with zero decode failures.

The project represents a significant technical achievement in GPU compiler development, demonstrating that CUDA can be compiled to AMD hardware without NVIDIA's toolchain. While still missing some features like const qualifiers and dynamic parallelism, BarraCUDA already supports production-ready kernels and includes a comprehensive test suite. The developer has made the source available on GitHub, offering a potential alternative for developers seeking to target AMD GPUs with existing CUDA codebases.