AutoMegaKernel: A Statically-Checked Agent Harness for Self-Retargeting Megakernel Synthesis
Not on the map. Why?
Abstract (arXiv)
AutoMegaKernel (AMK) compiles a HuggingFace Llama-family model into a single persistent cooperative CUDA kernel that runs the whole forward pass in one launch, with no per-model hand-written CUDA. The contribution is the system, not raw speed. A frozen schedule-IR validator statically certifies deadlock-freedom and race-freedom via static graph checks (not a mechanized proof), so an unsafe agent-proposed schedule is rejected before launch: across 7,160 adversarial schedules (6,091 unsafe) it had zero false-accepts and accepted all 360 real lowerings. The same source retargets sm_80/sm_90/sm_120 from one codebase, auto-generates correct megakernels for 10 of 10 supported models, and on a real SmolLM2-135M checkpoint reproduces HuggingFace greedy decode token-for-token (perplexity match 2.5e-7). An unattended, agent-drivable autoresearch loop self-improves the megakernel over its own baseline (1.25-1.72x). A search-found int8 (W8A16) megakernel beats CUDA-graphed cuBLAS bf16 at batch-1 decode across NVIDIA's datacenter inference fleet: L4 up to 1.33x, the current-gen L40S 1.25-1.27x, A10G up to 1.08x at scale, and the consumer RTX 5090 1.19-1.23x. The ordering is not a clean function of bandwidth (the 864 GB/s L40S beats the 600 GB/s A10G); the divide is inference-class vs training-class. AMK trails cuBLAS on the high-bandwidth training-class A100/H100, where the harness localizes the cross-SM-sync bottleneck; we report the gap plainly. This is a precision-asymmetric (W8A16 vs bf16) comparison at decode position 0; the largest real checkpoint is TinyLlama-1.1B. Code and the harness: https://github.com/RightNow-AI/AutoMegaKernel
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 16 of its 30 references that are in the map. First posted on arXiv 8 Jun 2026.
Builds on
16 of 30 references.
References · 16
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,767
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,551
- 2022Fast Inference from Transformers via Speculative Decodingcited by 1,615
- 2023SGLang: Efficient Execution of Structured Language Model Programscited by 1,107
- 2023Accelerating Large Language Model Decoding with Speculative Samplingcited by 975
- 2024Medusa: Simple LLM Inference Acceleration Framework with Multiple Decoding Headscited by 821
- 2024EAGLE: Speculative Sampling Requires Rethinking Feature Uncertaintycited by 564
- 2024FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precisioncited by 507
- 2020Ansor: Generating High-Performance Tensor Programs for Deep Learningcited by 199
- 2018Learning to Optimize Tensor Programscited by 138
- 2024MARLIN: Mixed-Precision Auto-Regressive Parallel Inference on Large Language Modelscited by 48
4 more
- 2024ThunderKittens: Simple, Fast, and Adorable AI Kernelscited by 34
- 2022Hidet: Task-Mapping Programming Paradigm for Deep Learning Tensor Programscited by 28
- 2025MPK: A Compiler and Runtime for Mega-Kernelizing Tensor Programscited by 14
- 2026AutoKernel: Autonomous GPU Kernel Optimization via Iterative Agent-Driven Searchcited by 14
Built on by
Not cited yet.