cd /news/ai-infrastructure/kernel-optimization-in-pictures · home › topics › ai-infrastructure › article
[ARTICLE · art-182912] src=cerebellumlabs.ai ↗ pub= topic=ai-infrastructure verified=true sentiment=· neutral

Kernel Optimization in Pictures

A visual explainer on GPU kernel optimization details the NVIDIA H100's memory and compute hierarchy, including 80 GB of HBM3 at up to 3.35 TB/s, 50 MB of L2 cache, 132 streaming multiprocessors with 128 CUDA cores and 4 tensor cores each, and 528 tensor cores delivering 989 TFLOPS at 16-bit. Citing Simon Boehm's CUDA matmul walkthrough, the piece notes that reassigning which thread computes which element alone raised memory throughput from 15 GB/s to 110 GB/s on an A6000, and that fused softmax speeds up by reducing round trips to HBM rather than by faster arithmetic.

recommendation

Restructure kernels so each thread block fetches data from HBM once and reuses it from shared memory and registers; Boehm's thread reassignment alone lifted throughput from 15 GB/s to 110 GB/s.

more in playbook: Inference and self-hosting
by read3 min views1 publishedDec 6, 2026
Kernel Optimization in Pictures
Image: source

Kernel optimization and H100s in pictures. Matrix multiply and fused softmax.

I'm post-training a custom model for kernel optimization. In one experiment I trained on test-time refinements. I tried checking the quality of refinements but realized I was completely ill-equipped to do so. I made some visualizations to help me wrap my mind around a lot of this stuff. I'll use as few words as possible.

GPU (H100) #

All the parts in an H100 do one of two main things: (1) store memory (2) do arithmetic. Tensor cores and CUDA cores do arithmetic, everything else is memory. In order to compute large operations quickly (like computing the next token), memory needs to be moved from memory stores to the cores as efficiently as possible. That is what kernels are for. A summary of the parts:

  • High Bandwidth Memory (HBM3): the GPU's main memory, 80 GB. Data moves in and out at up to 3.35 TB/s.
  • L2 cache: 50 MB of the most recently used HBM data. Managed by hardware.
  • Streaming Multiprocessor (SM): like a mini GPU. Contains CUDA cores, tensor cores, and shared memory.132 total, each with 128 CUDA cores, 4 tensor cores, and up to 227 KB of shared memory.
  • Shared memory: the memory of an SM. Can be used by any thread in the same block.
  • Register: values a thread is working on right now. Up to 255 per thread.
  • Tensor core: multiplies small matrices and does nothing else.528 total, 989 TFLOPS at 16-bit.
  • CUDA core: does one ordinary operation at a time (add, multiply, exp, compare), so it runs everything that is not a matrix multiply.16,896 total, 67 TFLOPS at 32-bit.
  • Warp: the GPU runs threads in packs of 32 called warps. All 32 do the same instruction at the same moment.

The smaller and closer to the cores a memory store is, the faster it is to move data to the cores.

- **HBM3 to an SM:** 3.35 TB/s (slow)
- **Shared memory to registers:** about 33 TB/s (fast)

Kernel #

A very simple kernel: adding two arrays, then multiplying by a number.

Now the realer example of generating next token during inference. Every row is a kernel the CPU launches.

A model launches hundreds of kernels for one token.

Matrix Multiplication #

These steps follow Simon Boehm's walkthrough. The first one changes no arithmetic at all, only which thread computes which element.

Recall that threads run in warps: packs of 32 that do the same instruction at the same moment.

On his A6000, that change alone took memory throughput from 15 GB/s to 110 GB/s.

The rest is the same idea each time: fetch data from far away once, then reuse it as many times as possible from somewhere close.

Fused Softmax #

Softmax does almost no arithmetic per element, so its speed is set by how many times the data crosses to HBM and back.

Nothing here made the arithmetic faster. It's all about moving the data better.

Refs #

- Simon Boehm, [How to Optimize a CUDA Matmul Kernel for cuBLAS-like Performance](https://siboehm.com/articles/22/CUDA-MMM)
- Horace He, [Making Deep Learning Go Brrrr From First Principles](https://horace.io/brrr_intro.html)
- Benjamin Spector and others, [GPUs Go Brrr](https://hazyresearch.stanford.edu/blog/2024-05-12-tk) (ThunderKittens)
- Triton, [Fused Softmax](https://triton-lang.org/main/getting-started/tutorials/02-fused-softmax.html)
- The diagrams are drawn with [deep-learning-visuals](https://github.com/Cerebellum-Labs-AI/deep-learning-visuals)
── more in #ai-infrastructure 4 stories · sorted by recency
── more on @nvidia 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/kernel-optimization-…] indexed:0 read:3min 2026-12-06 · —