Ncu Report Skill logo

Ncu Report Skill

Organization
mit-han-lab
ncu-report-skill

Use before deciding how to optimize a CUDA kernel (hand-written CUDA, Triton, CUTLASS/CuTe), when a kernel is slower than expected, and whenever you are about to run Nsight Compute (ncu) or read its output — instead of guessing at the bottleneck, writing your own profiling script, or reading ncu's console tables by eye. One ncu collection, then helpers that extract key metrics, NCU's rule results, per-line stalls (inlined CUTLASS/CuTe/Triton code included) and PM timelines, and a playbook from signals to fixes. Also when a user asks to profile a kernel, read an ncu report or write an optimization plan ("profile 一下", "为什么慢", "ncu 报告"). Written for ncu 2026.3 on Blackwell (B200 / B300) and other NVIDIA GPUs.

Overview

Publishermit-han-lab
Repositoryncu-report-skill
Skill namencu-report-skill
Stars
258
Forks
38
Bundled files
18
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 18 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by mit-han-lab on GitHub. Read the source before you install it.

Installation

Install the Ncu Report Skill AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/mit-han-lab/ncu-report-skill/tree/main
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/mit-han-lab/ncu-report-skill.git \
  .claude/skills/ncu-report-skill
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Ncu Report Skill in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Ncu Report Skill on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Ncu Report Skill is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Skill: CUDA Kernel Profiling (Nsight Compute)

When to use: before choosing what to optimize in a GPU kernel (CUDA C++, Triton, CUTLASS/CuTe), when a kernel is slower than its budget or baseline, after a change whose effect you do not understand, and every time you are about to run ncu or read a report — so the bottleneck comes from measurements, not guesses. Also when someone asks to profile a kernel, find its bottlenecks, read an ncu report or write an optimization plan ("profile X", "为什么这个 kernel 慢", "ncu report 说...", "下一步怎么优化", "帮我看一下这份 ncu 报告").

Written for: Nsight Compute 2026.3.1, the newest release (it also reads reports of older versions), on Blackwell — B200 (sm_100) and B300 (sm_103), 148 SMs each. A CUDA toolkit bundles the ncu of its release (CUDA 13.2: 2026.1.1); newer ones are separate installs (NVIDIA's CUDA package repositories carry nsight-compute-<version>, and the toolkit's ncu launcher runs the newest installed). Most advice is generic; GPU- or version-specific notes say so. ncu's flags, sets and metric names change between releases: ncu --version, ncu --help, ncu --list-sets and ncu --list-sections are the authority when something here does not match what you have.


Golden rule

Profile → Diagnose → Plan, in that order. Never guess.

Most under-performing CUDA kernels are under-performing for exactly one reason that ncu can tell you in 10 seconds. Don't invent hypotheses before you have the report. Don't start coding a fix before you've matched the observed pattern to a known diagnosis. Don't write a wall of suggestions — rank them by evidence and expected impact.


