KernelCraft: Benchmarking for Agentic Close-to-Metal Kernel Generation on Emerging Hardware

Jiayi Nie*1, Haoran Wu*1, Yao Lai1, Zeyu Cao1, Cheng Zhang2, Binglei Lou2,
Erwei Wang3, Jianyi Cheng4, Timothy M. Jones1, Robert Mullins1, Rika Antonova1, Yiren Zhao2
1University of Cambridge 2Imperial College London 3AMD 4University of Edinburgh
*Equal Contribution
KernelCraft Overview

Overview of KernelCraft. Generation tasks span three levels of workloads: primitive operations, composite operations, and end-to-end systems. The LLM agent receives task descriptions, ISA specifications, and hardware configurations as inputs, and iteratively refines kernels using tool-based feedback.

Abstract

New AI accelerators with novel instruction set architectures (ISAs) often require developers to manually craft low-level kernels — a time-consuming, laborious, and error-prone process that cannot scale across diverse hardware targets. This prevents emerging hardware platforms from reaching the market efficiently. While prior LLM-based code generation has shown promise in mature GPU ecosystems, it remains unclear whether agentic LLM systems can quickly produce valid and efficient kernels for emerging hardware with new ISAs.

We present KernelCraft: the first benchmark to evaluate an LLM agent's ability to generate and optimize low-level kernels for customized accelerators via a function-calling, feedback-driven workflow. Within KernelCraft, the agent refines kernels under ISA and hardware constraints using automated feedback derived from compilation checks, simulation, and correctness validation against ground truth. In our experiments, we assess agent performance across three emerging accelerator platforms on more than 20 ML tasks, each with 5 diverse task configurations, with special evaluation of task configuration complexity. Across four leading reasoning models, top agents produce functionally valid kernels for previously unseen ISAs within a few refinement steps, with optimized kernels that match or outperform template-based compiler baselines. With that, we demonstrate the potential for reducing the cost of kernel development for accelerator designers and kernel developers.

Benchmark Framework

KernelCraft Benchmark Flow

Diagnosis-and-repair loop. Starting from workload/ISA/hardware specifications, the agent writes an assembly kernel that is automatically verified using syntax checks and reference-based functional checks. When mismatches are detected, KernelCraft performs memory-level diff diagnostics and feeds signals back to the agent for iterative patching.

Hardware Platforms

KernelCraft evaluates across three emerging accelerator platforms with diverse ISAs:

Platform ISA Type Toolchain Execution
PLENA Custom NPU ISA PLENA Compiler Simulator
AMD NPU Custom NPU ISA Peano Compiler Hardware
Coral NPU RISC-V + RVV RISC-V Compiler Verilator RTL

Results

We evaluate four frontier reasoning models across 3 accelerator platforms, totalling over 1,100 experiments. Each task is evaluated on 5 configurations; cells show successful/total within the iteration budget per level (15, 20, and 25 iterations for Levels 1–3).

Success Rates

ID Task PLENA AMD NPU Coral NPU
GPT-5.2Gemini-3Sonnet 4DS-R1 GPT-5.2Gemini-3Sonnet 4DS-R1 GPT-5.2Gemini-3Sonnet 4DS-R1
Level 1: Primitive Operations (Max 15 iterations)
1SiLU5/55/52/50/51/51/50/50/53/53/50/50/5
2ReLU2/50/51/50/52/51/50/50/55/54/51/50/5
3GELU4/54/51/50/51/52/50/50/55/55/50/50/5
4Softmax5/53/54/50/50/50/50/50/54/52/50/50/5
5LayerNorm3/55/52/50/52/51/50/50/51/50/50/50/5
6RMSNorm3/55/51/51/51/50/50/50/51/51/50/50/5
7GEMV5/52/51/50/52/51/50/50/54/55/50/50/5
8GEMM4/52/50/50/54/53/52/51/52/54/51/51/5
9BatchMatMul2/52/50/50/50/50/50/50/50/50/50/50/5
10Linear4/52/50/50/53/52/51/50/52/50/50/50/5
11Conv2D--0/50/50/50/52/51/50/50/5
12DepthwiseConv--0/50/50/50/55/53/50/50/5
Level 1 Subtotal37/5030/5012/501/5016/6011/603/601/6034/6028/602/601/60
Level 2: Composite Operations (Max 20 iterations)
13RoPE0/50/50/50/50/50/50/50/5--
14FFN3/52/50/50/52/51/50/50/51/50/50/50/5
15SwiGLU4/50/50/50/50/50/50/50/50/50/50/50/5
16ScaledDotProduct3/52/50/50/51/50/50/50/5--
17FlashAttention3/51/50/50/5----
18MHA3/50/50/50/50/50/50/50/5--
19GQA1/50/50/50/50/50/50/50/5--
20MQA1/50/50/50/50/50/50/50/5--
Level 2 Subtotal18/405/400/400/403/351/350/350/351/100/100/100/10
Level 3: End-to-End System (Max 25 iterations)
21ConvBlock--0/50/50/50/50/51/50/50/5
22DecoderBlock (LLaMA)0/50/50/50/50/50/50/50/5--
23DecoderBlock (T5)0/50/50/50/50/50/50/50/5--
Level 3 Subtotal0/100/100/100/100/150/150/150/150/51/50/50/5
Total55/10035/10012/1001/10019/11012/1103/1101/11035/7529/752/751/75

-- = Not officially supported by the platform. Each task evaluated on 5 configurations.

Kernel Performance

Speedup of best KernelCraft agent's kernels over compiler baselines on representative workloads across three accelerator platforms (PLENA: native compiler, Coral: RVV -O2, AMD: Peano).

Performance speedup results

Coral NPU exhibits the largest gains (2–8x on GEMV, GEMM, ConvBlock). PLENA normalization tasks achieve consistent 1.06–1.22x speedups. AMD NPU results cluster tightly around baseline (0.89–1.18x).