Abstract
The rapid development of custom AI hardware (ASICs) has created a significant software bottleneck: the need for comprehensive kernel libraries to support high-level frameworks like PyTorch. This paper introduces TritorX, an agentic AI system that automates the generation of high-performance tensor kernels. By integrating Large Language Models (LLMs) into a closed-loop feedback cycle involving linting, compilation, and hardware execution, TritorX achieved 84.7% operator coverage for Meta’s MTIA accelerator in a matter of hours—a task that typically requires months of manual human engineering.
Introduction
The proliferation of specialized AI accelerators, such as Meta’s Training and Inference Accelerator (MTIA), necessitates the creation of extensive "backends"—libraries of low-level kernels (ATen operators) that bridge the gap between hardware and software frameworks. Manual kernel development is an arduous process requiring deep expertise in both hardware architecture and the Triton programming language. TritorX addresses the "coverage gap" by automating the generation of functionally correct kernels for hundreds of operators, enabling new chips to be compatible with existing AI models almost immediately.
System Architecture and Methods
TritorX employs an agentic Finite State Machine (FSM) to manage the kernel generation process. Unlike traditional "one-shot" prompting, the system uses an iterative loop that incorporates direct hardware feedback.
The process follows a rigorous iterative cycle:
- Generation: A reasoning LLM (such as Code World Model or GPT-OSS) receives a PyTorch operator's documentation and generates a Triton kernel along with a Python wrapper.
- Linting: A custom "Triton MTIA Linter" checks the code for hardware-specific restrictions and prevents the LLM from "cheating" by calling unauthorized high-level functions or dispatching work back to the CPU.
- Compilation & Execution: The code is compiled and executed on actual MTIA silicon or a QEMU hardware simulator.
- Feedback & Debugging: If the kernel fails to compile or produces incorrect results, error logs and stack traces are summarized (using a secondary LLM like Llama-4-Maverick) and fed back to the primary agent for debugging.
Experimental Setup and Datasets
The authors utilized the PyTorch OpInfo suite, a comprehensive testing framework defining expected behaviors for tensor operators. The evaluation set consisted of 568 unique MTIA-compatible operators. The test harness included over 20,000 individual tests covering diverse data types (float16, bfloat16, int32, etc.) and tensor shapes. To ensure real-world viability, kernels were also validated using input data captured from production models like DLRM (Recommendation) and NanoGPT.
Key Results and Insights
TritorX successfully generated 481 unique ATen operators, achieving 84.7% coverage of the MTIA-compatible set. This represents a massive scale-up from manual engineering, with the system capable of iterating over the entire operator set in just a few hours.
Key insights from the study include:
- Coverage over Peak Performance: For new hardware, having a working backend is more critical than having a perfectly tuned one. TritorX prioritizes generality and correctness across the entire operator set.
- Hardware-in-the-Loop is Essential: Documentation for new chips is often incomplete. By giving the LLM direct feedback from the compiler and silicon, the agent "distills" the hardware's requirements through trial and error.
- Test-Time Scaling: The stochastic nature of LLMs means they might fail initially but succeed on subsequent attempts. By running many iterations in parallel across 200 devices, TritorX significantly boosts its success rate.
Conclusion and Future Work
TritorX demonstrates that agentic LLM systems can drastically reduce the time required to bring up new AI hardware. While the current kernels are functionally correct, they are not yet optimized for maximum speed. Future work will focus on integrating autotuning and learned code optimization, handling more complex operator families like convolutions, and implementing formal verification to ensure memory safety.
Summary updated