From b9d2b3f495c54fe5786e284f14f18d5cdfd199b0 Mon Sep 17 00:00:00 2001 From: venkat1361 Date: Fri, 13 Sep 2024 13:28:00 -0500 Subject: [PATCH] SWDEV-476852 - Check added for agent architecture counters support. (#1022) * check added for agent arch support * formatting issue [ROCm/rocprofiler-sdk commit: bc82eccf4fd14f3c575e087f788802c6806408e8] --- projects/rocprofiler-sdk/source/include/rocprofiler-sdk/fwd.h | 3 ++- .../rocprofiler-sdk/source/lib/rocprofiler-sdk/counters.cpp | 2 ++ .../rocprofiler-sdk/source/lib/rocprofiler-sdk/rocprofiler.cpp | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/fwd.h b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/fwd.h index 9075f654db..0015493387 100644 --- a/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/fwd.h +++ b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/fwd.h @@ -105,7 +105,8 @@ typedef enum // NOLINT(performance-enum-size) ROCPROFILER_STATUS_ERROR_NOT_AVAILABLE, ///< The service is not available. ///< Please refer to API functions that return this ///< status code for more information. - ROCPROFILER_STATUS_ERROR_EXCEEDS_HW_LIMIT, ///< Exceeds hardware limits for collection + ROCPROFILER_STATUS_ERROR_EXCEEDS_HW_LIMIT, ///< Exceeds hardware limits for collection. + ROCPROFILER_STATUS_ERROR_AGENT_ARCH_NOT_SUPPORTED, ///< Agent HW architecture not supported. ROCPROFILER_STATUS_LAST, } rocprofiler_status_t; diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters.cpp b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters.cpp index 5cf63bfd5e..76f79b15ee 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters.cpp +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters.cpp @@ -125,6 +125,8 @@ rocprofiler_iterate_agent_supported_counters(rocprofiler_agent_id_t if(!agent) return ROCPROFILER_STATUS_ERROR_AGENT_NOT_FOUND; auto metrics = rocprofiler::counters::getMetricsForAgent(agent->name); + if(metrics.empty()) return ROCPROFILER_STATUS_ERROR_AGENT_ARCH_NOT_SUPPORTED; + std::vector ids; ids.reserve(metrics.size()); for(const auto& metric : metrics) diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/rocprofiler.cpp b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/rocprofiler.cpp index 8ab8274b51..0bfb3c1faf 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/rocprofiler.cpp +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/rocprofiler.cpp @@ -112,6 +112,8 @@ ROCPROFILER_STATUS_STRING(ROCPROFILER_STATUS_ERROR_NOT_AVAILABLE, "this status code for more information.") ROCPROFILER_STATUS_STRING(ROCPROFILER_STATUS_ERROR_EXCEEDS_HW_LIMIT, "Request exceeds the capabilities of the hardware to collect") +ROCPROFILER_STATUS_STRING(ROCPROFILER_STATUS_ERROR_AGENT_ARCH_NOT_SUPPORTED, + "Agent HW architecture is not supported, no counter metrics found.") template const char*