Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

rocprof-compute-pc-sampling

БесплатноБез исполняемых скриптовНе проверен

Collects and analyzes rocprof-compute PC sampling to show which individual instructions in an AMD GPU kernel are hot and why wavefronts stall there, with ISA…

amdот amd★ 523 звезды на GitHub

Об этом скилле

PC sampling

PC sampling answers a question counters cannot: which instruction inside the kernel is hot, and what the wavefront was waiting on. Use it after counters have already identified the kernel worth this level of detail.

PC sampling is experimental. Every command below needs --experimental, and option names can change between releases, so run rocprof-compute profile --experimental --help before choosing flags.

Before you start

If command -v rocprof-compute finds the tool and rocprof-compute analyze --debug-verify-deps passes, skip this section. On ROCm 10.2, use --verify-deps instead of --debug-verify-deps.

Otherwise, check that ROCm and a GPU are present:

rocminfo
amd-smi list

If either command fails, ROCm is not installed or no GPU is visible. Stop and point the user to "Install the ROCm Core SDK" in the install guide. Installing rocprof-compute alone does not help.

Check the GPU against compatible accelerators. The table lists product families, so match the Marketing Name that rocminfo prints, and use the gfx name to confirm. If the GPU is not supported, stop and tell the user.

Then follow "Install the analyze mode dependencies" in the install guide, which installs rocprof-compute in a virtual environment of its own. Use the nightly index so the version matches these skills. Activate that environment with source <venv>/bin/activate before you run rocprof-compute, and confirm with rocprof-compute analyze --debug-verify-deps. If the application is a Python script, note the full path of its Python before you activate, and run the script with that path.

1. Check what the hardware supports

rocprofv3-avail info --pc-sampling

This reports the sampling methods the installed device accepts and the valid interval range. Two methods exist:

  • stochastic samples in hardware and is the only method that records a stall reason. It requires MI300 or newer.
  • host_trap works more widely but records no stall reason, and its samples can land a little past the instruction responsible.

--pc-sampling-method defaults to stochastic. Fall back to host_trap only when the device rejects stochastic.

Start with the default interval: leave out --pc-sampling-interval. Change it only when the analysis shows too few or too many samples, and keep it within the range the command above prints. Stochastic intervals are counted in cycles and must be a power of two. Host-trap intervals are in microseconds.

2. Build for source attribution

Samples always map to the kernel's assembly. Mapping assembly back to a source line requires debug info in the application, for example hipcc -g. Without it, the Source column in CSV output is empty. Keep optimization flags on; profiling a -O0 build measures the wrong program.

Ask about the build before collecting, because rebuilding afterwards means re-profiling.

3. Collect

rocprof-compute profile \
    --experimental \
    --pc-sampling \
    --pc-sampling-method stochastic \
    --name <workload_name> \
    -- <application> <args>

PC sampling does not collect counters. A PC-sampling-only profile cannot be combined with the framework tracing options, and it will not populate the counter panels. When the user needs both, collect two workloads.

4. Analyze

rocprof-compute analyze --path ./workloads/<name>/<gpu_model>

The PC sampling table shows one row per kernel, hottest first, so it picks the kernel to look at. --pc-sampling-rows defaults to 10 kernels; pass 0 for every kernel.

Read the table as:

Column Meaning
Sample count how often execution was in the kernel
Stall reason what the kernel's wavefronts were waiting on, stochastic sampling only

For the hot instructions of that kernel, export the annotated disassembly (step 5) and open the kernel's ISA CSV.

A high sample count marks a hot instruction, not a defective one. A loop body is supposed to be hot. What matters is a hot instruction whose stall reason says it is waiting: a memory stall on a load means the kernel is latency-bound there, and the fix is usually coalescing, prefetching, or more independent work between the load and its use.

Stall reasons and what each one implies are listed in pc_sampling.rst. Do not interpret a stall reason from host-trap data; it does not record one.

5. Export annot

Полный SKILL.md на GitHub

Установить rocprof-compute-pc-sampling в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

.federated.jsonevals/evals.jsonevals/extended_evals.jsonevals/machine.ymlevals/samples/vrandom_access.cppskill-card.md

FAQ

Что делает скилл rocprof-compute-pc-sampling?

Collects and analyzes rocprof-compute PC sampling to show which individual instructions in an AMD GPU kernel are hot and why wavefronts stall there, with ISA and source line attribution. Use when the user asks which instruction or source line is slow, asks about stall reasons, wants instruction-level or ISA-level detail, or wants hotspots inside a single kernel. Not for CUDA tools, Windows, or whole-application timing.

Как установить скилл rocprof-compute-pc-sampling?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл rocprof-compute-pc-sampling запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить rocprof-compute-pc-sampling с