diff --git a/hipamd/src/hip_conversions.hpp b/hipamd/src/hip_conversions.hpp index ef928225eb..ebebde0d2e 100644 --- a/hipamd/src/hip_conversions.hpp +++ b/hipamd/src/hip_conversions.hpp @@ -97,7 +97,13 @@ cl_mem_object_type getCLMemObjectType(const unsigned int hipWidth, const unsigned int hipHeight, const unsigned int hipDepth, const unsigned int flags) { - if (flags == hipArrayDefault) { + if (flags & hipArrayLayered == hipArrayLayered) { + if ((hipWidth != 0) && (hipHeight == 0) && (hipDepth != 0)) { + return CL_MEM_OBJECT_IMAGE1D_ARRAY; + } else if ((hipWidth != 0) && (hipHeight != 0) && (hipDepth != 0)) { + return CL_MEM_OBJECT_IMAGE2D_ARRAY; + } + } else { if ((hipWidth != 0) && (hipHeight == 0) && (hipDepth == 0)) { return CL_MEM_OBJECT_IMAGE1D; } else if ((hipWidth != 0) && (hipHeight != 0) && (hipDepth == 0)) { @@ -105,12 +111,6 @@ cl_mem_object_type getCLMemObjectType(const unsigned int hipWidth, } else if ((hipWidth != 0) && (hipHeight != 0) && (hipDepth != 0)) { return CL_MEM_OBJECT_IMAGE3D; } - } else if (flags == hipArrayLayered) { - if ((hipWidth != 0) && (hipHeight == 0) && (hipDepth != 0)) { - return CL_MEM_OBJECT_IMAGE1D_ARRAY; - } else if ((hipWidth != 0) && (hipHeight != 0) && (hipDepth != 0)) { - return CL_MEM_OBJECT_IMAGE2D_ARRAY; - } } // error scenario. ShouldNotReachHere() return CL_MEM_OBJECT_ALLOCATION_FAILURE; diff --git a/hipamd/src/hip_memory.cpp b/hipamd/src/hip_memory.cpp index c66d5044c2..9db3a7c7d9 100644 --- a/hipamd/src/hip_memory.cpp +++ b/hipamd/src/hip_memory.cpp @@ -998,11 +998,6 @@ hipError_t ihipArrayCreate(hipArray** array, return hipErrorInvalidValue; } - if ((pAllocateArray->Flags & hipArraySurfaceLoadStore) || - (pAllocateArray->Flags & hipArrayTextureGather)) { - return hipErrorNotSupported; - } - const cl_channel_order channelOrder = hip::getCLChannelOrder(pAllocateArray->NumChannels, 0); const cl_channel_type channelType = hip::getCLChannelType(pAllocateArray->Format, hipReadModeElementType); const cl_mem_object_type imageType = hip::getCLMemObjectType(pAllocateArray->Width, diff --git a/hipamd/src/hip_surface.cpp b/hipamd/src/hip_surface.cpp index 3ec495b668..fcc7835120 100644 --- a/hipamd/src/hip_surface.cpp +++ b/hipamd/src/hip_surface.cpp @@ -44,6 +44,10 @@ hipError_t ihipCreateSurfaceObject(hipSurfaceObject_t* pSurfObject, const hipResourceDesc* pResDesc) { amd::Device* device = hip::getCurrentDevice()->devices()[0]; const device::Info& info = device->info(); + if (!info.imageSupport_) { + LogPrintfError("Texture not supported on the device %s", info.name_); + return hipErrorNotSupported; + } // Validate input params if (pSurfObject == nullptr || pResDesc == nullptr) {