From 1ac90df635b39dec19433c7e1f9ffe0bd1edd4a2 Mon Sep 17 00:00:00 2001 From: Alex Xie Date: Fri, 28 Oct 2022 14:48:34 -0400 Subject: [PATCH] SWDEV-363271 - Add some performance counter logs Change-Id: I368ba4afe47357eb6051b2a06f762b8050e5a560 [ROCm/clr commit: 9e00c674c8f6b9aa625e5ef9524628ec63f4b4d8] --- projects/clr/rocclr/device/rocm/roccounters.cpp | 4 ++++ projects/clr/rocclr/device/rocm/roccounters.hpp | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/projects/clr/rocclr/device/rocm/roccounters.cpp b/projects/clr/rocclr/device/rocm/roccounters.cpp index 5f75a3c0af..c10ae9896e 100644 --- a/projects/clr/rocclr/device/rocm/roccounters.cpp +++ b/projects/clr/rocclr/device/rocm/roccounters.cpp @@ -536,6 +536,7 @@ bool PerfCounterProfile::initialize() { profile_.output_buffer = {nullptr, 0}; if (api_.hsa_ven_amd_aqlprofile_start(&profile_, nullptr) != HSA_STATUS_SUCCESS) { + LogError("Start hsa aql profile counter failed"); return false; } @@ -553,6 +554,7 @@ bool PerfCounterProfile::initialize() { profile_.command_buffer.ptr = buf_ptr; } else { + LogError("Failed to allocate profile counter command buffer"); return false; } } @@ -570,12 +572,14 @@ bool PerfCounterProfile::initialize() { } else { roc_device_.hostFree(profile_.command_buffer.ptr, profile_.command_buffer.size); + LogError("Failed to allocate profile counter output buffer"); return false; } } // create the completion signal if (hsa_signal_create(1, 0, nullptr, &completionSignal_) != HSA_STATUS_SUCCESS) { + LogError("Failed to create signal for profile counter"); return false; } diff --git a/projects/clr/rocclr/device/rocm/roccounters.hpp b/projects/clr/rocclr/device/rocm/roccounters.hpp index 45ebbe6632..494d3e07b6 100644 --- a/projects/clr/rocclr/device/rocm/roccounters.hpp +++ b/projects/clr/rocclr/device/rocm/roccounters.hpp @@ -119,14 +119,20 @@ class PerfCounterProfile : public amd::ReferenceCountedObject { hsa_agent_t agent = roc_device_.getBackendDevice(); bool system_support, agent_support; hsa_system_extension_supported(HSA_EXTENSION_AMD_AQLPROFILE, 1, 0, &system_support); + if (!system_support) { + LogError("HSA system does not support profile counter"); + return false; + } hsa_agent_extension_supported(HSA_EXTENSION_AMD_AQLPROFILE, agent, 1, 0, &agent_support); - if (!system_support || !agent_support) { + if (!agent_support) { + LogError ("HSA agent does not support profile counter"); return false; } if (hsa_system_get_major_extension_table(HSA_EXTENSION_AMD_AQLPROFILE, hsa_ven_amd_aqlprofile_VERSION_MAJOR, sizeof(hsa_ven_amd_aqlprofile_pfn_t), &api_) != HSA_STATUS_SUCCESS) { + LogError ("Failed to obtain aql profile extension function table"); return false; }