[Rocprofiler-system]: Fix GPU event enumeration for rocprof-sys-avail and CLI option for parsing GPU HW Counters (#2476)

## Motivation

The `rocprof-sys-avail -H -c GPU` command is returning blank output which is expected to display a list of available GPU hardware counters instead.
The `rocprof-sys-sample` and `rocprof-sys-run` is missing the `--gpu-events` option for specifying GPU counter events during profiling.

## Technical Details

The initialize_event_info() function had a logic bug where it only called set_agents() if the agent_manager was empty, but the actual issue was that the gpu_agents and cpu_agents vectors were empty even when agents were discovered.
Fixed the conditional logic to properly call set_agents() when gpu_agents and cpu_agents are empty, regardless of the agent_manager state.

Added the `--gpu-events (-G)` option which sets the `ROCPROFSYS_ROCM_EVENTS` environment variable to the specified values.

Fixes an issue where unsupported GPU/APU arch is being skipped gracefully - more details about this issue in the below comment.
This commit is contained in:
Sajina PK
2026-01-09 11:59:45 -05:00
committed by GitHub
parent ebe22b5907
commit b3f59a37e4
5 changed files with 118 additions and 16 deletions
@@ -519,6 +519,9 @@ main(int argc, char** argv)
} catch(std::runtime_error& _e)
{
verbprintf(0, "Retrieving the GPU HW counters failed: %s", _e.what());
} catch(std::exception& _e)
{
verbprintf(0, "Exception retrieving GPU HW counters: %s", _e.what());
}
verbprintf(1, "Found %i HIP devices and %zu GPU HW counters\n", gpu_count,
_num_metrics);