Quickstart (what to do when someone says "profile this kernel")

  1. Create a new run directory first — one directory per run, never reuse an existing one — under the directory your project keeps profiling artifacts in (its README, AGENTS.md or contributing docs may name one; if none does, create one at the repo root and say where in the report). Each run holds its own harness/, reports/, analysis/ and REPORT.md; the docs call it $PROFILE_RUN_DIR. See reference/00-directory-layout.md.

  2. Decide what you're profiling. What inputs? Which dispatch path? What question do you want answered? If the kernel takes variable-sized inputs (variable seq lengths, variable batch sizes), you must pick specific representative shapes from the user's workload — don't profile with arbitrary inputs.

  3. Get a profile target. If the kernel already carries line info (many prebuilt libraries do; reference/02-harness-guide.md shows how to check), profile the real code: a few-line driver (Python or C++) that calls it once on a representative input is enough. Build a standalone harness with -lineinfo when the build has no line info or the kernel is buried in a slow program; the template is helpers/harness_template.cu. Keep it in $PROFILE_RUN_DIR/harness/.

  4. Collect one report with --set full: it holds the per-PC stall samples (SourceCounters) and the PM-sampling timelines and timed warp samples (PmSampling); --import-source yes embeds the source so the report reads anywhere. Give -o the .ncu-rep extension (without one, ncu 2026.3 writes .ncu-repz; the helpers read both):

    bash
    ncu --set full --import-source yes --clock-control boost \
        -k "regex:KERNEL" -c 1 -o "$PROFILE_RUN_DIR/reports/full_<tag>.ncu-rep" <command> [args]

    See reference/03-collection.md for picking the launch, skipping warm-up and faster targeted runs.

  5. Parse with the helpers — not by eye-balling the CLI — into $PROFILE_RUN_DIR/analysis/: analyze_reports.py (key metrics and NCU's rule results), extract_stall_hotspots.py (stalls per source line; --binary for inlined CUTLASS/CuTe code), plot_timeline.py (PM timelines). See helpers/README.md and reference/04-python-api.md.

  6. Work through the six analysis dimensions. See reference/05-analysis-dimensions.md. Every one matters, but on any given kernel only 1–2 will dominate.

  7. Match patterns to the diagnosis playbook. See reference/06-diagnosis-playbook.md. It maps NCU signal → likely cause → concrete fix, with example counts for "how big is this".

  8. Write the report at $PROFILE_RUN_DIR/REPORT.md with evidence-backed recommendations, ranked by expected impact. See reference/07-report-template.md.


Where the GPU is

Only ncu (and the program it launches) needs a GPU. Building the harness for an explicit architecture, ncu --import, and every Python helper only read and write files, so they can run on a machine or in a container without one. No helper picks a GPU or locks a clock: run ncu on the GPU your environment gives you, the way it runs any GPU command. If GPU commands run in another container or on another machine, keep the run directory where both see it (inside the project, say) and pass paths that exist on both sides.

ncu locks the GPU clock for every profiled kernel by default, which keeps reports comparable: at boost in ncu 2026.1–2026.3 (--clock-control boost; older versions default to base, which on a B300 runs kernels ~1.7x slower). ncu --help shows the default. To profile at another fixed clock, lock it outside ncu (e.g. sudo nvidia-smi -lgc MHZ,MHZ before, sudo nvidia-smi -rgc after) and pass --clock-control none, or ncu replaces your lock with its own. See reference/03-collection.md.


File index

Reference docs (read these when you need details)

FilePurpose
reference/00-directory-layout.mdRead first. Directory / naming conventions — one run = one subdirectory, no cross-contamination
reference/01-workflow.mdEnd-to-end checklist from "user request" to "final report"
reference/02-harness-guide.mdProfiling the real code vs. a standalone harness; checking for line info; drivers for Python / prebuilt libraries
reference/03-collection.mdncu command recipes: full, targeted, source-only, survey, clocks
reference/04-python-api.mdncu_report Python API patterns with copy-pasteable code
reference/05-analysis-dimensions.mdSix analysis dimensions: occupancy, balance, stalls, tensor core, timeline, memory
reference/06-diagnosis-playbook.mdPattern → diagnosis → fix. Merges Blackwell programming principles with NCU signals
reference/07-report-template.mdHow to structure the final report
reference/08-metric-names.mdMetric names on Blackwell with ncu 2026.3, and the ones that differ from older docs
reference/09-common-issues.mdPermissions, PM sampling, inlined code, TVM-FFI / PyTorch gotchas

Helpers (reusable code)

FilePurpose
helpers/harness_template.cuStandalone harness template — paste your kernel, fill in input allocation, done
helpers/safetensors_loader.hHeader-only safetensors reader (no external deps) for loading real workload tensors
helpers/analyze_reports.pyKey metrics, NCU rule results (by estimated speedup), side-by-side comparisons
helpers/extract_stall_hotspots.pyPer-line stall aggregation; --binary attributes inlined code to the kernel's own lines
helpers/plot_timeline.pyASCII PM-sampling timeline plotter — makes tail effect visible
helpers/list_flashinfer_workloads.pyBrowse a flashinfer-trace dataset — shape histograms, filter by axis, resolve safetensors paths for specific UUIDs
helpers/ncu_utils.pyShared Python helpers: finds ncu_report, report loading (every kernel in a report), safe metric access, rules, PM series, inline chains

Critical lessons (don't skip)

  1. Metric names differ between GPUs and ncu releases. reference/08-metric-names.md lists what --set full collects on Blackwell with ncu 2026.3. A name missing from a report may still exist: request it with --metrics. Enumerate with action.metric_names() or ncu --query-metrics.

  2. Always compile with -lineinfo (or profile code that has it). Without it, ncu's source view is blank and you cannot do per-line stall analysis. ncu attributes each PC to its innermost inlined frame — a library header for CUTLASS/CuTe code — so pass the profiled binary to extract_stall_hotspots.py --binary to rank the kernel's own lines.

  3. PM sampling is the only way to see tail effects. Static metrics average over the whole kernel; only the time-series (helpers/plot_timeline.py) shows the shape of utilization over time.

  4. Load-imbalance on variable-length inputs is often the #1 bottleneck. If the user's workload has sequences of varying length, per-SM active-cycle variance will often dwarf every other effect. Always check the input distribution.

  5. NCU's rule engine (--page details, or rules_<tag>.txt from analyze_reports.py) tells you where to look. Each rule comes with Est. Speedup: X%. Read them first, then check each against the counters before ranking it: estimates for small grids, shared-memory bank conflicts or L2 compression can be far off.

  6. Don't delegate understanding. Run the profiles yourself, open the reports, cite specific metric values. Never write "the profile shows it's memory-bound" — instead, name the two or three metric values that back your conclusion (e.g., "gpu__dram_throughput.avg.pct_of_peak_sustained_elapsed well under 10%, and long_scoreboard stalls dominate the pcsamp histogram, so the kernel is latency-bound on L1, not DRAM-bandwidth-bound"). Fill in the actual numbers from your report. Specificity is the deliverable.


Related skills

  • blackwell-cuda-programming.md — Blackwell-specific programming principles and checklists, preserved as a companion reference. Use it when proposing new kernel designs; use this skill when diagnosing existing kernels.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Ncu Report Skill AI skill do?

Use before deciding how to optimize a CUDA kernel (hand-written CUDA, Triton, CUTLASS/CuTe), when a kernel is slower than expected, and whenever you are about to run Nsight Compute (ncu) or read its output — instead of guessing at the bottleneck, writing your own profiling script, or reading ncu's console tables by eye. One ncu collection, then helpers that extract key metrics, NCU's rule results, per-line stalls (inlined CUTLASS/CuTe/Triton code included) and PM timelines, and a playbook from signals to fixes. Also when a user asks to profile a kernel, read an ncu report or write an optimi...

Why use Ncu Report Skill on TypingMind?

Because you install it once and use it with any model. Ncu Report Skill is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Ncu Report Skill in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/mit-han-lab/ncu-report-skill/tree/main. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Ncu Report Skill?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Ncu Report Skill?

As many as you like. As long as a model supports skills, you can use Ncu Report Skill with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Ncu Report Skill AI skill free?

Yes. It is published on GitHub by mit-han-lab under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