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

arXiv:2609.04523 · 2026-09-07 공개 · arXiv · PDF

llm human-in-the-loop multi-agent-system autonomous-agent compiler-feedback accelerator-optimization tpu kernel-generation

Abstract

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 https://github.com/AI-Hypercomputer/accelerator-agents/tree/main/MaxKernel.

한국어 요약

한 줄 요약

MaxKernel은 TPU 커널 최적화를 위한 3가지 에이전트 패러다임을 갖춘 시스템으로, JAXBench에서 1.58× 평균 가속을 달성한다.

핵심 기여도

핵심 아이디어

MaxKernel은 TPU 커널 개발의 복잡성을 해결하기 위해 **LLM과 실시간 컴파일러 피드백을 결합한 에이전트 기반 시스템**을 제안한다. 기존 커널 개발은 수작업으로 메모리 계층 관리, DMA 파이프라인 조율, 타일링 전략 도출 등이 필요했으며, LLM만으로는 API의 빠가르기, 메모리 제약, 불투명한 컴파일 오류로 인해 한계가 있었다. MaxKernel은 이 문제를 해결하기 위해 **3가지 패러다임**을 도입한다:
1. **HITL (Human-in-the-Loop)**: 인간 개입이 필요한 핵심 결정 시점에서 개발자와 협업.
2. **Auto (Autonomous Loop)**: 계획, 생성, 테스트, 하드웨어 프로파일링을 반복하는 자동화된 최적화 루프.
3. **Graph-Based Autonomous Search**: 커널 설계 공간을 그래프로 모델링하여 **광범위한 탐색**을 수행.

이 시스템은 **공유된 하위 에이전트 풀**을 통해 **계획, 구현, 자가 디버깅, 테스트, 하드웨어 프로파일링**을 처리하며, XProf와 같은 도구와 통합되어 실시간 피드백을 제공한다.

기술적 접근법

주요 결과

의의 및 한계

MaxKernel은 **LLM 기반 커널 생성과 하드웨어 최적화 간의 격차를 해소**하는 데 기여하며, **TPU 최적화 작업의 자동화와 가속화**를 가능하게 한다. 특히, **XProf 기반 실시간 피드백**과 **그래프 기반 탐색**을 통해 **로컬 최적점 탈출**과 **광범위한 설계 공간 탐색**이 가능하다는 점에서 학술적·실용적 가치가 있다.

하지만, **에이전트의 탐색 전략**은 여전히 제한적일 수 있으며, **다양한 하드웨어 아키텍처에 대한 확장성**은 추가 연구가 필요하다. 또한, **LLM의 생성 불확실성**은 여전히 존재하며, **정확한 하드웨어 프로파일링과 조합된 정책 개선**이 필요하다.

실용적 활용

MaxKernel은 **TPU 기반 딥러닝 모델의 커널 최적화**, **고성능 컴퓨팅 분야의 커스텀 가속기 개발**, **LLM 및 대규모 모델의 효율적 실행**에 적용 가능하다. 특히, **JAX/Pallas 기반 개발 환경**에서 실용적 활용이 높으며, **소프트웨어-하드웨어 통합 최적화**를 필요로 하는 산업 분야에 유용하게 사용될 수 있다.