METAXU

#roadmap

Milestones

Done means merged, tested, and green on both example gates. The design records live in the repo: docs/gpu_tiles.md (which numbers the GPU work internally as stages 0 to 4), docs/simdgroup_plan.md, and the Metaxu Book, whose examples run in CI.

done
The compiler runs programs. Parser, modules, type inference with hard conflict detection, and a strict interpreter that defines the semantics. 21 example programs run with pinned output, one of them a project with locked dependencies; two negative fixtures must be rejected.
done
Programs compile to native code. An LLVM backend whose output must match the interpreter byte for byte, including error messages and float formatting. It is reaching for C-like performance: small paired microbenchmarks exist to pin regressions and keep performance in view, not to score points against C.
done
Modes replace lifetimes. A borrow checker over locality, mutability, and linearity that propagates properties instead of asking for annotations. Thread-safety is inferred from what spawned closures capture.
done
Effects run threads. Delimited one-shot continuations; try/catch; real OS threads and mutexes behind Thread/Mutex effects; a handler crossing costs about 280 ns.
done
Tiles compute on the CPU. Tile[T, R, C] values with shapes checked at compile time, deterministic interpreter semantics, and a native lowering tested against them.
done
Kernels launch through an effect. Gpu.launch(n, f) defaults to a sequential CPU loop; handlers virtualize it. Buffer reads see the launch snapshot, writes merge through a written mask.
done
Kernels compile to Metal source. An emitter that produces C++-compatible MSL, so a clang++ shim tests it bit-exactly in a container with no GPU, plus a generated self-checking harness for Apple silicon.
done
Tiles in 32 and 16 bits. f32 and f16 as tile element kinds, stored as representable doubles with one rounding per operation, bit-identical across all three engines.
done
The language dispatches to Metal. run_metal installed as the Gpu handler sends the same kernel through MLX on a Mac, or through the bit-exact shim elsewhere. Anything outside the contract is an error, never a silent CPU fallback.
done
Matrix units. A kernel with an 8x8 f32 or f16 dot gets a second lowering: one launch instance is one 32-lane simdgroup, tiles live in threadgroup memory, and the dot is simdgroup_multiply_accumulate on simdgroup_float8x8. Kernels and the reference interpreter did not change; the shim emulates the collectives and stays bit-exact.

#next

In order

1
All lanes at work. In the simdgroup lowering only the dot uses the 32 lanes; loads, elementwise ops and stores run on one lane behind a barrier. Distributing them needs the shim to emulate lanes, then measurement on a Mac (docs/simdgroup_plan.md).
2
Half-precision device buffers. f16 kernels currently compute in half and convert back to f32 to store; typed half buffers remove the conversion.
3
Kernel purity as an effect class. A gpu class so the checker rejects IO, spawning, and allocation inside kernels at compile time.
4
Inferred layouts. Which lane holds which element becomes a checked property with explicit, costed conversions, following the TritonGPU vocabulary.
5
Other GPUs. A second emitter that prints TritonGPU-dialect MLIR text for NVIDIA and AMD, consumed by Triton's own pipeline.
6
Many GPUs. Collectives as sharding conversions with Dist.* effects and handlers as backends: loopback for tests, MLX distributed, NCCL.

#components

What each part does

parser
PLY grammar with a source location on every node (src/metaxu/parser.py). Multi-file imports and the std/ library resolve in the module loader.
checkers
SimpleSub type inference with hard conflict detection, plus the borrow checker for modes, locality, and linearity (compiler/frozen_borrow_checker.py). Undefined names are compile errors.
HIR / MIR
A typed high-level IR, then a mid-level IR in ANF with an explicit control-flow graph. Every backend consumes MIR.
interpreter
The semantics of record (compiler/mir_interp.py): strict, with delimited continuations, real OS threads, and a bounds-checked simulated heap for FFI. Backends are tested against it, not against intentions.
native
LLVM IR text handed to clang at -O2, linked with a small C runtime. Anything the emitter can't prove demotes to an honest placeholder rather than compiling wrong.
metal
A Metal Shading Language emitter for tile kernels (compiler/emit_msl.py) and a dispatch engine (compiler/metal_launch.py) that uses MLX on Apple silicon or a bit-exact clang++ shim anywhere.
stdlib
std/: streams, sync, option/result, iterators, sorting, strings, math, and the GPU surface, written in Metaxu itself. Writing it has been the best compiler stress test.