{"slug": "getting-fortran-running-on-gpu-s-natively", "title": "Getting Fortran running on GPU's natively", "summary": "Zane Hamilton's Booth compiler now compiles Fortran 'do concurrent' kernels to GPU machine code, supporting AMD RDNA 2/3/4, CDNA, Nvidia PTX, Tenstorrent, and Apple (WIP), with its own CPU backends for x86-64 and RISC-V. The compiler handles elementwise BLAS-1 operations like saxpy and sscal, but lacks reductions, nested loops, and proper intrinsic resolution for transcendentals. Hamilton is modernizing the SLATEC library and seeking community feedback on prioritization.", "body_md": "Hello!\n\nMy GPU compiler project [booth](https://github.com/Zaneham/Booth) now compiles Fortran `do concurrent`\n\nkernels to GPU machine code, and I wanted to share where it has got to.\n\nBooth takes CUDA, HIP or Triton and emits machine code directly for AMD RDNA 2/3/4 as well as CDNA, Nvidia PTX, Tenstorrent and Apple (still a WIP with the runtime for apple). It also has its own CPU backend for x86-64 and RISC-V. It does all the good things a compiler does all by itself and doesn’t contain any dependencies like MLIR or LLVM, you only need any C compiler to run it.\n\nWhat works is elementwise BLAS-1. saxpy, sscal, scopy, sswap, srot and srotm. Currently tested in CI everywhere except Tenstorrent as I’ve just been given a chip and we’re moving to emit machine code rather than their own c++ compiler. I’d like to publicly thank Hot Aisle as they provided the MI300X so I could validate Fortran running by hand.\n\nWhat does not work: no reductions, so sdot, sasum and snrm2 are absent. Nested loops inside a `do concurrent`\n\nget dropped on the offload path, which blocks CSEVL and the SLATEC special functions (filed as lfortran/lfortran#12369). And intrinsics come out as `abs`\n\nand `exp`\n\nrather than `fabsf`\n\nand `expf`\n\n, so transcendentals do not resolve. Elementwise arithmetic only, but that part is tested.\n\nI carried on the modernisation of SLATEC which you can see here: [Zaneham/SLATEC: A modernisation of the SLATEC library](https://github.com/Zaneham/SLATEC). The goal is to have routines that would benefit from GPU acceleration be a part of the CI process.\n\nIf anyone has some time I would appreciate feedback. Especially because I come from a historical computing and hobby background so if there’s any routines or parts of Fortran that people would like to see prioritised first, I am all ears. If you do give this a go and find any problems with this, please feel free to reach out to me directly and/or raise an issue. If you’re unsure if it’s something LFortran isn’t supporting yet or something with my compiler you’re more than welcome to leave an issue on Booth too.\n\nThis is a new and ongoing project so there will be big gaps and errors so if you hit anything just sing out.\n\nThanks all!\n\nZane", "url": "https://wpnews.pro/news/getting-fortran-running-on-gpu-s-natively", "canonical_source": "https://fortran-lang.discourse.group/t/getting-fortran-running-on-gpus-natively/11024#post_1", "published_at": "2026-07-28 10:59:04+00:00", "updated_at": "2026-07-28 11:05:42.572243+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Booth", "Zane Hamilton", "AMD", "Nvidia", "Tenstorrent", "Apple", "SLATEC", "LFortran"], "alternates": {"html": "https://wpnews.pro/news/getting-fortran-running-on-gpu-s-natively", "markdown": "https://wpnews.pro/news/getting-fortran-running-on-gpu-s-natively.md", "text": "https://wpnews.pro/news/getting-fortran-running-on-gpu-s-natively.txt", "jsonld": "https://wpnews.pro/news/getting-fortran-running-on-gpu-s-natively.jsonld"}}