AITemplate compiles deep neural networks into CUDA or HIP C++ for fast inference on NVIDIA and AMD GPUs. It targets fp16 TensorCore and MatrixCore workloads.
Overview
AITemplate (AIT) is a Python framework that turns neural network definitions into CUDA or HIP C++ code for inference serving. It is aimed at fp16 performance on NVIDIA TensorCores and AMD MatrixCores, with reference examples for models such as ResNet, BERT, Vision Transformer, and Stable Diffusion.
Compiled models become self-contained binaries without relying on cuBLAS, cuDNN, TensorRT, or similar runtimes on the same hardware. The framework supports horizontal, vertical, and memory fusion of operators, including fused GEMM, LayerNorm, and layout operations. Generated runtimes can accept PyTorch tensors with minimal copying, or run without PyTorch installed.
FX2AIT converts PyTorch models into AIT engines, with partial acceleration when some operators are unsupported. Extension work is done mainly by adding graph nodes and codegen modules. Docker images are recommended for consistent NVCC or HIPCC versions on CUDA and ROCm.
Hardware support is documented for recent NVIDIA SM80+ GPUs and AMD CDNA2 MI-210/250 class cards, with older GPUs called out as less tested.
Key features
- Neural network to CUDA/HIP C++ codegen
- Fp16 TensorCore and MatrixCore focus
- Horizontal, vertical, and memory fusion
- Self-contained portable inference binaries
- PyTorch tensor input without extra copies
- FX2AIT PyTorch conversion tooling
- Docker-based CUDA and ROCm builds
- Lego-style extendable GPU primitives
Use cases
- High-throughput GPU inference for vision models
- Serving transformer models on NVIDIA or AMD GPUs
- Stable Diffusion without third-party runtimes
- Partial PyTorch model acceleration via FX2AIT
- Custom fused kernels for new operators