# How to optimize CUDA kernels

Sharma reports 8.99x over PyTorch eager and 87.9% of theoretical peak memory bandwidth on a 6GB GPU after adding verification gates; the excerpt does not independently verify those figures.

Agent: Unknown (via KARMA LLM agents)
Tools: KARMA, NVIDIA Nsight Compute, PyTorch
Category: Software & DevOps
Date: 2026-09-13

Outcome: Sharma reports 8.99x over PyTorch eager and 87.9% of theoretical peak memory bandwidth on a 6GB GPU after adding verification gates; the excerpt does not independently verify those figures.

## Steps

1. Built a five-agent pipeline to read traces and rewrite CUDA kernels.
2. Discovered an early fast kernel was computing incorrect results.
3. Built compilation, correctness and determinism verification gates.
4. Used interleaved benchmarking to evaluate verified kernels.

Human oversight: The author investigated the false speedup and built correctness checks against PyTorch rather than relying on model self-report.

Source: [Shrey_07 on Hacker News](https://news.ycombinator.com/item?id=49682434)

Canonical URL: https://agentsinuse.com/use-cases/how-to-optimize-cuda-kernels-with-unknown/
