# Native CUDA Kernel Programming in Go

**URL:** <https://forum.golangbridge.org/t/native-cuda-kernel-programming-in-go/42549>\
**Category:** Releases\
**Created:** [September 13, 2026, 2:08pm UTC](https://forum.golangbridge.org/t/native-cuda-kernel-programming-in-go/42549 "2026-09-13T14:08:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mehdi\_Shokohifar](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/mehdi_shokohifar/32/17892_2.png) [@Mehdi\_Shokohifar](https://forum.golangbridge.org/u/Mehdi_Shokohifar)\
**Post date:** [September 13, 2026, 2:08pm UTC](https://forum.golangbridge.org/t/native-cuda-kernel-programming-in-go/42549/1 "2026-09-13T14:08:44Z")

</div>

Hello ,

I’ve been working on an experimental project that enables writing CUDA kernels directly in Go and compiling them to NVIDIA GPU code using LLVM 22.

Project:

> **[GitHub - mehdi-shokohi/cuda-ir.go: Write CUDA kernels in native Go. Compiled to PTX...](https://github.com/mehdi-shokohi/cuda-ir.go)**
>
> Write CUDA kernels in native Go. Compiled to PTX via llgo + LLVM

### Motivation

Most Go GPU solutions rely on cgo wrappers, external CUDA C++ code, or runtime bindings. I wanted to explore whether Go could be used as a native language for GPU kernel development by leveraging LLVM’s NVPTX backend.

### What the project does

- Generates LLVM IR from Go code

- Uses LLVM 22 for optimization and code generation

- Targets NVIDIA GPUs through the NVPTX backend

- Allows CUDA-style kernel development in Go

- Produces PTX code that can be executed by the CUDA driver

### Example

```auto
func VecAdd(a, b, c []float32) {
    idx := cuda.ThreadIdxX()
    c[idx] = a[idx] + b[idx]
}

```

### Current Status

The project is still experimental, but core compilation functionality is working. My goal is to build a more complete ecosystem for GPU programming in Go while learning more about compiler design, LLVM internals, and GPU architectures.

### Feedback Welcome

I would appreciate feedback from the Go community on:

- API design

- Compiler architecture

- LLVM integration

- GPU programming patterns in Go

- Potential use cases

If anyone has experience with LLVM, TinyGo, GPU computing, or compiler development, I’d love to hear your thoughts.

Repository:

> **[GitHub - mehdi-shokohi/cuda-ir.go: Write CUDA kernels in native Go. Compiled to PTX...](https://github.com/mehdi-shokohi/cuda-ir.go)**
>
> Write CUDA kernels in native Go. Compiled to PTX via llgo + LLVM

Thanks!
