Comparing ROCprofiler-SDK to legacy ROCm profiling tools#
This topic highlights the differences between the ROCprofiler-SDK and the legacy ROCm profiling tools: ROCProfiler and ROCTracer. The comparison also includes differences between the ROCprofiler-SDK command-line (CLI) tool: rocprofv3 and legacy ROCProfiler CLI tools: rocprof and rocprofv2.
ROCprofiler-SDK is an improved version of the ROCm profiling tools that enables more efficient implementations and better thread safety while avoiding the problems that hindered the legacy ROCm profiling tools. Here are the distinct ROCprofiler-SDK features, which also highlight the improvements over ROCProfiler and ROCTracer:
Improved tool initialization
Support for simultaneous use of the same services by multiple tools
Simplified control of one or more data collection services
Improved error checking and logging
Backward ABI compatibility
PC sampling (beta implementation)
The legacy ROCm profiling tools allowed a tool to access any of the services provided by ROCProfiler or ROCTracer, such as API tracing and kernel tracing, by calling roctracer_init() when an ROCm runtime is initially loaded.
Since the services to be used by the calling tool are not required to be specified during initialization, the libraries must be effectively prepared for any service to be available at any time.
This behavior introduced unnecessary overhead and made thread-safe data management difficult, as tools generally don’t use all the available services.
For example, ROCTracer always installed wrappers around every runtime API and added indirection overhead through the ROCTracer library to check for the current service configuration in a thread-safe manner.
ROCprofiler-SDK introduces context to solve the preceding issues. Contexts are effectively bundles of service configurations. ROCprofiler-SDK provides a single opportunity for a tool to create as many contexts as required.
A tool can group all services into a single context, create a separate context for each service, or use a mix.
This change in the design allows ROCprofiler-SDK to be aware of the services that might be requested by a tool at any given time.
The design change empowers ROCprofiler-SDK to:
Avoid unnecessary preparation for services that are never used. If no registered contexts request HSA API tracing, no wrappers need to be generated.
Perform more extensive checks during service specification and inform the tool about potential issues early.
Allow multiple tools to use certain services simultaneously.
Improve thread safety without introducing parallel bottlenecks.
Manage internal data and allocations more efficiently.
Command-line tool options: rocprofv3 versus rocprof and rocprofv2#
The following table provides a comparison between the CLI tool options of rocprofv3, rocprof, and rocprofv2. The comparison indicates that rocprofv3 is more efficient and flexible than rocprof and rocprofv2.
Category |
Feature |
rocprof |
rocprofv2 |
rocprofv3 |
Improvements |
Notes |
|---|---|---|---|---|---|---|
Basic tracing options |
HIP trace |
|
|
|
No change |
rocprof and rocprofv2
--hip-trace options include kernel dispatches and memory copy activities,unlike
rocprofv3. |
Basic tracing options |
HSA trace |
|
|
|
No change |
rocprof and rocprofv2
--hsa-trace options include kernel dispatches and memory copy activities,unlike
rocprofv3. |
Basic tracing options |
Scratch memory trace |
Not available |
Not available |
|
New option to trace scratch memory operations. |
|
Basic tracing options |
Marker trace (ROCTx) |
|
|
|
Improved ROCTx library with more features. |
|
Basic tracing options |
Memory copy trace |
Part of HIP and HSA traces |
Part of HIP and HSA traces |
|
Provides granularity for memory move operations. |
|
Basic tracing options |
Memory allocation trace |
Not available |
Not available |
|
New option for collecting memory allocation traces. Displays starting address, allocation size, and agent where allocation occurred. |
|
Basic tracing options |
Kernel trace |
|
|
|
Performance improvement. |
|
Granular tracing options |
HIP runtime trace |
Part of |
Part of |
|
For collecting HIP runtime API traces. For example, public HIP API functions starting with “hip” such as |
|
Granular tracing options |
HIP compiler trace |
Not available |
Not available |
|
For collecting HIP compiler-generated code traces. For example, HIP API functions starting with “__hip” such as |
|
Granular tracing options |
HSA core API trace |
Part of |
Part of |
|
New option for collecting only HSA API traces (core API). For example, HSA functions prefixed only with “hsa_” such as |
|
Granular tracing options |
HSA AMD trace |
Part of |
Part of |
|
For collecting HSA API traces (AMD-extension API). For example, HSA functions prefixed with “hsa_amd_” such as |
|
Granular tracing options |
HSA image extension trace |
Part of |
Part of |
|
New option for collecting HSA API traces (Image-extension API). For example, HSA functions prefixed only with |
|
Granular tracing options |
HSA finalizer trace |
Part of |
Part of |
|
New option for collecting HSA API traces (Finalizer-extension API). For example, HSA functions prefixed only with “hsa_ext_program_” such as |
|
Advanced tracing options |
Kokkos trace |
Not available |
Not available |
|
New option to enable built-in Kokkos tools support (implies |
|
Advanced tracing options |
RCCL trace |
Not available |
Not available |
|
For collecting ROCm Communication Collectives Library (RCCL, also pronounced as “Rickle”) traces. |
|
Advanced tracing options |
Scratch memory trace |
Not available |
Not available |
|
For collecting scratch memory event traces. |
|
Advanced tracing options |
rocDecode trace |
Not available |
Not available |
|
Tracing |
|
Advanced tracing options |
rocJPEG trace |
Not available |
Not available |
|
Tracing rocJPEG library. |
|
Aggregate tracing options |
Sys trace |
|
|
|
Extends the |
|
Aggregate tracing options |
Runtime trace |
Not available |
Not available |
|
New option to aggregate trace operations. |
|
Kernel naming options |
Kernel name mangling |
Not available |
Not available |
|
New option for mangled kernel names. |
|
Kernel naming options |
Kernel name truncation |
|
|
|
New option for truncating the demangled kernel names. |
|
Kernel naming options |
Kernel rename |
|
Not available |
|
New option to use region names defined by |
|
Post-processing tracing options |
Statistics |
|
Not available |
|
Statistics for the collected traces. |
|
Post-processing tracing options |
Summary |
Not available |
Not available |
|
New option to output a single summary of tracing data after the profiling session. |
|
Post-processing tracing options |
Summary per domain |
Not available |
Not available |
|
New option to output a summary for each tracing domain after the profiling session. |
Compared to |
Post-processing tracing options |
Summary groups |
Not available |
Not available |
|
New option to output a summary for each set of domains matching the regular expression. For example, |
|
Summary options |
Summary output file |
Not available |
Not available |
|
New option to output summary to a file, stdout, or stderr (default: stderr). |
|
Summary options |
Summary units |
Not available |
Not available |
|
New option to output summary in desired time units {sec,msec,usec,nsec}. |
|
Display options |
List available basic and derived metrics and PC sampling configurations |
|
|
|
A valid YAML is supported for this option now. |
|
Perfetto-specific options |
Perfetto data collection backend |
Not available |
Not available |
|
New option for Perfetto data collection backend. “system” mode requires starting traces and Perfetto daemons. |
|
Perfetto-specific options |
Perfetto buffer size |
Not available |
Setting environment variable |
|
New option to define the buffer size for Perfetto output in KB. default: 1 GB. |
|
Perfetto-specific options |
Perfetto buffer fill policy |
Not available |
Not available |
|
New option for handling new records when Perfetto has reached the buffer limit. |
|
Perfetto-specific options |
Perfetto shared memory size |
Not available |
Not available |
|
New option to define Perfetto shared memory size hint in KB. default: 64 KB. |
|
Filtering options |
Kernel filtration options for counter collection |
Supported in input.xml file (supports range, gpu and kernel filtration). |
kernel: <kernel_name> (can only be provided in input.txt file). |
|
Extensive control over output options using regular expressions. |
|
I/O options |
Output directory |
|
|
|
|
|
I/O options |
Output file |
|
|
|
|
|
I/O options |
Logging |
Minimal logging using environment variable. |
Minimal logging using environment variable. |
|
Extensive logging options |
|
I/O options |
Plugins |
Not available |
plugin support for different output formats. |
Replaced with |
Not needed as |
|
I/O options |
Output formats |
CSV, JSON (Chrome-Tracing format) |
CSV, JSON (Chrome-Tracing format), Perfetto, CTF |
CSV, JSON (custom schema), Perfetto, OTF2 |
Multiple output formats can be supported in a single run.
OTF2 can visualize larger trace files compared to Perfetto.
|
The Perfetto UI doesn’t accept the JSON output format generated by |
I/O options |
Counter collection |
Supports input text and XML format. |
Only supports input text format. |
Input support for text, YAML and JSON formats. |
It’s not possible to check for valid text file. Hence
rocprofv3 supports strongly typed input formats.YAML and JSON formats are more readable and easier to maintain.
Allows flexibility to add more features for the tool input.
|
|
I/O options |
Command-line counter collection |
Not available |
Not available |
|
New option to collect performance counters from command line. When specifying multiple counters, they must be comma or space-separated. |
|
I/O options |
Providing custom metrics file |
|
|
|
This option has been modified in |
|
Advanced options |
Preload |
Not available |
Not available |
|
Libraries to prepend to |
|
Trace control options |
Trace period |
|
|
|
Users can specify multiple configurations, each defined by a triplet in the format “start_delay:collection_time:repeat”, with the ability to change the unit of time in the given configurations. |
|
Trace control options |
Trace start |
|
Not available |
Not available |
Not available in |
|
Trace control options |
Flush interval |
|
|
Not available |
Not applicable for |
|
Trace control options |
Merge traces |
|
Not available |
Not available |
Not available in |
|
PC sampling options |
PC sampling |
Not available |
Not available |
|
Enables PC sampling support; beta version. |
|
Legacy options |
Timestamp On/Off |
|
Not available |
Not available |
Not applicable for |
|
Legacy options |
Context wait |
|
Not available |
Not available |
Not applicable for |
|
Legacy options |
Context limit |
|
Not available |
Not available |
Not applicable for |
|
Legacy options |
Code object tracking |
|
Always |
Always |
||
Legacy options |
Heartbeat |
|
Not available |
Not available |
Not applicable for |
Timing information: rocprofv3 versus rocprof and rocprofv2#
rocprofv3 provides more accurate timing information by reducing the tool overhead required to collect data and the interference with the timing of the kernel being measured. This results in a reduced kernel time variance received for the same kernel execution and more accurate timing overall. These changes are not available in rocprof and rocprofv2, so there can be substantial differences (up to 20 percent) in execution times reported by rocprof and rocprofv2 for a single kernel execution in comparison with rocprofv3. Across a large number of samples of the same kernel, the difference in the average execution time is limited to a single digit, with a much tighter variance of results on rocprofv3.
Default behavior: rocprofv3 versus rocprof and rocprofv2#
When run without an option, rocprofv3 behaves differently than rocprof and rocprofv2. The default behavior of rocprofv3 is to collect all available agents on the system and output them in CSV format, while rocprof and rocprofv2 output the kernel traces in CSV format by default. On rocprofv3, kernel traces are generated using --kernel-trace option.