From 60b4614f2430c124618fc5e1aafb60cd0d3278d4 Mon Sep 17 00:00:00 2001 From: Filip Hazubski Date: Thu, 14 Nov 2019 14:34:34 +0100 Subject: [PATCH] Remove OCL objects from HwHelper Change-Id: I6b629421eae5e3c9c158f769ef1bb8d68e37aae7 Signed-off-by: Filip Hazubski --- runtime/gen12lp/hw_helper_gen12lp.cpp | 7 ++-- runtime/helpers/hw_helper.h | 14 ++++---- runtime/helpers/hw_helper_base.inl | 16 ++++----- runtime/mem_obj/image.cpp | 16 ++++++--- runtime/mem_obj/image.h | 2 ++ .../mem_obj/create_image_aub_tests.cpp | 2 +- .../gen12lp/hw_helper_tests_gen12lp.inl | 16 +++------ unit_tests/helpers/hw_helper_tests.cpp | 34 ++++++++++--------- .../mem_obj/image2d_from_buffer_tests.cpp | 4 +-- unit_tests/mem_obj/image_tests.cpp | 2 +- 10 files changed, 56 insertions(+), 57 deletions(-) diff --git a/runtime/gen12lp/hw_helper_gen12lp.cpp b/runtime/gen12lp/hw_helper_gen12lp.cpp index 263fc88ea0..87df181253 100644 --- a/runtime/gen12lp/hw_helper_gen12lp.cpp +++ b/runtime/gen12lp/hw_helper_gen12lp.cpp @@ -51,10 +51,11 @@ bool HwHelperHw::obtainRenderBufferCompressionPreference(const HardwareI } template <> -void HwHelperHw::checkResourceCompatibility(Buffer *buffer, cl_int &errorCode) { - if (buffer->getGraphicsAllocation()->getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) { - errorCode = CL_INVALID_MEM_OBJECT; +bool HwHelperHw::checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) { + if (graphicsAllocation.getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) { + return false; } + return true; } template <> diff --git a/runtime/helpers/hw_helper.h b/runtime/helpers/hw_helper.h index 0f1a28293b..0f9a16246a 100644 --- a/runtime/helpers/hw_helper.h +++ b/runtime/helpers/hw_helper.h @@ -12,8 +12,6 @@ #include "runtime/gen_common/hw_cmds.h" #include "runtime/mem_obj/buffer.h" -#include "CL/cl.h" - #include #include #include @@ -45,7 +43,7 @@ class HwHelper { virtual const AubMemDump::LrcaHelper &getCsTraits(aub_stream::EngineType engineType) const = 0; virtual bool hvAlign4Required() const = 0; virtual bool obtainRenderBufferCompressionPreference(const HardwareInfo &hwInfo, const size_t size) const = 0; - virtual void checkResourceCompatibility(Buffer *buffer, cl_int &errorCode) = 0; + virtual bool checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) = 0; static bool renderCompressedBuffersSupported(const HardwareInfo &hwInfo); static bool renderCompressedImagesSupported(const HardwareInfo &hwInfo); static bool cacheFlushAfterWalkerSupported(const HardwareInfo &hwInfo); @@ -58,7 +56,7 @@ class HwHelper { size_t offset, uint32_t pitch, GraphicsAllocation *gfxAlloc, - cl_mem_flags flags, + bool isReadOnly, uint32_t surfaceType, bool forceNonAuxMode) = 0; virtual const std::vector getGpgpuEngineInstances() const = 0; @@ -68,7 +66,7 @@ class HwHelper { virtual uint32_t getMetricsLibraryGenId() const = 0; virtual uint32_t getMocsIndex(GmmHelper &gmmHelper, bool l3enabled, bool l1enabled) const = 0; virtual bool requiresAuxResolves() const = 0; - virtual bool tilingAllowed(bool isSharedContext, const cl_image_desc &imgDesc, bool forceLinearStorage) = 0; + virtual bool tilingAllowed(bool isSharedContext, bool isImage1d, bool forceLinearStorage) = 0; virtual uint32_t getBarriersCountFromHasBarriers(uint32_t hasBarriers) = 0; virtual uint32_t calculateAvailableThreadCount(PRODUCT_FAMILY family, uint32_t grfCount, uint32_t euCount, uint32_t threadsPerEu) = 0; @@ -143,7 +141,7 @@ class HwHelperHw : public HwHelper { bool obtainRenderBufferCompressionPreference(const HardwareInfo &hwInfo, const size_t size) const override; - void checkResourceCompatibility(Buffer *buffer, cl_int &errorCode) override; + bool checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) override; bool timestampPacketWriteSupported() const override; @@ -156,7 +154,7 @@ class HwHelperHw : public HwHelper { size_t offset, uint32_t pitch, GraphicsAllocation *gfxAlloc, - cl_mem_flags flags, + bool isReadOnly, uint32_t surfaceType, bool forceNonAuxMode) override; @@ -172,7 +170,7 @@ class HwHelperHw : public HwHelper { bool requiresAuxResolves() const override; - bool tilingAllowed(bool isSharedContext, const cl_image_desc &imgDesc, bool forceLinearStorage) override; + bool tilingAllowed(bool isSharedContext, bool isImage1d, bool forceLinearStorage) override; uint32_t getBarriersCountFromHasBarriers(uint32_t hasBarriers) override; diff --git a/runtime/helpers/hw_helper_base.inl b/runtime/helpers/hw_helper_base.inl index b8e52bb602..f939f8e145 100644 --- a/runtime/helpers/hw_helper_base.inl +++ b/runtime/helpers/hw_helper_base.inl @@ -71,7 +71,8 @@ bool HwHelperHw::isPageTableManagerSupported(const HardwareInfo &hwInfo) } template -inline void HwHelperHw::checkResourceCompatibility(Buffer *buffer, cl_int &errorCode) { +inline bool HwHelperHw::checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) { + return true; } template @@ -82,7 +83,7 @@ void HwHelperHw::setRenderSurfaceStateForBuffer(ExecutionEnvironment &ex size_t offset, uint32_t pitch, GraphicsAllocation *gfxAlloc, - cl_mem_flags flags, + bool isReadOnly, uint32_t surfaceType, bool forceNonAuxMode) { using RENDER_SURFACE_STATE = typename Family::RENDER_SURFACE_STATE; @@ -120,7 +121,7 @@ void HwHelperHw::setRenderSurfaceStateForBuffer(ExecutionEnvironment &ex surfaceState->setVerticalLineStride(0); surfaceState->setVerticalLineStrideOffset(0); if ((isAligned(bufferStateAddress) && isAligned(bufferStateSize)) || - ((flags & CL_MEM_READ_ONLY)) != 0) { + isReadOnly) { surfaceState->setMemoryObjectControlState(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER)); } else { surfaceState->setMemoryObjectControlState(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED)); @@ -231,16 +232,11 @@ inline bool HwHelperHw::requiresAuxResolves() const { } template -bool HwHelperHw::tilingAllowed(bool isSharedContext, const cl_image_desc &imgDesc, bool forceLinearStorage) { +bool HwHelperHw::tilingAllowed(bool isSharedContext, bool isImage1d, bool forceLinearStorage) { if (DebugManager.flags.ForceLinearImages.get() || forceLinearStorage || isSharedContext) { return false; } - - auto imageType = imgDesc.image_type; - auto buffer = castToObject(imgDesc.buffer); - - return !(imageType == CL_MEM_OBJECT_IMAGE1D || imageType == CL_MEM_OBJECT_IMAGE1D_ARRAY || - imageType == CL_MEM_OBJECT_IMAGE1D_BUFFER || buffer); + return !isImage1d; } template diff --git a/runtime/mem_obj/image.cpp b/runtime/mem_obj/image.cpp index d37f2477dc..ba95736002 100644 --- a/runtime/mem_obj/image.cpp +++ b/runtime/mem_obj/image.cpp @@ -187,7 +187,8 @@ Image *Image::create(Context *context, auto hostPtrRowPitch = imageDesc->image_row_pitch ? imageDesc->image_row_pitch : imageWidth * surfaceFormat->ImageElementSizeInBytes; auto hostPtrSlicePitch = imageDesc->image_slice_pitch ? imageDesc->image_slice_pitch : hostPtrRowPitch * imageHeight; - imgInfo.linearStorage = !hwHelper.tilingAllowed(context->isSharedContext, *imageDesc, memoryProperties.flags.forceLinearStorage); + imgInfo.linearStorage = !hwHelper.tilingAllowed(context->isSharedContext, Image::isImage1d(*imageDesc), + memoryProperties.flags.forceLinearStorage); imgInfo.preferRenderCompression = MemObjHelper::isSuitableForRenderCompression(!imgInfo.linearStorage, memoryProperties, *context, true); @@ -226,9 +227,8 @@ Image *Image::create(Context *context, bool transferNeeded = false; if (((imageDesc->image_type == CL_MEM_OBJECT_IMAGE1D_BUFFER) || (imageDesc->image_type == CL_MEM_OBJECT_IMAGE2D)) && (parentBuffer != nullptr)) { - hwHelper.checkResourceCompatibility(parentBuffer, errcodeRet); - - if (errcodeRet != CL_SUCCESS) { + if (!hwHelper.checkResourceCompatibility(*parentBuffer->getGraphicsAllocation())) { + errcodeRet = CL_INVALID_MEM_OBJECT; return nullptr; } @@ -1026,6 +1026,14 @@ const SurfaceFormatInfo *Image::getSurfaceFormatFromTable(cl_mem_flags flags, co return nullptr; } +bool Image::isImage1d(const cl_image_desc &imageDesc) { + auto imageType = imageDesc.image_type; + auto buffer = castToObject(imageDesc.buffer); + + return (imageType == CL_MEM_OBJECT_IMAGE1D || imageType == CL_MEM_OBJECT_IMAGE1D_ARRAY || + imageType == CL_MEM_OBJECT_IMAGE1D_BUFFER || buffer); +} + bool Image::isImage2d(cl_mem_object_type imageType) { return imageType == CL_MEM_OBJECT_IMAGE2D; } diff --git a/runtime/mem_obj/image.h b/runtime/mem_obj/image.h index d4e4f7072e..21f90f9519 100644 --- a/runtime/mem_obj/image.h +++ b/runtime/mem_obj/image.h @@ -106,6 +106,8 @@ class Image : public MemObj { size_t *imageRowPitch, size_t *imageSlicePitch); + static bool isImage1d(const cl_image_desc &imageDesc); + static bool isImage2d(cl_mem_object_type imageType); static bool isImage2dOr2dArray(cl_mem_object_type imageType); diff --git a/unit_tests/aub_tests/mem_obj/create_image_aub_tests.cpp b/unit_tests/aub_tests/mem_obj/create_image_aub_tests.cpp index 859a819e4d..f8d97573d6 100644 --- a/unit_tests/aub_tests/mem_obj/create_image_aub_tests.cpp +++ b/unit_tests/aub_tests/mem_obj/create_image_aub_tests.cpp @@ -96,7 +96,7 @@ HWTEST_P(AUBCreateImageArray, CheckArrayImages) { cl_mem_flags flags = CL_MEM_COPY_HOST_PTR; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat); auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, surfaceFormat); - imgInfo.linearStorage = !hwHelper.tilingAllowed(false, imageDesc, false); + imgInfo.linearStorage = !hwHelper.tilingAllowed(false, Image::isImage1d(imageDesc), false); auto queryGmm = MockGmm::queryImgParams(imgInfo); //allocate host_ptr diff --git a/unit_tests/gen12lp/hw_helper_tests_gen12lp.inl b/unit_tests/gen12lp/hw_helper_tests_gen12lp.inl index 6b1c122353..c51f78b975 100644 --- a/unit_tests/gen12lp/hw_helper_tests_gen12lp.inl +++ b/unit_tests/gen12lp/hw_helper_tests_gen12lp.inl @@ -142,32 +142,24 @@ class HwHelperTestsGen12LpBuffer : public ::testing::Test { std::unique_ptr buffer; }; -GEN12LPTEST_F(HwHelperTestsGen12LpBuffer, givenCompressedBufferThenCheckResourceCompatibilitySetCL_INVALID_MEM_OBJ) { +GEN12LPTEST_F(HwHelperTestsGen12LpBuffer, givenCompressedBufferThenCheckResourceCompatibilityReturnsFalse) { auto &helper = HwHelper::get(renderCoreFamily); buffer.reset(Buffer::create(context.get(), 0, MemoryConstants::cacheLineSize, nullptr, retVal)); buffer->getGraphicsAllocation()->setAllocationType(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED); - cl_int errCode = 0; - - helper.checkResourceCompatibility(buffer.get(), errCode); - - EXPECT_EQ(CL_INVALID_MEM_OBJECT, errCode); + EXPECT_FALSE(helper.checkResourceCompatibility(*buffer->getGraphicsAllocation())); } -GEN12LPTEST_F(HwHelperTestsGen12LpBuffer, givenBufferThenCheckResourceCompatibilityDoesNotSetErrorCode) { +GEN12LPTEST_F(HwHelperTestsGen12LpBuffer, givenBufferThenCheckResourceCompatibilityReturnsTrue) { auto &helper = HwHelper::get(renderCoreFamily); buffer.reset(Buffer::create(context.get(), 0, MemoryConstants::cacheLineSize, nullptr, retVal)); buffer->getGraphicsAllocation()->setAllocationType(GraphicsAllocation::AllocationType::BUFFER); - cl_int errCode = CL_SUCCESS; - - helper.checkResourceCompatibility(buffer.get(), errCode); - - EXPECT_EQ(CL_SUCCESS, errCode); + EXPECT_TRUE(helper.checkResourceCompatibility(*buffer->getGraphicsAllocation())); } using LriHelperTestsGen12Lp = ::testing::Test; diff --git a/unit_tests/helpers/hw_helper_tests.cpp b/unit_tests/helpers/hw_helper_tests.cpp index 25ce245ff8..6f51cc0a4d 100644 --- a/unit_tests/helpers/hw_helper_tests.cpp +++ b/unit_tests/helpers/hw_helper_tests.cpp @@ -16,6 +16,7 @@ #include "runtime/gmm_helper/resource_info.h" #include "runtime/helpers/hardware_commands_helper.h" #include "runtime/helpers/options.h" +#include "runtime/mem_obj/image.h" #include "runtime/os_interface/os_interface.h" #include "unit_tests/helpers/unit_test_helper.h" #include "unit_tests/helpers/variable_backup.h" @@ -267,7 +268,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenNoAllocationProvidedThe size_t offset = 0x1000; uint32_t pitch = 0x40; SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER; - helper.setRenderSurfaceStateForBuffer(ee, stateBuffer, size, addr, offset, pitch, nullptr, 0, type, true); + helper.setRenderSurfaceStateForBuffer(ee, stateBuffer, size, addr, offset, pitch, nullptr, false, type, true); RENDER_SURFACE_STATE *state = reinterpret_cast(stateBuffer); EXPECT_EQ(length.SurfaceState.Depth + 1u, state->getDepth()); @@ -282,7 +283,8 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenNoAllocationProvidedThe memset(stateBuffer, 0, sizeof(RENDER_SURFACE_STATE)); size = 0x1003; length.Length = static_cast(alignUp(size, 4) - 1); - helper.setRenderSurfaceStateForBuffer(ee, stateBuffer, size, addr, 0, pitch, nullptr, 0, type, true); + bool isReadOnly = false; + helper.setRenderSurfaceStateForBuffer(ee, stateBuffer, size, addr, 0, pitch, nullptr, isReadOnly, type, true); EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED), state->getMemoryObjectControlState()); EXPECT_EQ(length.SurfaceState.Depth + 1u, state->getDepth()); EXPECT_EQ(length.SurfaceState.Width + 1u, state->getWidth()); @@ -292,7 +294,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenNoAllocationProvidedThe size = 0x1000; addr = 0x2001; length.Length = static_cast(size - 1); - helper.setRenderSurfaceStateForBuffer(ee, stateBuffer, size, addr, 0, pitch, nullptr, 0, type, true); + helper.setRenderSurfaceStateForBuffer(ee, stateBuffer, size, addr, 0, pitch, nullptr, isReadOnly, type, true); EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED), state->getMemoryObjectControlState()); EXPECT_EQ(length.SurfaceState.Depth + 1u, state->getDepth()); EXPECT_EQ(length.SurfaceState.Width + 1u, state->getWidth()); @@ -302,8 +304,8 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenNoAllocationProvidedThe memset(stateBuffer, 0, sizeof(RENDER_SURFACE_STATE)); size = 0x1005; length.Length = static_cast(alignUp(size, 4) - 1); - cl_mem_flags flags = CL_MEM_READ_ONLY; - helper.setRenderSurfaceStateForBuffer(ee, stateBuffer, size, addr, 0, pitch, nullptr, flags, type, true); + isReadOnly = true; + helper.setRenderSurfaceStateForBuffer(ee, stateBuffer, size, addr, 0, pitch, nullptr, isReadOnly, type, true); EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER), state->getMemoryObjectControlState()); EXPECT_EQ(length.SurfaceState.Depth + 1u, state->getDepth()); EXPECT_EQ(length.SurfaceState.Width + 1u, state->getWidth()); @@ -338,7 +340,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenAllocationProvidedThenU GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull); allocation.setDefaultGmm(new Gmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), false)); SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER; - helper.setRenderSurfaceStateForBuffer(ee, stateBuffer, size, addr, 0, pitch, &allocation, 0, type, true); + helper.setRenderSurfaceStateForBuffer(ee, stateBuffer, size, addr, 0, pitch, &allocation, false, type, true); EXPECT_EQ(length.SurfaceState.Depth + 1u, state->getDepth()); EXPECT_EQ(length.SurfaceState.Width + 1u, state->getWidth()); EXPECT_EQ(length.SurfaceState.Height + 1u, state->getHeight()); @@ -376,7 +378,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmAndAllocationCompres allocation.setDefaultGmm(new Gmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), false)); allocation.getDefaultGmm()->isRenderCompressed = true; SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER; - helper.setRenderSurfaceStateForBuffer(ee, stateBuffer, size, addr, 0, pitch, &allocation, 0, type, false); + helper.setRenderSurfaceStateForBuffer(ee, stateBuffer, size, addr, 0, pitch, &allocation, false, type, false); EXPECT_EQ(RENDER_SURFACE_STATE::COHERENCY_TYPE_GPU_COHERENT, state->getCoherencyType()); EXPECT_EQ(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E, state->getAuxiliarySurfaceMode()); @@ -408,7 +410,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmCompressionEnabledAn allocation.setDefaultGmm(new Gmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), false)); allocation.getDefaultGmm()->isRenderCompressed = true; SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER; - helper.setRenderSurfaceStateForBuffer(ee, stateBuffer, size, addr, 0, pitch, &allocation, 0, type, false); + helper.setRenderSurfaceStateForBuffer(ee, stateBuffer, size, addr, 0, pitch, &allocation, false, type, false); EXPECT_EQ(RENDER_SURFACE_STATE::COHERENCY_TYPE_IA_COHERENT, state->getCoherencyType()); EXPECT_EQ(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE, state->getAuxiliarySurfaceMode()); @@ -439,7 +441,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmCompressionDisabledA GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull); allocation.setDefaultGmm(new Gmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), false)); SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER; - helper.setRenderSurfaceStateForBuffer(ee, stateBuffer, size, addr, 0, pitch, &allocation, 0, type, false); + helper.setRenderSurfaceStateForBuffer(ee, stateBuffer, size, addr, 0, pitch, &allocation, false, type, false); EXPECT_EQ(RENDER_SURFACE_STATE::COHERENCY_TYPE_IA_COHERENT, state->getCoherencyType()); EXPECT_EQ(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE, state->getAuxiliarySurfaceMode()); @@ -471,7 +473,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmAndAllocationCompres allocation.setDefaultGmm(new Gmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), false)); allocation.getDefaultGmm()->isRenderCompressed = true; SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER; - helper.setRenderSurfaceStateForBuffer(ee, stateBuffer, size, addr, 0, pitch, &allocation, 0, type, true); + helper.setRenderSurfaceStateForBuffer(ee, stateBuffer, size, addr, 0, pitch, &allocation, false, type, true); EXPECT_EQ(RENDER_SURFACE_STATE::COHERENCY_TYPE_IA_COHERENT, state->getCoherencyType()); EXPECT_EQ(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE, state->getAuxiliarySurfaceMode()); @@ -524,7 +526,7 @@ HWTEST_F(HwHelperTest, DISABLED_profilingCreationOfRenderSurfaceStateVsMemcpyOfC for (uint32_t i = 0; i < maxLoop; ++i) { auto t1 = std::chrono::high_resolution_clock::now(); - helper.setRenderSurfaceStateForBuffer(ee, surfaceStates[i], size, addr, 0, pitch, nullptr, 0, type, true); + helper.setRenderSurfaceStateForBuffer(ee, surfaceStates[i], size, addr, 0, pitch, nullptr, false, type, true); auto t2 = std::chrono::high_resolution_clock::now(); timesCreate.push_back(t1); timesCreate.push_back(t2); @@ -700,21 +702,21 @@ HWTEST_F(HwHelperTest, givenHwHelperWhenAskingForTilingSupportThenReturnValidVal (imgTypes[i] == CL_MEM_OBJECT_IMAGE2D_ARRAY); // non shared context, dont force linear storage - EXPECT_EQ((tilingSupported & allowedType), helper.tilingAllowed(false, imgDesc, false)); + EXPECT_EQ((tilingSupported & allowedType), helper.tilingAllowed(false, Image::isImage1d(imgDesc), false)); { DebugManagerStateRestore restore; DebugManager.flags.ForceLinearImages.set(true); // non shared context, dont force linear storage + debug flag - EXPECT_FALSE(helper.tilingAllowed(false, imgDesc, false)); + EXPECT_FALSE(helper.tilingAllowed(false, Image::isImage1d(imgDesc), false)); } // shared context, dont force linear storage - EXPECT_FALSE(helper.tilingAllowed(true, imgDesc, false)); + EXPECT_FALSE(helper.tilingAllowed(true, Image::isImage1d(imgDesc), false)); // non shared context, force linear storage - EXPECT_FALSE(helper.tilingAllowed(false, imgDesc, true)); + EXPECT_FALSE(helper.tilingAllowed(false, Image::isImage1d(imgDesc), true)); // non shared context, dont force linear storage + create from buffer imgDesc.buffer = buffer.get(); - EXPECT_FALSE(helper.tilingAllowed(false, imgDesc, false)); + EXPECT_FALSE(helper.tilingAllowed(false, Image::isImage1d(imgDesc), false)); } } diff --git a/unit_tests/mem_obj/image2d_from_buffer_tests.cpp b/unit_tests/mem_obj/image2d_from_buffer_tests.cpp index 2e21ea65cb..496dc26c38 100644 --- a/unit_tests/mem_obj/image2d_from_buffer_tests.cpp +++ b/unit_tests/mem_obj/image2d_from_buffer_tests.cpp @@ -405,8 +405,8 @@ TEST_F(Image2dFromBufferTest, givenBufferWhenImageFromBufferThenIsImageFromBuffe HWTEST_F(Image2dFromBufferTest, givenBufferWhenImageFromBufferThenIsImageFromBufferSetAndAllocationTypeIsBufferNullptr) { class MockHwHelperHw : public HwHelperHw { public: - void checkResourceCompatibility(Buffer *buffer, cl_int &errorCode) override { - errorCode = CL_INVALID_MEM_OBJECT; + bool checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) override { + return false; } }; diff --git a/unit_tests/mem_obj/image_tests.cpp b/unit_tests/mem_obj/image_tests.cpp index 1095032e5f..f14a288ef5 100644 --- a/unit_tests/mem_obj/image_tests.cpp +++ b/unit_tests/mem_obj/image_tests.cpp @@ -1356,7 +1356,7 @@ TEST(ImageTest, givenForcedLinearImages3DImageAndProperDescriptorValuesWhenIsCop imgInfo.rowPitch = imageDesc.image_width * surfaceFormat->ImageElementSizeInBytes; imgInfo.slicePitch = imgInfo.rowPitch * imageDesc.image_height; imgInfo.size = imgInfo.slicePitch; - imgInfo.linearStorage = !hwHelper.tilingAllowed(false, *imgInfo.imgDesc, false); + imgInfo.linearStorage = !hwHelper.tilingAllowed(false, Image::isImage1d(*imgInfo.imgDesc), false); auto hostPtr = alignedMalloc(imgInfo.size, MemoryConstants::cacheLineSize);