arXiv:2610.35336cs.PFOct 2026

Manuscript Offprint

arXiv:2610.35336

One Megakernel is Not Enough: Predicting Where to Cut for Streaming Inference

Aditya Chatterjee, Anand Joseph X M, Sanjay Singh Chauhan

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Aditya Chatterjee

NVIDIA

Bangalore, India

adichatterje@nvidia.com

Anand Joseph X M

NVIDIA

Hyderabad, India

anajoseph@nvidia.com

Sanjay Singh Chauhan

NVIDIA

Pune, India

schauhan@nvidia.com

Abstract—A megakernel is a large monolithic kernel that fuses multiple kernels/operators into a single persistent kernel. We show that the best configuration is a composition of multiple megakernels with no overlapping conventional graph component, or a fully conventional graph. We present a framework that selects megakernel regions in a streaming inference model from conventional-graph profiles and standalone kernel benchmarks, without running any candidate design end to end. Across NH-TTS, Qwen3-TTS and Llama-1B, the best composition ranges from zero to four megakernels at different batch sizes. We introduce four model categories (megakernel-stable/ receding/ advancing/ averse) that capture how a model's best megakernel composition changes with batch size. Using NH-TTS model on H100 NVL GPU, we demonstrate that preserving three specialized megakernels can improve both latency and throughput despite introducing additional kernel boundaries.

Index Terms—ML inference, Megakernel, Kernel fusion, GPU performance modeling

I. INTRODUCTION

Time to First Audio (TTFA)/Time to First Token (TTFT), Inter-Token Latency (ITL)/Inter-Chunk Latency (ICL) and Throughput (RTFx)/Realtime Factor (RTF) are the key metrics for real-time serving of streaming inference models. So long as the RTFx is greater than 1, the overall latency of the response is dictated by the TTFA / TTFT. Minimizing TTFA/TTFT is critical in applications that support bidirectional streaming (input and output). Being able to serve requests at the maximum batch size while keeping these metrics within acceptable limits is critical for real-time serving.

A megakernel fuses multiple operators into one persistent kernel whose thread blocks stay resident on the GPU and hand-over work to one another without returning to the host. Large Language Models (LLMs) operate in two phases per request - prefill (run once) and decode (run autoregressively token by token). Existing megakernel designs usually fuse the decode phase and leave prefill to conventional execution or out of scope. In [1] up to 1.7×1.7\times lower per-token latency than vLLM [2] and SGLang [3] is reported for small-batch LLM decoding. Multi-modal models like text-to-speech (TTS) operate in multiple phases. A TTS model runs prefill once per request, an autoregressive producer once per step, a local transformer N times per step and an audio codec once per chunk of frames. These phases run at different rates and prefer different thread-block shapes. These phase differences make fusion boundaries a performance choice. Each cut decides which phases share one launch configuration, how long thread blocks stay held and how the phases share the GPU.

We evaluate an upcoming autoregressive TTS model with a Nemotron-H backbone [4] denoted as NH-TTS in this paper. Figure 1 shows the six representative NH-TTS layouts at batch size 32. For NH-TTS at batch 32, Figure 2 shows that the three-megakernel design publishes the first audio 4.05×4.05\times sooner than the conventional TensorRT [5] pipeline and 21.4% sooner than a single megakernel for the whole model. Across 13 combinations of model and batch size on three frameworks, the best tested design uses anywhere from zero to four megakernels. Qwen3-TTS [6] needs four up to batch 32 and none from batch 48, where the same cuts make it slower. Guessing is costly: for NH-TTS and Qwen3-TTS, the next-best layout is 3 to 29% slower than the best.

NH-TTS: where should megakernel boundaries go?

Figure

Fig. 1. Six representative NH-TTS layouts from the 81-candidate design space. The three-megakernel design with the lowest measured first-publication latency at batch 32 on H100 NVL is highlighted.

Three megakernels outperform one monolith megakernel

NH-TTS · batch 32 · H100 NVL · 3 MK: dynamic 88/44 CTA split

Mean batch p95 first publication (ms)

Lower is better

-21.4% vs. 1 MK

Figure

Throughput (RTFx)

Higher is better

+28.0% vs. 1 MK

Fig. 2. TTFA and RTFx for NH-TTS at batch size 32 with the selected three-megakernel design

Exhaustively implementing and timing compositions is costly: our NH-TTS search contains 81 candidates. We address first-publication-aware selection among supported implementations by combining compatible service measurements with persistent resource lifetimes and streaming publication dependencies.

We present a boundary planner that ranks supported compositions using conventional-graph profiles, operator benchmarks and source-declared implementation contracts. These contracts specify geometry, storage, compiled-entry membership and synchronization. The planner combines their costs with streaming dependencies to select boundaries and sharing policies without timing candidate compositions end to end.

We evaluate the planner on H100 NVL GPU with three models on three frameworks: NH-TTS (TensorRT), Qwen3-TTS (vLLM [2]) and Llama (PyTorch [7]). We show that the planner selects the measured best design in all 13 model-batch cases.