In this series / On this page· 4 of 4

Megakernels for Decode: What a Kernel Boundary Costs, and When Fusing a Layer Pays

What a kernel boundary costs a decode layer, why SGLang's and vLLM's new fused decode paths save far more than launches, and when fusing pays.

38 min readUpdated

vLLM removed 10 of the 23 kernels in each Kimi K3 decode layer (16 GB300 GPUs, batch 8), and the layer went from 130 to 69 µs. Ten kernel boundaries cost 18 to 40 µs, so most of the 61 µs came from somewhere else, and on most deployments none of it would show up. Whether yours would comes down to one ratio: each GPU's weight-read time per layer against the time its kernel boundaries take.

Where did 61 µs per layer go?

In vLLM's own trace, the kernels that disappeared explain a minority of the saving. The rest is waiting taken off the critical path.

The trace comes from the vLLM team's post on their specialized Kimi K3 decode path: one KDA attention layer plus its MoE block, rank 0 of 16 GB300 GPUs, batch 8. Figure 1 redraws it.

Two kernel timelines of one Kimi K3 decode layer on 16 GB300 GPUs at batch 8, each with a main stream and an auxiliary stream. Stock vLLM: 23 kernels over 130 µs; the main stream runs the attention projections, KDA and an all-reduce, then sits idle for about 47 µs while the expert matrix multiplications FC1 and FC2 run on the auxiliary stream, then finishes with an all-reduce and the up-projection. Specialized decode: 13 kernels over 69 µs; the output projection, all-reduce and residual run as one kernel, the two expert multiplications as one, routing on a side stream and an L2 prefetch stream warming the next weights. A dashed line at 26 µs marks the time each GPU needs to read its share of the layer's weights.Two kernel timelines of one Kimi K3 decode layer on 16 GB300 GPUs at batch 8, each with a main stream and an auxiliary stream. Stock vLLM: 23 kernels over 130 µs; the main stream runs the attention projections, KDA and an all-reduce, then sits idle for about 47 µs while the expert matrix multiplications FC1 and FC2 run on the auxiliary stream, then finishes with an all-reduce and the up-projection. Specialized decode: 13 kernels over 69 µs; the output projection, all-reduce and residual run as one kernel, the two expert multiplications as one, routing on a side stream and an L2 prefetch stream warming the next weights. A dashed line at 26 µs marks the time each GPU needs to read its share of the layer's weights.

The saving is the wait for the experts and the communication stops, not the launches. Bars as read off the vLLM team's trace; their counts are 23 and 13 kernels.

In the stock layer, the main stream runs the attention projections, the KDA kernel and an all-reduce, then waits about 47 µs for the expert multiplications (FC1, then FC2) running on a second stream. A separate kernel then does the all-reduce and norm, another the up-projection with its multicast. The specialized layer changes what each boundary waits for:

  • The output projection, its all-reduce and the residual add run as one kernel. Producers publish partial results into NVLink-accessible buffers, and the consumer starts as soon as its inputs land.
  • FC1 and FC2 run as one kernel. The router scores and the latent input projection, computed whole on every GPU in the stock path, are split across the 16 ranks and exchanged over NVLink, and the shared expert runs on a side stream.
  • A prefetch stream warms L2 with the next weights while the GPUs communicate.
  • Kernels are chained with programmatic dependent launch (PDL, below): a kernel starts its loads before its predecessor ends.

