diff --git a/projects/rocprofiler/src/core/counters/basic/gfx_metrics.xml b/projects/rocprofiler/src/core/counters/basic/gfx_metrics.xml index d4c1f462be..83d0bc50d7 100755 --- a/projects/rocprofiler/src/core/counters/basic/gfx_metrics.xml +++ b/projects/rocprofiler/src/core/counters/basic/gfx_metrics.xml @@ -617,6 +617,9 @@ + + + diff --git a/projects/rocprofiler/src/core/counters/derived/metrics.xml b/projects/rocprofiler/src/core/counters/derived/metrics.xml index b5ef65cb4d..05a959b7f5 100755 --- a/projects/rocprofiler/src/core/counters/derived/metrics.xml +++ b/projects/rocprofiler/src/core/counters/derived/metrics.xml @@ -386,6 +386,9 @@ + + + diff --git a/projects/rocprofiler/src/core/counters/metrics/basic_counters.xml b/projects/rocprofiler/src/core/counters/metrics/basic_counters.xml index 6095e3f2eb..6a9bdca6dd 100755 --- a/projects/rocprofiler/src/core/counters/metrics/basic_counters.xml +++ b/projects/rocprofiler/src/core/counters/metrics/basic_counters.xml @@ -630,6 +630,9 @@ + + + @@ -733,3 +736,4 @@ + diff --git a/projects/rocprofiler/src/core/counters/metrics/derived_counters.xml b/projects/rocprofiler/src/core/counters/metrics/derived_counters.xml index 3119c4577d..6e2b54fb4b 100755 --- a/projects/rocprofiler/src/core/counters/metrics/derived_counters.xml +++ b/projects/rocprofiler/src/core/counters/metrics/derived_counters.xml @@ -505,6 +505,8 @@ #Mi300 + + #Navi21 diff --git a/projects/rocprofiler/src/core/counters/metrics/metrics.h b/projects/rocprofiler/src/core/counters/metrics/metrics.h index 7a47c06649..dda6be48de 100755 --- a/projects/rocprofiler/src/core/counters/metrics/metrics.h +++ b/projects/rocprofiler/src/core/counters/metrics/metrics.h @@ -39,6 +39,7 @@ THE SOFTWARE. #include "expr.h" #include "xml.h" #include +#include #include "src/core/hardware/hsa_info.h" namespace rocprofiler { @@ -203,14 +204,17 @@ class MetricsDict { xml_->AddConst("top.const.metric", "SE_NUM", agent_info->getShaderEngineCount()); ImportMetrics(agent_info, "const"); agent_name_ = agent_info->getName(); - if (agent_name_.substr(0, 6) == "gfx940") - agent_name_ = - "gfx940"; // To correct the agent_name from "gfx940:forcestoresc1+" -> "gfx940" - if (std::string("gfx906") == agent_name_ || std::string("gfx908") == agent_name_ || - std::string("gfx90a") == agent_name_ || std::string("gfx940") == agent_name_ || - std::string("gfx1032") == agent_name_ || std::string("gfx1031") == agent_name_ || - std::string("gfx1030") == agent_name_ || std::string("gfx1100") == agent_name_ || - std::string("gfx1101") == agent_name_) { + + if (agent_name_.find(':') != std::string::npos) // Remove compiler flags from the agent_name + agent_name_ = agent_name_.substr(0, agent_name_.find(':')); + + std::unordered_set supported_agent_names = { + "gfx906", "gfx908" "gfx90a", // Vega + "gfx940", "gfx941", "gfx942", // Mi300 + "gfx1030", "gfx1031", "gfx1032", // Navi2x + "gfx1100", "gfx1101" // Navi3x + }; + if (supported_agent_names.find(agent_name_) != supported_agent_names.end()) { ImportMetrics(agent_info, agent_name_); } else { agent_name_ = agent_info->getGfxip(); diff --git a/projects/rocprofiler/src/core/hardware/hsa_info.cpp b/projects/rocprofiler/src/core/hardware/hsa_info.cpp index 1a49f3e986..3188c6830f 100644 --- a/projects/rocprofiler/src/core/hardware/hsa_info.cpp +++ b/projects/rocprofiler/src/core/hardware/hsa_info.cpp @@ -85,13 +85,11 @@ AgentInfo::AgentInfo(const hsa_agent_t agent, ::CoreApiTable* table) : handle_(a rocprofiler::fatal("hsa_agent_get_info for PCI info failed"); } - // TODO: (sauverma) use hsa_agent_get_info_fn(HSA_AMD_AGENT_INFO_NUM_XCC) - // to get xcc_num once hsa headers are updated from rocr/hsa - std::string gpu_name = std::string(name_).substr(0, 6); - if (gpu_name == "gfx940") - xcc_num_ = 6; - else - xcc_num_ = 1; + // TODO(saurabh, giovanni): Remove this in 5.7 + if (table->hsa_agent_get_info_fn(agent, + static_cast(HSA_AMD_AGENT_INFO_NUM_XCC), &xcc_num_) != HSA_STATUS_SUCCESS) { + xcc_num_ = 1; + } } uint64_t AgentInfo::getIndex() const { return index_; } diff --git a/projects/rocprofiler/src/core/hsa/queues/queue.cpp b/projects/rocprofiler/src/core/hsa/queues/queue.cpp index 8d58c5d426..598f1d92ab 100644 --- a/projects/rocprofiler/src/core/hsa/queues/queue.cpp +++ b/projects/rocprofiler/src/core/hsa/queues/queue.cpp @@ -193,7 +193,7 @@ static const kernel_descriptor_t* GetKernelCode(uint64_t kernel_object) { static uint32_t arch_vgpr_count(Agent::AgentInfo& info, const kernel_descriptor_t& kernel_code) { const std::string_view& name = info.getName(); std::string info_name(name.data(), name.size()); - if (strcmp(name.data(), "gfx90a") == 0 || strcmp(name.data(), "gfx940") == 0) + if (strcmp(name.data(), "gfx90a") == 0 || strncmp(name.data(), "gfx94", 5) == 0) return (AMD_HSA_BITS_GET(kernel_code.compute_pgm_rsrc3, AMD_COMPUTE_PGM_RSRC_THREE_ACCUM_OFFSET) + 1) * @@ -211,7 +211,7 @@ static uint32_t accum_vgpr_count(Agent::AgentInfo& info, const kernel_descriptor const std::string_view& name = info.getName(); std::string info_name(name.data(), name.size()); if (strcmp(info_name.c_str(), "gfx908") == 0) return arch_vgpr_count(info, kernel_code); - if (strcmp(info_name.c_str(), "gfx90a") == 0 || strcmp(info_name.c_str(), "gfx940") == 0) + if (strcmp(info_name.c_str(), "gfx90a") == 0 || strncmp(info_name.c_str(), "gfx94", 5) == 0) return (AMD_HSA_BITS_GET(kernel_code.compute_pgm_rsrc1, AMD_COMPUTE_PGM_RSRC_ONE_GRANULATED_WORKITEM_VGPR_COUNT) + 1) * diff --git a/projects/rocprofiler/src/core/metrics.h b/projects/rocprofiler/src/core/metrics.h index 4756e11605..388a40a29f 100755 --- a/projects/rocprofiler/src/core/metrics.h +++ b/projects/rocprofiler/src/core/metrics.h @@ -33,6 +33,7 @@ THE SOFTWARE. #include #include #include +#include #include "core/types.h" #include "util/exception.h" @@ -201,14 +202,17 @@ class MetricsDict { xml_->AddConst("top.const.metric", "SE_NUM", agent_info->se_num); ImportMetrics(agent_info, "const"); agent_name_ = agent_info->name; - if (agent_name_.substr(0, 6) == "gfx940") - agent_name_ = - "gfx940"; // To correct the agent_name from "gfx940:forcestoresc1+" -> "gfx940" - if (std::string("gfx906") == agent_name_ || std::string("gfx908") == agent_name_ || - std::string("gfx90a") == agent_name_ || std::string("gfx940") == agent_name_ || - std::string("gfx1032") == agent_name_ || std::string("gfx1031") == agent_name_ || - std::string("gfx1030") == agent_name_ || std::string("gfx1100") == agent_name_ || - std::string("gfx1101") == agent_name_) { + + if (agent_name_.find(':') != std::string::npos) // Remove compiler flags from the agent_name + agent_name_ = agent_name_.substr(0, agent_name_.find(':')); + + std::unordered_set supported_agent_names = { + "gfx906", "gfx908" "gfx90a", // Vega + "gfx940", "gfx941", "gfx942", // Mi300 + "gfx1030", "gfx1031", "gfx1032", // Navi2x + "gfx1100", "gfx1101" // Navi3x + }; + if (supported_agent_names.find(agent_name_) != supported_agent_names.end()) { ImportMetrics(agent_info, agent_name_); } else { agent_name_ = agent_info->gfxip; diff --git a/projects/rocprofiler/test/tool/gfx_metrics.xml b/projects/rocprofiler/test/tool/gfx_metrics.xml index 768b896c7e..7641b682c4 100755 --- a/projects/rocprofiler/test/tool/gfx_metrics.xml +++ b/projects/rocprofiler/test/tool/gfx_metrics.xml @@ -631,6 +631,9 @@ + + + @@ -739,3 +742,4 @@ + diff --git a/projects/rocprofiler/test/tool/metrics.xml b/projects/rocprofiler/test/tool/metrics.xml index 47ce197a95..120b2223e1 100755 --- a/projects/rocprofiler/test/tool/metrics.xml +++ b/projects/rocprofiler/test/tool/metrics.xml @@ -426,6 +426,8 @@ #Mi300 + + #Navi21 diff --git a/projects/rocprofiler/test/tool/tool.cpp b/projects/rocprofiler/test/tool/tool.cpp index 1466f83a45..e56efb1f3b 100644 --- a/projects/rocprofiler/test/tool/tool.cpp +++ b/projects/rocprofiler/test/tool/tool.cpp @@ -670,7 +670,7 @@ static const kernel_descriptor_t* GetKernelCode(uint64_t kernel_object) { } static uint32_t arch_vgpr_count(const AgentInfo &info, const kernel_descriptor_t &kernel_code) { - if (strcmp(info.name, "gfx90a") == 0 || strcmp(info.name, "gfx940") == 0) + if (strcmp(info.name, "gfx90a") == 0 || strncmp(info.name, "gfx94", 5) == 0) return (AMD_HSA_BITS_GET(kernel_code.compute_pgm_rsrc3, AMD_COMPUTE_PGM_RSRC_THREE_ACCUM_OFFSET) + 1) * 4; return (AMD_HSA_BITS_GET(kernel_code.compute_pgm_rsrc1, AMD_COMPUTE_PGM_RSRC_ONE_GRANULATED_WORKITEM_VGPR_COUNT) + 1) @@ -680,7 +680,7 @@ static uint32_t arch_vgpr_count(const AgentInfo &info, const kernel_descriptor_t static uint32_t accum_vgpr_count(const AgentInfo &info, const kernel_descriptor_t &kernel_code) { if (strcmp(info.name, "gfx908") == 0) return arch_vgpr_count(info, kernel_code); - if (strcmp(info.name, "gfx90a") == 0 || strcmp(info.name, "gfx940") == 0) + if (strcmp(info.name, "gfx90a") == 0 || strncmp(info.name, "gfx94", 5) == 0) return (AMD_HSA_BITS_GET(kernel_code.compute_pgm_rsrc1, AMD_COMPUTE_PGM_RSRC_ONE_GRANULATED_WORKITEM_VGPR_COUNT) + 1) * 8 - arch_vgpr_count(info, kernel_code); @@ -737,6 +737,7 @@ void set_kernel_properties(const rocprofiler_callback_data_t* callback_data, // Kernel disoatch callback hsa_status_t dispatch_callback(const rocprofiler_callback_data_t* callback_data, void* user_data, rocprofiler_group_t* group) { + // TODO: return success, make atomic flag // Passed tool data callbacks_data_t* tool_data = reinterpret_cast(user_data); // HSA status