← Back to projects

Fusion

Fusion is a small Linux-only programming language whose primary purpose is calling into existing C and CUDA libraries with as little ABI friction as possible. Programs compile to LLVM IR, are JIT-executed against a C runtime, and can dynamically load any .so library (including libcudart and libnccl) through libffi. The proof-of-life: a Fusion program that trains a microGPT end-to-end.

The interesting part isn't the language design itself. It's small and intentionally so, with structs, opaque types, extern declarations, and a sequential top-level. The interesting part is that "compile, JIT, FFI to C" is a much smaller surface area than "write a real backend," while still being expressive enough to do real GPU work. The tradeoff is that you live or die by your runtime, and a lot of effort went into making libffi shims feel native rather than bolted on.

The piece I expected to hate and ended up enjoying most was the tooling: the LSP and the VSCode extension. Once you have language tooling around a toy compiler, the toy stops feeling like a parser exercise and starts feeling like a real language.

flowchart LR
    src[".fusion source"] --> lex[Lexer]
    lex --> parse[Parser]
    parse --> sem[Semantic checks]
    sem --> ir[LLVM IR]
    ir --> jit[JIT execute]
    jit --> rt["C runtime + FFI"]

What's next: bigger benchmarks on real ML workloads, and porting the runtime so it isn't Linux-locked.