From b8533eec6d90b53d235297cdbe7c1e5547d3076c Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Tue, 1 Jun 2021 23:51:29 -0500 Subject: [PATCH] Add agent info query for HSA_AMD_AGENT_INFO_SVM_DIRECT_HOST_ACCESS. Allows determining if the host can directly access HMM memory that is physically resident in vram. Change-Id: Ie452eedd0e27fe1b511afd416f5a1cd01b3d84e8 [ROCm/ROCR-Runtime commit: 9e53cab61321395b621218b1617547c72ccb94d3] --- .../runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp | 3 +++ .../rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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 00d5f4d510..0c35286f6c 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 @@ -982,6 +982,9 @@ hsa_status_t GpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const { case HSA_AMD_AGENT_INFO_ASIC_REVISION: *((uint32_t*)value) = static_cast(properties_.Capability.ui32.ASICRevision); break; + case HSA_AMD_AGENT_INFO_SVM_DIRECT_HOST_ACCESS: + assert(regions_.size() != 0 && "No device local memory found!"); + *((bool*)value) = properties_.Capability.ui32.CoherentHostAccess == 1; 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 cc5a34f214..df48de94ec 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 @@ -291,7 +291,13 @@ typedef enum hsa_amd_agent_info_s { * selective workarounds for hardware errata. * The type of this attribute is uint32_t. */ - HSA_AMD_AGENT_INFO_ASIC_REVISION = 0xA012 + HSA_AMD_AGENT_INFO_ASIC_REVISION = 0xA012, + /** + * Queries whether or not the host can directly access SVM memory that is + * physically resident in the agent's local memory. + * The type of this attribute is bool. + */ + HSA_AMD_AGENT_INFO_SVM_DIRECT_HOST_ACCESS = 0xA013 } hsa_amd_agent_info_t; typedef struct hsa_amd_hdp_flush_s {