mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Remove OCL objects from HwHelper
Change-Id: I6b629421eae5e3c9c158f769ef1bb8d68e37aae7 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
db81e7247c
commit
60b4614f24
@ -51,10 +51,11 @@ bool HwHelperHw<Family>::obtainRenderBufferCompressionPreference(const HardwareI
|
||||
}
|
||||
|
||||
template <>
|
||||
void HwHelperHw<Family>::checkResourceCompatibility(Buffer *buffer, cl_int &errorCode) {
|
||||
if (buffer->getGraphicsAllocation()->getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) {
|
||||
errorCode = CL_INVALID_MEM_OBJECT;
|
||||
bool HwHelperHw<Family>::checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) {
|
||||
if (graphicsAllocation.getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
|
@ -12,8 +12,6 @@
|
||||
#include "runtime/gen_common/hw_cmds.h"
|
||||
#include "runtime/mem_obj/buffer.h"
|
||||
|
||||
#include "CL/cl.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
@ -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<aub_stream::EngineType> 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;
|
||||
|
||||
|
@ -71,7 +71,8 @@ bool HwHelperHw<Family>::isPageTableManagerSupported(const HardwareInfo &hwInfo)
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void HwHelperHw<GfxFamily>::checkResourceCompatibility(Buffer *buffer, cl_int &errorCode) {
|
||||
inline bool HwHelperHw<GfxFamily>::checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
@ -82,7 +83,7 @@ void HwHelperHw<Family>::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<Family>::setRenderSurfaceStateForBuffer(ExecutionEnvironment &ex
|
||||
surfaceState->setVerticalLineStride(0);
|
||||
surfaceState->setVerticalLineStrideOffset(0);
|
||||
if ((isAligned<MemoryConstants::cacheLineSize>(bufferStateAddress) && isAligned<MemoryConstants::cacheLineSize>(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<GfxFamily>::requiresAuxResolves() const {
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool HwHelperHw<GfxFamily>::tilingAllowed(bool isSharedContext, const cl_image_desc &imgDesc, bool forceLinearStorage) {
|
||||
bool HwHelperHw<GfxFamily>::tilingAllowed(bool isSharedContext, bool isImage1d, bool forceLinearStorage) {
|
||||
if (DebugManager.flags.ForceLinearImages.get() || forceLinearStorage || isSharedContext) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto imageType = imgDesc.image_type;
|
||||
auto buffer = castToObject<Buffer>(imgDesc.buffer);
|
||||
|
||||
return !(imageType == CL_MEM_OBJECT_IMAGE1D || imageType == CL_MEM_OBJECT_IMAGE1D_ARRAY ||
|
||||
imageType == CL_MEM_OBJECT_IMAGE1D_BUFFER || buffer);
|
||||
return !isImage1d;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
@ -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<Buffer>(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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -142,32 +142,24 @@ class HwHelperTestsGen12LpBuffer : public ::testing::Test {
|
||||
std::unique_ptr<Buffer> 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;
|
||||
|
@ -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<RENDER_SURFACE_STATE *>(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<uint32_t>(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<uint32_t>(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<uint32_t>(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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,8 +405,8 @@ TEST_F(Image2dFromBufferTest, givenBufferWhenImageFromBufferThenIsImageFromBuffe
|
||||
HWTEST_F(Image2dFromBufferTest, givenBufferWhenImageFromBufferThenIsImageFromBufferSetAndAllocationTypeIsBufferNullptr) {
|
||||
class MockHwHelperHw : public HwHelperHw<FamilyType> {
|
||||
public:
|
||||
void checkResourceCompatibility(Buffer *buffer, cl_int &errorCode) override {
|
||||
errorCode = CL_INVALID_MEM_OBJECT;
|
||||
bool checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) override {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user