Skip to content
inference.academy

glossary/compute/megakernel

Megakernel

also persistent kernel

A single GPU kernel that runs an entire decode step, with every operation expressed as tasks that the streaming multiprocessors pull from a queue and fine-grained counters standing in for kernel boundaries. A normal step launches dozens of kernels, and each boundary drains the pipeline, leaves idle SMs at the end of a wave and forbids the next operation from prefetching its weights. A megakernel removes the boundaries, which is worth most exactly where decode is worst: small batches, where the step is bound by reading the weights and every bubble is bandwidth thrown away.


39% to 62%

Of the bandwidth speed of light on one H100 for a 30B-parameter, 3.3B-active model at batch 1, vLLM against Cohere's megakernel; 185 to 292 tokens a second.


Related