analyze-kernel-bottleneck

analyze-kernel-bottleneck is a skill for Claude Code from pjt222/agent-almanac. It costs 77 tokens per session (4,486 once invoked), scanned A, original, MIT.

A GPU performance-analysis workflow for classifying a CUDA kernel as limited by computation, memory access, or waiting time. CUDA is NVIDIA’s platform for running programs on GPUs, and a kernel is a GPU function.

In plain words
What is it for?
Use it to establish a baseline, apply roofline and occupancy analysis, inspect GPU instructions and stalls, check shared-memory limits, and choose an optimisation strategy.
Why use it?
It helps identify the actual bottleneck before choosing an optimisation. This prevents spending time on changes such as larger tiles or asynchronous transfers when they do not address the limiting factor.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the agent-almanac plugin — 122 skills, 76 agents shipped together

Good fit Use it to establish a baseline, apply roofline and occupancy analysis, inspect GPU instructions and stalls, check shared-memory limits, and choose an optimisation strategy.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/pjt222/agent-almanac/analyze-kernel-bottleneck
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.

Any agent
npx skills add pjt222/agent-almanac --skill analyze-kernel-bottleneck
Clone the repo
git clone --depth 1 https://github.com/pjt222/agent-almanac

Made for: Claude Code.

Or install agent-almanac, the plugin that ships this one along with the rest of its 122 skills, 76 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for analyze-kernel-bottleneck

README.md
[![agentmods](https://agentmods.dev/badge/skills/pjt222/agent-almanac/analyze-kernel-bottleneck.svg)](https://agentmods.dev/skills/pjt222/agent-almanac/analyze-kernel-bottleneck)
Your own site
<a href="https://agentmods.dev/skills/pjt222/agent-almanac/analyze-kernel-bottleneck"><img src="https://agentmods.dev/badge/skills/pjt222/agent-almanac/analyze-kernel-bottleneck.svg" alt="Measured on agentmods" height="20"></a>
Per session 77 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,486 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00077 $0.04486
Opus 5 $0.00039 $0.02243
Sonnet 5 $0.00015 $0.00897
Haiku 4.5 $0.00008 $0.00449

Measured 4d ago against content hash ea09e5404f93, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

analyze-kernel-bottleneck scanned grade A with 0 findings 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 4d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

i18n/caveman-lite/skills/analyze-kernel-bottleneck/SKILL.md · 317 lines

How it starts

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

Analyze Kernel Bottleneck

Systematically identify whether a GPU kernel is compute-bound, memory-bound, or latency-bound by measuring baseline performance, classifying on the roofline, computing occupancy and compute/load ratio per tile, inspecting SASS instruction mix and stall codes, checking the shared memory cliff, and applying a decision matrix to select the right optimization strategy.

When to Use

  • Before optimizing any CUDA kernel -- establish baseline and classify bottleneck type
  • After writing a first working version of a kernel to identify the optimization path
  • When a kernel underperforms expectations relative to theoretical peak
  • When deciding between cp.async, larger tiles, or algorithmic restructuring

Inputs

  • Required: Compiled kernel (.cubin or .cu source with build command)
  • Required: Benchmark harness that launches the kernel with CUDA event timing
  • Required: Problem dimensions (e.g., M, N, K for GEMM; seq_len, heads, head_dim for attention)
  • Optional: Target GPU architecture (default: GA104 / sm_86 / RTX 3070 Ti)
  • Optional: Expected peak utilization percentage for comparison
  • Optional: Prior profiling data (Nsight Compute reports)

Procedure

Step 1: Measure Baseline Performance

Run the kernel with CUDA events (BenchTimer), record time in milliseconds. Calculate effective throughput metrics:

  1. Compile the kernel if not already built:
    nvcc --cubin -arch=sm_86 -O2 -o kernel.sm_86.cubin kernel.cu
    nvcc -arch=sm_86 -O2 -o bench bench.cu -lcuda -I../../phase2/common
    
  2. Run with representative problem sizes, ensuring warmup runs precede measurement:
    ./bench 4096 4096 4096
    
  3. Record kernel time in ms from CUDA events (not wall-clock).
  4. Calculate effective GFLOPS and effective bandwidth:
    • GEMM: effective_gflops = (2 * M * N * K) / (time_ms / 1000) / 1e9
    • Bandwidth-limited kernels: effective_bw = total_bytes / (time_ms / 1000) / 1e9
    • Flash Attention: effective_gflops = (4 * batch * heads * seq_len^2 * head_dim) / (time_ms / 1000) / 1e9

Read the full file on GitHub · 317 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. 4d ago First seen · 317 lines · 77 tokens per session scan A ea09e5404f93

Subscribe to this mod's changes

analyze-kernel-bottleneck is a skill published in the GitHub repository pjt222/agent-almanac (32 stars, last pushed today), licensed MIT. It adds 77 tokens to every session and 4,486 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

triage-issue

Verify an issue, persisted audit finding, or unresolved review finding against current code, classify it, and write only the contracted forge/ledger outcome. Supports independent batches and an immediate-fix review-finding route. Triggers: "triage-issue", "triage issue N", "triage this finding", "is this trigger met".

gtrabanco/agentic-workflow · 74 tokens

pet-development

Use when developing, running, or debugging Commodore PET software (Commodore BASIC or 6502 assembly) on the VICE emulator with the pet CLI or the pet-tools MCP server. Covers the build/run/observe/debug loop, the stopped-state discipline, PET text encodings, and per-model differences.

nschneir/PET-Project · 66 tokens

ai-equipment-failure-rca-draft

A root-cause analysis draft assistant for investigating equipment failures. Root-cause analysis means looking for the underlying reason a failure happened, not only its visible symptom.

skillsaiagent/aiskills · 81 tokens

gke-ai-troubleshooting-tpu-dynamic-slices-monitoring

Monitors, troubleshoots, and manages GKE TPU Dynamic Slices custom resources. Use when checking TPU slice lifecycle states, troubleshooting slice provisioning failures, validating single-slice or multi-slice (JobSet) workload manifests, or safely patching stuck finalizers and disabling the slice controller. Don't use…

google/skills · 107 tokens

gke-ai-troubleshooting-tpu-vbar-oom

Diagnoses and prevents vbarcontrolagent segfaults, out-of-memory (OOM) errors, and TPU device initialization failures on TPU v6e nodes in GKE caused by race conditions during TPU device resets or high-frequency metrics polling. Use when troubleshooting vbarcontrolagent crashes, memory cgroup OOMs in serial console…

google/skills · 125 tokens

cocoreview

CocoReview — structured code review with six-severity findings vocabulary, progressive disclosure architecture, and universal anti-pattern baseline. Invoked via $review [file] [--complexity] [--security] [--architecture] [--language ].

Snowflake-Labs/cocoplus · 57 tokens