Ten fewer kernels at the 1.8 µs per boundary we measure in the next section save 18 µs; even at a pessimistic 4 µs, 40 µs. (Our measurement comes from a GPU with under a third of a GB300's SMs and much slower memory; no GB300 figure is published, and the 4 µs bound covers the gap.) The other 20 to 43 µs is the stock layer's 47 µs idle wait and its communication stops, collapsed.

Neither layer is anywhere near the memory floor. At batch 8, a Kimi K3 layer reads about 3.3 GB of weights: about 1.2 GB of BF16 attention, shared experts and projections, plus about 120 distinct MXFP4 experts at 17.6 MB each (896 experts, 16 active per token, assuming uniform routing; real prompts change which experts each step reads). Over 16 GPUs that is about 200 MB each, 26 µs at 8 TB/s. The stock layer takes five times that, the fused one 2.7 times. At this size a layer is a latency problem, not a bandwidth problem. Batch 1 says the same from the step times in PR #61867: 7.38 ms per step stock and 3.90 ms fused over 93 layers is at most 79 and 42 µs per layer, against an 11 µs read.

SGLang's low-latency mode makes the point from the other side. On DeepSeek-V4.1-Flash, four GB300s, one request verifying six speculative rows, its NVIDIA plugin took the verify graph from 1,205 to 1,189 kernels, fewer than one per layer, and the median layer from 96.8 to 68.4 µs. The gain came from moving PDL releases earlier, doing the send in the GEMM epilogue, folding RoPE into the query load, and launching the expert GEMM before routing finishes. The kernel count is a proxy; the cost is what each boundary forces the GPU to wait for.

What a kernel boundary costs

A boundary has three costs. The CPU or the graph has to issue the next launch. The GPU drains the last blocks of one kernel while most SMs sit idle, then ramps the next one up while its first loads are in flight. And on several GPUs, a boundary is often where the layer stops to communicate. CUDA graphs remove the first cost, PDL hides part of the second, a persistent kernel trades the second for a grid barrier, and only fusing the send into the producer removes the third.

We measured the first two on one GPU. The microbenchmark runs a chain of N dependent phases that together read W bytes from memory, like the N kernels of one layer reading that layer's weights, in five modes: launched from the CPU on a stream, captured in a CUDA graph, graph plus PDL with each kernel waiting for its predecessor first, graph plus PDL with each kernel reading its own weights first, and one persistent cooperative kernel with grid.sync() between phases. Every mode uses the same grid (288 blocks of 256 threads, all co-resident on its 48 SMs), the reads come from a 1 GiB ring that moves every chain so they hit DRAM rather than L2, and the cost of one boundary is the slope of chain time against N. Setup: a GB10 (DGX Spark), driver 580.173.02, CUDA 13.4, nvcc -O3 -arch=sm_121, 30 October 2026; two full sweeps agreed within 0.07 µs.

Horizontal bars of the cost of one kernel boundary on a GB10 in five launch modes, for empty phases and for phases reading a 32 MiB chain from DRAM. Stream: 2.05 and 3.49 µs. CUDA graph: 0.77 and 1.81 µs. Graph plus PDL, wait first: 0.59 and 1.63 µs. Graph plus PDL, load first: 0.58 and 1.62 µs. Persistent kernel with a grid barrier: 1.04 and 2.05 µs.Horizontal bars of the cost of one kernel boundary on a GB10 in five launch modes, for empty phases and for phases reading a 32 MiB chain from DRAM. Stream: 2.05 and 3.49 µs. CUDA graph: 0.77 and 1.81 µs. Graph plus PDL, wait first: 0.59 and 1.63 µs. Graph plus PDL, load first: 0.58 and 1.62 µs. Persistent kernel with a grid barrier: 1.04 and 2.05 µs.

A graph removes the CPU's share of a boundary; with data, 1.6 to 1.8 µs of draining and ramping remains.

Mode Empty phases 4 MiB chain 32 MiB chain 256 MiB chain
Stream 2.05 µs 4.06 µs 3.49 µs 3.83 µs
CUDA graph 0.77 µs 2.31 µs 1.81 µs 1.49 µs
Graph + PDL, wait first 0.59 µs 1.96 µs 1.63 µs 1.43 µs
Graph + PDL, load first 0.58 µs 1.89 µs 1.62 µs 1.46 µs
Persistent + grid.sync() 1.04 µs 2.44 µs 2.05 µs 1.47 µs

Three things stand out.

A graph halves the boundary, and the half it leaves is on the GPU. With empty phases, a graph replay costs 0.77 µs per kernel against 2.05 µs from the CPU, close to what we measured from PyTorch (0.88 µs from a graph of 1,000 kernels) and to Hazy Research's H100 numbers (2.1 µs from a stream, about 1.3 µs from a graph). Once the phases read memory, the graph's boundary grows to 1.8 µs: that extra microsecond is the drain and the ramp. In bandwidth terms, the 32 MiB chain reaches 239 GB/s in one kernel and 143 GB/s cut into 64 kernels under a graph, 85 GB/s from a stream. The 4 MiB column is the small-kernel case: at N = 64 each phase reads 64 KB, the chain runs at 27 GB/s under a graph, and a boundary costs 1.9 to 2.3 µs.

PDL trims a little, and the order inside the kernel barely matters here. PDL lets the next kernel launch while its predecessor is still running and wait on the device (cudaGridDependencySynchronize()) instead of at the launch. It saves about 0.2 µs per boundary over a plain graph. Reading the weights before the wait, which is what the vendor paths do, was no faster than waiting first in our chain: every mode runs a full-occupancy grid, so the next kernel's blocks only get an SM slot as the previous kernel's blocks exit, and there is little room to overlap. The pattern still matters at scale, where the predecessor is a communication wait of several microseconds rather than a drain:

// scripts/gx10/decode-megakernels/boundary.cu, lines 98-103 (comments ours): mode pdl_load
__global__ void phase_pdl_load(Args a, int k) {
  const unsigned acc = read_slice(a, k);       // this phase's weights: they do not depend on the predecessor
  cudaTriggerProgrammaticLaunchCompletion();   // let the next kernel launch now
  cudaGridDependencySynchronize();             // wait for the predecessor's output before using it
  hand_on(a, k, acc);
}

The launch side is one attribute on cudaLaunchKernelEx (or on the captured node):

// boundary.cu, lines 134-135
attr[0].id = cudaLaunchAttributeProgrammaticStreamSerialization;
attr[0].val.programmaticStreamSerializationAllowed = 1;

A persistent kernel is not free. One launch with a grid barrier between phases cost 2.05 µs per phase at 32 MiB, more than a graph replay (1.81 µs) and PDL (1.62 µs). A barrier makes every block wait for the slowest one, which is the drain under another name. Hazy Research's Llama-1B megakernel gets around it with an on-GPU instruction interpreter and counters per dependency instead of a grid-wide barrier, and still counts 250 of its 600 µs B200 forward pass as store, flag and load latency. A practitioner's megakernel for a 0.6B speech decoder on an RTX 5080 went from 466 launches per token to one and ended 1.65 times slower than vLLM with CUDA graphs. One kernel per step is a design with its own costs, not the end state of fusion.

The team behind that Llama-1B megakernel, now at Together AI, reached the same conclusion (16 November 2026). On an H100, stock torch.compile kernels with CUDA graphs and finely placed PDL reached 975 tokens per second, 98% of their megakernel's 990, "without writing a single kernel". Their boundary costs have the same shape as ours: on an H100, a graph replay at 1,051 ns, graph plus PDL at 645 ns and a cooperative grid.sync() at 1,043 ns, against our 0.77, 0.58 and 1.04 µs with empty phases. Their verdict: megakernels "were the wrong objective for a system to target".

What we could not measure is the third cost. With one GPU, there is no all-reduce to wait for. SGLang's post puts numbers on it for AMD: under HIP graphs, each small kernel "still costs 2-4 µs on the GPU", the compute units idle while kernels drain and ramp, and a layer stops twice for its all-reduces.

To measure your own GPU, download the benchmark as we ran it, boundary.cu, and the fit, slopes.py. Build it for your architecture (-arch=sm_90 on an H100, sm_100 on a B200; PDL needs compute capability 9.0 or newer), run the sweep, and fit the slopes:

nvcc -O3 -std=c++17 -arch=sm_121 -lineinfo boundary.cu -o boundary
./boundary > boundary.csv        # the full sweep: 26 s on our GB10, 1 GiB of GPU memory
python3 slopes.py boundary.csv   # cost per boundary for each mode and chain size

Count it on your engine

Two numbers tell you whether your decode step pays a boundary tax: kernels per layer, and what each boundary costs. Nsight Systems gives you the first directly and hides the second; for it, run the benchmark above on your GPU or use the costs above (1.6 to 2.3 µs per boundary under a graph on our GPU, about 1.3 µs on an H100, 2 to 4 µs per small kernel on an MI355X).

On vLLM, time a run of 1 output token and a run of 65, each in its own NVTX range, so their difference is 64 decode steps. Our script, as run, minus its argument parsing and JSON output:

# decode_trace.py: batch-1 decode under Nsight Systems, vLLM 0.32.0
import statistics, time

import torch
from vllm import LLM, SamplingParams

model, rev = "Qwen/Qwen3-8B", "b968826d9c46dd6066d109eabc6255188de91218"
mode, batch, util = "FULL_AND_PIECEWISE", 1, 0.35               # mode: the default, or "NONE"
llm = LLM(model, revision=rev, gpu_memory_utilization=util, max_model_len=4096, enable_prefix_caching=False,
          max_num_batched_tokens=8192, max_num_seqs=8, seed=0,
          compilation_config={"cudagraph_mode": mode})          # Qwen3.6: add limit_mm_per_prompt={"image": 0, "video": 0}
words = ("The scheduler admits requests while their KV blocks fit in memory and the token budget "
         "allows it, then runs one forward pass for all of them. ") * 60
ids = llm.get_tokenizer()(words)["input_ids"][:512]
prompts = [{"prompt_token_ids": ids} for _ in range(batch)]


def run(n, label, reps=5):
    sp = SamplingParams(max_tokens=n, temperature=0.0, ignore_eos=True)
    llm.generate(prompts, sp, use_tqdm=False)                   # warm-up for this shape
    times = []
    for i in range(reps):
        torch.cuda.synchronize()
        if i == reps - 1:
            torch.cuda.nvtx.range_push(label)                   # only the last repetition is in the range
        t0 = time.perf_counter()
        llm.generate(prompts, sp, use_tqdm=False)
        torch.cuda.synchronize()
        times.append(time.perf_counter() - t0)
        if i == reps - 1:
            torch.cuda.nvtx.range_pop()
    return statistics.median(times)


t1 = run(1, "prefill-only")
tn = run(65, "prefill+decode")
step_ms = (tn - t1) / 64 * 1000
print(f"{step_ms:.2f} ms per decode step")

Run it under Nsight Systems:

$ export VLLM_ENABLE_V1_MULTIPROCESSING=0      # engine core in this process, so the NVTX ranges cover its kernels
$ nsys profile -t cuda,nvtx --cuda-graph-trace=node --sample=none --cpuctxsw=none -o v-q8b-b1 python decode_trace.py
$ nsys stats -r nvtx_pushpop_trace,cuda_gpu_trace -f csv -o v-q8b-b1 v-q8b-b1.nsys-rep

--cuda-graph-trace=node records each kernel inside a replayed graph instead of one bar per graph. NONE keeps torch.compile's fused kernels and drops the graphs (compilation.py). We ran Qwen3-8B at gpu_memory_utilization=0.35 and the MoE model at 0.50: batch 1 needs little KV cache, and the GB10's memory is shared with the operating system.

On SGLang, the benchmark script runs one static batch without a server and starts the profiler itself:

$ nsys profile -t cuda,nvtx --cuda-graph-trace=node --capture-range=cudaProfilerApi --capture-range-end=stop \
    -o s-q8b-b1 python3 -m sglang.benchmark.one_batch --model-path Qwen/Qwen3-8B \
      --revision b968826d9c46dd6066d109eabc6255188de91218 --batch-size 1 --input-len 512 --output-len 64 \
      --mem-fraction-static 0.35 --context-length 4096 --cuda-graph-backend-decode full \
      --profile --profile-activities CUDA_PROFILER --profile-stage decode --profile-start-step 32
$ nsys stats -r cuda_gpu_trace -f csv -o s-q8b-b1 s-q8b-b1.nsys-rep

--cuda-graph-backend-decode takes full (the default), breakable or disabled (cuda_graph_config.py); we traced full and disabled. This capture holds 31 decode steps, not the 16 you might ask for (see Gotchas).

From the kernel trace, count kernels per step and compute busy time as the union of kernel intervals, so kernels overlapping on several streams or under PDL are not counted twice; idle is what is left of the span. For vLLM, the decode steps are the kernels of the prefill+decode range after as many kernels as the prefill-only range holds (same prompt, same engine: those are the prefill step):

# gaps.py: kernels per decode step and idle share, from `nsys stats -r cuda_gpu_trace -f csv`
#   SGLang: python3 gaps.py TRACE.csv STEPS LAYERS
#   vLLM:   python3 gaps.py TRACE.csv 64 LAYERS --nvtx NVTX.csv   (NVTX.csv from `-r nvtx_pushpop_trace`)
import csv, statistics, sys


def kernels(path):
    rows = []
    for r in csv.DictReader(open(path, newline="")):
        if (r.get("Bytes (MB)") or "").strip() not in ("", "0") or r.get("Name", "").startswith("[CUDA mem"):
            continue                                            # memcpy / memset rows
        s = int(float(r["Start (ns)"]))
        rows.append((s, s + int(float(r["Duration (ns)"]))))
    return sorted(rows)


def window(path, name):                                         # last NVTX range ending with `name`
    w = None
    for r in csv.DictReader(open(path, newline="")):
        col = {k.strip().lower().split(" ")[0]: v for k, v in r.items() if k}
        if (col.get("name") or col.get("range", "")).strip().endswith(name):
            w = (int(float(col["start"])), int(float(col["end"])))
    assert w, f"no NVTX range ending with {name!r} in {path}"
    return w


path, steps, layers = sys.argv[1], int(sys.argv[2]), int(sys.argv[3])
rows = kernels(path)
if "--nvtx" in sys.argv:
    nvtx = sys.argv[sys.argv.index("--nvtx") + 1]
    inside = lambda w: [k for k in rows if k[0] >= w[0] and k[1] <= w[1]]
    rows = inside(window(nvtx, "prefill+decode"))[len(inside(window(nvtx, "prefill-only"))):]
busy, (cur_s, cur_e), gaps = 0, rows[0], []
for s, e in rows[1:]:
    if s > cur_e:                                               # a gap closes the current busy interval
        busy += cur_e - cur_s
        gaps.append(s - cur_e)
        cur_s, cur_e = s, e
    else:                                                       # overlap: extend it
        cur_e = max(cur_e, e)
busy += cur_e - cur_s
span = rows[-1][1] - rows[0][0]
print(f"{len(rows) / steps:.1f} kernels per step, {len(rows) / steps / layers:.2f} per layer")
print(f"span {span / steps / 1e3:.0f} us per step, idle {100 * (span - busy) / span:.1f}%, "
      f"median gap {statistics.median(gaps) / 1e3:.2f} us")

nsys stats -o v-q8b-b1 writes v-q8b-b1_cuda_gpu_trace.csv and v-q8b-b1_nvtx_pushpop_trace.csv, so the vLLM run is python3 gaps.py v-q8b-b1_cuda_gpu_trace.csv 64 36 --nvtx v-q8b-b1_nvtx_pushpop_trace.csv, and the SGLang capture above is python3 gaps.py s-q8b-b1_cuda_gpu_trace.csv 31 36.

We ran both engines at batch 1 with a 512-token prompt on the same machine (vLLM 0.32.0 with torch 2.13; SGLang 0.5.22 in lmsysorg/sglang:v0.5.22-cu130-runtime; Nsight Systems 2025.3.2):

Engine and model Decode graphs Step Kernels per step Per layer Idle share Median gap
vLLM, Qwen3-8B BF16 FULL_AND_PIECEWISE 72.8 ms 414 11.5 0.2% 0.10 µs
vLLM, Qwen3-8B BF16 NONE 73.7 ms 414 11.5 1.5% 2.43 µs
SGLang, Qwen3-8B BF16 full 72.9 ms 447 12.4 0.9% 0.19 µs
SGLang, Qwen3-8B BF16 disabled 73.0 ms 447 12.4 1.2% 0.06 µs
vLLM, Qwen3.6-35B-A3B FP8 FULL_AND_PIECEWISE 21.3 ms 1,370 34.3 0.6% 0.13 µs
vLLM, Qwen3.6-35B-A3B FP8 NONE 36.5 ms 1,370 34.3 38.2% 2.72 µs
SGLang, Qwen3.6-35B-A3B FP8 full 19.5 ms 1,351 33.8 5.7% 0.13 µs
SGLang, Qwen3.6-35B-A3B FP8 disabled 36.6 ms 1,352 33.8 49.3% 12.72 µs

vLLM step times are wall time per decode step, untraced for Qwen3-8B (traced runs were 0.002% slower with graphs and 0.13% without) and traced for the MoE model; SGLang's are its own median decode latency. Most of SGLang's 5.7% on the MoE model sits between steps, about 0.7 ms per step where the benchmark loop synchronizes; inside the step it is about 2%. SGLang with graphs disabled shows a smaller median gap than with graphs on for the dense model: its CPU runs far enough ahead that the kernels queue back to back.

The dense model doesn't care. Qwen3-8B reads 386 MB of weights per layer, 1.6 ms at the 241 GB/s this GPU actually reaches (measured in the roofline piece). Its 11.5 kernels per layer at 1.8 µs are about 21 µs, 1% of the layer. Turning graphs off costs 1 ms per step, 2.3 µs per kernel, close to the microbenchmark's stream launch: the CPU keeps ahead of the GPU, and the launches mostly hide behind the weight reads.

The MoE model does. Qwen3.6-35B-A3B reads about 60 MB per layer at batch 1 (nine experts of 3.1 M parameters plus about 32 M of attention, in FP8), 0.25 ms, yet runs 34 kernels per layer, many of them tiny: the median kernel lasts 3 µs, and three quarters of them run under 10 µs. Without graphs, the CPU cannot launch them as fast as the GPU finishes them, and the step goes from 21 to 36 ms. With graphs, an estimate rather than a trace reading: 1,370 boundaries at 1.8 to 2.3 µs (our chain's cost for large and for 64 KB phases) are 2.5 to 3.2 ms of a 21 ms step, 12 to 15%.

Nsight's idle share hides most of it. With graphs on, the trace shows the MoE step 0.6% idle and a median gap of 0.13 µs. The microbenchmark explains why: under a graph, its kernels sit 0.10 µs apart in the trace, yet each boundary costs 1.81 µs. The other 1.7 µs is inside the kernels' own durations, the predecessor draining and the successor ramping, and Nsight counts it as busy. Use the idle share to see the launches the graphs remove; use kernels per layer times a per-boundary cost to see what is left.

When fusing pays: the arithmetic

Compare two times per layer per GPU: the weight read and the boundary budget. Fusion can at best remove the second.

read     = bytes per layer / tensor-parallel GPUs / achievable bandwidth
budget   = kernels per layer × cost per boundary  (+ communication stops)
share    = budget / layer time

Plugged in, with the per-layer bytes from each model's configuration and checkpoint:

Deployment Read per layer per GPU Measured layer
Kimi K3, 16× GB300, batch 1 11 µs ≤ 79 µs stock, ≤ 42 µs fused (vLLM PR)
Kimi K3, 16× GB300, batch 8 26 µs 130 µs stock, 69 µs fused (vLLM trace)
DeepSeek-V4.1-Flash, 4× GB300, verify of 6 rows about 26 µs 96.8 µs stock, 68.4 µs plugin (SGLang profile)
Qwen3-1.7B BF16, one B200 12.6 µs not measured
Qwen3-8B BF16, one B200 48 µs not measured
Qwen3.6-35B-A3B FP8, one GB10 0.25 ms about 0.43 ms (our trace)
Qwen3-8B BF16, one GB10 1.6 ms about 1.9 ms (our trace)

The DeepSeek line counts about 35 distinct FP4 experts of 18.8 MB for six rows, plus about 185 MB of FP8 attention and projections; the two Engram tables, 197 B of its FP8 parameters, are looked up, not read whole. Datacenter rows use the specified 8 TB/s, so their floors are lower bounds; the two single-desktop-GPU rows use the 241 GB/s it reaches, and their layer times are the step time minus the LM head's read (5.2 and 4.2 ms), divided by the number of layers.

Three curves of the share of a decode layer spent at kernel boundaries, for boundary budgets of 10, 20 and 40 µs per layer, against each GPU's weight-read time per layer on a log scale from 3 µs to 3 ms. The share is above 25% for reads under about 30 µs and falls under 5% past 1 ms. Markers along the axis: Kimi K3 at batch 1 and Qwen3-1.7B on a B200 at 11 to 13 µs, Kimi K3 at batch 8 and DeepSeek-V4.1-Flash verify at 26 µs, Qwen3-8B on a B200 at 48 µs, Qwen3.6-35B-A3B on a GB10 at 0.25 ms, Qwen3-8B on a GB10 at 1.6 ms.Three curves of the share of a decode layer spent at kernel boundaries, for boundary budgets of 10, 20 and 40 µs per layer, against each GPU's weight-read time per layer on a log scale from 3 µs to 3 ms. The share is above 25% for reads under about 30 µs and falls under 5% past 1 ms. Markers along the axis: Kimi K3 at batch 1 and Qwen3-1.7B on a B200 at 11 to 13 µs, Kimi K3 at batch 8 and DeepSeek-V4.1-Flash verify at 26 µs, Qwen3-8B on a B200 at 48 µs, Qwen3.6-35B-A3B on a GB10 at 0.25 ms, Qwen3-8B on a GB10 at 1.6 ms.

Fusion pays left of about 100 µs per layer; an 8B model on one desktop-class GPU sits far to the right. A 34-kernel MoE layer has a budget near 60 µs, above the top curve.

Try it with your own numbers. Pick a preset, then change the tensor-parallel size or the bandwidth (the measured time clears, so the bar shows the model alone), or pick another per-boundary cost, and watch the share move:

Interactive widget: boundary-tax. Open this page in a browser with JavaScript to use it.

The rule we would apply: below about 100 µs of weight read per layer per GPU, measure the boundaries; above about 1 ms, keep CUDA graphs on (the default in both engines) and stop. In between, count kernels per layer: a sparse MoE with 30-plus kernels per layer, like Qwen3.6-35B-A3B on our GPU, already spends an estimated 12 to 15% of its step at boundaries.

What moves a deployment left, toward fusion paying: faster memory, more tensor-parallel GPUs (each reads less), sparser MoE, smaller models, small batches. What moves it right: bigger dense models, slower memory, and batching, because a batch shares each weight read and each boundary among more tokens (the Kimi K3 TP16 gain in the PR falls from 1.89 times at batch 1 to 1.79 at batch 8). Speculative verification is the case both vendors tuned for: six to eight rows per step give each kernel more work for a weight read that grows far less than the rows do (a dense model reads the same bytes; DeepSeek-V4.1-Flash reads about 35 experts for six rows instead of 6 for one). The same arithmetic explains why vLLM reports a larger gain at TP16 than at TP8 (1.88 against 1.58 times without speculation): half the bytes per GPU, the same boundaries.

What the widget cannot see is the "other" bar when you enter a measured time: communication waits and small-batch kernels running far below bandwidth. For Kimi K3 at batch 8, 23 boundaries at 1.8 µs are 41 µs of the 130; the read is 26; the remaining 63 µs is that, and it is where most of the vendors' gain comes from. Fewer kernels is how they got at it, not what it was.

What you can turn on today

Neither switch is in a stable release as of 31 October 2026, and both need GB300 GPUs in one NVLink domain.

Engine Switch First in Hardware and parallelism Models
vLLM --additional-config '{"decode_backend": "latency_specialized"}' v0.32.1rc0 and v0.33.0rc0 (Kimi K3, #61867); v0.33.0rc0 (DeepSeek-V4.1-Flash, #61868) GB300 with NVLink multicast; Kimi K3 at TP8 or TP16, DeepSeek-V4.1-Flash at TP4 Kimi K3 (decode batches up to 64, DSpark, decode context parallelism), DeepSeek-V4.1-Flash (up to 384 rows); prefill and mixed batches run the stock path
SGLang --enable-nvidia-megakernel with the sgl-nvidia-mega package main (#44945, merged 19 October, after v0.5.22) GB300 (SM103) DeepSeek-V4.1-Flash TP4, Qwen3.5-397B-A17B TP8, Kimi K3 TP8 (experimental, "does not claim performance"); an unsupported setup stops the server at startup

On AMD, vLLM has a Kimi K3 specialized decode for MI355X (#60683) and an opt-in DeepSeek-V4.1-Flash path (VLLM_ROCM_MONO_DECODE=1, #60397, in v0.32.0); SGLang's sgl-amd-mono runs two persistent launches per layer on MI350X and MI355X.

The vendors' numbers, each with its setup:

  • vLLM, Kimi K3: 842 against 488 decode tokens/s (1.73 times) at batch 1 on 16 GB300s with DSpark speculation and a synthetic acceptance length of 6; 1.58 times (TP8) and 1.88 times (TP16) without speculation. The PR's own tables are tighter: 1.53 to 1.71 times at batches 1 to 8 with that setting, 1.36 to 1.50 times at TP8 with 32k-token real prompts and a synthetic acceptance length of 3.78.
  • vLLM, DeepSeek-V4.1-Flash: the speculative step at batch 1 goes from 5,355 to 4,375 µs (−18.3%) on one GB300 tray at TP4.
  • SGLang, DeepSeek-V4.1-Flash: P90 per-user speed from 671 to 928 tokens/s (1.38 times) with one session on four GB300s, and 1.56 times with four sessions on four MI355Xs, on a replay of agent traffic.

None of this is one kernel per step. vLLM's path still runs 13 kernels per layer, SGLang's NVIDIA plugin hands work between kernels through mailboxes and PDL, and only the AMD path is two persistent launches per layer. Hazy Research's Llama-1B megakernel (May 2025: one persistent kernel with an on-GPU interpreter, 78% of H100 bandwidth at batch 1) and Mirage MPK (a compiler that turns a model into one SM-level task graph, up to 1.7 times lower latency than kernel-per-operator systems) are the research lineage. The 2026 engine paths are its production form: hand-specialized per model, per GPU and per parallelism. The Muse Spark Open kernels below push the same idea one step further on two kinds of hardware.

They are also large. PR #61867 adds 12,805 lines in 50 files, all under vllm/models/kimi_k3/nvidia/, opened and merged within about 10.5 hours. The vLLM team writes that "agent-optimized inference code is outpacing our review and maintenance workflow" and answers with four rules: isolate changes in the model's code, bound the scope while keeping production features, validate correctness systematically, and let contributors run evaluations on their own GPUs (RFC #59665, RFC #61698). SGLang answers with a boundary: kernels live outside the core repository behind a declared interface, checked before weights load. For an operator, the opt-in switch and the fallback are what make these paths safe to try, and the correctness evidence in the PRs (evaluations within about one standard error of stock; for DeepSeek-V4.1-Flash, bitwise-identical collectives over 1,000 replays and a race stress test over 100,000) is what to read before turning them on.

Two megakernels for one model

Two November releases, both for Meta's Muse Spark Open (816B parameters, about 42B active, 62 MoE layers of which 46 use a 2,048-token sliding window), took fusion further than the engine switches above, on two different machines. Both serve one request at a time with speculative verification at tensor parallelism 8: the far left of the curve above, where the rule says fusion pays.

On eight GB300s, one launch per layer. The SGLang team's kernel (LMSYS, 5 November; code in facebookresearch/sgl-muse-mega) runs each layer, from its attention to the next layer's QKV projection, as one kernel of twelve warps per SM with fixed roles: weight loads, KV loads, tensor cores, the exchanges with the other GPUs. A decode step falls from about 1,450 kernels to 97, and from 12.9 to 5.9 ms (verify of 16 drafted tokens 10.9 to 5.3 ms, draft 1.16 to 0.44 ms): 517 to 1,109 tokens per second on GSM8K. Two of their findings sharpen the costs this article measured:

  • They stopped at one kernel per layer on purpose. An SM caches about 128 KB of instructions; their kernels are 215 to 314 KB of machine code. Two 100 KB blocks of code run back to back took 19.5 µs each against 12.4 µs alone, because they kept evicting each other. A whole-model kernel would pay that on every pass, so they keep one launch per layer and read their own code into L2 at the start of every launch.
  • The fence was the hidden boundary. Handing data to another GPU the textbook way (write, fence, set a flag) cost 3.6 to 4.0 µs per fence while the SM had weight loads in flight, about twice our measured kernel boundary. Their fix makes the data its own flag: the receiving buffer starts filled with a value no producer writes (an all-ones NaN in BF16), and the reader polls until every slot has changed.

On one TPU v7 host, one program per step. The SGLang-TorchTPU team (PyTorch blog, 10 November; branch haolin/ms-v11, not yet upstream) run all 62 layers of a decode or verify step as a single Pallas program on each of the host's eight devices. Their starting point is this article's diagnosis on another chip: the previous path, already built from fused blocks, took 2.9 times the time needed to stream its weights, and profiling showed collectives costing about 45 µs per layer while the math cost almost nothing at batch 1. Inside one program, every weight load, KV read and partial sum sent to another device is issued ahead of the compute that needs it. Time per output token fell from 3.78 to 1.95 ms for one request (1.94 times), 1.85 times for two, with the gain narrowing as concurrency grows, which is the curve's prediction: more rows per step share each weight read and each stop.

The two designs disagree on where to stop. A GPU kernel runs from an instruction cache and pays for its own size; a TPU program is scheduled ahead of time by its compiler, so a whole step can be one program. Both are batch-1 numbers from the teams that built them, on hardware few readers have, and neither is in a release.

Gotchas

--cuda-graph-trace=node can perturb what it measures. Tracing each node of a replayed graph adds work per kernel, so take kernel counts from the traced run and step times from an untraced one. On vLLM 0.32.0 with Qwen3-8B the two agreed within 0.002% with graphs on; with graphs off the traced step was 0.1 ms longer (73.80 against 73.71 ms).

--profile-steps is ignored with CUDA_PROFILER in SGLang 0.5.22. In one_batch.py, start_profile returns None in that mode, and the stop condition tests profiler is not None, so the capture runs from the start step to the last decode step. With 64 output tokens and a start at step 32, that is 31 steps, not the 16 we asked for: count steps before dividing: the instances of a once-per-layer kernel in nsys stats -r cuda_gpu_kern_sum, divided by the number of layers, give the steps (31 here).

"Graphs off" in vLLM is two different things. cudagraph_mode: NONE keeps torch.compile's fused kernels and only drops the graphs; enforce_eager also turns off compilation, which changes the kernels themselves. Compare NONE against the default to isolate launch cost.

A fused path that falls back measures nothing. vLLM's covers decode batches up to 64 and hands prefill and mixed batches to the stock path; SGLang's covers fixed row counts per model. A benchmark with chunked prefill mixed in, or a batch above coverage, runs stock code. Check the trace for the fused kernels, and SGLang's startup log for NVIDIA megakernel: active.

Where this leads

The batch-1 verify step is where both fused paths were tuned: speculative decoding explains why a step that checks six tokens costs far less than six steps. The small-batch matrix multiplications that make up the rest of the gap are DeepGEMM's territory.

Sources

  1. Inference EnginesThe Draft's LM Head: What vLLM 0.33's Quantized Copy Saves at Batch 1
  2. Serving in ProductionContext Parallelism for Long-Context Serving: PCP and DCP in vLLM and SGLang
  3. Quantization in PracticeHumming, Measured: One Quantized-Kernel Library Against Marlin and FlashInfer

Inference Notes

Once a week: what changed in serving AI models, and what it means if you build, run or pay for them, in about five minutes.

Read past issues