benchmark-kernel

A guide for measuring the execution speed of FlashInfer GPU kernels with CUPTI, a hardware-level GPU timing tool.

In plain words
What is it for?
Measure kernel runtime, compare FlashAttention, cuDNN, CUTLASS, and TensorRT-LLM backends, and save repeatable results to CSV.
Why use it?
It provides consistent timings, uses CUDA events when CUPTI is unavailable, and supports comparisons between different GPU implementations.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/flashinfer-ai/flashinfer/benchmark-kernel
Any agent
npx skills add flashinfer-ai/flashinfer --skill benchmark-kernel
Clone the repo
git clone --depth 1 https://github.com/flashinfer-ai/flashinfer

Made for: Claude Code, Codex.

Per session 14 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,602 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00014 $0.03602
Opus 5 $0.00007 $0.01801
Sonnet 5 $0.00003 $0.00720
Haiku 4.5 $0.00001 $0.00360

Measured 3d ago against content hash 597917dae005, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

benchmark-kernel scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

sudo nvidia-smi -lgc <base_clock>
.claude/skills/benchmark-kernel/SKILL.md · 433 lines

How it starts

The opening of the file, as written. The whole thing — 433 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Tutorial: Benchmarking FlashInfer Kernels

This tutorial shows you how to accurately benchmark FlashInfer kernels.

Goal

Measure the performance of FlashInfer kernels:

  • Get accurate GPU kernel execution time
  • Compare multiple backends (FlashAttention2/3, cuDNN, CUTLASS, TensorRT-LLM)
  • Generate reproducible benchmark results
  • Save results to CSV for analysis

Timing Methods

FlashInfer supports two timing methods:

  1. CUPTI (Preferred): Hardware-level profiling for most accurate GPU kernel time

    • Measures pure GPU compute time without host-device overhead
    • Requires cupti-python >= 13.0.0 (CUDA 13+)
  2. CUDA Events (Fallback): Standard CUDA event timing

    • Automatically used if CUPTI is not available
    • Good accuracy, slight overhead from host synchronization

The framework automatically uses CUPTI if available, otherwise falls back to CUDA events.

Autotuner timing (separate from the benchmark framework above). The AutoTuner's internal per-tactic timing has its own selector, FLASHINFER_AUTOTUNE_TIMER: globaltimer forces the GPU %globaltimer register, cuda_event forces cudaEvent, and unset/auto uses %globaltimer only when Confidential Computing (CC) is detected. Under CC cudaEventElapsedTime is unreliable (can go negative), which would corrupt tactic ranking — the globaltimer path avoids that. CC auto-detection can be overridden with FLASHINFER_CONFIDENTIAL_COMPUTE=0/1. (Full env-var reference in CLAUDE.md.)

Installation

Install CUPTI (Recommended)

For the most accurate benchmarking:

pip install -U cupti-python

Requirements: CUDA 13+ (CUPTI version 13+)

Without CUPTI

If you don't install CUPTI, the framework will:

  • Print a warning: CUPTI is not installed. Falling back to CUDA events.
  • Automatically use CUDA events for timing
  • Still provide good benchmark results

Step 1: Choose Your Test Routine

Read the full file on GitHub · 433 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 433 lines · 14 tokens per session scan B 597917dae005

Subscribe to this mod's changes

benchmark-kernel is a skill published in the GitHub repository flashinfer-ai/flashinfer (6,312 stars, last pushed yesterday), licensed Apache-2.0. It adds 14 tokens to every session and 3,602 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 1 finding (asks for root). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

megakernel-optimization

Use when optimizing or generating a CUDA megakernel for a HuggingFace Llama-family model with AutoMegaKernel (AMK), drives the correctness-gated propose -> eval -> keep/revert loop (or hands off to the unattended autoresearch driver).

RightNow-AI/AutoMegaKernel · 57 tokens

gpu-server-setup

Prepare a Linux server with NVIDIA GPUs for neural-network and LLM workloads, or diagnose one that misbehaves. Use when the user asks to set up or prepare a GPU server, install NVIDIA drivers or CUDA on Debian/Ubuntu, wire Docker to GPUs (NVIDIA Container Toolkit), deploy vLLM / Infinity / OpenWebUI / Ollama /…

EvilFreelancer/gpu-server-setup · 167 tokens

cuopt-skill-evolution

After solving a non-trivial problem, detect generalizable learnings and propose skill updates. Always active — applies to every interaction.

NVIDIA/cuopt · 33 tokens

cuopt-developer

Modify, build, test, debug, and contribute to NVIDIA cuOpt (C++/CUDA, Python, server, CI). Use for solver internals, PRs, DCO, and code conventions.

NVIDIA/cuopt · 47 tokens

cuopt-user-rules

Base rules for end users calling NVIDIA cuOpt (routing/LP/MILP/QP/install/server). Not for cuOpt internals — use cuopt-developer for those.

NVIDIA/cuopt · 42 tokens

trtllm-model-onboard-multimodal

Onboard a HuggingFace multimodal model (vision/audio/video + text) to the TensorRT-LLM PyTorch backend. Use when writing a new tensorrtllm/torch/models/modeling .py plus its input processor and weight mapper, or extending an existing VLM. Not for AutoDeploy — use ad-model-onboard for that path.

NVIDIA/TensorRT-LLM · 93 tokens