kiln · an ML compiler, end to end
The pipeline of XLA, TVM and torch.compile, from scratch: decode ONNX, fold and canonicalize the graph, fuse it into a few kernels over an affine loop IR, generate SIMD C or CUDA, compile it at run time and auto-tune every matrix multiply on the machine it runs on. On 4 CPU cores it is the fastest of five engines.
BERT, 8 sequences of 128 tokens, 4 CPU cores; medians of every timing. Outputs match PyTorch's.
Lower is better. kiln has the lowest median latency on all three of its CPU benchmark models (bench/run.sh).
The GPU backend generates CUDA with fp16 tensor-core matmuls, split-K and CUDA graphs, compiles it with NVRTC at run time and tunes it on the device.
7.9 ms against torch.compile's 13.1 ms on an NVIDIA T4 in fp16.
0.30 ms against 1.10 ms; auto-tuning alone is worth up to 1.70×.
On BERT in fp16 kiln trails torch.compile, and in fp32 the cuBLAS-based engines stay ahead. Stated, not hidden.
CI checks the generated C and CUDA against PyTorch with each optimisation switched off and under every tuned schedule, on an emulator of the CUDA execution model, so a fast wrong kernel cannot ship.
On BERT and SmolLM2, end to end.
Each auto-tuned variant is run against the reference, not just the winner.
A memory planner packs every intermediate into one buffer: 381 MB of BERT intermediates in 16 MB.
Every stage of a production ML compiler, built from scratch and benchmarked against the engines people actually use.
ONNX decoding, constant folding, fusion over an affine loop IR, SIMD C and CUDA generation.
Every matmul tuned where it runs; worth up to 1.70×.
117 ms vs 149 ms on BERT, fastest of five engines.
Generated code checked against PyTorch under every tuned schedule in CI.
On an NVIDIA T4 in fp16 kiln trails torch.compile on BERT, and in fp32 the cuBLAS-based engines stay ahead of it.
@software{kundu2026kiln,
author = {Kundu, Sankur},
title = {kiln: an ML compiler from ONNX to fused, auto-tuned SIMD C and CUDA},
year = {2026},
url = {https://github.com/Shakhtar-Sankur/kiln},
license = {Apache-2.0}
}