Логотип Rocprofiler Pc Sampling

Rocprofiler Pc Sampling

Організація
amd
rocprofiler-pc-sampling

Profiles a target application using rocprofv3 with program counter sampling enabled and then analyzes the results. Use when the user has a program that runs on an AMD GPU and asks to perform PC sampling, to determine the runtime performance characteristics of their application, to determine stall reasons, or to determine hotspots in the code.

Огляд

Видавецьamd
Репозиторійskills
Назва навичкиrocprofiler-pc-sampling
Зірки
465
Форки
44
Файли в пакеті
8
ЛіцензіяMIT
Посилання
  • Інструкції у форматі Markdown

    Файл SKILL.md, який модель завантажує за потреби, тож токени витрачаються лише тоді, коли запит справді відповідає навичці.

  • Працює з будь-якою LLM

    Навички ШІ — це звичайний Markdown, а не код для певного постачальника, тому вони працюють із GPT, Claude, Gemini, Grok або локальною моделлю.

  • Файлів у комплекті: 8

    Скрипти, шаблони й довідкові матеріали, які модель може читати під час роботи. Файли доступні лише для читання й ніколи не виконуються.

  • Відкритий вихідний код

    Опубліковано на GitHub користувачем amd. Перегляньте вихідний вміст перед установленням.

Встановлення

Установіть навичку ШІ Rocprofiler Pc Sampling у TypingMind, щоб використовувати її з будь-якою LLM, або додайте її до іншого агента, що читає SKILL.md.

1

Встановити в TypingMind

TypingMind встановлює навичку безпосередньо з її папки GitHub — читає SKILL.md, збирає файли ресурсів у пакет і зберігає результат локально.

  1. Відкрийте застосунок і перейдіть до Плагіни → Навички.
  2. Виберіть «Встановити з GitHub».
  3. Вставте наведений нижче URL папки навички та підтвердьте встановлення.
    https://github.com/amd/skills/tree/main/skills/rocprofiler-pc-sampling
  4. Увімкніть навичку в кожному чаті, де хочете її використовувати.
Плагіни → Навички → Нова навичка → За URL GitHub, потім вставте URL папки й натисніть «Продовжити».
2

Встановити в іншому агенті

Будь-який агент, що підтримує формат Agent Skills, може використовувати цю навичку — скопіюйте папку до каталогу навичок цього агента.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/amd/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/rocprofiler-pc-sampling .claude/skills/rocprofiler-pc-sampling
Після копіювання перезапустіть Claude Code, щоб завантажити нову навичку.

Використовуйте навичку в TypingMind

Увімкніть навичку Rocprofiler Pc Sampling в будь-якому чаті TypingMind, і далі модель усе зробить сама. Назва й опис навички містяться в системному промпті, а щойно надходить відповідний запит, модель самостійно завантажує повні інструкції — вам не потрібно викликати навичку вручну, і до фактичного використання вона не витрачає токенів.

Модель самостійно завантажує навичку Rocprofiler Pc Sampling, щойно надходить відповідний запит.

Працює з будь-якою моделлю ШІ

Навички ШІ — це звичайні інструкції Markdown, а не код для певного постачальника, тому навичка Rocprofiler Pc Sampling не прив’язана до моделі, для якої її створено. Установіть її один раз у TypingMind і використовуйте з GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama або локальною моделлю, яку ви запускаєте самостійно, — усе з вашими власними ключами API.

  • Завантажується лише за потреби

    Системний промпт містить лише назву й опис. Інструкції завантажуються за першого відповідного запиту, тож невикористана навичка нічого не коштує.

  • Змінюйте моделі під час чату

    Оскільки навичка — це інструкції, а не код, зміна моделі не порушує її роботу: наступна модель читає той самий файл SKILL.md.

Інструкції навички

Це вміст файлу SKILL.md, який завантажує модель. Прочитайте його перед установленням — навичка містить інструкції, яких дотримуватиметься ваша модель.

PC Sampling

