From 175265aef4c6ff2fa179bec90aac0b34eca554f6 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 23 Jun 2023 15:02:48 +0000 Subject: [PATCH] Add query for driver gpu_id Add query OS driver node ID (gpu_id) Change-Id: I72ebc54d8ae5dbcd1346535912160a642b1065ae [ROCm/ROCR-Runtime commit: 60a0fd64c4c2006b3d4a1c4ca3d7911a6467ef02] --- .../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 | 7 ++++++- 3 files changed, 12 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 0b40031cc8..bdb6070f80 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 @@ -388,6 +388,9 @@ hsa_status_t CpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const { case HSA_AMD_AGENT_INFO_NUM_XCC: *((uint32_t*)value) = 0; break; + case HSA_AMD_AGENT_INFO_DRIVER_UID: + *((uint32_t*)value) = 0; + 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 ddce3c7598..effe251fbf 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 @@ -1352,6 +1352,9 @@ hsa_status_t GpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const { case HSA_AMD_AGENT_INFO_NUM_XCC: *((uint32_t*)value) = static_cast(properties_.NumXcc); break; + case HSA_AMD_AGENT_INFO_DRIVER_UID: + *((uint32_t*)value) = KfdGpuID(); + 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 1e810f411a..36f5ae1466 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 @@ -394,7 +394,12 @@ typedef enum hsa_amd_agent_info_s { * Queries for number of XCCs within the agent. * The type of this attribute is uint32_t. */ - HSA_AMD_AGENT_INFO_NUM_XCC = 0xA111 + HSA_AMD_AGENT_INFO_NUM_XCC = 0xA111, + /** + * Queries for driver unique identifier. + * The type of this attribute is uint32_t. + */ + HSA_AMD_AGENT_INFO_DRIVER_UID = 0xA112 } hsa_amd_agent_info_t; /**