kernel-benchmark

Benchmark custom GPU kernels against PyTorch baselines with CUDA event timing.

14|Updated Apr 16, 2026
One-click install
npx skills add https://github.com/fmh66/kernel-opt-agent --skill kernel-benchmark
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kernel-benchmark
Source: https://github.com/fmh66/kernel-opt-agent/tree/main/skills/kernel-benchmark
Command: npx skills add https://github.com/fmh66/kernel-opt-agent --skill kernel-benchmark

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, triton, nvidia-cutlass-dsl, flashinfer-python, and includes scripts (resource) components.

What problem does it solve?

You need an objective way to compare a custom GPU kernel implementation (CUDA-C++, CUTLASS, CuTe DSL, or Triton) against known PyTorch baselines, while ensuring correctness before you trust any timing results.

Core Features & Use Cases

  • Correctness-first benchmarking: Validates solution outputs against a required PyTorch eager reference before collecting latency numbers.
  • Multiple kernel & baseline types: Benchmarks CUDA-C++/CUTLASS shared-library kernels and CuTe DSL/Triton Python implementations, with optional baselines for torch.compile and FlashInfer.
  • KernelBench-style timing: Uses CUDA event timing by default with warmup, trial control, and L2 cache thrashing to reduce measurement bias.
  • Actionable report output: Writes a benchmark.md summary including timing distribution stats and speedups versus selected baselines.

Quick Start

Run the benchmark by providing your solution file, a reference module that defines reference(**kwargs), a directory to write benchmark.md, and the kernel dimension/scalar arguments your reference expects.

Frequently Asked Questions about kernel-benchmark

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I benchmark custom Triton or CUDA kernels against PyTorch baselines?

To benchmark custom GPU kernels against PyTorch baselines, you provide a solution file and a reference module defining reference(**kwargs). The tool uses configurable warmup, trial timing, and KernelBench-style CUDA events to generate latency and speedup results.

Why does my GPU kernel benchmark show inaccurate latency measurements?

Latency measurements can be inaccurate due to measurement bias, but this benchmark applies L2 cache thrashing and uses CUDA event timing by default with configurable warmup and trial control to reduce bias and ensure trustworthy results.

Do I need to validate kernel correctness before running performance benchmarks?

Validating kernel correctness before benchmarking is required. The tool checks solution outputs against a required PyTorch eager reference function prior to collecting any timing numbers to ensure you only benchmark correct implementations.

Can I use torch.compile or FlashInfer as baselines when benchmarking GPU kernels?

You can use torch.compile and FlashInfer as optional baselines when benchmarking. The tool compares your custom CUDA-C++, CUTLASS, CuTe DSL, or Triton implementations against these alternatives alongside the standard PyTorch eager mode.

What is the process for benchmarking a CUDA-C++ shared library kernel?

Benchmarking a CUDA-C++ shared library kernel requires mapping the solution ABI. The tool solves for .cu/.so files, validates correctness against a PyTorch reference, times execution with CUDA events, and outputs a benchmark.md summary report.