Muni.works introduced Tang, a tensor IR with affine views and monoid comprehensions. Fusion, flash attention and its backward pass are derived as rewrites. One graph lowers to CUDA, Metal, WGSL, OpenCL, GLSL and C. The least memory traffic and optimal tile are dual solutions of one linear program. A time floor built on it never exceeds measured time on tested kernels. Wins and losses against PyTorch, llama.cpp and FlashAttention are reported. Tang derives kernels for an 80B mixture-of-experts model on one H200. Derived kernels match or trail hand-tuned ones depending on batch size and context. Time-to-first-token improves for some derived attention and scan kernels. Performance varies against FlashAttention-2 and FlashAttention-3.
What changed
Kernels were written by hand for each operator, chip, and fusion.
What it unlocks
Deriving kernels automatically from a tensor IR instead of hand-writing them.
- 1.2× faster than PyTorch at seq len 512
- 148.7 tok/s for Qwen3-8B decode
- 92% of llama.cpp at 4k context
- 18% slower than hand kernels at batch 1
What you need to act on it
- a tensor IR with affine views and monoid comprehensions
- a compiler that can lower to CUDA, Metal, WGSL, OpenCL, GLSL, or C
Sources