techlist.io

Kernel Optimization

2 posts

OpenAI2026-07-283 min readCurated summary

How GPT-5.6 fuses frontier intelligence with frontier efficiency

# How OpenAI Built GPT‑5.6 to Balance Frontier Intelligence and Efficiency OpenAI designed the GPT‑5.6 model family to deliver top-tier capability at lower cost across the range of tasks people use its models for. The flagship GPT‑5.6 Sol outperforms Claude Fable 5 on the Artificial Analysis Coding Agent Index at less than half the cost, while the mid-tier Terra matches GPT‑5.5 on intelligence benchmarks at half the price. The gains come from optimizing every layer of the stack: the models themselves, inference, and the agentic harness that powers Codex and ChatGPT Work. ## Efficiency as a System-Wide Goal - OpenAI reports serving 1 billion active users and more than 2 million businesses, which makes efficiency central to distributing intelligence broadly. - GPT‑5.6 is trained to get more work done per token, optimizing for both task success and efficiency so the model takes a more direct path through a task. - The family spans three price points: Sol (flagship), Terra (mid-tier, half the price of GPT‑5.5 with similar benchmark results), and Luna (fastest and cheapest, priced 80% below Sol). ## Accelerating Inference with GPT‑5.6 Sol Inference is optimized as a whole system, since a efficient model can still be costly to serve if requests are routed poorly or hardware sits idle. GPT‑5.6 Sol, running in Codex, helped with much of this work. - **Load balancing:** Requests are routed globally by geography, available capacity, and accelerator type, then distributed within clusters by load, context length, and cache availability. Sol analyzed production traffic, found overlooked imbalances, and tested routing strategies. These changes alone significantly reduced serving costs. - **Kernel optimization:** Sol rewrote and optimized production GPU kernels in Triton and Gluon, reducing end-to-end serving costs by 20%. OpenAI used its open-source FpSan (Floating-Point Sanitizer) to verify kernel correctness. - **Speculative decoding:** Sol redesigned its own draft model through hundreds of experiments on size, structure, and features. It also launched and monitored the speculator training run, handling hardware failures and training instability on its own. Token-generation efficiency improved by more than 15%. - **Workload-specific configuration:** Batching, sharding, and KV cache management depend on prompt length, output length, batch size, and cache hit rate. Sol generated and evaluated candidate configurations against production workloads, which made per-scenario tuning practical. ## Reducing Repeated Work in the Agentic Harness A single user turn in Codex or ChatGPT Work can involve dozens of model requests and tool calls, so any overhead in the repeated loop gets multiplied. The harness, a Rust orchestration layer, addresses this in two main ways. - **Avoiding context bloat:** Deferred discovery surfaces integrations, custom MCP tools, skills, and plugins only when needed. Tool output is capped at 10,000 tokens by default unless the model requests more. - **Preserving prompt-cache prefixes:** Model-visible history is append-only, so new messages and tool results go at the end rather than into earlier context. Tools are presented in a deterministic order, and runtime settings such as approval policies are applied during execution rather than embedded in tool definitions. This design contributes to high prompt-cache hit rates in both products. OpenAI describes these efficiency gains as the product of compounding improvements across research, inference, and the harness. It expects the pace of optimization to accelerate as GPT‑5.6 takes on more of this engineering work itself.

OpenAI2021-07-274 min readCurated summary

Introducing Triton: Open-source GPU programming for neural networks

# Triton: Open-Source Python-Like GPU Programming for Neural Networks Triton 1.0 is an open-source, Python-like language that lets researchers with little or no CUDA experience write GPU kernels that usually approach expert-level CUDA performance. Its main claim is that it automates the hardest parts of GPU optimization, such as memory coalescing, shared memory management, and within-SM scheduling, so developers can focus on high-level logic. The post argues this makes it practical to write fused kernels, including FP16 matrix multiplication that matches cuBLAS in under 25 lines, some up to 2x faster than equivalent PyTorch implementations. ## Why Fused Kernels Matter - Research code typically chains native framework operators, which creates many temporary tensors and data movement that hurt performance at scale. - Custom GPU kernels can fix this, but writing them is difficult. - Existing alternatives were either too verbose, too inflexible, or produced code noticeably slower than hand-tuned baselines. - Triton extends an earlier language and compiler of the same name, originally created by Philippe Tillet, who now works at OpenAI. ## The Challenges of GPU Programming Optimizing CUDA code requires attention to three components of modern GPUs: - **DRAM:** memory transfers must be coalesced into large transactions to use the wide memory bus. - **SRAM (shared memory):** data must be staged manually for reuse and arranged to avoid bank conflicts. - **ALUs:** computations must be partitioned and scheduled across and within Streaming Multiprocessors (SMs) to exploit parallelism and specialized units like tensor cores. Triton automates memory coalescing, shared memory management, and within-SM scheduling. It deliberately leaves cross-SM scheduling to the developer, since tiling and inter-SM synchronization remain algorithmic decisions that should stay flexible. ## Programming Model - Triton resembles Numba: kernels are decorated Python functions launched over a grid of program instances identified by `program_id`. - Unlike Numba, Triton parallelizes within an instance through operations on blocks (small power-of-two-sized arrays) rather than the SIMT thread model. This hides intra-block concurrency issues such as coalescing, shared memory synchronization, and tensor core scheduling. - Element-wise operations gain little, but complex kernels become much simpler. - **Fused softmax example:** each instance loads and normalizes one row using NumPy-like primitives, avoiding the explicit inter-thread synchronization that a CUDA version requires. - Triton JIT treats tensors as raw pointers, preserving low-level control needed for complex structures such as block-sparse tensors. - This softmax keeps each row in SRAM throughout normalization, maximizing reuse for up to about 32K columns. PyTorch's general-purpose CUDA implementation uses temporary memory, making it more flexible but slower. The post frames the lesson as simplifying specialized kernels, not Triton being inherently superior. - The Torch JIT (v1.9) performed worse on the same operation, illustrating how hard it is to automatically generate efficient CUDA from high-level tensor operations. ## Matrix Multiplication - Fused element-wise operations and reductions are necessary, but matrix multiplication is central to neural networks. - A Triton matmul reaches peak performance in about 25 lines of Python. The equivalent CUDA would take considerably more effort and would likely be slower. - The kernel groups programs together to improve L2 cache hit rates, loads blocks of A and B in a loop, accumulates with `tl.dot`, and stores results with boundary masks. - Handwritten kernels can be customized with fused input transformations (such as slicing) and output transformations (such as Leaky ReLU), which would be out of reach for most developers without Triton. ## System Architecture and Compiler - Triton's performance comes from Triton-IR, an LLVM-based intermediate representation where multi-dimensional blocks of values are first-class. - The `@triton.jit` decorator walks the Python AST and builds Triton-IR using an SSA construction algorithm. - The compiler simplifies and optimizes the IR, automatically parallelizes it, and lowers it through LLVM-IR to PTX for recent NVIDIA GPUs. - Stashing data in shared memory is automated by analyzing operands of block-level operations like `tl.dot`, with allocation and synchronization handled by standard liveness analysis. - Programs are parallelized across SMs by running kernel instances concurrently, and within SMs by partitioning block-level iteration spaces across SIMD units. - At the time of the post, CPUs and AMD GPUs were unsupported, and the authors invited community contributions. ## Conclusion Triton is open source on GitHub and the authors want it to become a community-driven project. For developers who need custom GPU kernels but lack deep CUDA expertise, it offers a practical path to near-expert performance with far less code.