From 4f283d9bb341915b74d0fa9746ea1e5c1f9eafe7 Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Wed, 1 Feb 2023 12:26:03 -0500 Subject: [PATCH] Make the number of per agent SDMA engines queryable. Change-Id: Iae1cc9b7ec783fdda05f9384f0ad0327ea1a8cc3 --- runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp | 6 ++++++ runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp | 6 ++++++ runtime/hsa-runtime/inc/hsa_ext_amd.h | 13 +++++++++++++ 3 files changed, 25 insertions(+) diff --git a/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp b/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp index 2c4d236933..8b35d99557 100644 --- a/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp +++ b/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp @@ -376,6 +376,12 @@ hsa_status_t CpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const { case HSA_AMD_AGENT_INFO_SDMA_UCODE_VERSION: *((uint32_t*)value) = 0; break; + case HSA_AMD_AGENT_INFO_NUM_SDMA_ENG: + *((uint32_t*)value) = 0; + break; + case HSA_AMD_AGENT_INFO_NUM_SDMA_XGMI_ENG: + *((uint32_t*)value) = 0; + break; case HSA_AMD_AGENT_INFO_IOMMU_SUPPORT: *((hsa_amd_iommu_version_t*)value) = HSA_IOMMU_SUPPORT_NONE; break; diff --git a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp index 791f2b6430..a240b74680 100644 --- a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp +++ b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp @@ -1111,6 +1111,12 @@ hsa_status_t GpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const { case HSA_AMD_AGENT_INFO_SDMA_UCODE_VERSION: *((uint32_t*)value) = static_cast(properties_.uCodeEngineVersions.uCodeSDMA); break; + case HSA_AMD_AGENT_INFO_NUM_SDMA_ENG: + *((uint32_t*)value) = static_cast(properties_.NumSdmaEngines); + break; + case HSA_AMD_AGENT_INFO_NUM_SDMA_XGMI_ENG: + *((uint32_t*)value) = static_cast(properties_.NumSdmaXgmiEngines); + break; case HSA_AMD_AGENT_INFO_IOMMU_SUPPORT: if (properties_.Capability.ui32.HSAMMUPresent) *((hsa_amd_iommu_version_t*)value) = HSA_IOMMU_SUPPORT_V2; diff --git a/runtime/hsa-runtime/inc/hsa_ext_amd.h b/runtime/hsa-runtime/inc/hsa_ext_amd.h index eff93710d4..3f933c2109 100644 --- a/runtime/hsa-runtime/inc/hsa_ext_amd.h +++ b/runtime/hsa-runtime/inc/hsa_ext_amd.h @@ -361,6 +361,19 @@ typedef enum hsa_amd_agent_info_s { * The type of this attribute is uint32_t. */ HSA_AMD_AGENT_INFO_SDMA_UCODE_VERSION = 0xA109, + /** + * Queries the number of SDMA engines. + * If HSA_AMD_AGENT_INFO_NUM_SDMA_XGMI_ENG query returns non-zero, + * this query returns the the number of SDMA engines optimized for + * host to device bidirectional traffic. + * The type of this attribute is uint32_t. + */ + HSA_AMD_AGENT_INFO_NUM_SDMA_ENG = 0xA10A, + /** + * Queries the number of additional SDMA engines optimized for D2D xGMI copies. + * The type of this attribute is uint32_t. + */ + HSA_AMD_AGENT_INFO_NUM_SDMA_XGMI_ENG = 0xA10B, /** * Queries for version of IOMMU supported by agent. * The type of this attribute is hsa_amd_iommu_version_t.