flydsl-kernel-trace-analysis
БесплатноЗапускает вложенные скриптыНе проверенProfile GPU kernels using rocprofv3 to collect ATT instruction-level traces, then analyze the trace data using hotspot_analyzer.py to identify top-K stall…
от amd★ 523 звезды на GitHubОб этом скилле
Kernel Trace Analysis
Profile and analyze GPU kernel ATT traces to identify stall hotspots and produce an optimization plan.
All analysis is done by running the bundled hotspot_analyzer.py (ATT) and
pmc_l2_analyzer.py (PMC CSVs); never recompute their metrics yourself.
Do not use GUI tools.
If the question is only "did my change increase register pressure, spills, or LDS?", use
/isa-resource-difffirst — it is compile-only, needs no GPU or profiler run, and answers in seconds. Come here when you need to know why a kernel is slow rather than what resources it uses.To pick an LLVM knob that changes what the compiler emits — a compile hint, a function attribute, an
-mllvmflag — and to prove it took effect, use/llvm. That is also compile-only.
Arguments
| Argument | Description |
|---|---|
<CMD> |
Command to profile. Example: python bench_pa.py --batch 32 |
--dir <path> |
Skip collection; analyze existing ui_output_agent_*_dispatch_* directory |
--topk N |
Show top-N hotspots (default: 15) |
Analyzer Scripts
${CLAUDE_SKILL_DIR}/scripts/hotspot_analyzer.py— reads aui_output_agent_*_dispatch_*ATT directory; reports top-K stall hotspots, stall-type breakdown, and occupancy (combined-VGPR-pool model, reads accum/LDS/SGPR fromout_kernel_trace.csv).${CLAUDE_SKILL_DIR}/scripts/pmc_l2_analyzer.py— reads rocprofv3 PMC counter CSV(s); reports L2 hit rate, HBM 32B-partial fraction, and over-fetch ratio. Use when a kernel is memory-bound and you need to know why (ATT has no cache counters). See "L2 / HBM efficiency analysis" under Step 5.
Workflow
Mode A: Analyze existing dispatch directory
If the user provides --dir <path> or already has a ui_output_agent_*_dispatch_* directory:
# Both analyzers ship with this skill -- do not reimplement them.
python ${CLAUDE_SKILL_DIR}/scripts/hotspot_analyzer.py <dispatch_dir> --kernel <kernel> --topk 15 --mode both --detail --context 4
Skip to Step 5: Interpret Results.
Mode B: Full collection workflow
Step 1: Kernel Discovery
touch /tmp/trace_ts
rocprofv3 --stats --kernel-trace -f csv -- <CMD> 2>&1
find . -maxdepth 3 -name "*stats*" -newer /tmp/trace_ts -type f 2>/dev/null
Parse the stats CSV and present a kernel table:
| Rank | Kernel Name | Calls | Total (us) | Avg (us) | % GPU Time |
|---|
Ask the user which kernel to trace if not obvious.
Prefer results.db if available — use sqlite3 for structured queries:
sqlite3 results.db "
SELECT ks.KernelName, COUNT(*) calls,
ROUND(AVG(kd.end-kd.start)/1000.0,1) avg_us
FROM rocpd_kernel_dispatch kd
JOIN rocpd_info_kernel_symbol ks ON kd.kernel_symbol_id=ks.id
GROUP BY ks.KernelName ORDER BY avg_us DESC LIMIT 20;"
Step 2: Configure input.yaml
Write /tmp/trace_input.yaml with the job below, setting
kernel_include_regex to the kernel found in Step 1:
jobs:
-
kernel_include_regex: <KERNEL_NAME_PATTERN>
kernel_iteration_range: "[1, [3-4]]"
output_file: out
output_directory: kernel_trace_output
output_format: [csv]
truncate_kernels: true
sys_trace: true
advanced_thread_trace: true
att_target_cu: 1
att_shader_engine_mask: "0xf"
att_simd_select: "0xf"
att_buffer_size: "0x6000000"
Key notes:
kernel_iteration_range:"[1, [3-4]]"skips warmup, traces dispatches 3-4att_buffer_size: 96MB per SE; increase to"0xC000000"if truncatedatt_target_cu: 1: single CU keeps output manageable
Step 3: Collect ATT Trace
FLYDSL_DEBUG_ENABLE_DEBUG_INFO=1 rocprofv3 -i /tmp/trace_input.yaml -- <CMD> 2>&1
find . -type d -name "ui_output_agent_*" -newer /tmp/trace_ts 2>/dev/null
If the rocprof-trace-decoder library is missing, install the release matching
the ROCm version in /opt/rocm/.info/version. Set RTD_VERSION to that release
before running the block below. build-rocm-image hardcodes its own
RTD_VERSION for the image it builds and does not derive it either; if the two
disagree, the ROCm version on the machine you are profiling wins:
RTD_VERSION=0.1.6 # <-- set to the release matching your ROCm version
RTD_INSTALLER="rocprof-trace-decoder-manylinux-2.28-${RTD_VERSION}-Linux.sh"
wget -q "https://github.com/ROCm/rocprof-trace-decoder/releases/download/${RTD_VERSION}/${RTD_INSTALLER}"
chmod +x "${RTD_INSTALLER}"
"./${RTD_INSTALLER}" --skip-license --prefix=/tmp/rtd-install
find /tmp/rtd-install -name '*.so*' -exec cp -a {} /opt/rocm/lib/ \;
ldconfig
Output structure:
ui_output_agent_<PID>_dispatch_<N>/
├── code.json ← PRIMARY: per-instruction stall/cycle data
├── snapshots.json ← source file path mapping (virtual → local filename)
├── source_0_*.py ← embedded source files
├── filenames.json ← wave
Установить flydsl-kernel-trace-analysis в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadEditBashGrepGlobAgentWriteВложенные файлы
FAQ
Что делает скилл flydsl-kernel-trace-analysis?
Profile GPU kernels using rocprofv3 to collect ATT instruction-level traces, then analyze the trace data using hotspot_analyzer.py to identify top-K stall hotspots (VMEM-load, VMEM-wait, LDS/SMEM-wait, barrier, MFMA stalls) mapped back to source lines, and produce an actionable optimization plan. Also analyzes rocprofv3 PMC counter CSVs (L2 hit rate, partial reads, over-fetch). Usage: /kernel-trace-analysis <cmd> Can also analyze an existing dispatch dir directly: /kernel-trace-analysis --dir <path>
Как установить скилл flydsl-kernel-trace-analysis?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл flydsl-kernel-trace-analysis запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic