From 9e4977baa8b52ecc27e7fb099ea09a8b1154abef Mon Sep 17 00:00:00 2001 From: "Jonathan R. Madsen" Date: Mon, 18 Jul 2022 01:52:03 -0500 Subject: [PATCH] Fix statistics type and use feature name indexes (#85) - fix reporting units and statistics type for rocm_data_tracker - use indexes for feature names instead of strings [ROCm/rocprofiler-systems commit: 7745c12417d37984c2cc3e1997033a57b4088dcf] --- .../lib/omnitrace/library/components/rocprofiler.cpp | 9 ++++----- .../lib/omnitrace/library/components/rocprofiler.hpp | 4 +++- .../source/lib/omnitrace/library/rocprofiler.cpp | 9 +++++++-- .../source/lib/omnitrace/library/tracing.hpp | 3 ++- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/projects/rocprofiler-systems/source/lib/omnitrace/library/components/rocprofiler.cpp b/projects/rocprofiler-systems/source/lib/omnitrace/library/components/rocprofiler.cpp index 47c33eda91..dffff72c43 100644 --- a/projects/rocprofiler-systems/source/lib/omnitrace/library/components/rocprofiler.cpp +++ b/projects/rocprofiler-systems/source/lib/omnitrace/library/components/rocprofiler.cpp @@ -45,9 +45,6 @@ #include #include -TIMEMORY_STATISTICS_TYPE(component::rocm_data_tracker, component::rocm_feature_value) -TIMEMORY_DEFINE_CONCRETE_TRAIT(report_units, component::rocm_data_tracker, false_type) - namespace tim { namespace component @@ -86,7 +83,7 @@ rocm_event::rocm_event(uint32_t _dev, uint32_t _thr, uint32_t _queue, for(uint32_t i = 0; i < _feature_count; ++i) { const rocprofiler_feature_t* p = &_features[i]; - feature_names.emplace_back(p->name); + feature_names.emplace_back(i); switch(p->data.kind) { // Output metrics results @@ -121,7 +118,9 @@ rocm_event::as_string() const _ss << std::fixed; for(size_t i = 0; i < feature_names.size(); ++i) { - _ss << ", " << feature_names.at(i) << " = "; + auto _name = omnitrace::rocprofiler::get_data_labels().at(device_id).at( + feature_names.at(i)); + _ss << ", " << _name << " = "; auto _as_string = [&_ss](auto&& itr) { _ss << std::setw(4) << itr; }; std::visit(_as_string, feature_values.at(i)); } diff --git a/projects/rocprofiler-systems/source/lib/omnitrace/library/components/rocprofiler.hpp b/projects/rocprofiler-systems/source/lib/omnitrace/library/components/rocprofiler.hpp index 3c76db0150..8d3e6041d8 100644 --- a/projects/rocprofiler-systems/source/lib/omnitrace/library/components/rocprofiler.hpp +++ b/projects/rocprofiler-systems/source/lib/omnitrace/library/components/rocprofiler.hpp @@ -82,7 +82,7 @@ struct rocm_event rocm_metric_type entry = 0; rocm_metric_type exit = 0; std::string name = {}; - std::vector feature_names = {}; + std::vector feature_names = {}; std::vector feature_values = {}; rocm_event() = default; @@ -224,6 +224,8 @@ TIMEMORY_DEFINE_CONCRETE_TRAIT(is_timing_category, component::rocprofiler_data, TIMEMORY_DEFINE_CONCRETE_TRAIT(uses_timing_units, component::rocprofiler_data, false_type) TIMEMORY_DEFINE_CONCRETE_TRAIT(report_units, component::rocprofiler_data, false_type) TIMEMORY_STATISTICS_TYPE(component::rocprofiler_data, component::rocprofiler_value) +TIMEMORY_STATISTICS_TYPE(component::rocm_data_tracker, component::rocm_feature_value) +TIMEMORY_DEFINE_CONCRETE_TRAIT(report_units, component::rocm_data_tracker, false_type) #if !defined(OMNITRACE_EXTERN_COMPONENTS) || \ (defined(OMNITRACE_EXTERN_COMPONENTS) && OMNITRACE_EXTERN_COMPONENTS > 0) diff --git a/projects/rocprofiler-systems/source/lib/omnitrace/library/rocprofiler.cpp b/projects/rocprofiler-systems/source/lib/omnitrace/library/rocprofiler.cpp index c663ae5c13..82cca15b57 100644 --- a/projects/rocprofiler-systems/source/lib/omnitrace/library/rocprofiler.cpp +++ b/projects/rocprofiler-systems/source/lib/omnitrace/library/rocprofiler.cpp @@ -533,7 +533,10 @@ post_process_perfetto() return JOIN(" ", "Device", _v, JOIN("", '[', _dev_id, ']')); }; for(auto nitr : itr.feature_names) - counter_track::emplace(_dev_id, addendum(nitr)); + { + auto _name = get_data_labels().at(itr.device_id).at(nitr); + counter_track::emplace(_dev_id, addendum(_name)); + } } } @@ -737,7 +740,9 @@ post_process_timemory() { _storage.reserve(_n); for(size_t i = _storage.size(); i < _n; ++i) - _storage.emplace_back(ditr.first, i, itr->feature_names.at(i)); + _storage.emplace_back( + ditr.first, i, + get_data_labels().at(ditr.first).at(itr->feature_names.at(i))); } } diff --git a/projects/rocprofiler-systems/source/lib/omnitrace/library/tracing.hpp b/projects/rocprofiler-systems/source/lib/omnitrace/library/tracing.hpp index c5ccf5b7ea..a19a6b4830 100644 --- a/projects/rocprofiler-systems/source/lib/omnitrace/library/tracing.hpp +++ b/projects/rocprofiler-systems/source/lib/omnitrace/library/tracing.hpp @@ -94,7 +94,8 @@ thread_init() if(threading::get_id() > 0) threading::set_thread_name(JOIN(" ", "Thread", threading::get_id()).c_str()); thread_data::construct( - JOIN('/', "omnitrace", process::get_id(), "thread", threading::get_id()), + JOIN('/', "omnitrace/process", process::get_id(), "thread", + threading::get_id()), quirk::config{}); get_interval_data()->reserve(512); // save the hash maps