Allow events to be grouped by HIP stream ID (#274)

- Corelate memory_copy and kernel_dispatch events with their HIP stream_id and add stream_id as an annotation in Perfetto.
- By default, group memory_copy and kernel_dispatch events in Perfetto output by their stream_id.
- Add option, with the configuration setting ROCPROFSYS_ROCM_GROUP_BY_QUEUE, to group by HSA queue instead.

---------

Signed-off-by: David Galiffi <David.Galiffi@amd.com>
Co-authored-by: David Galiffi <David.Galiffi@amd.com>
This commit is contained in:
ajanicijamd
2025-07-23 21:28:26 -04:00
zatwierdzone przez GitHub
rodzic 67ec52b523
commit 4b4a846b58
11 zmienionych plików z 416 dodań i 120 usunięć
+26
Wyświetl plik
@@ -372,6 +372,22 @@ config_settings(const std::shared_ptr<settings>& _config)
for(const auto& itr : buffered_tracing_info)
_add_operation_settings(itr.name, itr, buffered_operation_option_names);
// Add the ROCPROFSYS_ROCM_GROUP_BY_QUEUE setting if the hip_stream domain is present
// in supported ROCProfiler-SDK domains.
auto _has_hip_stream = std::find(_domain_choices.begin(), _domain_choices.end(),
"hip_stream") != _domain_choices.end();
if(_has_hip_stream)
{
ROCPROFSYS_CONFIG_SETTING(
bool, "ROCPROFSYS_ROCM_GROUP_BY_QUEUE",
"By default, Perfetto trace will show the HIP streams to which kernel "
"and memory copy operations submitted. With the "
"`ROCPROFSYS_ROCM_GROUP_BY_QUEUE` option, the trace will display HSA queues "
"to which these kernel and memory operations were submitted.",
false, "rocm", "perfetto");
}
}
std::unordered_set<rocprofiler_callback_tracing_kind_t>
@@ -550,6 +566,16 @@ get_rocm_events()
" ,;\t\n");
}
bool
get_group_by_queue(void)
{
std::optional<bool> _group_by_queue =
config::get_setting_value<bool>("ROCPROFSYS_ROCM_GROUP_BY_QUEUE");
bool _ret = _group_by_queue.value_or(true);
return _ret;
}
std::vector<int32_t>
get_operations(rocprofiler_callback_tracing_kind_t kindv)
{