Skip to content
AI.info

The Pulse

AMD details instruction-level GPU profiling in ROCm

AMD has described how developers can use PC sampling in ROCprofiler-SDK to find GPU instruction hotspots in compiled workloads. The company’s example uses two sampling methods to investigate a matrix multiplication kernel.

AMD details instruction-level GPU profiling in ROCm

GPU developers can use PC sampling in AMD’s ROCm software to locate instruction-level performance hotspots in compiled workloads without modifying kernel code, the company said in a November 26 technical post. The capability is part of ROCprofiler-SDK in ROCm 6.4 and later.

PC sampling periodically records the program counter of executing GPU waves and associates samples with instructions. The collected samples can be aggregated into a statistical profile showing where execution time or stalls are concentrated.

Instruction-level decoding works with precompiled binaries, but mapping a sampled instruction back to a source line requires the binary to have been built with debug symbols. Without them, the source-line field is empty and the output shows assembly instructions instead.

Two sampling methods

The software-based host-trap method uses a host thread to periodically trap running waves and capture their program-counter information. It is available across a range of AMD CDNA GPUs starting with Instinct MI200 series accelerators.

The hardware-based stochastic method samples waves on a cycle-based schedule. It can also provide execution details such as instruction type, stall reason and arbiter state. AMD lists support for CDNA 3, CDNA 4 and CDNA 5 architectures, including the Instinct MI300, MI325 and MI350 series and the MI455X.

The post’s examples cover CDNA 3 and CDNA 4. It says the same sampling support extends to CDNA 5, although that architecture is not covered by the examples.

In host-trap sampling, a driver-initiated host thread broadcasts a trap to compute units, targeting a wave slot. A resident wave captures its state in GPU memory and then resumes execution.

The requested interval is a target rather than a guaranteed cadence because host scheduling and wave response affect timing. The reported program counter can also be one or two instructions past the costly instruction, a limitation the post calls sampling skid.

Running the profiler

AMD’s examples use the rocprofv3 command-line interface. The host-trap command is gated behind a beta-enabled flag, and the post describes a capability check that shows whether the GPU advertises support and which sampling intervals the driver accepts.

The example host-trap run produces a sample file and a GPU agent metadata file, each prefixed by the process ID. The sample file includes timestamps, active-lane masks, dispatch IDs, decoded instructions and correlation IDs that link samples to the launching API call. For binaries built with debug symbols, it can also include source-line mappings.

A matrix multiplication example

In a worked matrix multiplication example, the post says sampling helped identify a fetch-bound pattern involving uncoalesced global loads in a naive kernel. The investigation then led to a rewrite using LDS tiling.

On a single Instinct MI300A in a four-accelerator test system, with ROCm rocm-10.1.0, AMD reports that the tiled version measured about 3.0 times faster and that the hot line’s WAITCNT stall count fell about 12.2 times. The company presents those figures as results under the post’s test conditions, not as general hardware claims.

AMD describes PC sampling as complementary to kernel tracing, performance-monitoring counters and Advanced Thread Trace. The post says it can direct attention to instructions and code regions within an existing workload without requiring manual instrumentation.

Sources

  1. Original source · Blog post AMD ROCm Blogs “Beyond Counters: Instruction-Level GPU Hotspot Profiling with PC Sampling in ROCprofiler-SDK” rocm.blogs.amd.com

Companies in this story

Related stories

Explore

More articles