From 15114271be4178c74dd80f125a3789403452e2fe Mon Sep 17 00:00:00 2001 From: Mike Li Date: Thu, 7 Oct 2021 13:42:44 -0400 Subject: [PATCH] Return failure with any IMAGE attribute for gfx940 The gfx940 does not support IMAGE instructions. Any get_info with IMAGE attributes should return failure. Signed-off-by: Mike Li Change-Id: I12005628f92780f551ab6f8b41526c66b54c6a59 [ROCm/ROCR-Runtime commit: 46b667e530dfabd9dd269bd2a53a9e4f21d12115] --- .../hsa-runtime/core/runtime/amd_gpu_agent.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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 fdf033081c..dc8f63263b 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 @@ -936,6 +936,9 @@ hsa_status_t GpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const { // agent, and vendor name length limit excluding terminating nul character. constexpr size_t hsa_name_size = 63; + const bool isa_has_image_support = + (isa_->GetMajorVersion() == 9 && isa_->GetMinorVersion() == 4) ? false : true; + switch (attribute_u) { case HSA_AGENT_INFO_NAME: { std::string name = isa_->GetProcessorName(); @@ -1071,18 +1074,21 @@ hsa_status_t GpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const { case HSA_EXT_AGENT_INFO_IMAGE_2DADEPTH_MAX_ELEMENTS: case HSA_EXT_AGENT_INFO_IMAGE_3D_MAX_ELEMENTS: case HSA_EXT_AGENT_INFO_IMAGE_ARRAY_MAX_LAYERS: - return hsa_amd_image_get_info_max_dim(public_handle(), attribute, value); + if (isa_has_image_support) + *((uint32_t*)value) = 0; + else + return hsa_amd_image_get_info_max_dim(public_handle(), attribute, value); + break; case HSA_EXT_AGENT_INFO_MAX_IMAGE_RD_HANDLES: // TODO: hardcode based on OCL constants. - *((uint32_t*)value) = 128; + *((uint32_t*)value) = isa_has_image_support ? 128 : 0; break; case HSA_EXT_AGENT_INFO_MAX_IMAGE_RORW_HANDLES: - // TODO: hardcode based on OCL constants. - *((uint32_t*)value) = 64; + *((uint32_t*)value) = isa_has_image_support ? 64 : 0; break; case HSA_EXT_AGENT_INFO_MAX_SAMPLER_HANDLERS: - // TODO: hardcode based on OCL constants. - *((uint32_t*)value) = 16; + *((uint32_t*)value) = isa_has_image_support ? 16 : 0; + break; case HSA_AMD_AGENT_INFO_CHIP_ID: *((uint32_t*)value) = properties_.DeviceId; break;