Introduction
The rapid proliferation of novel AI accelerators has introduced a critical bottleneck in the hardware development lifecycle: the programmability wall. Every new AI chip features a unique Instruction Set Architecture (ISA) and a complex memory hierarchy. To harness their full potential, developers must manually craft "kernels"—highly optimized, low-level assembly code for fundamental operations like matrix multiplications and activations.
This manual process is notoriously slow, error-prone, and unscalable across diverse hardware targets. Furthermore, traditional compilers suffer from a "cold-start" problem, lacking the maturity to extract maximum performance from brand-new architectures. KernelCraft introduces the first benchmark designed to evaluate whether Large Language Model (LLM) agents can bridge this gap by autonomously generating and optimizing low-level kernels for customized accelerators.
An Agentic, Feedback-Driven Workflow
Rather than relying on single-pass code generation, KernelCraft evaluates LLMs using an agentic, tool-use-based "diagnosis-and-repair" loop. The agent acts as a systems programmer:
- Input: The agent is provided with a task description, the hardware's ISA specification manual, and specific hardware configurations (e.g., memory constraints).
- Action: It utilizes native tools to write assembly (
write_code), validate syntax (check_syntax), and test the code on a simulator or actual hardware (run_evaluation). - Feedback: If the execution fails, the agent can inspect memory diffs (
view_output) or search the documentation for specific instruction semantics (grep_docs). - Refinement: The agent iteratively reasons about errors and refines the code until it achieves functional correctness and optimal performance.
The KernelCraft Benchmark
To rigorously test these capabilities, the KernelCraft Benchmark encompasses:
- 33 Diverse Tasks: Comprising 23 Machine Learning operations and 10 CPU-specific tasks.
- Three Complexity Levels: Ranging from Level 1 (primitives like ReLU and GEMM) and Level 2 (composite logic like Attention and LayerNorm) to Level 3 (end-to-end blocks like Transformer Decoders).
- Four Hardware Targets: Three emerging Neural Processing Units (PLENA, AMD NPU, Coral NPU) and one high-performance RISC-V CPU (Sonic BOOM).
Key Insights and Performance Breakthroughs
The evaluation of leading reasoning models on KernelCraft yielded several compelling insights into the current state of AI-driven systems programming:
- Outperforming Traditional Compilers: In multiple instances, agent-generated kernels significantly outperformed manufacturer compilers. Notably, on the Coral NPU
ConvBlocktask, an agent achieved a 7.93x speedup over the compiler baseline by autonomously discovering "BatchNorm folding"—an optimization that fused normalization into integer arithmetic. - Strong Success Rates: The strongest evaluated model, GPT-5.2, achieved a 56% success rate on the PLENA accelerator and 47% on the Coral NPU. On standard RISC-V CPU tasks, agents successfully generated kernels that matched or exceeded the performance of the mature
gcc -O2compiler. - The Necessity of "Thinking": Extended reasoning capabilities (utilizing "thinking tokens") proved non-negotiable for low-level programming. Without extended reasoning, models frequently failed to resolve complex address mapping issues or terminated prematurely.
- Documentation as a Bottleneck: An agent's success was highly correlated with the quality and comprehensiveness of the provided ISA documentation. While agents demonstrated zero-shot capabilities, providing just one in-context example of a related kernel drastically improved success rates on less-documented hardware.
- Hardware-Software Co-Design: In a fascinating case study, an agent identified inefficiencies in an existing ISA and proposed novel instructions (such as
V_RED_MAX_IDX) to accelerate specific ML workloads, showcasing the potential for LLMs to assist in ISA co-design.
Limitations and the Path Forward
Despite these breakthroughs, fully autonomous kernel generation remains an unsolved challenge for highly complex operations. Level 3 (end-to-end) tasks proved exceedingly difficult, with only one successful kernel generated across all evaluations. Additionally, while agents can beat immature compilers, they still lag behind human experts in crafting highly complex, pipelined operations like depthwise convolutions.
Future advancements in this domain will likely require:
- Formal Verification: Transitioning from empirical numerical validation to generating formal mathematical proofs of kernel correctness.
- Persistent Memory Mechanisms: Enabling agents to retain "lessons learned" across multiple refinement iterations to improve efficiency and reduce token costs.
- Model Fusing: Directly embedding low-level ISA knowledge into the model's weights, reducing the reliance on massive system prompts and documentation parsing.
KernelCraft demonstrates that agentic LLM systems hold immense potential to shatter the programmability wall, accelerating the time-to-market for the next generation of AI hardware.
Summary updated