[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
committato da GitHub
parent ebe22b5907
commit b3f59a37e4
5 ha cambiato i file con 118 aggiunte e 16 eliminazioni
@@ -837,6 +837,18 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
original_envs);
});
parser
.add_argument({ "-G", "--gpu-events" },
"Set the GPU hardware counter events to record (ref: "
"`rocprof-sys-avail -H -c GPU`)")
.action([&](parser_t& p) {
auto _events =
join(array_config{ "," }, p.get<std::vector<std::string>>("gpu-events"));
rocprofsys::common::update_env(_env, "ROCPROFSYS_ROCM_EVENTS", _events,
update_mode::REPLACE, ":", updated_envs,
original_envs);
});
parser.start_group("MISCELLANEOUS OPTIONS", "");
parser
.add_argument({ "-i", "--inlines" },