SWDEV-363271 - Add some performance counter logs

Change-Id: I368ba4afe47357eb6051b2a06f762b8050e5a560


[ROCm/clr commit: 9e00c674c8]
This commit is contained in:
Alex Xie
2022-10-28 14:48:34 -04:00
committed by AlexBin Xie
parent 67ab900b7c
commit 1ac90df635
2 changed files with 11 additions and 1 deletions
@@ -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;
}
@@ -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;
}