[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.
Este commit está contenido en:
Sajina PK
2026-01-09 11:59:45 -05:00
cometido por GitHub
padre ebe22b5907
commit b3f59a37e4
Se han modificado 5 ficheros con 118 adiciones y 16 borrados
@@ -1073,6 +1073,23 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
_data.processed_environs.emplace("papi_events");
}
if(_data.environ_filter("gpu_events", _data))
{
_parser
.add_argument({ "-G", "--gpu-events" },
"Set the GPU hardware counter events to record (ref: "
"`rocprof-sys-avail -H -c GPU`)")
.min_count(1)
.dtype("[EVENT ...]")
.action([&](parser_t& p) {
auto _events = join(array_config_t{ "," }, p.get<strvec_t>("gpu-events"));
update_env(_data, "ROCPROFSYS_ROCM_EVENTS", _events);
});
_data.processed_environs.emplace("gpu_events");
_data.processed_environs.emplace("rocm_events");
}
add_group_arguments(_parser, "category", _data, true);
add_group_arguments(_parser, "io", _data, true);
add_group_arguments(_parser, "perfetto", _data, true);