Most machine learning acceleration still depends on hand-written GPU kernels customized for specific hardware architectures, batch shapes, and operator fusions. The Tang compiler replaces this manual process by deriving high-performance kernel schedules automatically from pure mathematical representations.
Tang structures its intermediate representation around two simple primitives: affine views for iteration spaces and comprehensions representing monoid reductions. Because online softmax forms an algebraic monoid, the compiler automatically derives the FlashAttention schedule, generating both forward and backward passes without writing custom CUDA code.
Benchmark results demonstrate that this derived implementation matches or exceeds hand-tuned baselines. On an RTX 3090, a derived transformer forward pass runs 1.2 times faster than PyTorch with CUDA graphs, while Qwen3-8B achieves 148 tokens per second during decode.
Deriving kernel schedules mathematically eliminates hand-written GPU kernels without sacrificing bare-metal efficiency.