Prerequisites

  • The system must have a ROCm installation and an accessible AMD GPU; that is, amd-smi should return at least one valid device.
  • The GPU must support PC sampling. Available PC sampling configurations can be determined via rocprofv3-avail info --pc-sampling or rocprofv3 -L. Your sampling method and interval must align with the outputs of this command. Also pay attention to any flags reported for a given configuration; at time of writing, stochastic sampling intervals must be powers of two.
  • The application should be built with debug symbols AND optimization flags (e.g. -g -O3) in order to get source line attribution and a representative execution profile.

How to use PC Sampling

To run rocprofv3 with PC sampling:

  • explicitly enable pc sampling with the flag --pc-sampling-beta-enabled.
  • specify the type of pc sampling method with --pc-sampling-method: host_trap or stochastic
  • specify the interval unit for the sampling with --pc-sampling-unit: time for host_trap and cycles for stochastic
  • specify the sampling interval with --pc-sampling-interval: an integer representing microseconds if you specified time or cycles if you specified cycles.
  • add the --kernel-trace flag to track kernel launches for attribution
  • specify either the json or csv output format with --output-format; the default output format, rocpd, does not currently support PC sampling output.

A typical command will look like the following:

bash
rocprofv3 \
  --pc-sampling-beta-enabled \
  --pc-sampling-method stochastic \
  --pc-sampling-unit cycles \
  --pc-sampling-interval 1048576 \
  --kernel-trace \
  --output-format json \
  -- <target app>

PC Sampling Outputs

Output-related options:

  • -d <dir>: output location (default: %cwd%)
  • -o <prefix>: name prefix (default: %hostname%/%pid%)
  • --output-format csv,json: emit both formats

Default path pattern: <output_dir>/<output_prefix>_<name>.<ext> where prefix is %hostname%/%pid% unless overridden.

Possible output files
FileFormatContents
*_pc_sampling_stochastic.csv or *_pc_sampling_host_trap.csvCSVFlat sample records; one row per sample
*_agent_info.csvCSVGPU/CPU agent metadata (not samples)
*_kernel_trace.csvCSVKernel dispatch records (with --kernel-trace)
*_results.jsonJSONAll data in one file

PC Sampling Guidance

There are two types of PC sampling: host-trap and stochastic. Stochastic requires hardware support and is available on fewer GPUs, but provides more information.

The default output format, rocpd, does not currently support pc sampling, so you must explicitly specify json (preferred) or csv. json outputs contain more information.

  • Prefer stochastic sampling unless the sampling interval needs to be larger than what stochastic can support.
  • Prefer the json output format since it will carry richer information when using stochastic sampling.
  • Prefer larger stochastic sampling intervals (2^18^-2^20^; often the maximum) unless the workload is short enough that this does not produce sufficient samples. Shorter intervals will quickly produce huge amounts of data.
  • Prefer host trap intervals on the order of 1000 microseconds, decreasing if needed.

Analyzing PC Sampling Results

Inside this skill's folder is an analysis script: scripts/analyze_pc_sampling.py. When passed the output sample file (.json or .csv) it will report the top sample locations and top stall reasons. You may also filter results to a particular kernel -with --kernel <kernel name>.

Run the included python script to perform basic analysis of the output files. Use its output to analyze the user's code, explain its performance, and help give specific and relevant suggestions for improvements. Inform the user of hot spots, the causes of the hotspots (if available), and possible improvements if any. If there are no notable potential improvements, briefly explain why. For example, transpose operations are heavily memory bound and a profile of a well-written transpose kernel will exhibit large amounts of WAITCNT stalls. This is inherent from the task itself and is not necessarily a failing of the kernel. However, a naive transpose kernel may exhibit scattered reads or writes, causing far more memory traffic and thus WAITCNT stalls than is necessary.

Procedure Checklist

  1. ensure the prerequisites defined above are met
  2. if there is not an up-to-date build of the target application with debug information, build it
  3. profile the application with rocprofv3 using pc sampling settings as directed above
  4. run this skill's included analysis script on the profiling outputs
  5. check that the run was successful and produced a non-trivial number of samples
  6. use the output of the script to provide analysis of their code's behavior and specific guidance on possible improvements

Misc. Tips

