• Tiny-gpu-compiler: An educational MLIR-based compiler targeting open-source GPU hardware I built an open-source compiler that uses MLIR to compile a C-like GPU kernellanguage down to 16-bit binary instructions targeting tiny-gpu, an open-source GPU written in Verilog. • The goal is to make the full compilation pipeline from source to siliconunderstandable. • The project includes an interactive web visualizer where youcan write a kernel, see the TinyGPU dialect IR get generated, watch registerallocation happen, inspect color-coded binary encoding, and step throughcycle-accurate GPU execution - all in the browser. • Technical details: CustomtinygpuMLIR dialect with 15 operations defined in TableGen ODS,each mapping directly to hardware capabilities (arithmetic, memory, controlflow, special register reads) All values arei8matching the hardware’s 8-bit data path Linear scan register allocator over 13 GPRs (R0-R12), with R13/R14/R15reserved for blockIdx/blockDim/threadIdx Binary emitter producing 16-bit instruction words that match tiny-gpu’sISA encoding exactly (verified against the Verilog decoder) Control flow lowering from structured if/else and for-loops to explicitbasic blocks with BRnzp (conditional branch on NZP flags) and JMP The compilation pipeline follows the standard MLIR pattern: The web visualizer reimplements the pipeline in TypeScript for in-browsercompilation, plus a cycle-accurate GPU simulator ported from the Verilog RTL. • Github :GitHub - gautam1858/tiny-gpu-compiler: An MLIR-based compiler that takes GPU kernels and compiles them to real hardware instructions. • Interactive web visualizer included.
Article Summaries:
- A developer has released an open‑source compiler that translates a C‑like GPU kernel language into 16‑bit binary instructions for TinyGPU, a minimal Verilog‑based GPU. Built on MLIR, the compiler defines a TinyGPU dialect with 15 operations that map directly to hardware features, uses an 8‑bit data path, and performs linear‑scan register allocation over 13 GPRs. The pipeline-from source to binary-runs in the browser via a TypeScript visualizer that shows IR generation, register allocation, binary encoding, and cycle‑accurate execution. The author seeks feedback on dialect design, register‑allocation modeling, and whether an intermediate dialect is needed for future CIRCT‑based Verilog generation.
- I built an open-source compiler that uses MLIR to compile a C-like GPU kernel language down to 16-bit binary instructions targeting tiny-gpu, an open-source GPU written in Verilog. The goal is to make the full compilation pipeline from source to silicon understandable. The project includes an interactive web visualizer where you can write a kernel, see the TinyGPU dialect IR get generated, watch register allocation happen, inspect color-coded binary encoding, and step through cycle-accurate GPU execution - all in the browser. Technical details: - Custom tinygpu MLIR dialect with 15 operations
Sources:
- https://discourse.llvm.org/t/tiny-gpu-compiler-an-educational-mlir-based-compiler-targeting-open-source-gpu-hardware/89948 (Latest source article published: 2026-02-24 06:01 UTC)