[Rocprofiler-systems] : Refactor papi enumeration to fix a hang on Intel systems (#1672)

* Refactor papi enumeration to fix a hang on Intel systems

- Add an exclude argument to available_events_info() for
  perf_event_uncore causing hang like case on Intel systems with large
number of uncore events.
- Enumerate papi available events only when papi events are specified by
  users inside early initialization logic
- Move papi available event query for ROCPROFSYS_SAMPLING_OVERFLOW_EVENT
  config setting to the avail component, to move the heavy logic outside
initialization.
- Make category option for rocprof-sys-avail -H -c case insensitive
- Provide new option to query available overflow events that can be
  specified for ROCPROFSYS_SAMPLING_OVERFLOW_EVENT using new command
option rocprof-sys-avail -H -c overflow

* Update projects/rocprofiler-systems/source/bin/rocprof-sys-avail/common.cpp

Co-authored-by: Milan Radosavljevic <milan.radosavljevic@amd.com>

* Update timemory submodule pointer

Signed-off-by: David Galiffi <David.Galiffi@amd.com>

* Fix errors on compile

* Change 1: Optimization for the category matching lambda

Optmization changes.

* Modify the rocprof-sys-avail -c option for overflow

Overflow should not be displayed as a device in rocprof-sys-avail -H -c CPU

Users can instead do regex on summary where overflow is appended in description

User can do rocprof-sys-avail -H -c CPU -d -r overflow

* Revert change to column width

---------

Signed-off-by: David Galiffi <David.Galiffi@amd.com>
Co-authored-by: Milan Radosavljevic <milan.radosavljevic@amd.com>
Co-authored-by: David Galiffi <David.Galiffi@amd.com>
This commit is contained in:
Sajina PK
2025-11-21 00:19:58 -05:00
committed by GitHub
parent 4f4352acd0
commit d77b245730
6 changed files with 106 additions and 69 deletions
@@ -623,11 +623,12 @@ configure_settings(bool _init)
"the same signal (SIGRTMIN + 1)",
SIGRTMIN + 1, "sampling", "advanced");
ROCPROFSYS_CONFIG_SETTING(std::string, "ROCPROFSYS_SAMPLING_OVERFLOW_EVENT",
"Metric for overflow sampling",
std::string{ "perf::PERF_COUNT_HW_CACHE_REFERENCES" },
"sampling", "hardware_counters")
->set_choices(perf::get_config_choices());
ROCPROFSYS_CONFIG_SETTING(
std::string, "ROCPROFSYS_SAMPLING_OVERFLOW_EVENT",
"Metric for overflow sampling. Defaults to perf::PERF_COUNT_HW_CACHE_REFERENCES. "
"For full list of events see: rocprof-sys-avail -H -c CPU -r overflow",
std::string{ "perf::PERF_COUNT_HW_CACHE_REFERENCES" }, "sampling",
"hardware_counters");
rocprofiler_sdk::config_settings(_config);
amd_smi::config_settings(_config);
@@ -942,12 +943,18 @@ configure_settings(bool _init)
{
auto _papi_events = _config->find("ROCPROFSYS_PAPI_EVENTS");
_add_rocprofsys_category(_papi_events);
std::vector<std::string> _papi_choices = {};
for(auto itr : tim::papi::available_events_info())
// Only enumerate PAPI events if the user has specified them
if(_papi_events->second->get_config_updated() ||
!_config->get_papi_events().empty())
{
if(itr.available()) _papi_choices.emplace_back(itr.symbol());
std::vector<std::string> _papi_choices = {};
for(const auto& itr :
tim::papi::available_events_info({ "perf_event_uncore" }))
{
if(itr.available()) _papi_choices.emplace_back(itr.symbol());
}
_papi_events->second->set_choices(_papi_choices);
}
_papi_events->second->set_choices(_papi_choices);
}
#else
_config->find("ROCPROFSYS_PAPI_EVENTS")->second->set_hidden(true);