Tiny workloads may produce too few samples. Ensure the workload is large enough to get a representative sample count. If source code is available and the workload is too small, consider modifying the code to invoke the kernel multiple times, and then restoring it to its original state after the profiling run.

Host-trap sampling can have an instruction "skid" of one or two instructions; if sample attribution does not make sense, look at the surrounding instructions and branch targets.

A brief overview of stall types and their causes is available in this skill's resources/stall-reasons.md.

The rocm-systems repository has several PC sampling documentation files in this folder: projects/rocprofiler-sdk/source/docs/how-to/. You may also access them here: https://rocm.docs.amd.com/projects/rocprofiler-sdk/en/develop/how-to/cdna3-cdna4-pc-sampling.html

Only one PC sampling configurations is supported at a time, so if exactly one valid configuration is reported then PC sampling is probably being actively used by another process.

Файли в пакеті

Модель читає ці файли за потреби, поки навичку завантажено. Вони доступні для читання й ніколи не виконуються.

Поширені запитання

Що робить навичка ШІ Rocprofiler Pc Sampling?

Profiles a target application using rocprofv3 with program counter sampling enabled and then analyzes the results. Use when the user has a program that runs on an AMD GPU and asks to perform PC sampling, to determine the runtime performance characteristics of their application, to determine stall reasons, or to determine hotspots in the code.

Навіщо використовувати Rocprofiler Pc Sampling у TypingMind?

Тому що ви встановлюєте її один раз і використовуєте з будь-якою моделлю. Rocprofiler Pc Sampling — це звичайний Markdown, а не код для конкретного постачальника, тому та сама навичка працює з GPT-5, Claude, Gemini, Grok або локальною моделлю. Ви можете змінити модель навіть посеред чату, і навичка продовжить працювати. TypingMind використовує ваші власні ключі API, тож ви платите безпосередньо постачальникам замість передплати за кожне місце користувача, а ваші навички й чати залишаються у вашому сховищі.

Як встановити Rocprofiler Pc Sampling у TypingMind?

Відкрийте в TypingMind Плагіни → Навички → Встановити з GitHub і вставте https://github.com/amd/skills/tree/main/skills/rocprofiler-pc-sampling. TypingMind прочитає файл SKILL.md, додасть супровідні файли та встановить навичку, яку можна вмикати окремо для кожного чату.

Які моделі ШІ можуть використовувати Rocprofiler Pc Sampling?

Будь-яка модель, яку ви підключите в TypingMind. Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для конкретного постачальника, тому GPT, Claude, Gemini, Grok і локальні моделі можуть завантажувати цю навичку, коли запит їй відповідає.

Зі скількома моделями ШІ можна використовувати Rocprofiler Pc Sampling?

Зі скількома забажаєте. Якщо модель підтримує навички, ви можете використовувати з нею Rocprofiler Pc Sampling — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama та інші — усе в TypingMind із власними ключами API.

Чи безкоштовна навичка ШІ Rocprofiler Pc Sampling?

Так. Навичку опубліковано на GitHub: amd, за ліцензією MIT. Ви платите лише своєму постачальнику ШІ за використані токени.

Що таке навички ШІ?

Навичка ШІ — це багаторазовий набір інструкцій, який навчає модель ШІ виконувати одне конкретне завдання. Він відповідає відкритому формату Agent Skills: файл SKILL.md із назвою та описом, а також скрипти, шаблони чи довідкові файли, які можуть знадобитися моделі. Модель читає інструкції лише тоді, коли ваш запит відповідає навичці, тому встановлена навичка нічого не коштує, доки її не використано.

Чим навички ШІ відрізняються від плагінів або серверів MCP?

Плагін або сервер MCP надає моделі нові інструменти для виклику — код, який десь виконується й повертає результат. Натомість навичка ШІ надає моделі знання та порядок дій: як підійти до завдання, яких кроків дотримуватися та яким має бути якісний результат. Навички — це звичайний Markdown, тож їм не потрібні ні сервер, ні ключ API, ні середовище виконання, і вони працюють із будь-якою моделлю.

Усі

Створіть власний ШІ-простір уже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