From 0e3850b0038ae3ca264e0e6996095a697cdb1f11 Mon Sep 17 00:00:00 2001 From: Joseph Greathouse Date: Thu, 28 May 2020 13:01:30 -0500 Subject: [PATCH] Add ability to get ASIC revision from hsa_agent_get_info() Change-Id: Ie30c64f9e02f9e704c9a4c4145deb9580429fdf6 [ROCm/ROCR-Runtime commit: 3fe95c696aec7e84e518e40355c308a88549b6c8] --- .../runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp | 3 +++ .../runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp | 3 +++ .../rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h | 10 +++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp index b355ff01e7..ceae7ee22e 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp @@ -363,6 +363,9 @@ hsa_status_t CpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const { snprintf((char*)value, sizeof(uuid_tmp), "%s", uuid_tmp); break; } + case HSA_AMD_AGENT_INFO_ASIC_REVISION: + *((uint32_t*)value) = static_cast(properties_.Capability.ui32.ASICRevision); + break; default: return HSA_STATUS_ERROR_INVALID_ARGUMENT; break; diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp index d73ad56b38..40cff5eee5 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp @@ -931,6 +931,9 @@ hsa_status_t GpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const { snprintf((char*)value, (ss.str().length() + 1), "%s", (char*)ss.str().c_str()); break; } + case HSA_AMD_AGENT_INFO_ASIC_REVISION: + *((uint32_t*)value) = static_cast(properties_.Capability.ui32.ASICRevision); + break; default: return HSA_STATUS_ERROR_INVALID_ARGUMENT; break; diff --git a/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h b/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h index 2d7283f676..bc6ea7d84b 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h @@ -174,7 +174,15 @@ typedef enum hsa_amd_agent_info_s { * Agents that do not support UUID will return the string "GPU-XX" or * "CPU-XX" or "DSP-XX" depending upon their device type ::hsa_device_type_t */ - HSA_AMD_AGENT_INFO_UUID = 0xA011 + HSA_AMD_AGENT_INFO_UUID = 0xA011, + /** + * Queries for the ASIC revision of an agent. The value is an integer that + * increments for each revision. This can be used by user-level software to + * change how it operates, depending on the hardware version. This allows + * selective workarounds for hardware errata. + * The type of this attribute is uint32_t. + */ + HSA_AMD_AGENT_INFO_ASIC_REVISION = 0xA012 } hsa_amd_agent_info_t; typedef struct hsa_amd_hdp_flush_s {