Environment variables for custom tools#
This page documents the environment variables that affect a custom tool built
against ROCprofiler-SDK — that is, a shared library that implements
rocprofiler_configure (see ROCprofiler-SDK tool library). It does not cover the
ROCPROF_* variables consumed by rocprofv3; those are documented separately
in the rocprofv3 how-to guides.
Only variables that are part of the public custom-tool contract are listed here. Internal SDK tuning knobs and development/test overrides are intentionally omitted: they are subject to change without notice and should not be relied on by external tools.
Variables are grouped by the role they play in a custom tool’s lifecycle.
Tool discovery and loading#
These variables control how ROCprofiler-SDK locates and loads your tool library.
At least one of the following mechanisms must be configured before the first
ROCm runtime call so that registration can discover the tool. With
ROCP_TOOL_LIBRARIES the library is dlopened by the SDK during
registration (triggered by the first ROCm runtime call); with LD_PRELOAD the
library is mapped by the dynamic loader at process start.
Variable |
Default |
Description |
|---|---|---|
|
(unset) |
Colon-separated list of absolute paths to shared libraries that export
Warning The current parser splits on |
|
(unset) |
Standard dynamic-loader mechanism. If your tool library is listed in
|
Note
ROCP_TOOL_LIBRARIES failure modes differ:
If an entry cannot be
dlopened (for example, the file does not exist or has unresolved dependencies), the SDK callsROCP_FATALand the process terminates.If an entry is loaded but does not export
rocprofiler_configure, a warning is logged and that library is simply not registered as a tool; the process continues.
Logging and diagnostics#
These variables are the first thing to reach for when debugging a custom tool that is not being loaded, not being initialized, or not receiving callbacks.
Variable |
Default |
Description |
|---|---|---|
|
|
Severity threshold for SDK log output. Accepted values:
Log messages are emitted to |
Queue interception behavior#
This variable controls how ROCprofiler-SDK intercepts HSA queue operations. It is an advanced knob: most tools do not need to set it, and the default is chosen automatically based on the services your tool enables.
Variable |
Default |
Description |
|---|---|---|
|
(auto) |
Boolean ( When unset, the SDK chooses automatically: inline interposition is enabled only when no registered context requires dispatch counter collection, thread trace (ATT), or PC sampling; otherwise the legacy path is used. If you set this to |
Kernel dispatch timestamp source#
Variable |
Default |
Description |
|---|---|---|
|
|
Size in KiB of the firmware dispatch-log ring, as an integer from The driver only accepts ring sizes of |
|
|
Timeout in milliseconds, as an integer from |
|
|
Internal/advanced. Per-queue close-drain budget in milliseconds: how long
|
|
|
Boolean. The master switch for the entire KFD dispatch-log feature. When
unset (the default) the SDK does not probe the KFD dispatch-log interface
and every dispatch uses Under signal-less completion, a dispatch batch that qualifies is published with its AQL packet untouched – the SDK allocates no completion signal and does not modify the application’s – and the dispatch completes from the firmware dispatch-log record instead of a signal. A batch that does not qualify keeps the signal path, so the two coexist. Firmware timestamps require inline queue interposition, so enabling a service that only the legacy interception path supports (counter collection, advanced thread trace, or PC sampling) puts every dispatch on the HSA timestamps. A batch qualifies only when the dispatch log is live for that GPU, the reader is healthy, and every packet’s doorbell slot has exactly one live owning queue; a doorbell collision (two live queues sharing a slot) retires that slot to the signal path. A queue destroy does not retire the slot: a later queue that reuses the doorbell opens a fresh owner window and its records are attributed by dispatch time, so a queue-churning workload (for example a HIP stream pool) keeps using signal-less. ABI v4 exposes the firmware’s wrapping per-region cursor directly and carries no producer-side read pointer, so a ring overrun is not detectable by the reader: if the firmware laps the reader between drains, the copied records for the lapped span are unreliable and cannot be trusted to belong to any specific dispatch. There is no overrun warning or count. As a current limitation, un-attributed dispatches keep their correlation-id references until process teardown rather than being retired eagerly. One limitation is inherent to the doorbell-slot design: attribution requires that no two live queues on the same GPU share a page-relative doorbell slot at the same time. The doorbell allocator makes this rare, but if it does occur the slot is treated as ambiguous and its dispatches fall back to the signal path rather than risk a misattribution. Experimental, and gfx950-only today. This feature and its
Disabled by default. Enabling it changes when dispatch records are delivered relative to the application observing its own completion signal, so it is opt-in. |
Beta-feature opt-in#
Tools that use beta services must enable them explicitly. Without these variables, the corresponding configuration calls return an error.
Variable |
Default |
Description |
|---|---|---|
|
|
Enables the PC sampling service. Required to call
|
|
|
Enables Streaming Performance Monitor (SPM) counter collection. |
Agent visibility#
These standard ROCm runtime variables influence which agents the SDK exposes to your tool through the agent-information API. They are not owned by ROCprofiler-SDK, but custom tools that enumerate agents need to be aware of them.
Variable |
Default |
Description |
|---|---|---|
|
(all) |
Standard ROCm runtime selector. Restricts the set of agents the runtime
— and therefore the SDK — sees. Affects iteration through
|
|
(all) |
HIP-level device selectors. These affect which agents HIP exposes but do not directly hide agents from the SDK; tools that correlate HIP device ordinals with SDK agent IDs must account for the mapping. |
Minimal worked example#
Launching an application with a custom tool libmy_tool.so and verbose SDK
logging:
export ROCP_TOOL_LIBRARIES=/path/to/libmy_tool.so
export ROCPROFILER_LOG_LEVEL=info
./my_application
Equivalent invocation using LD_PRELOAD (useful when the tool must also
intercept symbols from the target):
LD_PRELOAD=/path/to/libmy_tool.so \
ROCPROFILER_LOG_LEVEL=info \
./my_application
See also#
ROCprofiler-SDK tool library — overview of the custom tool API and
rocprofiler_configure.Implementing process attachment tools — environment considerations when attaching to an already-running process.