---
title: "Last year we built megakernels. This year we deleted them: The road to Together Compiler"
description: "Megakernels for Llama 1B hit 990 TPS on H100 but were too inflexible to productionize, supporting only one model, batch size and precision."
url: "https://swe.quest/articles/last-year-we-built-megakernels-this-year-we-deleted-them-the-road-to-together-8e97dcf4bda731c8"
canonical: "https://www.together.ai/blog/road-to-together-compiler"
source: "Together AI"
published: "2026-11-16"
difficulty: "hard"
kind: "Deep dive"
reading_minutes: 28
tags: ["compilers","inference","performance","hardware"]
---

# Last year we built megakernels. This year we deleted them: The road to Together Compiler

A post on [Together AI](https://swe.quest/sources/together.md), published 2026-11-16, 28 min read, Deep dive. Original: [https://www.together.ai/blog/road-to-together-compiler](https://www.together.ai/blog/road-to-together-compiler)

## Summary

Megakernels for Llama 1B hit 990 TPS on H100 but were too inflexible to productionize, supporting only one model, batch size and precision. Applying CUDA Graphs plus Programmatic Dependent Launch (PDL) to default Torch Inductor kernels recovers 98% of that performance with no hand-written kernels, and agent-driven "multi-kernels" beat the old megakernels by up to 1.7x, exceeding 1100 TPS. The analysis also shows where Inductor falls short: workload-dependent flag effects across 607 config options, misleading isolated benchmarks (L2 flushes, zeroed inputs, CPU launch overhead in timings), and greedy pairwise fusion that ignores SM utilization. These findings shaped Together Compiler, a system that searches the optimization space and measures kernels inside real forward passes on real data.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Compilers](https://swe.quest/tags/compilers.md) (Compilers & runtimes)
- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Hardware](https://swe.quest/tags/hardware.md) (Infrastructure)

## Prerequisites

- CUDA kernel execution model ([easy posts on Operating systems](https://swe.quest/tags/operating-systems.md?difficulty=easy))
- PyTorch and torch.compile
- GPU memory hierarchy ([easy posts on Hardware](https://swe.quest/tags/hardware.md?difficulty=easy))
- LLM decode inference ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))

## Keywords

Together Compiler, Torch Inductor, CUDA Graphs, PDL, Megakernels, Llama 1B, H100, Triton

## Related posts

- [Custom Kernels for All from Codex and Claude](https://swe.quest/articles/custom-kernels-for-all-from-codex-and-claude-9d652cbc33fa9001.md): Hugging Face · 2026-02-13 · Medium · 9 min read · AI for coding, Performance engineering, Inference & serving, Hardware, Python
  Hugging Face packaged CUDA kernel expertise (GPU architecture guides for H100/A100/T4, diffusers and transformers integration patterns, vectorized kernel templates, benchmark scripts) into an agent skill that lets Claude and Codex generate complete kernel-builder projects with PyTorch bindings.
- [Key research and product announcements at the AI Native Conf](https://swe.quest/articles/key-research-and-product-announcements-at-the-ai-native-conf-07f3b657efde83f0.md): Together AI · 2026-03-05 · Hard · 7 min read · Inference & serving, Hardware, Model training, AI agents, Performance engineering
  Together AI announced seven research and product releases spanning GPU kernels, reinforcement learning infrastructure and inference optimization.
- [Together Compiler: Continual Compilation for AI inference](https://swe.quest/articles/together-compiler-continual-compilation-for-ai-inference-d1283db901cce6b0.md): Together AI · 2026-11-04 · Hard · 6 min read · Inference & serving, Compilers, AI agents, Performance engineering
  Together Compiler (TKCC) is an agent-driven continual optimization loop that recompiles inference engines as model, hardware and traffic shape drift.
- [ParallelKernelBench: Frontier LLMs can't write fast multi-GPU kernels (yet)](https://swe.quest/articles/parallelkernelbench-frontier-llms-can-t-write-fast-multi-gpu-kernels-yet-416eb937565c8218.md): Together AI · 2026-06-23 · Hard · 10 min read · AI for coding, Evaluation, Hardware, Performance engineering, Distributed systems
  ParallelKernelBench is a benchmark of 87 multi-GPU problems drawn from Megatron-LM, DeepSpeed, DeepEP, TensorRT-LLM, NeMo-RL and non-LLM workloads.
- [KernelEvolve: How Meta’s Ranking Engineer Agent Optimizes AI Infrastructure](https://swe.quest/articles/kernelevolve-how-meta-s-ranking-engineer-agent-optimizes-ai-infrastructure-d31b329bdf84a06a.md): Meta Engineering · 2026-04-02 · Hard · 14 min read · AI agents, Performance engineering, Hardware, Compilers, Recommendations & ranking
  KernelEvolve is Meta's agentic kernel-authoring system that treats kernel optimization as a search problem instead of one-shot LLM code generation.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
