From be80bf54060903102b33645298dc48fc261a29bb Mon Sep 17 00:00:00 2001 From: Ajay Date: Wed, 21 Sep 2022 19:50:06 +0000 Subject: [PATCH] SWDEV-353548 - assert with different behavior for Release vs Debug assert statement behavior -Debug: crashes tests with SIGABORT -Release: continues silently without Change-Id: I7578eb16a7391ff7f9d68f1cae3bcea7f8225579 --- hipamd/src/hip_conversions.hpp | 36 +++++++++++-------------------- hipamd/src/hip_graph_internal.cpp | 4 ++-- hipamd/src/hip_memory.cpp | 4 ++-- hipamd/src/hip_texture.cpp | 7 +++--- 4 files changed, 19 insertions(+), 32 deletions(-) diff --git a/hipamd/src/hip_conversions.hpp b/hipamd/src/hip_conversions.hpp index 592335c4ee..757ccc79bf 100644 --- a/hipamd/src/hip_conversions.hpp +++ b/hipamd/src/hip_conversions.hpp @@ -70,8 +70,7 @@ cl_channel_type getCLChannelType(const hipArray_Format hipFormat, } } - ShouldNotReachHere(); - + //error scenario return {}; } @@ -89,8 +88,7 @@ cl_channel_order getCLChannelOrder(const unsigned int hipNumChannels, break; } - ShouldNotReachHere(); - + //error scenario return {}; } @@ -131,8 +129,7 @@ cl_addressing_mode getCLAddressingMode(const hipTextureAddressMode hipAddressMod return CL_ADDRESS_CLAMP; } - ShouldNotReachHere(); - + //error scenario return {}; } @@ -145,8 +142,7 @@ cl_filter_mode getCLFilterMode(const hipTextureFilterMode hipFilterMode) { return CL_FILTER_LINEAR; } - ShouldNotReachHere(); - + //error scenario return {}; } @@ -161,8 +157,7 @@ cl_mem_object_type getCLMemObjectType(const hipResourceType hipResType) { break; } - ShouldNotReachHere(); - + //error scenario return {}; } @@ -205,8 +200,7 @@ size_t getElementSize(const hipArray_const_t array) { return 4 * array->NumChannels; } - ShouldNotReachHere(); - + //error scenario return {}; } @@ -288,8 +282,7 @@ hipChannelFormatDesc getChannelFormatDesc(int numChannels, } } - ShouldNotReachHere(); - + //error scenario return {}; } @@ -356,8 +349,7 @@ hipArray_Format getArrayFormat(const hipChannelFormatDesc& desc) { break; } - ShouldNotReachHere(); - + //error scenario return {}; } @@ -395,8 +387,7 @@ int getNumChannels(const hipResourceViewFormat hipFormat) { break; } - ShouldNotReachHere(); - + //error scenario return {}; } @@ -439,8 +430,7 @@ hipArray_Format getArrayFormat(const hipResourceViewFormat hipFormat) { break; } - ShouldNotReachHere(); - + //error scenario return {}; } @@ -535,8 +525,7 @@ hipResourceViewFormat getResourceViewFormat(const hipChannelFormatDesc& desc) { break; } - ShouldNotReachHere(); - + //error scenario return {}; } @@ -604,8 +593,7 @@ std::pair getMemoryType(const hipMemcpyKind kind) return {hipMemoryTypeUnified, hipMemoryTypeUnified}; } - ShouldNotReachHere(); - + //error scenario return {}; } diff --git a/hipamd/src/hip_graph_internal.cpp b/hipamd/src/hip_graph_internal.cpp index c0b288b584..1a5d4f07d0 100644 --- a/hipamd/src/hip_graph_internal.cpp +++ b/hipamd/src/hip_graph_internal.cpp @@ -291,7 +291,7 @@ hipError_t hipGraphMemcpyNode::ValidateParams(const hipMemcpy3DParms* pNodeParam return status; } } else { - ShouldNotReachHere(); + return hipErrorInvalidValue; } return hipSuccess; } @@ -469,7 +469,7 @@ hipError_t hipGraphMemcpyNode::SetCommandParams(const hipMemcpy3DParms* pNodePar amd::CopyMemoryCommand* command = reinterpret_cast(commands_[0]); command->setParams(*srcImage, *dstImage, srcOrigin, dstOrigin, copyRegion); } else { - ShouldNotReachHere(); + return hipErrorInvalidValue; } return hipSuccess; } diff --git a/hipamd/src/hip_memory.cpp b/hipamd/src/hip_memory.cpp index 75da3f0beb..ee943686dc 100644 --- a/hipamd/src/hip_memory.cpp +++ b/hipamd/src/hip_memory.cpp @@ -873,7 +873,7 @@ amd::Image* ihipImageCreate(const cl_channel_order channelOrder, imageSlicePitch); break; default: - ShouldNotReachHere(); + LogPrintfError("Cannot create image of imageType: 0x%x \n", imageType); } } else { switch (imageType) { @@ -916,7 +916,7 @@ amd::Image* ihipImageCreate(const cl_channel_order channelOrder, numMipLevels); break; default: - ShouldNotReachHere(); + LogPrintfError("Cannot create image of imageType: 0x%x \n", imageType); } } diff --git a/hipamd/src/hip_texture.cpp b/hipamd/src/hip_texture.cpp index 1f7ed22b15..610d93fe46 100644 --- a/hipamd/src/hip_texture.cpp +++ b/hipamd/src/hip_texture.cpp @@ -248,10 +248,9 @@ hipError_t ihipCreateTextureObject(hipTextureObject_t* pTexObject, } break; } - case hipResourceTypeMipmappedArray: { - ShouldNotReachHere(); - break; - } + case hipResourceTypeMipmappedArray: + return hipErrorInvalidValue; + case hipResourceTypeLinear: { const cl_channel_order channelOrder = hip::getCLChannelOrder(hip::getNumChannels(pResDesc->res.linear.desc), pTexDesc->sRGB); const cl_channel_type channelType = hip::getCLChannelType(hip::getArrayFormat(pResDesc->res.linear.desc), pTexDesc->readMode);