Logo van Ncu Report Skill

Ncu Report Skill

Organisatie
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.

Overzicht

Uitgevermit-han-lab
Repositoryncu-report-skill
Skillnaamncu-report-skill
Sterren
258
Forks
38
Meegeleverde bestanden
18
LicentieMIT
Links
  • Instructies in Markdown

    Het model laadt het bestand SKILL.md alleen als dat nodig is. Dat kost dus alleen tokens als een verzoek daadwerkelijk bij de skill past.

  • Werkt met elk LLM

    AI-skills bestaan uit instructies in gewone Markdown, niet uit aanbiederspecifieke code. Daardoor werken ze met GPT, Claude, Gemini, Grok of een lokaal model.

  • Meegeleverde bestanden: 18

    Scripts, sjablonen en referentiemateriaal die het model tijdens het werken kan lezen. De bestanden kunnen alleen worden gelezen en worden nooit uitgevoerd.

  • Open source

    Gepubliceerd door mit-han-lab op GitHub. Bekijk de bronbestanden voordat je de skill installeert.

Installatie

Installeer de AI-skill Ncu Report Skill in TypingMind om deze met elk LLM te gebruiken, of voeg de skill toe aan een andere agent die SKILL.md kan lezen.

1

Installeren in TypingMind

TypingMind installeert een skill rechtstreeks vanuit de GitHub-map. De app leest SKILL.md, bundelt de bijbehorende bestanden en slaat het resultaat lokaal op.

  1. Open de app en ga naar Plug-ins → Skills.
  2. Kies "Installeren via GitHub".
  3. Plak de onderstaande URL van de skillmap en bevestig.
    https://github.com/mit-han-lab/ncu-report-skill/tree/main
  4. Schakel de skill in voor elke chat waarin je de skill wilt kunnen gebruiken.
Plug-ins → Skills → Skill toevoegen → Via GitHub-URL. Plak vervolgens de map-URL en druk op Doorgaan.
2

Installeren in een andere agent

Elke agent die het Agent Skills-formaat kan lezen, kan deze skill gebruiken — kopieer de map naar de skillmap van die agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/mit-han-lab/ncu-report-skill.git \
  .claude/skills/ncu-report-skill
Start Claude Code na het kopiëren opnieuw op, zodat de nieuwe skill wordt herkend.

Gebruik deze skill in TypingMind

Schakel Ncu Report Skill in voor een chat naar keuze in TypingMind en het model doet de rest. De naam en beschrijving staan in de systeemprompt. Zodra een verzoek bij de skill past, laadt het model zelf de volledige instructies. Je hoeft de skill nooit handmatig aan te roepen. Pas als het model de skill daadwerkelijk gebruikt, kost dat tokens.

Het model laadt Ncu Report Skill automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Ncu Report Skill niet gebonden aan het model waarvoor de skill is geschreven. Installeer de skill één keer in TypingMind en gebruik deze met GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama of een lokaal model dat je zelf draait — allemaal met je eigen API-sleutels.

  • Alleen geladen wanneer nodig

    De systeemprompt bevat alleen de naam en beschrijving. De instructies worden bij het eerste bijpassende verzoek opgehaald, dus een ongebruikte skill kost niets.

  • Wissel van model tijdens een chat

    Omdat de skill uit instructies bestaat en niet uit code, blijft deze werken als je van model wisselt — het volgende model leest hetzelfde SKILL.md-bestand.

Skillinstructies

Dit is de inhoud van SKILL.md die het model laadt. Lees deze vóór de installatie — een skill bestaat uit instructies die je model zal volgen.

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.

Meegeleverde bestanden

Zolang de skill geladen is, leest het model deze bestanden als dat nodig is. Het model kan ze alleen lezen; ze worden nooit uitgevoerd.

Veelgestelde vragen

Wat doet de AI-skill 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 optimi...

Waarom Ncu Report Skill gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Ncu Report Skill bestaat uit gewone Markdown in plaats van aanbiederspecifieke code. Dezelfde skill werkt dus met GPT-5, Claude, Gemini, Grok of een lokaal model. Ook als je midden in een chat van model wisselt, blijft de skill werken. TypingMind werkt met je eigen API-sleutels, dus je betaalt aanbieders rechtstreeks in plaats van een abonnement per gebruikersplek af te sluiten. Je skills en chats blijven in je eigen opslag.

Hoe installeer ik Ncu Report Skill in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/mit-han-lab/ncu-report-skill/tree/main. TypingMind leest het bestand SKILL.md, bundelt de bijbehorende bestanden en installeert het geheel als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Ncu Report Skill gebruiken?

Elk model dat je in TypingMind koppelt. AI-skills bestaan uit gewone Markdown-instructies in plaats van aanbiederspecifieke code. GPT, Claude, Gemini, Grok en lokale modellen kunnen deze skill dus allemaal laden wanneer een verzoek erbij past.

Hoeveel AI-modellen kan ik met Ncu Report Skill gebruiken?

Zoveel als je wilt. Je kunt Ncu Report Skill gebruiken met elk model dat skills ondersteunt, zoals GPT, Claude, Gemini, Grok, DeepSeek, Mistral of Llama. Allemaal in TypingMind met je eigen API-sleutels.

Is de AI-skill Ncu Report Skill gratis?

Ja. Deze skill is door mit-han-lab op GitHub gepubliceerd onder de licentie MIT. Je betaalt alleen je eigen AI-aanbieder voor de tokens die je gebruikt.

Wat zijn AI-skills?

Een AI-skill is een herbruikbare bundel instructies die een AI-model leert hoe het één specifieke taak moet uitvoeren. De skill volgt het open Agent Skills-formaat: het bestand SKILL.md bevat de naam en beschrijving van de skill. Daarnaast kan de skill scripts, sjablonen of referentiebestanden bevatten die het model nodig heeft. Het model leest de instructies alleen als je verzoek bij de skill past. Een geïnstalleerde skill kost dus niets zolang deze niet wordt gebruikt.

Waarin verschillen AI-skills van plug-ins of MCP-servers?

Een plug-in of MCP-server geeft een model nieuwe tools om aan te roepen: code die ergens wordt uitgevoerd en een resultaat teruggeeft. Een AI-skill geeft het model juist kennis en een werkwijze: hoe het een taak moet aanpakken, welke stappen het moet volgen en hoe goede uitvoer eruitziet. Skills bestaan uit gewone Markdown en hebben dus geen server, API-sleutel of runtime nodig. Ze werken met elk model.

Bekijk alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