benchmark-kernel

Benchmark FlashInfer GPU kernels with CUPTI timing and CSV metrics.

2|1|Updated Oct 21, 2025
One-click install
npx skills add https://github.com/fw-ai/flashinfer --skill benchmark-kernel-fw-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: benchmark-kernel
Source: https://github.com/fw-ai/flashinfer/tree/main/.claude/skills/benchmark-kernel
Command: npx skills add https://github.com/fw-ai/flashinfer --skill benchmark-kernel-fw-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires cupti-python, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a robust framework for accurately measuring the performance of FlashInfer's GPU kernels, enabling detailed performance analysis and comparison across different backends.

Core Features & Use Cases

  • Accurate Timing: Utilizes CUPTI for precise GPU kernel execution times, falling back to CUDA events.
  • Backend Comparison: Easily compare performance across multiple backends like FlashAttention-2/3, cuDNN, CUTLASS, and TensorRT-LLM.
  • Reproducible Results: Generates CSV reports with detailed metrics and commands to reproduce benchmarks.
  • Use Case: A researcher wants to determine the fastest attention kernel for their specific hardware and workload. They can use this Skill to run benchmarks for various attention routines with different configurations and backends, then analyze the results to select the optimal kernel.

Quick Start

Run a benchmark for the BatchDecodeWithPagedKVCacheWrapper routine using FlashAttention-2 and cuDNN backends with specified batch and sequence lengths.

Frequently Asked Questions about benchmark-kernel

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

FAQPage Schema
How do I benchmark FlashInfer GPU kernels accurately?

You can benchmark FlashInfer GPU kernels accurately using this framework, which utilizes CUPTI for precise timing or falls back to CUDA events to measure performance metrics like median time and TFLOPS.

Can I compare performance across FlashAttention-2, cuDNN, and TensorRT-LLM backends?

Yes, you can compare performance across multiple backends including FlashAttention-2/3, cuDNN, CUTLASS, and TensorRT-LLM for attention, GEMM, and MoE operations to identify the optimal kernel.

What metrics and formats are generated when benchmarking GPU kernels?

Benchmarking GPU kernels generates reproducible CSV reports containing detailed performance metrics such as median time, TFLOPS, and memory bandwidth, alongside the exact commands to reproduce the results.

Do I need cupti-python to measure GPU kernel execution times?

Yes, cupti-python is a required dependency to enable precise CUPTI timing for measuring GPU kernel execution times, with the system falling back to standard CUDA events if unavailable.

How do I benchmark attention routines with different batch and sequence lengths?

You can benchmark attention routines with different batch and sequence lengths by running specified configurations across various backends, such as testing BatchDecodeWithPagedKVCacheWrapper with FlashAttention-2 and cuDNN.