From 0368938f67f23272e1e55f9f5f49ce926b25263e Mon Sep 17 00:00:00 2001 From: Ammar ELWazir Date: Fri, 2 Jun 2023 05:27:38 +0000 Subject: [PATCH] Profiler and Tracer fix to use the same GPU ID Change-Id: Ie42212d7717a3fd5e8fe1b5d1a2e893499ccedf7 [ROCm/rocprofiler commit: edf162163a8c62577710f85eba37300e9a45edf9] --- projects/rocprofiler/src/core/hsa/hsa_support.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/rocprofiler/src/core/hsa/hsa_support.cpp b/projects/rocprofiler/src/core/hsa/hsa_support.cpp index b83bb64c25..8a18ffbf6e 100644 --- a/projects/rocprofiler/src/core/hsa/hsa_support.cpp +++ b/projects/rocprofiler/src/core/hsa/hsa_support.cpp @@ -839,7 +839,6 @@ void Initialize(HsaApiTable* table) { [](hsa_agent_t agent, void* data) { Agent::AgentInfo agent_info{agent, &GetCoreApiTable()}; static int cpu_agent_count = 0; - static int gpu_agent_count = 0; static int other_agent_count = 0; switch (agent_info.getType()) { case HSA_DEVICE_TYPE_CPU: @@ -867,7 +866,12 @@ void Initialize(HsaApiTable* table) { // that would be an improvement--it's what legacy roctracer // is currently doing as well as the roctracer compatibility // code earlier in this file. - agent_info.setIndex(gpu_agent_count++); + uint32_t driver_node_id; + if (rocprofiler::hsa_support::GetCoreApiTable().hsa_agent_get_info_fn( + agent, static_cast(HSA_AMD_AGENT_INFO_DRIVER_NODE_ID), + &driver_node_id) != HSA_STATUS_SUCCESS) + rocprofiler::fatal("hsa_agent_get_info failed"); + agent_info.setIndex(driver_node_id); uint32_t gpu_cpu_numa_node_id; if (GetCoreApiTable().hsa_agent_get_info_fn( agent, HSA_AGENT_INFO_NODE, &gpu_cpu_numa_node_id) != HSA_STATUS_SUCCESS)