arXiv(opens in a new tab)cs.AISep 2026Cited by 2 papers on PaperVantage

Manuscript Offprint

arXiv:2609.04523

MaxKernel: Agentic Kernel Generation for TPUs

Shangkun Wang, Nina Cai, Charles Hoong, Julian Walker, Gerson Kroiz, George Vanica, Deepak Patil, Andi Gavrilescu, Hassan Sipra, Sethu Sankaran

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Shangkun Wang¹,, Nina Cai¹,, Charles Hong¹, Julian Walker², Gerson Kroiz¹, George Vanica¹, Deepak Patil¹, Andi Gavrilescu¹, Hassan Sipra¹ and Sethu Sankaran¹

*Equal contributions, ²Google DeepMind, ¹Google

Code: https://github.com/AI-Hypercomputer/accelerator-agents/tree/main/MaxKernel

Designing and authoring high-performance custom kernels for accelerators is a complex task that requires deep hardware-level expertise. Large Language Models (LLM) can be leveraged together with real-time compiler feedback to build agentic systems for kernel generation. In this work, we present MaxKernel, a multi-agent system that implements three distinct paradigms for TPU kernel development: (1) a Human-in-the-Loop (HITL) agent for collaborative, step-by-step design; (2) an Autonomous (Auto) agent that executes a fully automated, metric/trace-driven optimization loop; and (3) a Graph-Based Autonomous Search that scales the Auto agent for global exploration of the design space. All three paradigms leverage a shared pool of specialized sub-agents to handle planning, implementation, self-debugging, testing, and hardware profiling. We evaluate MaxKernel on JaxBench, a comprehensive suite of 50 diverse kernel tasks for TPUs, alongside complex, real-world workloads from state-of-the-art open-source models. We demonstrate that MaxKernel consistently generates highly optimized implementations, matching expert hand-tuned baselines and delivering significant performance across the benchmark. Our agent is open-sourced and available here..

1. Introduction

The continuous scaling of deep learning architectures has driven a growing demand for specialized hardware accelerators. To fully utilize the compute and memory bandwidth of these devices, engineers frequently bypass standard compiler pipelines to develop custom, optimized kernels. However, writing these custom kernels, whether in CUDA [9, 10] and Triton [15] for Graphics Processing Units (GPUs), JAX/Pallas [1] for Tensor Processing Units (TPUs), Neuron Kernel Interface (NKI) for AWS Tranium, Triton and Cude DSL for Meta Training and Inference Accelerator (MTIA) is a complex process. It requires extensive hardware expertise, specifically the ability to manually manage memory hierarchies (e.g., HBM versus SRAM/VMEM), orchestrate Direct Memory Access (DMA) pipelining, and derive multi-dimensional tiling strategies.

Several works have shown that kernel generation benefits from test time scaling and agentic techniques across GPUs, TPUs [5, 16], Tranium, NKI [14], MTIA [8], and other accelerators [2, 5]. Standard zero-shot or few-shot LLM approaches need to be augmented with real-time compiler feedback due to the rigidity of accelerator APIs, strict memory constraints, and opaque low-level compiler errors [16]. Furthermore, even when an LLM generates functionally correct code, achieving optimal hardware performance typically requires an iterative process of empirical profiling, often utilizing tools like XProf [6], configuration tuning, frequently changing APIs and context [5, 16], and optimization techniques including evolutionary [11], greedy search [12, 18], and collaborative search [4].

Traditional compiler optimization techniques, such as Halide [13], TVM [3] and Ansor [19], address these complexities by decoupling algorithm definitions from scheduling, yet they still require significant domain knowledge or expensive evolutionary search phases. Recent works, such as

Corresponding author(s): sethusankaran@google.com © 2026 Google. All rights reserved

Figure

Figure 1 | A schematic of the MaxKernel framework outlining the various modalities of operation and tools.

AutoComp [5], have demonstrated the potential of using LLMs to navigate these search spaces for tensor programs, which may critical performance gains by abandoning complex ideas before the code can compile.

To address these challenges, we present MaxKernel, a multi-agent framework designed to automate and accelerate TPU kernel engineering. We benchmark our generated kernels on JAXBench [16] in addition to kernels for state-of-the-art OSS models, evaluating both functional correctness and execution time. While our primary evaluation focuses on TPU development via JAX/Pallas, the underlying agentic principles apply broadly to accelerator programming. MaxKernel supports three distinct orchestration paradigms:

  1. Human-in-the-Loop (HITL): An interactive modality that keeps the human developer in control at critical decision points, ensuring safety and architectural alignment for complex kernels.

  2. Autonomous Loop: An automated, closed-loop agent that continuously iterates through planning, generation, testing, and trace-based hardware profiling to systematically optimize performance.

  3. Graph-Based Autonomous Search: An extension of the autonomous loop that models the kernel design space as a formal search graph. By leveraging different search algorithms (e.g., simple parallel search, beam search, etc), this paradigm conducts a broader exploration to navigate performance trade-offs and avoid local optima.

In summary, our core contributions are as follows.

  1. Modular Multi-Agent Architecture: We introduce MaxKernel, a flexible, multi-agent framework comprising specialized sub-agents capable of writing, debugging, and tuning hardware-specific kernels. This architecture seamlessly integrates with compiler pipelines and empirical profiling tools (e.g., XProf) to provide critical closed-loop hardware feedback to the LLMs.

  2. Versatile Orchestration Paradigms: We detail three distinct execution workflows: Human-in-the-Loop, Autonomous Loop Pipeline, and Graph-Based Autonomous Search. This enables developers to dynamically trade off between manual architectural control, rapid automated iteration, and broad formal design-space exploration.

  3. Rigorous Empirical Evaluation: We evaluate our framework on TPU optimization workloads using the JAXBench benchmark suite and SOTA OSS kernels. MaxKernel successfully bridges the gap between static LLM code generation and high-performance kernel engineering, achieving a 1.58× geometric mean speedup across the JAXBench workloads. Furthermore, on the eight production kernels where human-written kernels exist, MaxKernel achieves a 2.32× geometric mean speedup over the reference code, outperforming human-written ones (2.02×).

References (17)