git404hub

what is automegakernel fr?

rightnow-ai/automegakernel — explained in plain English

Analysis updated 2026-07-18

33PythonAudience · researcherComplexity · 5/5Setup · hard

tl;dr

A Python toolkit that fuses an entire LLM's forward pass into one CUDA megakernel, speeding up single-request inference on GPUs like the L4 and L40S by avoiding repeated memory round-trips.

vibe map

mindmap
  root((automegakernel))
    What it does
      Fuses GPU kernels
      Speeds single request inference
      Targets Llama models
    Tech Stack
      Python
      CUDA
      MCP server
    Use Cases
      Speed up voice assistants
      Speed up AI agents
      Auto-tune kernels
    Audience
      Researchers
      ML engineers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

what do people make with this?

VIBE 1

Speed up single-request, low-batch inference for voice assistants or real-time AI agents on inference-class GPUs.

VIBE 2

Compile a HuggingFace Llama model's forward pass into one fused CUDA kernel instead of many separate launches.

VIBE 3

Use the built-in MCP server and validator to safely try automated schedule changes without risking a GPU deadlock.

VIBE 4

Run an unattended autoresearch session to squeeze extra performance out of a megakernel's schedule.

what's the stack?

PythonCUDAHuggingFace

how it stacks up fr

rightnow-ai/automegakernel410979729/scope-recallarahim3/mlx-dspark
Stars333333
LanguagePythonPythonPython
Setup difficultyhardmoderateeasy
Complexity5/53/53/5
Audienceresearcherdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

how do i run it?

Difficulty · hard time til it works · 1day+

Requires a CUDA GPU (sm_75 to sm_120) and is currently limited to the Llama model family.

in plain english

AutoMegaKernel (AMK) is a Python toolkit that compiles the entire forward pass of a large language model into a single CUDA kernel, called a megakernel, instead of launching many separate GPU operations for each token generated. Currently it works with HuggingFace Llama models. The goal is to reduce the overhead that accumulates when activation data has to be written back to GPU memory between every operation. In a standard setup, generating each token triggers many separate GPU kernel launches, one per layer operation, and results travel through high-bandwidth GPU memory (HBM) between them. A megakernel keeps the whole computation in fast on-chip memory and prefetches the next layer's weights while the current layer computes. This matters most for single-request, low-batch inference: voice assistants, real-time tools, and AI agents. AMK does not claim to beat throughput-optimized servers handling many requests at once. The performance results show AMK's int8-quantized megakernel outperforming NVIDIA's cuBLAS library at batch-1 decode on inference-class GPUs: the L4 and L40S GPUs see speedups of 1.18 to 1.33 times compared to cuBLAS running at full bf16 precision. On training-class GPUs like the A100 and H100, AMK trails cuBLAS, and the README states this plainly. The win on inference GPUs comes from reading fewer bytes (int8 loads half the data of bf16), not from a better-performing kernel at the same precision. A coding agent (Claude Code or Codex) drives the system through a structured interface: an MCP server, commands, and a schedule validator that checks proposed changes before they touch the GPU. The validator rejected zero unsafe schedules across 7,160 adversarial tests. When a proposed change would cause a deadlock or race condition, it is rejected at validation time rather than hanging the GPU. An unattended 10-minute autoresearch run improved the megakernel's performance 1.47 times over its starting schedule. Coverage today is the Llama model family on CUDA (sm_75 through sm_120). The README notes that broadening to more model families, hardware targets, and programming languages is the central direction of future work.

prompts (copy fr)

prompt 1
Walk me through compiling a HuggingFace Llama model into a megakernel using AutoMegaKernel.
prompt 2
Explain why AMK's int8-quantized megakernel beats cuBLAS on the L4 and L40S but trails it on the A100 and H100.
prompt 3
Show me how the schedule validator in this repo prevents deadlocks or race conditions before a change touches the GPU.
prompt 4
Help me set up the MCP server so a coding agent can drive AutoMegaKernel's optimization process.
prompt 5
How would I run an unattended autoresearch session with AutoMegaKernel to improve my model's decode speed?

Frequently asked questions

what is automegakernel fr?

A Python toolkit that fuses an entire LLM's forward pass into one CUDA megakernel, speeding up single-request inference on GPUs like the L4 and L40S by avoiding repeated memory round-trips.

What language is automegakernel written in?

Mainly Python. The stack also includes Python, CUDA, HuggingFace.

How hard is automegakernel to set up?

Setup difficulty is rated hard, with roughly 1day+ to a first successful run.

Who is automegakernel for?

Mainly researcher.

peek the repo → explain another one

This repo across BitVibe Labs

double-check against the repo, no cap.