From cb8e9656eeed8db3d69b99b4f9d0adfffb081e09 Mon Sep 17 00:00:00 2001 From: Krzysztof Gibala Date: Mon, 4 May 2020 11:04:43 +0200 Subject: [PATCH] Merge MemoryPropertiesFlags files Move mem_properties_parser_helper files to memory_properties_flags_helpers Rename MemoryPropertiesParser to MemoryPropertiesHelper Related-To: NEO-4143 Change-Id: Ib35360bceff90be2383696083226f8be1e47538c Signed-off-by: Krzysztof Gibala --- opencl/source/api/api.cpp | 39 ++- opencl/source/helpers/CMakeLists.txt | 8 +- .../memory_properties_flags_helpers.cpp | 15 - .../helpers/memory_properties_flags_helpers.h | 21 -- ...lper.cpp => memory_properties_helpers.cpp} | 21 +- ...r_helper.h => memory_properties_helpers.h} | 19 +- ...inl => memory_properties_helpers_base.inl} | 19 +- opencl/source/mem_obj/buffer.cpp | 24 +- opencl/source/mem_obj/image.cpp | 12 +- opencl/source/mem_obj/mem_obj_helper.h | 2 +- .../source/mem_obj/mem_obj_helper_common.inl | 2 +- opencl/source/mem_obj/pipe.cpp | 16 +- opencl/source/sharings/d3d/d3d_surface.cpp | 4 +- .../enqueue_copy_image_aub_tests.cpp | 4 +- .../enqueue_fill_image_aub_tests.cpp | 2 +- .../enqueue_kernel_aub_tests.cpp | 2 +- .../enqueue_map_image_aub_tests.cpp | 2 +- .../enqueue_read_buffer_aub_tests.cpp | 2 +- .../enqueue_read_image_aub_tests.cpp | 2 +- .../enqueue_read_write_image_aub_fixture.h | 4 +- .../enqueue_verify_memory_image_aub_tests.cpp | 2 +- .../enqueue_write_image_aub_tests.cpp | 2 +- .../run_kernel_aub_tests_skl.cpp | 4 +- .../mem_obj/create_image_aub_tests.cpp | 8 +- .../command_queue/enqueue_map_image_tests.cpp | 4 +- .../command_queue/enqueue_thread_tests.cpp | 16 +- .../multiple_map_image_tests.cpp | 2 +- .../context/driver_diagnostics_tests.cpp | 12 +- .../test/unit_test/fixtures/image_fixture.h | 4 +- .../unit_test/gen11/image_tests_gen11.cpp | 2 +- opencl/test/unit_test/helpers/CMakeLists.txt | 3 +- .../unit_test/helpers/base_object_tests.cpp | 2 +- .../mem_properties_parser_helper_tests.cpp | 187 ----------- .../memory_properties_flags_helpers_tests.cpp | 120 ------- .../memory_properties_helpers_tests.cpp | 294 ++++++++++++++++++ .../kernel/kernel_image_arg_tests.cpp | 14 +- opencl/test/unit_test/kernel/kernel_tests.cpp | 6 +- .../test/unit_test/mem_obj/buffer_tests.cpp | 32 +- .../mem_obj/create_image_format_tests.cpp | 8 +- .../test/unit_test/mem_obj/image1d_tests.cpp | 4 +- .../mem_obj/image2d_from_buffer_tests.cpp | 26 +- .../test/unit_test/mem_obj/image2d_tests.cpp | 4 +- .../test/unit_test/mem_obj/image3d_tests.cpp | 4 +- .../mem_obj/image_array_size_tests.cpp | 6 +- .../mem_obj/image_from_subbuffer_tests.cpp | 4 +- .../mem_obj/image_redescribe_tests.cpp | 6 +- opencl/test/unit_test/mem_obj/image_tests.cpp | 34 +- .../unit_test/mem_obj/image_tiled_tests.cpp | 2 +- .../mem_obj/image_validate_tests.cpp | 4 +- .../mem_obj/mem_obj_destruction_tests.cpp | 6 +- .../mem_obj/mem_obj_helper_tests.cpp | 34 +- .../test/unit_test/mem_obj/mem_obj_tests.cpp | 52 ++-- .../unit_test/mem_obj/nv12_image_tests.cpp | 22 +- .../mem_obj/packed_yuv_image_tests.cpp | 6 +- ..._manager_allocate_in_device_pool_tests.inl | 20 +- opencl/test/unit_test/mocks/mock_buffer.h | 14 +- .../linux/drm_command_stream_tests.cpp | 4 +- .../linux/drm_memory_manager_tests.cpp | 18 +- .../windows/wddm_memory_manager_tests.cpp | 12 +- .../test/unit_test/sharings/sharing_tests.cpp | 8 +- .../memory_manager/unified_memory_manager.cpp | 6 +- 61 files changed, 598 insertions(+), 640 deletions(-) delete mode 100644 opencl/source/helpers/memory_properties_flags_helpers.cpp delete mode 100644 opencl/source/helpers/memory_properties_flags_helpers.h rename opencl/source/helpers/{mem_properties_parser_helper.cpp => memory_properties_helpers.cpp} (61%) rename opencl/source/helpers/{mem_properties_parser_helper.h => memory_properties_helpers.h} (67%) rename opencl/source/helpers/{memory_properties_flags_helpers_base.inl => memory_properties_helpers_base.inl} (69%) delete mode 100644 opencl/test/unit_test/helpers/mem_properties_parser_helper_tests.cpp delete mode 100644 opencl/test/unit_test/helpers/memory_properties_flags_helpers_tests.cpp create mode 100644 opencl/test/unit_test/helpers/memory_properties_helpers_tests.cpp diff --git a/opencl/source/api/api.cpp b/opencl/source/api/api.cpp index 3cc9b8b8df..518d74f465 100644 --- a/opencl/source/api/api.cpp +++ b/opencl/source/api/api.cpp @@ -34,8 +34,7 @@ #include "opencl/source/execution_environment/cl_execution_environment.h" #include "opencl/source/gtpin/gtpin_notify.h" #include "opencl/source/helpers/get_info_status_mapper.h" -#include "opencl/source/helpers/mem_properties_parser_helper.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/helpers/queue_helpers.h" #include "opencl/source/helpers/validators.h" #include "opencl/source/kernel/kernel.h" @@ -661,7 +660,7 @@ cl_mem CL_API_CALL clCreateBuffer(cl_context context, return nullptr; } - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0); if (isFieldValid(flags, MemObjHelper::validFlagsForBuffer)) { Buffer::validateInputAndCreateBuffer(*pContext, memoryProperties, flags, 0, size, hostPtr, retVal, buffer); } else { @@ -701,8 +700,8 @@ cl_mem CL_API_CALL clCreateBufferWithPropertiesINTEL(cl_context context, cl_mem_flags flags = 0; cl_mem_flags_intel flagsIntel = 0; cl_mem_alloc_flags_intel allocflags = 0; - if (MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, - MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::BUFFER, *pContext)) { + if (MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, + MemoryPropertiesHelper::ObjType::BUFFER, *pContext)) { Buffer::validateInputAndCreateBuffer(*pContext, memoryProperties, flags, flagsIntel, size, hostPtr, retVal, buffer); } else { retVal = CL_INVALID_VALUE; @@ -845,7 +844,7 @@ cl_mem CL_API_CALL clCreateImage(cl_context context, retVal = validateObjects(WithCastToInternal(context, &pContext)); if (retVal == CL_SUCCESS) { - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0); if (isFieldValid(flags, MemObjHelper::validFlagsForImage)) { image = Image::validateAndCreateImage(pContext, memoryProperties, flags, 0, imageFormat, imageDesc, hostPtr, retVal); } else { @@ -888,8 +887,8 @@ cl_mem CL_API_CALL clCreateImageWithPropertiesINTEL(cl_context context, retVal = validateObjects(WithCastToInternal(context, &pContext)); if (retVal == CL_SUCCESS) { - if (MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, - MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::IMAGE, *pContext)) { + if (MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, + MemoryPropertiesHelper::ObjType::IMAGE, *pContext)) { image = Image::validateAndCreateImage(pContext, memoryProperties, flags, flagsIntel, imageFormat, imageDesc, hostPtr, retVal); } else { retVal = CL_INVALID_VALUE; @@ -936,7 +935,7 @@ cl_mem CL_API_CALL clCreateImage2D(cl_context context, retVal = validateObjects(WithCastToInternal(context, &pContext)); if (retVal == CL_SUCCESS) { - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0); image2D = Image::validateAndCreateImage(pContext, memoryProperties, flags, 0, imageFormat, &imageDesc, hostPtr, retVal); } @@ -987,7 +986,7 @@ cl_mem CL_API_CALL clCreateImage3D(cl_context context, retVal = validateObjects(WithCastToInternal(context, &pContext)); if (retVal == CL_SUCCESS) { - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0); image3D = Image::validateAndCreateImage(pContext, memoryProperties, flags, 0, imageFormat, &imageDesc, hostPtr, retVal); } @@ -1154,7 +1153,7 @@ cl_int CL_API_CALL clGetImageParamsINTEL(cl_context context, } if (CL_SUCCESS == retVal) { surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(memFlags, imageFormat, pContext->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - retVal = Image::validate(pContext, MemoryPropertiesParser::createMemoryProperties(memFlags, 0, 0), surfaceFormat, imageDesc, nullptr); + retVal = Image::validate(pContext, MemoryPropertiesHelper::createMemoryProperties(memFlags, 0, 0), surfaceFormat, imageDesc, nullptr); } if (CL_SUCCESS == retVal) { retVal = Image::getImageParams(pContext, memFlags, surfaceFormat, imageDesc, imageRowPitch, imageSlicePitch); @@ -3502,9 +3501,9 @@ void *clHostMemAllocINTEL( cl_mem_flags flags = 0; cl_mem_flags_intel flagsIntel = 0; cl_mem_alloc_flags_intel allocflags = 0; - if (!MemoryPropertiesParserHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel, - allocflags, MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::UNKNOWN, - *neoContext)) { + if (!MemoryPropertiesHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel, + allocflags, MemoryPropertiesHelper::ObjType::UNKNOWN, + *neoContext)) { err.set(CL_INVALID_VALUE); return nullptr; } @@ -3540,9 +3539,9 @@ void *clDeviceMemAllocINTEL( cl_mem_flags flags = 0; cl_mem_flags_intel flagsIntel = 0; cl_mem_alloc_flags_intel allocflags = 0; - if (!MemoryPropertiesParserHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel, - allocflags, MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::UNKNOWN, - *neoContext)) { + if (!MemoryPropertiesHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel, + allocflags, MemoryPropertiesHelper::ObjType::UNKNOWN, + *neoContext)) { err.set(CL_INVALID_VALUE); return nullptr; } @@ -3581,9 +3580,9 @@ void *clSharedMemAllocINTEL( cl_mem_flags flags = 0; cl_mem_flags_intel flagsIntel = 0; cl_mem_alloc_flags_intel allocflags = 0; - if (!MemoryPropertiesParserHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel, - allocflags, MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::UNKNOWN, - *neoContext)) { + if (!MemoryPropertiesHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel, + allocflags, MemoryPropertiesHelper::ObjType::UNKNOWN, + *neoContext)) { err.set(CL_INVALID_VALUE); return nullptr; } diff --git a/opencl/source/helpers/CMakeLists.txt b/opencl/source/helpers/CMakeLists.txt index d1f313ec8b..01c877d961 100644 --- a/opencl/source/helpers/CMakeLists.txt +++ b/opencl/source/helpers/CMakeLists.txt @@ -29,11 +29,9 @@ set(RUNTIME_SRCS_HELPERS_BASE ${CMAKE_CURRENT_SOURCE_DIR}/hardware_context_controller.cpp ${CMAKE_CURRENT_SOURCE_DIR}/hardware_context_controller.h ${CMAKE_CURRENT_SOURCE_DIR}/helper_options.cpp - ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/mem_properties_parser_helper.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/mem_properties_parser_helper.h - ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/memory_properties_flags_helpers.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_flags_helpers.h - ${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_flags_helpers_base.inl + ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/memory_properties_helpers.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_helpers.h + ${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_helpers_base.inl ${CMAKE_CURRENT_SOURCE_DIR}/mipmap.cpp ${CMAKE_CURRENT_SOURCE_DIR}/mipmap.h ${CMAKE_CURRENT_SOURCE_DIR}/per_thread_data.cpp diff --git a/opencl/source/helpers/memory_properties_flags_helpers.cpp b/opencl/source/helpers/memory_properties_flags_helpers.cpp deleted file mode 100644 index 6efe4e6e14..0000000000 --- a/opencl/source/helpers/memory_properties_flags_helpers.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (C) 2019-2020 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "opencl/source/helpers/memory_properties_flags_helpers_base.inl" - -namespace NEO { - -void MemoryPropertiesParser::addExtraMemoryProperties(MemoryProperties &properties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel) { -} - -} // namespace NEO diff --git a/opencl/source/helpers/memory_properties_flags_helpers.h b/opencl/source/helpers/memory_properties_flags_helpers.h deleted file mode 100644 index 4c020dab59..0000000000 --- a/opencl/source/helpers/memory_properties_flags_helpers.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2019-2020 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#pragma once -#include "opencl/extensions/public/cl_ext_private.h" - -#include "memory_properties_flags.h" - -namespace NEO { - -class MemoryPropertiesParser { - public: - static void addExtraMemoryProperties(MemoryProperties &properties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel); - - static MemoryProperties createMemoryProperties(cl_mem_flags flags, cl_mem_flags_intel flagsIntel, cl_mem_alloc_flags_intel allocflags); -}; -} // namespace NEO diff --git a/opencl/source/helpers/mem_properties_parser_helper.cpp b/opencl/source/helpers/memory_properties_helpers.cpp similarity index 61% rename from opencl/source/helpers/mem_properties_parser_helper.cpp rename to opencl/source/helpers/memory_properties_helpers.cpp index 030849c11a..c4e472b246 100644 --- a/opencl/source/helpers/mem_properties_parser_helper.cpp +++ b/opencl/source/helpers/memory_properties_helpers.cpp @@ -5,16 +5,17 @@ * */ -#include "opencl/source/helpers/mem_properties_parser_helper.h" - -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers_base.inl" #include "opencl/source/mem_obj/mem_obj_helper.h" namespace NEO { -bool MemoryPropertiesParserHelper::parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryProperties &memoryProperties, - cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel, - cl_mem_alloc_flags_intel &allocflags, ObjType objectType, Context &context) { +void MemoryPropertiesHelper::addExtraMemoryProperties(MemoryProperties &properties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel) { +} + +bool MemoryPropertiesHelper::parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryProperties &memoryProperties, + cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel, + cl_mem_alloc_flags_intel &allocflags, ObjType objectType, Context &context) { if (properties == nullptr) { return true; } @@ -35,13 +36,13 @@ bool MemoryPropertiesParserHelper::parseMemoryProperties(const cl_mem_properties } } - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, allocflags); + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, allocflags); switch (objectType) { - case MemoryPropertiesParserHelper::ObjType::BUFFER: + case MemoryPropertiesHelper::ObjType::BUFFER: return isFieldValid(flags, MemObjHelper::validFlagsForBuffer) && isFieldValid(flagsIntel, MemObjHelper::validFlagsForBufferIntel); - case MemoryPropertiesParserHelper::ObjType::IMAGE: + case MemoryPropertiesHelper::ObjType::IMAGE: return isFieldValid(flags, MemObjHelper::validFlagsForImage) && isFieldValid(flagsIntel, MemObjHelper::validFlagsForImageIntel); default: @@ -50,7 +51,7 @@ bool MemoryPropertiesParserHelper::parseMemoryProperties(const cl_mem_properties return true; } -void MemoryPropertiesParserHelper::fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryProperties &memoryProperties, const HardwareInfo &hwInfo) { +void MemoryPropertiesHelper::fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryProperties &memoryProperties, const HardwareInfo &hwInfo) { fillCachePolicyInProperties(allocationProperties, memoryProperties.flags.locallyUncachedResource, memoryProperties.flags.readOnly, diff --git a/opencl/source/helpers/mem_properties_parser_helper.h b/opencl/source/helpers/memory_properties_helpers.h similarity index 67% rename from opencl/source/helpers/mem_properties_parser_helper.h rename to opencl/source/helpers/memory_properties_helpers.h index 27b21b6b64..d867b5a97b 100644 --- a/opencl/source/helpers/mem_properties_parser_helper.h +++ b/opencl/source/helpers/memory_properties_helpers.h @@ -17,7 +17,7 @@ namespace NEO { class Context; -class MemoryPropertiesParserHelper { +class MemoryPropertiesHelper { public: enum class ObjType { UNKNOWN, @@ -25,25 +25,20 @@ class MemoryPropertiesParserHelper { IMAGE, }; + static void addExtraMemoryProperties(MemoryProperties &properties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel); + + static MemoryProperties createMemoryProperties(cl_mem_flags flags, cl_mem_flags_intel flagsIntel, cl_mem_alloc_flags_intel allocflags); + static bool parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryProperties &memoryProperties, cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel, cl_mem_alloc_flags_intel &allocflags, ObjType objectType, Context &context); static AllocationProperties getAllocationProperties(uint32_t rootDeviceIndex, MemoryProperties memoryProperties, bool allocateMemory, size_t size, - GraphicsAllocation::AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo, DeviceBitfield subDevicesBitfieldParam) { - AllocationProperties allocationProperties(rootDeviceIndex, allocateMemory, size, type, multiStorageResource, subDevicesBitfieldParam); - fillPoliciesInProperties(allocationProperties, memoryProperties, hwInfo); - return allocationProperties; - } + GraphicsAllocation::AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo, DeviceBitfield subDevicesBitfieldParam); static void fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryProperties &memoryProperties, const HardwareInfo &hwInfo); static void fillCachePolicyInProperties(AllocationProperties &allocationProperties, bool uncached, bool readOnly, - bool deviceOnlyVisibilty) { - allocationProperties.flags.uncacheable = uncached; - auto cacheFlushRequired = !uncached && !readOnly && !deviceOnlyVisibilty; - allocationProperties.flags.flushL3RequiredForRead = cacheFlushRequired; - allocationProperties.flags.flushL3RequiredForWrite = cacheFlushRequired; - } + bool deviceOnlyVisibilty); }; } // namespace NEO diff --git a/opencl/source/helpers/memory_properties_flags_helpers_base.inl b/opencl/source/helpers/memory_properties_helpers_base.inl similarity index 69% rename from opencl/source/helpers/memory_properties_flags_helpers_base.inl rename to opencl/source/helpers/memory_properties_helpers_base.inl index 62843a5cbb..9fbc44a09c 100644 --- a/opencl/source/helpers/memory_properties_flags_helpers_base.inl +++ b/opencl/source/helpers/memory_properties_helpers_base.inl @@ -8,13 +8,13 @@ #include "shared/source/helpers/bit_helpers.h" #include "opencl/extensions/public/cl_ext_private.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "CL/cl_ext_intel.h" namespace NEO { -MemoryProperties MemoryPropertiesParser::createMemoryProperties(cl_mem_flags flags, cl_mem_flags_intel flagsIntel, cl_mem_alloc_flags_intel allocflags) { +MemoryProperties MemoryPropertiesHelper::createMemoryProperties(cl_mem_flags flags, cl_mem_flags_intel flagsIntel, cl_mem_alloc_flags_intel allocflags) { MemoryProperties memoryProperties; if (isValueSet(flags, CL_MEM_READ_WRITE)) { @@ -86,4 +86,19 @@ MemoryProperties MemoryPropertiesParser::createMemoryProperties(cl_mem_flags fla return memoryProperties; } +AllocationProperties MemoryPropertiesHelper::getAllocationProperties(uint32_t rootDeviceIndex, MemoryProperties memoryProperties, bool allocateMemory, size_t size, + GraphicsAllocation::AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo, DeviceBitfield subDevicesBitfieldParam) { + AllocationProperties allocationProperties(rootDeviceIndex, allocateMemory, size, type, multiStorageResource, subDevicesBitfieldParam); + fillPoliciesInProperties(allocationProperties, memoryProperties, hwInfo); + return allocationProperties; +} + +void MemoryPropertiesHelper::fillCachePolicyInProperties(AllocationProperties &allocationProperties, bool uncached, bool readOnly, + bool deviceOnlyVisibilty) { + allocationProperties.flags.uncacheable = uncached; + auto cacheFlushRequired = !uncached && !readOnly && !deviceOnlyVisibilty; + allocationProperties.flags.flushL3RequiredForRead = cacheFlushRequired; + allocationProperties.flags.flushL3RequiredForWrite = cacheFlushRequired; +} + } // namespace NEO diff --git a/opencl/source/mem_obj/buffer.cpp b/opencl/source/mem_obj/buffer.cpp index 971d5e191b..276b7cff36 100644 --- a/opencl/source/mem_obj/buffer.cpp +++ b/opencl/source/mem_obj/buffer.cpp @@ -26,7 +26,7 @@ #include "opencl/source/cl_device/cl_device.h" #include "opencl/source/command_queue/command_queue.h" #include "opencl/source/context/context.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/helpers/validators.h" #include "opencl/source/mem_obj/mem_obj_helper.h" @@ -124,7 +124,7 @@ Buffer *Buffer::create(Context *context, size_t size, void *hostPtr, cl_int &errcodeRet) { - return create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, size, hostPtr, errcodeRet); + return create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, size, hostPtr, errcodeRet); } Buffer *Buffer::create(Context *context, @@ -223,9 +223,9 @@ Buffer *Buffer::create(Context *context, } if (!memory) { - AllocationProperties allocProperties = MemoryPropertiesParserHelper::getAllocationProperties(rootDeviceIndex, memoryProperties, - allocateMemory, size, allocationType, context->areMultiStorageAllocationsPreferred(), - context->getDevice(0)->getHardwareInfo(), context->getDeviceBitfieldForAllocation()); + AllocationProperties allocProperties = MemoryPropertiesHelper::getAllocationProperties(rootDeviceIndex, memoryProperties, + allocateMemory, size, allocationType, context->areMultiStorageAllocationsPreferred(), + context->getDevice(0)->getHardwareInfo(), context->getDeviceBitfieldForAllocation()); memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties, hostPtr); } @@ -238,10 +238,10 @@ Buffer *Buffer::create(Context *context, allocationType = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY; zeroCopyAllowed = false; copyMemoryFromHostPtr = true; - AllocationProperties allocProperties = MemoryPropertiesParserHelper::getAllocationProperties(rootDeviceIndex, memoryProperties, - true, // allocateMemory - size, allocationType, context->areMultiStorageAllocationsPreferred(), - context->getDevice(0)->getHardwareInfo(), context->getDeviceBitfieldForAllocation()); + AllocationProperties allocProperties = MemoryPropertiesHelper::getAllocationProperties(rootDeviceIndex, memoryProperties, + true, // allocateMemory + size, allocationType, context->areMultiStorageAllocationsPreferred(), + context->getDevice(0)->getHardwareInfo(), context->getDeviceBitfieldForAllocation()); memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties); } @@ -337,7 +337,7 @@ Buffer *Buffer::create(Context *context, Buffer *Buffer::createSharedBuffer(Context *context, cl_mem_flags flags, SharingHandler *sharingHandler, GraphicsAllocation *graphicsAllocation) { - auto sharedBuffer = createBufferHw(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, graphicsAllocation->getUnderlyingBufferSize(), nullptr, nullptr, graphicsAllocation, false, false, false); + auto sharedBuffer = createBufferHw(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, graphicsAllocation->getUnderlyingBufferSize(), nullptr, nullptr, graphicsAllocation, false, false, false); sharedBuffer->setSharingHandler(sharingHandler); return sharedBuffer; @@ -422,7 +422,7 @@ Buffer *Buffer::createSubBuffer(cl_mem_flags flags, const cl_buffer_region *region, cl_int &errcodeRet) { DEBUG_BREAK_IF(nullptr == createFunction); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); auto buffer = createFunction(this->context, memoryProperties, flags, 0, region->size, ptrOffset(this->memoryStorage, region->origin), this->hostPtr ? ptrOffset(this->hostPtr, region->origin) : nullptr, @@ -583,7 +583,7 @@ Buffer *Buffer::createBufferHwFromDevice(const Device *device, auto funcCreate = bufferFactory[hwInfo.platform.eRenderCoreFamily].createBufferFunction; DEBUG_BREAK_IF(nullptr == funcCreate); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); auto pBuffer = funcCreate(nullptr, memoryProperties, flags, flagsIntel, size, memoryStorage, hostPtr, gfxAllocation, zeroCopy, isHostPtrSVM, isImageRedescribed); pBuffer->offset = offset; diff --git a/opencl/source/mem_obj/image.cpp b/opencl/source/mem_obj/image.cpp index 7627afcd1c..67cf7c94fe 100644 --- a/opencl/source/mem_obj/image.cpp +++ b/opencl/source/mem_obj/image.cpp @@ -26,7 +26,7 @@ #include "opencl/source/context/context.h" #include "opencl/source/helpers/get_info_status_mapper.h" #include "opencl/source/helpers/gmm_types_converter.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/helpers/mipmap.h" #include "opencl/source/helpers/surface_formats.h" #include "opencl/source/mem_obj/buffer.h" @@ -444,7 +444,7 @@ Image *Image::createImageHw(Context *context, const MemoryProperties &memoryProp Image *Image::createSharedImage(Context *context, SharingHandler *sharingHandler, const McsSurfaceInfo &mcsSurfaceInfo, GraphicsAllocation *graphicsAllocation, GraphicsAllocation *mcsAllocation, cl_mem_flags flags, cl_mem_flags_intel flagsIntel, const ClSurfaceFormatInfo *surfaceFormat, ImageInfo &imgInfo, uint32_t cubeFaceIndex, uint32_t baseMipLevel, uint32_t mipCount) { - auto sharedImage = createImageHw(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, flagsIntel, graphicsAllocation->getUnderlyingBufferSize(), + auto sharedImage = createImageHw(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, flagsIntel, graphicsAllocation->getUnderlyingBufferSize(), nullptr, surfaceFormat->OCLImageFormat, Image::convertDescriptor(imgInfo.imgDesc), false, graphicsAllocation, false, baseMipLevel, mipCount, surfaceFormat); sharedImage->setSharingHandler(sharingHandler); sharedImage->setMcsAllocation(mcsAllocation); @@ -917,7 +917,7 @@ Image *Image::redescribeFillImage() { imageFormatNew.image_channel_data_type = surfaceFormat->OCLImageFormat.image_channel_data_type; DEBUG_BREAK_IF(nullptr == createFunction); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags | CL_MEM_USE_HOST_PTR, flagsIntel, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags | CL_MEM_USE_HOST_PTR, flagsIntel, 0); auto image = createFunction(context, memoryProperties, flags | CL_MEM_USE_HOST_PTR, @@ -973,7 +973,7 @@ Image *Image::redescribe() { imageFormatNew.image_channel_data_type = surfaceFormat->OCLImageFormat.image_channel_data_type; DEBUG_BREAK_IF(nullptr == createFunction); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags | CL_MEM_USE_HOST_PTR, flagsIntel, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags | CL_MEM_USE_HOST_PTR, flagsIntel, 0); auto image = createFunction(context, memoryProperties, flags | CL_MEM_USE_HOST_PTR, @@ -1035,7 +1035,7 @@ cl_int Image::writeNV12Planes(const void *hostPtr, size_t hostPtrRowPitch) { // Create NV12 UV Plane image std::unique_ptr imageYPlane(Image::create( context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -1059,7 +1059,7 @@ cl_int Image::writeNV12Planes(const void *hostPtr, size_t hostPtrRowPitch) { // Create NV12 UV Plane image std::unique_ptr imageUVPlane(Image::create( context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, diff --git a/opencl/source/mem_obj/mem_obj_helper.h b/opencl/source/mem_obj/mem_obj_helper.h index 07e872a182..f222f0d531 100644 --- a/opencl/source/mem_obj/mem_obj_helper.h +++ b/opencl/source/mem_obj/mem_obj_helper.h @@ -11,7 +11,7 @@ #include "shared/source/memory_manager/unified_memory_manager.h" #include "opencl/extensions/public/cl_ext_private.h" -#include "opencl/source/helpers/mem_properties_parser_helper.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/mem_obj.h" #include "CL/cl.h" diff --git a/opencl/source/mem_obj/mem_obj_helper_common.inl b/opencl/source/mem_obj/mem_obj_helper_common.inl index 75487ef7d7..ad9a7ecd75 100644 --- a/opencl/source/mem_obj/mem_obj_helper_common.inl +++ b/opencl/source/mem_obj/mem_obj_helper_common.inl @@ -72,7 +72,7 @@ bool MemObjHelper::validateMemoryPropertiesForImage(const MemoryProperties &memo AllocationProperties MemObjHelper::getAllocationPropertiesWithImageInfo(uint32_t rootDeviceIndex, ImageInfo &imgInfo, bool allocateMemory, const MemoryProperties &memoryProperties, const HardwareInfo &hwInfo, DeviceBitfield subDevicesBitfieldParam) { AllocationProperties allocationProperties{rootDeviceIndex, allocateMemory, imgInfo, GraphicsAllocation::AllocationType::IMAGE, subDevicesBitfieldParam}; - MemoryPropertiesParserHelper::fillPoliciesInProperties(allocationProperties, memoryProperties, hwInfo); + MemoryPropertiesHelper::fillPoliciesInProperties(allocationProperties, memoryProperties, hwInfo); return allocationProperties; } diff --git a/opencl/source/mem_obj/pipe.cpp b/opencl/source/mem_obj/pipe.cpp index fb432fb4b0..0f2f427b4c 100644 --- a/opencl/source/mem_obj/pipe.cpp +++ b/opencl/source/mem_obj/pipe.cpp @@ -13,7 +13,7 @@ #include "opencl/source/cl_device/cl_device.h" #include "opencl/source/context/context.h" #include "opencl/source/helpers/get_info_status_mapper.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/mem_obj_helper.h" namespace NEO { @@ -27,7 +27,7 @@ Pipe::Pipe(Context *context, GraphicsAllocation *gfxAllocation) : MemObj(context, CL_MEM_OBJECT_PIPE, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, static_cast(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace), @@ -54,16 +54,16 @@ Pipe *Pipe::create(Context *context, MemoryManager *memoryManager = context->getMemoryManager(); DEBUG_BREAK_IF(!memoryManager); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0); while (true) { auto size = static_cast(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace); auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex(); AllocationProperties allocProperties = - MemoryPropertiesParserHelper::getAllocationProperties(rootDeviceIndex, memoryProperties, - true, // allocateMemory - size, GraphicsAllocation::AllocationType::PIPE, - false, // isMultiStorageAllocation - context->getDevice(0)->getHardwareInfo(), context->getDeviceBitfieldForAllocation()); + MemoryPropertiesHelper::getAllocationProperties(rootDeviceIndex, memoryProperties, + true, // allocateMemory + size, GraphicsAllocation::AllocationType::PIPE, + false, // isMultiStorageAllocation + context->getDevice(0)->getHardwareInfo(), context->getDeviceBitfieldForAllocation()); GraphicsAllocation *memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties); if (!memory) { errcodeRet = CL_OUT_OF_HOST_MEMORY; diff --git a/opencl/source/sharings/d3d/d3d_surface.cpp b/opencl/source/sharings/d3d/d3d_surface.cpp index f4acc79e9a..3f6da7cc5d 100644 --- a/opencl/source/sharings/d3d/d3d_surface.cpp +++ b/opencl/source/sharings/d3d/d3d_surface.cpp @@ -14,7 +14,7 @@ #include "opencl/source/cl_device/cl_device.h" #include "opencl/source/context/context.h" #include "opencl/source/helpers/gmm_types_converter.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/image.h" #include "opencl/source/mem_obj/mem_obj_helper.h" @@ -99,7 +99,7 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo imgInfo.imgDesc.imageWidth /= 2; imgInfo.imgDesc.imageHeight /= 2; } - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0); AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(rootDeviceIndex, imgInfo, true, // allocateMemory memoryProperties, context->getDevice(0)->getHardwareInfo(), diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_copy_image_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_copy_image_aub_tests.cpp index 9c6ff1c00a..253ef0bfda 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_copy_image_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_copy_image_aub_tests.cpp @@ -87,7 +87,7 @@ HWTEST_P(AUBCopyImage, simple) { auto retVal = CL_INVALID_VALUE; srcImage.reset(Image::create( context.get(), - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -98,7 +98,7 @@ HWTEST_P(AUBCopyImage, simple) { dstImage.reset(Image::create( context.get(), - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_fill_image_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_fill_image_aub_tests.cpp index 180a773595..8bc0c183b2 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_fill_image_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_fill_image_aub_tests.cpp @@ -185,7 +185,7 @@ HWTEST_P(AubFillImage, simple) { auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); image.reset(Image::create( context.get(), - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_kernel_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_kernel_aub_tests.cpp index 790c8cf656..75dddf29e4 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_kernel_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_kernel_aub_tests.cpp @@ -995,7 +995,7 @@ HWTEST2_F(AUBBindlessKernel, DISABLED_givenBindlessCopyImageKernelWhenEnqueuedTh auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, device->getHardwareInfo().capabilityTable.clVersionSupport); auto image = std::unique_ptr(Image::create( contextCl, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_map_image_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_map_image_aub_tests.cpp index 7342fd4d17..fce7407e20 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_map_image_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_map_image_aub_tests.cpp @@ -127,7 +127,7 @@ HWTEST_P(AUBMapImage, MapUpdateUnmapVerify) { auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, pClDevice->getHardwareInfo().capabilityTable.supportsOcl21Features); srcImage.reset(Image::create( context.get(), - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_read_buffer_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_read_buffer_aub_tests.cpp index 9e229dc2b4..4ce2c145d2 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_read_buffer_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_read_buffer_aub_tests.cpp @@ -124,7 +124,7 @@ HWTEST_F(AUBReadBuffer, reserveCanonicalGpuAddress) { MemoryPool::MemoryNull); std::unique_ptr srcBuffer(Buffer::createBufferHw(&context, - MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(srcMemory), diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_read_image_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_read_image_aub_tests.cpp index 0e8ed9b5bd..443d16d8b7 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_read_image_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_read_image_aub_tests.cpp @@ -145,7 +145,7 @@ HWTEST_P(AUBReadImage, simpleUnalignedMemory) { auto retVal = CL_INVALID_VALUE; srcImage.reset(Image::create( context.get(), - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_read_write_image_aub_fixture.h b/opencl/test/unit_test/aub_tests/command_queue/enqueue_read_write_image_aub_fixture.h index 415b89b172..8ef45a18cc 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_read_write_image_aub_fixture.h +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_read_write_image_aub_fixture.h @@ -82,7 +82,7 @@ struct AUBImageUnaligned auto image = std::unique_ptr(Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -177,7 +177,7 @@ struct AUBImageUnaligned auto image = std::unique_ptr(Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_verify_memory_image_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_verify_memory_image_aub_tests.cpp index 1add0b35f1..82537b9afd 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_verify_memory_image_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_verify_memory_image_aub_tests.cpp @@ -74,7 +74,7 @@ HWTEST_P(VerifyMemoryImageHw, givenDifferentImagesWhenValidatingMemoryThenSucces auto retVal = CL_INVALID_VALUE; std::unique_ptr image(Image::create( context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_write_image_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_write_image_aub_tests.cpp index f3ffe29367..a2e16ede23 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_write_image_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_write_image_aub_tests.cpp @@ -139,7 +139,7 @@ HWTEST_P(AUBWriteImage, simpleUnalignedMemory) { auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); dstImage.reset(Image::create( context.get(), - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, diff --git a/opencl/test/unit_test/aub_tests/gen9/skl/command_queue/run_kernel_aub_tests_skl.cpp b/opencl/test/unit_test/aub_tests/gen9/skl/command_queue/run_kernel_aub_tests_skl.cpp index 3a126a554b..c8ecccfd4b 100644 --- a/opencl/test/unit_test/aub_tests/gen9/skl/command_queue/run_kernel_aub_tests_skl.cpp +++ b/opencl/test/unit_test/aub_tests/gen9/skl/command_queue/run_kernel_aub_tests_skl.cpp @@ -332,7 +332,7 @@ SKLTEST_F(AUBRunKernelIntegrateTest, deviceSideVme) { auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto srcImage = Image::create( context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -343,7 +343,7 @@ SKLTEST_F(AUBRunKernelIntegrateTest, deviceSideVme) { auto refImage = Image::create( context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, diff --git a/opencl/test/unit_test/aub_tests/mem_obj/create_image_aub_tests.cpp b/opencl/test/unit_test/aub_tests/mem_obj/create_image_aub_tests.cpp index 17c5d20501..75d47061d5 100644 --- a/opencl/test/unit_test/aub_tests/mem_obj/create_image_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/mem_obj/create_image_aub_tests.cpp @@ -112,7 +112,7 @@ HWTEST_P(AUBCreateImageArray, CheckArrayImages) { image.reset(Image::create( context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -242,7 +242,7 @@ HWTEST_P(CopyHostPtrTest, imageWithDoubledRowPitchThatIsCreatedWithCopyHostPtrFl data += passedRowPitch; } - image.reset(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + image.reset(Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, pHostPtr, retVal)); ASSERT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(image->getImageDesc().image_row_pitch, imgInfo.rowPitch); @@ -312,7 +312,7 @@ HWTEST_P(UseHostPtrTest, imageWithRowPitchCreatedWithUseHostPtrFlagCopiedActuall } image.reset(Image::create( context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -408,7 +408,7 @@ HWTEST_F(AUBCreateImage, image3DCreatedWithDoubledSlicePitchWhenQueriedForDataRe } cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - image.reset(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + image.reset(Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, host_ptr, retVal)); depthToCopy = imageDesc.image_depth; diff --git a/opencl/test/unit_test/command_queue/enqueue_map_image_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_map_image_tests.cpp index 79c63bf79d..a6ecc8c203 100644 --- a/opencl/test/unit_test/command_queue/enqueue_map_image_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_map_image_tests.cpp @@ -10,7 +10,7 @@ #include "shared/test/unit_test/helpers/debug_manager_state_restore.h" #include "opencl/source/event/user_event.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/test/unit_test/command_queue/command_enqueue_fixture.h" #include "opencl/test/unit_test/command_queue/command_queue_fixture.h" #include "opencl/test/unit_test/fixtures/device_fixture.h" @@ -922,7 +922,7 @@ TEST_F(EnqueueMapImageTest, givenImage1DArrayWhenEnqueueMapImageIsCalledThenRetu class MockImage : public Image { public: MockImage(Context *context, cl_mem_flags flags, GraphicsAllocation *allocation, const ClSurfaceFormatInfo &surfaceFormat, - const cl_image_format &imageFormat, const cl_image_desc &imageDesc) : Image(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, + const cl_image_format &imageFormat, const cl_image_desc &imageDesc) : Image(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, 0, nullptr, imageFormat, imageDesc, true, diff --git a/opencl/test/unit_test/command_queue/enqueue_thread_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_thread_tests.cpp index 1169a48cad..6c8e9e4fe3 100644 --- a/opencl/test/unit_test/command_queue/enqueue_thread_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_thread_tests.cpp @@ -9,7 +9,7 @@ #include "shared/source/helpers/aligned_memory.h" #include "opencl/source/command_queue/command_queue_hw.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/kernel/kernel.h" #include "opencl/source/mem_obj/buffer.h" #include "opencl/source/mem_obj/image.h" @@ -217,7 +217,7 @@ HWTEST_F(EnqueueThreading, enqueueCopyBufferToImage) { cl_mem_flags flags = CL_MEM_WRITE_ONLY; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr dstImage(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); + std::unique_ptr dstImage(Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); ASSERT_NE(nullptr, dstImage.get()); size_t dstOrigin[3] = {1024u, 1, 0}; @@ -241,9 +241,9 @@ HWTEST_F(EnqueueThreading, enqueueCopyImage) { imageDesc.image_width = 1024u; cl_mem_flags flags = CL_MEM_WRITE_ONLY; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr srcImage(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); + std::unique_ptr srcImage(Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); ASSERT_NE(nullptr, srcImage.get()); - std::unique_ptr dstImage(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); + std::unique_ptr dstImage(Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); ASSERT_NE(nullptr, srcImage.get()); size_t srcOrigin[3] = {1024u, 1, 0}; @@ -269,7 +269,7 @@ HWTEST_F(EnqueueThreading, enqueueCopyImageToBuffer) { cl_mem_flags flags = CL_MEM_WRITE_ONLY; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr srcImage(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); + std::unique_ptr srcImage(Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); ASSERT_NE(nullptr, srcImage.get()); std::unique_ptr dstBuffer(Buffer::create(context, CL_MEM_READ_WRITE, 1024u, nullptr, retVal)); @@ -308,7 +308,7 @@ HWTEST_F(EnqueueThreading, enqueueFillImage) { cl_mem_flags flags = CL_MEM_WRITE_ONLY; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr image(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); + std::unique_ptr image(Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); ASSERT_NE(nullptr, image.get()); size_t origin[3] = {1024u, 1, 0}; @@ -354,7 +354,7 @@ HWTEST_F(EnqueueThreading, enqueueReadImage) { cl_mem_flags flags = CL_MEM_WRITE_ONLY; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr image(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); + std::unique_ptr image(Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); ASSERT_NE(nullptr, image.get()); void *ptr = ::alignedMalloc(1024u, 4096); @@ -404,7 +404,7 @@ HWTEST_F(EnqueueThreading, enqueueWriteImage) { cl_mem_flags flags = CL_MEM_READ_ONLY; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr image(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); + std::unique_ptr image(Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); ASSERT_NE(nullptr, image.get()); void *ptr = ::alignedMalloc(1024u, 4096); diff --git a/opencl/test/unit_test/command_queue/multiple_map_image_tests.cpp b/opencl/test/unit_test/command_queue/multiple_map_image_tests.cpp index f399cca56d..34b44f1226 100644 --- a/opencl/test/unit_test/command_queue/multiple_map_image_tests.cpp +++ b/opencl/test/unit_test/command_queue/multiple_map_image_tests.cpp @@ -115,7 +115,7 @@ struct MultipleMapImageTest : public DeviceFixture, public ::testing::Test { auto surfaceFormat = Image::getSurfaceFormatFromTable(Traits::flags, &Traits::imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); cl_int retVal = CL_SUCCESS; - auto img = Image::create(context, MemoryPropertiesParser::createMemoryProperties(Traits::flags, 0, 0), Traits::flags, 0, surfaceFormat, &Traits::imageDesc, Traits::hostPtr, retVal); + auto img = Image::create(context, MemoryPropertiesHelper::createMemoryProperties(Traits::flags, 0, 0), Traits::flags, 0, surfaceFormat, &Traits::imageDesc, Traits::hostPtr, retVal); auto mockImage = static_cast *>(img); return std::unique_ptr>(mockImage); diff --git a/opencl/test/unit_test/context/driver_diagnostics_tests.cpp b/opencl/test/unit_test/context/driver_diagnostics_tests.cpp index 99570276e1..6542bf2d74 100644 --- a/opencl/test/unit_test/context/driver_diagnostics_tests.cpp +++ b/opencl/test/unit_test/context/driver_diagnostics_tests.cpp @@ -9,7 +9,7 @@ #include "shared/test/unit_test/helpers/debug_manager_state_restore.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/mem_obj_helper.h" #include "opencl/test/unit_test/mocks/mock_gmm.h" @@ -473,7 +473,7 @@ TEST_F(PerformanceHintTest, given64bitCompressedBufferWhenItsCreatedThenProperPe cl_context_properties validProperties[3] = {CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL, CL_CONTEXT_DIAGNOSTICS_LEVEL_ALL_INTEL, 0}; auto context = std::unique_ptr(Context::create(validProperties, ClDeviceVector(&deviceId, 1), callbackFunction, static_cast(userData), retVal)); context->isSharedContext = false; - auto buffer = std::unique_ptr(Buffer::create(context.get(), MemoryPropertiesParser::createMemoryProperties((1 << 21), 0, 0), (1 << 21), 0, size, static_cast(NULL), retVal)); + auto buffer = std::unique_ptr(Buffer::create(context.get(), MemoryPropertiesHelper::createMemoryProperties((1 << 21), 0, 0), (1 << 21), 0, size, static_cast(NULL), retVal)); snprintf(expectedHint, DriverDiagnostics::maxHintStringSize, DriverDiagnostics::hintFormat[BUFFER_IS_COMPRESSED], buffer.get()); auto compressionSupported = HwHelper::get(hwInfo.platform.eRenderCoreFamily).obtainRenderBufferCompressionPreference(hwInfo, size) && HwHelper::renderCompressedBuffersSupported(hwInfo); @@ -491,7 +491,7 @@ TEST_F(PerformanceHintTest, givenUncompressedBufferWhenItsCreatedThenProperPerfo auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); cl_device_id deviceId = device.get(); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0); size_t size = 0u; @@ -563,7 +563,7 @@ TEST_F(PerformanceHintTest, givenCompressedImageWhenItsCreatedThenProperPerforma auto image = std::unique_ptr(Image::create( context.get(), - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -622,7 +622,7 @@ TEST_F(PerformanceHintTest, givenImageWithNoGmmWhenItsCreatedThenNoPerformanceHi auto image = std::unique_ptr(Image::create( context.get(), - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -683,7 +683,7 @@ TEST_F(PerformanceHintTest, givenUncompressedImageWhenItsCreatedThenProperPerfor auto image = std::unique_ptr(Image::create( context.get(), - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, diff --git a/opencl/test/unit_test/fixtures/image_fixture.h b/opencl/test/unit_test/fixtures/image_fixture.h index ffd16347bf..11f0b7e43b 100644 --- a/opencl/test/unit_test/fixtures/image_fixture.h +++ b/opencl/test/unit_test/fixtures/image_fixture.h @@ -10,7 +10,7 @@ #include "shared/source/helpers/hw_info.h" #include "shared/test/unit_test/helpers/default_hw_info.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/image.h" #include "opencl/source/platform/platform.h" #include "opencl/test/unit_test/fixtures/device_fixture.h" @@ -78,7 +78,7 @@ struct ImageHelper { auto surfaceFormat = Image::getSurfaceFormatFromTable(Traits::flags, imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto image = Image::create( context, - NEO::MemoryPropertiesParser::createMemoryProperties(Traits::flags, 0, 0), + NEO::MemoryPropertiesHelper::createMemoryProperties(Traits::flags, 0, 0), Traits::flags, 0, surfaceFormat, diff --git a/opencl/test/unit_test/gen11/image_tests_gen11.cpp b/opencl/test/unit_test/gen11/image_tests_gen11.cpp index 72628c6e54..3060587313 100644 --- a/opencl/test/unit_test/gen11/image_tests_gen11.cpp +++ b/opencl/test/unit_test/gen11/image_tests_gen11.cpp @@ -38,7 +38,7 @@ struct AppendSurfaceStateParamsTest : public ::testing::Test { void createImage() { auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); EXPECT_NE(nullptr, surfaceFormat); - image.reset(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); + image.reset(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); } cl_int retVal = CL_SUCCESS; diff --git a/opencl/test/unit_test/helpers/CMakeLists.txt b/opencl/test/unit_test/helpers/CMakeLists.txt index 4c6923d32b..7f7ad4bf3a 100644 --- a/opencl/test/unit_test/helpers/CMakeLists.txt +++ b/opencl/test/unit_test/helpers/CMakeLists.txt @@ -32,9 +32,8 @@ set(IGDRCL_SRCS_tests_helpers ${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests.h ${CMAKE_CURRENT_SOURCE_DIR}/kernel_filename_helper.h ${CMAKE_CURRENT_SOURCE_DIR}/kmd_notify_tests.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/mem_properties_parser_helper_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/memory_management_tests.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_flags_helpers_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_helpers_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/mipmap_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/per_thread_data_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ptr_math_tests.cpp diff --git a/opencl/test/unit_test/helpers/base_object_tests.cpp b/opencl/test/unit_test/helpers/base_object_tests.cpp index 126b8ff512..9ecc61ff6c 100644 --- a/opencl/test/unit_test/helpers/base_object_tests.cpp +++ b/opencl/test/unit_test/helpers/base_object_tests.cpp @@ -288,7 +288,7 @@ TEST(CastToImage, WhenCastingFromMemObjThenBehavesAsExpected) { extern std::thread::id tempThreadID; class MockBuffer : public MockBufferStorage, public Buffer { public: - MockBuffer() : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data, &mockGfxAllocation, true, false, false) { + MockBuffer() : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data, &mockGfxAllocation, true, false, false) { } void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly) override { diff --git a/opencl/test/unit_test/helpers/mem_properties_parser_helper_tests.cpp b/opencl/test/unit_test/helpers/mem_properties_parser_helper_tests.cpp deleted file mode 100644 index 3f8744b0c1..0000000000 --- a/opencl/test/unit_test/helpers/mem_properties_parser_helper_tests.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (C) 2019-2020 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "opencl/source/helpers/mem_properties_parser_helper.h" -#include "opencl/source/mem_obj/mem_obj_helper.h" -#include "opencl/test/unit_test/mocks/mock_context.h" - -#include "CL/cl_ext_intel.h" -#include "gtest/gtest.h" - -using namespace NEO; - -struct MemoryPropertiesParserHelperTests : ::testing::Test { - MockContext context; - MemoryProperties memoryProperties; - cl_mem_flags flags = 0; - cl_mem_flags_intel flagsIntel = 0; - cl_mem_alloc_flags_intel allocflags = 0; -}; - -TEST_F(MemoryPropertiesParserHelperTests, givenNullPropertiesWhenParsingMemoryPropertiesThenTrueIsReturned) { - EXPECT_TRUE(MemoryPropertiesParserHelper::parseMemoryProperties(nullptr, memoryProperties, flags, flagsIntel, allocflags, - MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::UNKNOWN, context)); -} - -TEST_F(MemoryPropertiesParserHelperTests, givenEmptyPropertiesWhenParsingMemoryPropertiesThenTrueIsReturned) { - cl_mem_properties_intel properties[] = {0}; - - EXPECT_TRUE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, - MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::UNKNOWN, context)); - EXPECT_TRUE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, - MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::BUFFER, context)); - EXPECT_TRUE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, - MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::IMAGE, context)); -} - -TEST_F(MemoryPropertiesParserHelperTests, givenValidPropertiesWhenParsingMemoryPropertiesThenTrueIsReturned) { - cl_mem_properties_intel properties[] = { - CL_MEM_FLAGS, - CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY | CL_MEM_ALLOC_HOST_PTR | CL_MEM_COPY_HOST_PTR | - CL_MEM_USE_HOST_PTR | CL_MEM_HOST_WRITE_ONLY | CL_MEM_HOST_READ_ONLY | CL_MEM_HOST_NO_ACCESS, - CL_MEM_FLAGS_INTEL, - CL_MEM_LOCALLY_UNCACHED_RESOURCE | CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE, - CL_MEM_ALLOC_FLAGS_INTEL, - CL_MEM_ALLOC_WRITE_COMBINED_INTEL, CL_MEM_ALLOC_DEFAULT_INTEL, - 0}; - - EXPECT_TRUE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, - MemoryPropertiesParserHelper::ObjType::UNKNOWN, context)); -} - -TEST_F(MemoryPropertiesParserHelperTests, givenValidPropertiesWhenParsingMemoryPropertiesForBufferThenTrueIsReturned) { - cl_mem_properties_intel properties[] = { - CL_MEM_FLAGS, - MemObjHelper::validFlagsForBuffer, - CL_MEM_FLAGS_INTEL, - MemObjHelper::validFlagsForBufferIntel, - 0}; - - EXPECT_TRUE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, - MemoryPropertiesParserHelper::ObjType::BUFFER, context)); -} - -TEST_F(MemoryPropertiesParserHelperTests, givenValidPropertiesWhenParsingMemoryPropertiesForImageThenTrueIsReturned) { - cl_mem_properties_intel properties[] = { - CL_MEM_FLAGS, - MemObjHelper::validFlagsForImage, - CL_MEM_FLAGS_INTEL, - MemObjHelper::validFlagsForImageIntel, - 0}; - - EXPECT_TRUE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, - MemoryPropertiesParserHelper::ObjType::IMAGE, context)); -} - -TEST_F(MemoryPropertiesParserHelperTests, givenInvalidPropertiesWhenParsingMemoryPropertiesThenFalseIsReturned) { - cl_mem_properties_intel properties[] = { - (1 << 30), CL_MEM_ALLOC_HOST_PTR | CL_MEM_COPY_HOST_PTR | CL_MEM_USE_HOST_PTR, - 0}; - - EXPECT_FALSE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, - MemoryPropertiesParserHelper::ObjType::UNKNOWN, context)); - EXPECT_FALSE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, - MemoryPropertiesParserHelper::ObjType::BUFFER, context)); - EXPECT_FALSE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, - MemoryPropertiesParserHelper::ObjType::IMAGE, context)); -} - -TEST_F(MemoryPropertiesParserHelperTests, givenInvalidPropertiesWhenParsingMemoryPropertiesForImageThenFalseIsReturned) { - cl_mem_properties_intel properties[] = { - CL_MEM_FLAGS, - MemObjHelper::validFlagsForBuffer, - CL_MEM_FLAGS_INTEL, - MemObjHelper::validFlagsForBufferIntel, - 0}; - - EXPECT_FALSE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, - MemoryPropertiesParserHelper::ObjType::IMAGE, context)); -} - -TEST_F(MemoryPropertiesParserHelperTests, givenInvalidFlagsWhenParsingMemoryPropertiesForImageThenFalseIsReturned) { - cl_mem_properties_intel properties[] = { - CL_MEM_FLAGS, - (1 << 30), - CL_MEM_FLAGS_INTEL, - MemObjHelper::validFlagsForImageIntel, - 0}; - - EXPECT_FALSE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, - MemoryPropertiesParserHelper::ObjType::IMAGE, context)); -} - -TEST_F(MemoryPropertiesParserHelperTests, givenInvalidFlagsIntelWhenParsingMemoryPropertiesForImageThenFalseIsReturned) { - cl_mem_properties_intel properties[] = { - CL_MEM_FLAGS, - MemObjHelper::validFlagsForImage, - CL_MEM_FLAGS_INTEL, - (1 << 30), - 0}; - - EXPECT_FALSE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, - MemoryPropertiesParserHelper::ObjType::IMAGE, context)); -} - -TEST_F(MemoryPropertiesParserHelperTests, givenInvalidPropertiesWhenParsingMemoryPropertiesForBufferThenFalseIsReturned) { - cl_mem_properties_intel properties[] = { - CL_MEM_FLAGS, - MemObjHelper::validFlagsForImage, - CL_MEM_FLAGS_INTEL, - MemObjHelper::validFlagsForImageIntel, - 0}; - - EXPECT_FALSE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, - MemoryPropertiesParserHelper::ObjType::BUFFER, context)); -} - -TEST_F(MemoryPropertiesParserHelperTests, givenInvalidFlagsWhenParsingMemoryPropertiesForBufferThenFalseIsReturned) { - cl_mem_properties_intel properties[] = { - CL_MEM_FLAGS, - (1 << 30), - CL_MEM_FLAGS_INTEL, - MemObjHelper::validFlagsForBufferIntel, - 0}; - - EXPECT_FALSE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, - MemoryPropertiesParserHelper::ObjType::BUFFER, context)); -} - -TEST_F(MemoryPropertiesParserHelperTests, givenInvalidFlagsIntelWhenParsingMemoryPropertiesForBufferThenFalseIsReturned) { - cl_mem_properties_intel properties[] = { - CL_MEM_FLAGS, - MemObjHelper::validFlagsForBuffer, - CL_MEM_FLAGS_INTEL, - (1 << 30), - 0}; - - EXPECT_FALSE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, - MemoryPropertiesParserHelper::ObjType::BUFFER, context)); -} - -TEST_F(MemoryPropertiesParserHelperTests, givenDifferentParametersWhenCallingFillCachePolicyInPropertiesThenFlushL3FlagsAreCorrectlySet) { - AllocationProperties allocationProperties{0, 0, GraphicsAllocation::AllocationType::BUFFER}; - - for (auto uncached : ::testing::Bool()) { - for (auto readOnly : ::testing::Bool()) { - for (auto deviceOnlyVisibilty : ::testing::Bool()) { - if (uncached || readOnly || deviceOnlyVisibilty) { - allocationProperties.flags.flushL3RequiredForRead = true; - allocationProperties.flags.flushL3RequiredForWrite = true; - MemoryPropertiesParserHelper::fillCachePolicyInProperties(allocationProperties, uncached, readOnly, deviceOnlyVisibilty); - EXPECT_FALSE(allocationProperties.flags.flushL3RequiredForRead); - EXPECT_FALSE(allocationProperties.flags.flushL3RequiredForWrite); - } else { - allocationProperties.flags.flushL3RequiredForRead = false; - allocationProperties.flags.flushL3RequiredForWrite = false; - MemoryPropertiesParserHelper::fillCachePolicyInProperties(allocationProperties, uncached, readOnly, deviceOnlyVisibilty); - EXPECT_TRUE(allocationProperties.flags.flushL3RequiredForRead); - EXPECT_TRUE(allocationProperties.flags.flushL3RequiredForWrite); - } - } - } - } -} diff --git a/opencl/test/unit_test/helpers/memory_properties_flags_helpers_tests.cpp b/opencl/test/unit_test/helpers/memory_properties_flags_helpers_tests.cpp deleted file mode 100644 index e8fe17d672..0000000000 --- a/opencl/test/unit_test/helpers/memory_properties_flags_helpers_tests.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (C) 2019-2020 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "opencl/source/helpers/memory_properties_flags_helpers.h" - -#include "CL/cl_ext_intel.h" -#include "gtest/gtest.h" - -using namespace NEO; - -TEST(MemoryProperties, givenValidPropertiesWhenCreateMemoryPropertiesThenTrueIsReturned) { - MemoryProperties properties; - - properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0); - EXPECT_TRUE(properties.flags.readWrite); - - properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_WRITE_ONLY, 0, 0); - EXPECT_TRUE(properties.flags.writeOnly); - - properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_ONLY, 0, 0); - EXPECT_TRUE(properties.flags.readOnly); - - properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); - EXPECT_TRUE(properties.flags.useHostPtr); - - properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_ALLOC_HOST_PTR, 0, 0); - EXPECT_TRUE(properties.flags.allocHostPtr); - - properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); - EXPECT_TRUE(properties.flags.copyHostPtr); - - properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_HOST_WRITE_ONLY, 0, 0); - EXPECT_TRUE(properties.flags.hostWriteOnly); - - properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_HOST_READ_ONLY, 0, 0); - EXPECT_TRUE(properties.flags.hostReadOnly); - - properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_HOST_NO_ACCESS, 0, 0); - EXPECT_TRUE(properties.flags.hostNoAccess); - - properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_KERNEL_READ_AND_WRITE, 0, 0); - EXPECT_TRUE(properties.flags.kernelReadAndWrite); - - properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL, 0, 0); - EXPECT_TRUE(properties.flags.accessFlagsUnrestricted); - - properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_NO_ACCESS_INTEL, 0, 0); - EXPECT_TRUE(properties.flags.noAccess); - - properties = MemoryPropertiesParser::createMemoryProperties(0, CL_MEM_LOCALLY_UNCACHED_RESOURCE, 0); - EXPECT_TRUE(properties.flags.locallyUncachedResource); - - properties = MemoryPropertiesParser::createMemoryProperties(0, CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE, 0); - EXPECT_TRUE(properties.flags.locallyUncachedInSurfaceState); - - properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL, 0, 0); - EXPECT_TRUE(properties.flags.forceSharedPhysicalMemory); - - properties = MemoryPropertiesParser::createMemoryProperties(0, 0, CL_MEM_ALLOC_WRITE_COMBINED_INTEL); - EXPECT_TRUE(properties.allocFlags.allocWriteCombined); - - properties = MemoryPropertiesParser::createMemoryProperties(0, CL_MEM_48BIT_RESOURCE_INTEL, 0); - EXPECT_TRUE(properties.flags.resource48Bit); -} - -TEST(MemoryProperties, givenClMemForceLinearStorageFlagWhenCreateMemoryPropertiesThenReturnProperValue) { - MemoryProperties memoryProperties; - cl_mem_flags flags = 0; - cl_mem_flags_intel flagsIntel = 0; - - flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL; - flagsIntel = 0; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); - EXPECT_TRUE(memoryProperties.flags.forceLinearStorage); - - flags = 0; - flagsIntel |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); - EXPECT_TRUE(memoryProperties.flags.forceLinearStorage); - - flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL; - flagsIntel |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); - EXPECT_TRUE(memoryProperties.flags.forceLinearStorage); - - flags = 0; - flagsIntel = 0; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); - EXPECT_FALSE(memoryProperties.flags.forceLinearStorage); -} - -TEST(MemoryProperties, givenClAllowUnrestrictedSizeFlagWhenCreateMemoryPropertiesThenReturnProperValue) { - MemoryProperties memoryProperties; - cl_mem_flags flags = 0; - cl_mem_flags_intel flagsIntel = 0; - - flags |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL; - flagsIntel = 0; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); - EXPECT_TRUE(memoryProperties.flags.allowUnrestrictedSize); - - flags = 0; - flagsIntel |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); - EXPECT_TRUE(memoryProperties.flags.allowUnrestrictedSize); - - flags |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL; - flagsIntel |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); - EXPECT_TRUE(memoryProperties.flags.allowUnrestrictedSize); - - flags = 0; - flagsIntel = 0; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); - EXPECT_FALSE(memoryProperties.flags.allowUnrestrictedSize); -} diff --git a/opencl/test/unit_test/helpers/memory_properties_helpers_tests.cpp b/opencl/test/unit_test/helpers/memory_properties_helpers_tests.cpp new file mode 100644 index 0000000000..ef8acc59b2 --- /dev/null +++ b/opencl/test/unit_test/helpers/memory_properties_helpers_tests.cpp @@ -0,0 +1,294 @@ +/* + * Copyright (C) 2019-2020 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "opencl/source/helpers/memory_properties_helpers.h" +#include "opencl/source/mem_obj/mem_obj_helper.h" +#include "opencl/test/unit_test/mocks/mock_context.h" + +#include "CL/cl_ext_intel.h" +#include "gtest/gtest.h" + +using namespace NEO; + +TEST(MemoryProperties, givenValidPropertiesWhenCreateMemoryPropertiesThenTrueIsReturned) { + MemoryProperties properties; + + properties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0); + EXPECT_TRUE(properties.flags.readWrite); + + properties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_WRITE_ONLY, 0, 0); + EXPECT_TRUE(properties.flags.writeOnly); + + properties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_ONLY, 0, 0); + EXPECT_TRUE(properties.flags.readOnly); + + properties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); + EXPECT_TRUE(properties.flags.useHostPtr); + + properties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_ALLOC_HOST_PTR, 0, 0); + EXPECT_TRUE(properties.flags.allocHostPtr); + + properties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); + EXPECT_TRUE(properties.flags.copyHostPtr); + + properties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_HOST_WRITE_ONLY, 0, 0); + EXPECT_TRUE(properties.flags.hostWriteOnly); + + properties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_HOST_READ_ONLY, 0, 0); + EXPECT_TRUE(properties.flags.hostReadOnly); + + properties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_HOST_NO_ACCESS, 0, 0); + EXPECT_TRUE(properties.flags.hostNoAccess); + + properties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_KERNEL_READ_AND_WRITE, 0, 0); + EXPECT_TRUE(properties.flags.kernelReadAndWrite); + + properties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL, 0, 0); + EXPECT_TRUE(properties.flags.accessFlagsUnrestricted); + + properties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_NO_ACCESS_INTEL, 0, 0); + EXPECT_TRUE(properties.flags.noAccess); + + properties = MemoryPropertiesHelper::createMemoryProperties(0, CL_MEM_LOCALLY_UNCACHED_RESOURCE, 0); + EXPECT_TRUE(properties.flags.locallyUncachedResource); + + properties = MemoryPropertiesHelper::createMemoryProperties(0, CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE, 0); + EXPECT_TRUE(properties.flags.locallyUncachedInSurfaceState); + + properties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL, 0, 0); + EXPECT_TRUE(properties.flags.forceSharedPhysicalMemory); + + properties = MemoryPropertiesHelper::createMemoryProperties(0, 0, CL_MEM_ALLOC_WRITE_COMBINED_INTEL); + EXPECT_TRUE(properties.allocFlags.allocWriteCombined); + + properties = MemoryPropertiesHelper::createMemoryProperties(0, CL_MEM_48BIT_RESOURCE_INTEL, 0); + EXPECT_TRUE(properties.flags.resource48Bit); +} + +TEST(MemoryProperties, givenClMemForceLinearStorageFlagWhenCreateMemoryPropertiesThenReturnProperValue) { + MemoryProperties memoryProperties; + cl_mem_flags flags = 0; + cl_mem_flags_intel flagsIntel = 0; + + flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL; + flagsIntel = 0; + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); + EXPECT_TRUE(memoryProperties.flags.forceLinearStorage); + + flags = 0; + flagsIntel |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL; + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); + EXPECT_TRUE(memoryProperties.flags.forceLinearStorage); + + flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL; + flagsIntel |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL; + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); + EXPECT_TRUE(memoryProperties.flags.forceLinearStorage); + + flags = 0; + flagsIntel = 0; + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); + EXPECT_FALSE(memoryProperties.flags.forceLinearStorage); +} + +TEST(MemoryProperties, givenClAllowUnrestrictedSizeFlagWhenCreateMemoryPropertiesThenReturnProperValue) { + MemoryProperties memoryProperties; + cl_mem_flags flags = 0; + cl_mem_flags_intel flagsIntel = 0; + + flags |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL; + flagsIntel = 0; + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); + EXPECT_TRUE(memoryProperties.flags.allowUnrestrictedSize); + + flags = 0; + flagsIntel |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL; + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); + EXPECT_TRUE(memoryProperties.flags.allowUnrestrictedSize); + + flags |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL; + flagsIntel |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL; + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); + EXPECT_TRUE(memoryProperties.flags.allowUnrestrictedSize); + + flags = 0; + flagsIntel = 0; + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); + EXPECT_FALSE(memoryProperties.flags.allowUnrestrictedSize); +} + +struct MemoryPropertiesHelperTests : ::testing::Test { + MockContext context; + MemoryProperties memoryProperties; + cl_mem_flags flags = 0; + cl_mem_flags_intel flagsIntel = 0; + cl_mem_alloc_flags_intel allocflags = 0; +}; + +TEST_F(MemoryPropertiesHelperTests, givenNullPropertiesWhenParsingMemoryPropertiesThenTrueIsReturned) { + EXPECT_TRUE(MemoryPropertiesHelper::parseMemoryProperties(nullptr, memoryProperties, flags, flagsIntel, allocflags, + MemoryPropertiesHelper::ObjType::UNKNOWN, context)); +} + +TEST_F(MemoryPropertiesHelperTests, givenEmptyPropertiesWhenParsingMemoryPropertiesThenTrueIsReturned) { + cl_mem_properties_intel properties[] = {0}; + + EXPECT_TRUE(MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, + MemoryPropertiesHelper::ObjType::UNKNOWN, context)); + EXPECT_TRUE(MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, + MemoryPropertiesHelper::ObjType::BUFFER, context)); + EXPECT_TRUE(MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, + MemoryPropertiesHelper::ObjType::IMAGE, context)); +} + +TEST_F(MemoryPropertiesHelperTests, givenValidPropertiesWhenParsingMemoryPropertiesThenTrueIsReturned) { + cl_mem_properties_intel properties[] = { + CL_MEM_FLAGS, + CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY | CL_MEM_ALLOC_HOST_PTR | CL_MEM_COPY_HOST_PTR | + CL_MEM_USE_HOST_PTR | CL_MEM_HOST_WRITE_ONLY | CL_MEM_HOST_READ_ONLY | CL_MEM_HOST_NO_ACCESS, + CL_MEM_FLAGS_INTEL, + CL_MEM_LOCALLY_UNCACHED_RESOURCE | CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE, + CL_MEM_ALLOC_FLAGS_INTEL, + CL_MEM_ALLOC_WRITE_COMBINED_INTEL, CL_MEM_ALLOC_DEFAULT_INTEL, + 0}; + + EXPECT_TRUE(MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, + MemoryPropertiesHelper::ObjType::UNKNOWN, context)); +} + +TEST_F(MemoryPropertiesHelperTests, givenValidPropertiesWhenParsingMemoryPropertiesForBufferThenTrueIsReturned) { + cl_mem_properties_intel properties[] = { + CL_MEM_FLAGS, + MemObjHelper::validFlagsForBuffer, + CL_MEM_FLAGS_INTEL, + MemObjHelper::validFlagsForBufferIntel, + 0}; + + EXPECT_TRUE(MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, + MemoryPropertiesHelper::ObjType::BUFFER, context)); +} + +TEST_F(MemoryPropertiesHelperTests, givenValidPropertiesWhenParsingMemoryPropertiesForImageThenTrueIsReturned) { + cl_mem_properties_intel properties[] = { + CL_MEM_FLAGS, + MemObjHelper::validFlagsForImage, + CL_MEM_FLAGS_INTEL, + MemObjHelper::validFlagsForImageIntel, + 0}; + + EXPECT_TRUE(MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, + MemoryPropertiesHelper::ObjType::IMAGE, context)); +} + +TEST_F(MemoryPropertiesHelperTests, givenInvalidPropertiesWhenParsingMemoryPropertiesThenFalseIsReturned) { + cl_mem_properties_intel properties[] = { + (1 << 30), CL_MEM_ALLOC_HOST_PTR | CL_MEM_COPY_HOST_PTR | CL_MEM_USE_HOST_PTR, + 0}; + + EXPECT_FALSE(MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, + MemoryPropertiesHelper::ObjType::UNKNOWN, context)); + EXPECT_FALSE(MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, + MemoryPropertiesHelper::ObjType::BUFFER, context)); + EXPECT_FALSE(MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, + MemoryPropertiesHelper::ObjType::IMAGE, context)); +} + +TEST_F(MemoryPropertiesHelperTests, givenInvalidPropertiesWhenParsingMemoryPropertiesForImageThenFalseIsReturned) { + cl_mem_properties_intel properties[] = { + CL_MEM_FLAGS, + MemObjHelper::validFlagsForBuffer, + CL_MEM_FLAGS_INTEL, + MemObjHelper::validFlagsForBufferIntel, + 0}; + + EXPECT_FALSE(MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, + MemoryPropertiesHelper::ObjType::IMAGE, context)); +} + +TEST_F(MemoryPropertiesHelperTests, givenInvalidFlagsWhenParsingMemoryPropertiesForImageThenFalseIsReturned) { + cl_mem_properties_intel properties[] = { + CL_MEM_FLAGS, + (1 << 30), + CL_MEM_FLAGS_INTEL, + MemObjHelper::validFlagsForImageIntel, + 0}; + + EXPECT_FALSE(MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, + MemoryPropertiesHelper::ObjType::IMAGE, context)); +} + +TEST_F(MemoryPropertiesHelperTests, givenInvalidFlagsIntelWhenParsingMemoryPropertiesForImageThenFalseIsReturned) { + cl_mem_properties_intel properties[] = { + CL_MEM_FLAGS, + MemObjHelper::validFlagsForImage, + CL_MEM_FLAGS_INTEL, + (1 << 30), + 0}; + + EXPECT_FALSE(MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, + MemoryPropertiesHelper::ObjType::IMAGE, context)); +} + +TEST_F(MemoryPropertiesHelperTests, givenInvalidPropertiesWhenParsingMemoryPropertiesForBufferThenFalseIsReturned) { + cl_mem_properties_intel properties[] = { + CL_MEM_FLAGS, + MemObjHelper::validFlagsForImage, + CL_MEM_FLAGS_INTEL, + MemObjHelper::validFlagsForImageIntel, + 0}; + + EXPECT_FALSE(MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, + MemoryPropertiesHelper::ObjType::BUFFER, context)); +} + +TEST_F(MemoryPropertiesHelperTests, givenInvalidFlagsWhenParsingMemoryPropertiesForBufferThenFalseIsReturned) { + cl_mem_properties_intel properties[] = { + CL_MEM_FLAGS, + (1 << 30), + CL_MEM_FLAGS_INTEL, + MemObjHelper::validFlagsForBufferIntel, + 0}; + + EXPECT_FALSE(MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, + MemoryPropertiesHelper::ObjType::BUFFER, context)); +} + +TEST_F(MemoryPropertiesHelperTests, givenInvalidFlagsIntelWhenParsingMemoryPropertiesForBufferThenFalseIsReturned) { + cl_mem_properties_intel properties[] = { + CL_MEM_FLAGS, + MemObjHelper::validFlagsForBuffer, + CL_MEM_FLAGS_INTEL, + (1 << 30), + 0}; + + EXPECT_FALSE(MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, + MemoryPropertiesHelper::ObjType::BUFFER, context)); +} + +TEST_F(MemoryPropertiesHelperTests, givenDifferentParametersWhenCallingFillCachePolicyInPropertiesThenFlushL3FlagsAreCorrectlySet) { + AllocationProperties allocationProperties{0, 0, GraphicsAllocation::AllocationType::BUFFER}; + + for (auto uncached : ::testing::Bool()) { + for (auto readOnly : ::testing::Bool()) { + for (auto deviceOnlyVisibilty : ::testing::Bool()) { + if (uncached || readOnly || deviceOnlyVisibilty) { + allocationProperties.flags.flushL3RequiredForRead = true; + allocationProperties.flags.flushL3RequiredForWrite = true; + MemoryPropertiesHelper::fillCachePolicyInProperties(allocationProperties, uncached, readOnly, deviceOnlyVisibilty); + EXPECT_FALSE(allocationProperties.flags.flushL3RequiredForRead); + EXPECT_FALSE(allocationProperties.flags.flushL3RequiredForWrite); + } else { + allocationProperties.flags.flushL3RequiredForRead = false; + allocationProperties.flags.flushL3RequiredForWrite = false; + MemoryPropertiesHelper::fillCachePolicyInProperties(allocationProperties, uncached, readOnly, deviceOnlyVisibilty); + EXPECT_TRUE(allocationProperties.flags.flushL3RequiredForRead); + EXPECT_TRUE(allocationProperties.flags.flushL3RequiredForWrite); + } + } + } + } +} diff --git a/opencl/test/unit_test/kernel/kernel_image_arg_tests.cpp b/opencl/test/unit_test/kernel/kernel_image_arg_tests.cpp index 865c715997..b120998c9b 100644 --- a/opencl/test/unit_test/kernel/kernel_image_arg_tests.cpp +++ b/opencl/test/unit_test/kernel/kernel_image_arg_tests.cpp @@ -9,7 +9,7 @@ #include "shared/source/helpers/ptr_math.h" #include "shared/test/unit_test/helpers/debug_manager_state_restore.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/kernel/kernel.h" #include "opencl/test/unit_test/fixtures/kernel_arg_fixture.h" #include "opencl/test/unit_test/mocks/mock_allocation_properties.h" @@ -121,7 +121,7 @@ TEST_F(KernelImageArgTest, givenImageWithWriteOnlyAccessAndReadOnlyArgWhenCheckC imgDesc.image_width = 5; imgDesc.image_height = 5; auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr img(Image::create(context.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal)); + std::unique_ptr img(Image::create(context.get(), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal)); pKernelInfo->kernelArgInfo[0].metadata.accessQualifier = NEO::KernelArgMetadata::AccessReadOnly; cl_mem memObj = img.get(); retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj); @@ -160,7 +160,7 @@ TEST_F(KernelImageArgTest, givenImageWithReadOnlyAccessAndWriteOnlyArgWhenCheckC imgDesc.image_width = 5; imgDesc.image_height = 5; auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr img(Image::create(context.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal)); + std::unique_ptr img(Image::create(context.get(), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal)); pKernelInfo->kernelArgInfo[0].metadata.accessQualifier = NEO::KernelArgMetadata::AccessWriteOnly; cl_mem memObj = img.get(); retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj); @@ -180,7 +180,7 @@ TEST_F(KernelImageArgTest, givenImageWithReadOnlyAccessAndReadOnlyArgWhenCheckCo imgDesc.image_width = 5; imgDesc.image_height = 5; auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr img(Image::create(context.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal)); + std::unique_ptr img(Image::create(context.get(), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal)); pKernelInfo->kernelArgInfo[0].metadata.accessQualifier = NEO::KernelArgMetadata::AccessReadOnly; cl_mem memObj = img.get(); retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj); @@ -196,7 +196,7 @@ TEST_F(KernelImageArgTest, givenImageWithWriteOnlyAccessAndWriteOnlyArgWhenCheck imgDesc.image_width = 5; imgDesc.image_height = 5; auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr img(Image::create(context.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal)); + std::unique_ptr img(Image::create(context.get(), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal)); pKernelInfo->kernelArgInfo[0].metadata.accessQualifier = NEO::KernelArgMetadata::AccessWriteOnly; cl_mem memObj = img.get(); retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj); @@ -241,7 +241,7 @@ TEST_F(KernelImageArgTest, givenKernelWithSettedArgWhenUnSetCalledThenArgIsUnset imgDesc.image_width = 5; imgDesc.image_height = 5; auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr img(Image::create(context.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal)); + std::unique_ptr img(Image::create(context.get(), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal)); cl_mem memObj = img.get(); retVal = pKernel->setArg(0, sizeof(memObj), &memObj); @@ -278,7 +278,7 @@ TEST_F(KernelImageArgTest, givenKernelWithSharedImageWhenSetArgCalledThenUsingSh imgDesc.image_width = 5; imgDesc.image_height = 5; auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr img(Image::create(context.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal)); + std::unique_ptr img(Image::create(context.get(), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal)); cl_mem memObj = img.get(); MockSharingHandler *mockSharingHandler = new MockSharingHandler; diff --git a/opencl/test/unit_test/kernel/kernel_tests.cpp b/opencl/test/unit_test/kernel/kernel_tests.cpp index e49af71859..f47614f0d0 100644 --- a/opencl/test/unit_test/kernel/kernel_tests.cpp +++ b/opencl/test/unit_test/kernel/kernel_tests.cpp @@ -18,7 +18,7 @@ #include "shared/test/unit_test/utilities/base_object_utils.h" #include "opencl/source/built_ins/builtins_dispatch_builder.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/helpers/surface_formats.h" #include "opencl/source/kernel/kernel.h" #include "opencl/source/mem_obj/image.h" @@ -2089,7 +2089,7 @@ HWTEST_F(KernelResidencyTest, WhenMakingArgsResidentThenImageFromImageCheckIsCor cl_int retVal; MockContext context; - std::unique_ptr imageNV12(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + std::unique_ptr imageNV12(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); EXPECT_EQ(imageNV12->getMediaPlaneType(), 0u); @@ -2103,7 +2103,7 @@ HWTEST_F(KernelResidencyTest, WhenMakingArgsResidentThenImageFromImageCheckIsCor imageDesc.image_depth = 0; imageDesc.mem_object = imageNV12.get(); - std::unique_ptr imageY(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + std::unique_ptr imageY(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); EXPECT_EQ(imageY->getMediaPlaneType(), 0u); diff --git a/opencl/test/unit_test/mem_obj/buffer_tests.cpp b/opencl/test/unit_test/mem_obj/buffer_tests.cpp index 823a1eb474..d2983019bc 100644 --- a/opencl/test/unit_test/mem_obj/buffer_tests.cpp +++ b/opencl/test/unit_test/mem_obj/buffer_tests.cpp @@ -25,7 +25,7 @@ #include "opencl/source/command_queue/command_queue_hw.h" #include "opencl/source/command_queue/gpgpu_walker.h" #include "opencl/source/event/user_event.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/buffer.h" #include "opencl/source/platform/platform.h" #include "opencl/test/unit_test/fixtures/device_fixture.h" @@ -88,11 +88,11 @@ TEST(Buffer, givenReadOnlySetOfInputFlagsWhenPassedToisReadOnlyMemoryPermittedBy using Buffer::isReadOnlyMemoryPermittedByFlags; }; cl_mem_flags flags = CL_MEM_HOST_NO_ACCESS | CL_MEM_READ_ONLY; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0); EXPECT_TRUE(MockBuffer::isReadOnlyMemoryPermittedByFlags(memoryProperties)); flags = CL_MEM_HOST_READ_ONLY | CL_MEM_READ_ONLY; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0); EXPECT_TRUE(MockBuffer::isReadOnlyMemoryPermittedByFlags(memoryProperties)); } @@ -106,7 +106,7 @@ TEST_P(BufferReadOnlyTest, givenNonReadOnlySetOfInputFlagsWhenPassedToisReadOnly }; cl_mem_flags flags = GetParam() | CL_MEM_USE_HOST_PTR; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0); EXPECT_FALSE(MockBuffer::isReadOnlyMemoryPermittedByFlags(memoryProperties)); } static cl_mem_flags nonReadOnlyFlags[] = { @@ -334,7 +334,7 @@ TEST(Buffer, givenAllocHostPtrFlagPassedToBufferCreateWhenNoSharedContextOrRende } TEST(Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturnedIn64Bit) { - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(0, 0, 0); MockContext context; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.isSharedContext = false; @@ -343,7 +343,7 @@ TEST(Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenB } TEST(Buffer, givenRenderCompressedBuffersDisabledLocalMemoryEnabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturnedIn64Bit) { - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(0, 0, 0); MockContext context; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.isSharedContext = false; @@ -352,7 +352,7 @@ TEST(Buffer, givenRenderCompressedBuffersDisabledLocalMemoryEnabledWhenAllocatio } TEST(Buffer, givenSharedContextWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) { - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(0, 0, 0); MockContext context; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.isSharedContext = true; @@ -361,7 +361,7 @@ TEST(Buffer, givenSharedContextWhenAllocationTypeIsQueriedThenBufferHostMemoryTy } TEST(Buffer, givenSharedContextAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) { - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(0, 0, 0); MockContext context; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.isSharedContext = true; @@ -371,7 +371,7 @@ TEST(Buffer, givenSharedContextAndRenderCompressedBuffersEnabledWhenAllocationTy TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) { cl_mem_flags flags = CL_MEM_USE_HOST_PTR; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0); MockContext context; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.isSharedContext = false; @@ -381,7 +381,7 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledWhenAllocationTypeIsQuerie TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) { cl_mem_flags flags = CL_MEM_USE_HOST_PTR; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0); MockContext context; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.isSharedContext = false; @@ -391,7 +391,7 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledWhenAllocationTypeIsQueried TEST(Buffer, givenAllocHostPtrFlagWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) { cl_mem_flags flags = CL_MEM_ALLOC_HOST_PTR; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0); MockContext context; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.isSharedContext = false; @@ -401,7 +401,7 @@ TEST(Buffer, givenAllocHostPtrFlagWhenAllocationTypeIsQueriedThenBufferTypeIsRet TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferMemoryTypeIsReturned) { cl_mem_flags flags = CL_MEM_USE_HOST_PTR; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0); MockContext context; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.isSharedContext = false; @@ -411,7 +411,7 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledAndRenderCompressedBuffers TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferMemoryTypeIsReturned) { cl_mem_flags flags = CL_MEM_USE_HOST_PTR; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0); MockContext context; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.isSharedContext = false; @@ -421,7 +421,7 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledAndRenderCompressedBuffersE TEST(Buffer, givenUseHostPointerFlagAndForceSharedPhysicalStorageWhenLocalMemoryIsEnabledThenBufferHostMemoryTypeIsReturned) { cl_mem_flags flags = CL_MEM_USE_HOST_PTR | CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0); MockContext context; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.isSharedContext = false; @@ -431,7 +431,7 @@ TEST(Buffer, givenUseHostPointerFlagAndForceSharedPhysicalStorageWhenLocalMemory TEST(Buffer, givenAllocHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturned) { cl_mem_flags flags = CL_MEM_ALLOC_HOST_PTR; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0); MockContext context; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.isSharedContext = false; @@ -440,7 +440,7 @@ TEST(Buffer, givenAllocHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocatio } TEST(Buffer, givenZeroFlagsNoSharedContextAndRenderCompressedBuffersDisabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) { - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(0, 0, 0); MockContext context; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.isSharedContext = false; diff --git a/opencl/test/unit_test/mem_obj/create_image_format_tests.cpp b/opencl/test/unit_test/mem_obj/create_image_format_tests.cpp index e030722672..6828b0ccfc 100644 --- a/opencl/test/unit_test/mem_obj/create_image_format_tests.cpp +++ b/opencl/test/unit_test/mem_obj/create_image_format_tests.cpp @@ -5,7 +5,7 @@ * */ -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/helpers/surface_formats.h" #include "opencl/source/mem_obj/image.h" #include "opencl/test/unit_test/fixtures/device_fixture.h" @@ -64,7 +64,7 @@ typedef CreateImageFormatTest ReadWriteFormatTest; TEST_P(ReadWriteFormatTest, returnsSuccess) { auto image = Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -89,7 +89,7 @@ typedef CreateImageFormatTest ReadOnlyFormatTest; TEST_P(ReadOnlyFormatTest, returnsSuccess) { auto image = Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -112,7 +112,7 @@ typedef CreateImageFormatTest WriteOnlyFormatTest; TEST_P(WriteOnlyFormatTest, returnsSuccess) { auto image = Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, diff --git a/opencl/test/unit_test/mem_obj/image1d_tests.cpp b/opencl/test/unit_test/mem_obj/image1d_tests.cpp index 96844f16b0..8261b9c73e 100644 --- a/opencl/test/unit_test/mem_obj/image1d_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image1d_tests.cpp @@ -5,7 +5,7 @@ * */ -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/buffer.h" #include "opencl/source/mem_obj/image.h" #include "opencl/test/unit_test/fixtures/device_fixture.h" @@ -75,7 +75,7 @@ HWTEST_P(CreateImage1DType, validTypes) { auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, pClDevice->getHardwareInfo().capabilityTable.supportsOcl21Features); auto image = Image::create( context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, diff --git a/opencl/test/unit_test/mem_obj/image2d_from_buffer_tests.cpp b/opencl/test/unit_test/mem_obj/image2d_from_buffer_tests.cpp index 94f54aad5a..d9a6a30b7a 100644 --- a/opencl/test/unit_test/mem_obj/image2d_from_buffer_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image2d_from_buffer_tests.cpp @@ -9,7 +9,7 @@ #include "shared/source/helpers/hw_helper.h" #include "opencl/source/cl_device/cl_device_info_map.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/buffer.h" #include "opencl/source/mem_obj/image.h" #include "opencl/source/platform/extensions.h" @@ -60,7 +60,7 @@ class Image2dFromBufferTest : public DeviceFixture, public ::testing::Test { Image *createImage() { cl_mem_flags flags = CL_MEM_READ_ONLY; auto surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - return Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, NULL, retVal); + return Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, NULL, retVal); } cl_image_format imageFormat; cl_image_desc imageDesc; @@ -91,7 +91,7 @@ TEST_F(Image2dFromBufferTest, givenBufferWhenCreateImage2dArrayFromBufferThenIma imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D_ARRAY; cl_mem_flags flags = CL_MEM_READ_ONLY; auto surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL); + retVal = Image::validate(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL); EXPECT_EQ(CL_INVALID_IMAGE_DESCRIPTOR, retVal); } TEST_F(Image2dFromBufferTest, CalculateRowPitch) { @@ -107,7 +107,7 @@ TEST_F(Image2dFromBufferTest, givenInvalidRowPitchWhenCreateImage2dFromBufferThe imageDesc.image_row_pitch = 255; cl_mem_flags flags = CL_MEM_READ_ONLY; auto surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, ptr); + retVal = Image::validate(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, ptr); EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal); } @@ -136,7 +136,7 @@ TEST_F(Image2dFromBufferTest, InvalidHostPtrAlignment) { ASSERT_NE(nullptr, imageDesc.mem_object); cl_mem_flags flags = CL_MEM_READ_ONLY; auto surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL); + retVal = Image::validate(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL); EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal); clReleaseMemObject(imageDesc.mem_object); @@ -149,7 +149,7 @@ TEST_F(Image2dFromBufferTest, givenInvalidFlagsWhenValidateIsCalledThenReturnErr for (auto flag : flags) { const auto surfaceFormat = Image::getSurfaceFormatFromTable(flag, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flag, 0, 0), surfaceFormat, &imageDesc, reinterpret_cast(0x12345)); + retVal = Image::validate(&context, MemoryPropertiesHelper::createMemoryProperties(flag, 0, 0), surfaceFormat, &imageDesc, reinterpret_cast(0x12345)); EXPECT_EQ(CL_INVALID_VALUE, retVal); } } @@ -162,7 +162,7 @@ TEST_F(Image2dFromBufferTest, givenOneChannel8BitColorsNoRowPitchSpecifiedAndToo imageFormat.image_channel_order = CL_R; const auto surfaceFormat = static_cast(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features)); - retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL); + retVal = Image::validate(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL); EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal); } @@ -174,7 +174,7 @@ TEST_F(Image2dFromBufferTest, givenOneChannel16BitColorsNoRowPitchSpecifiedAndTo imageFormat.image_channel_order = CL_R; const auto surfaceFormat = static_cast(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features)); - retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL); + retVal = Image::validate(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL); EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal); } @@ -186,7 +186,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel8BitColorsNoRowPitchSpecifiedAndTo imageFormat.image_channel_order = CL_RGBA; const auto surfaceFormat = static_cast(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features)); - retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL); + retVal = Image::validate(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL); EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal); } @@ -198,7 +198,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel16BitColorsNoRowPitchSpecifiedAndT imageFormat.image_channel_order = CL_RGBA; const auto surfaceFormat = static_cast(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features)); - retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL); + retVal = Image::validate(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL); EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal); } @@ -211,7 +211,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel8BitColorsAndNotTooLargeRowPitchSp imageFormat.image_channel_order = CL_RGBA; const auto surfaceFormat = static_cast(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features)); - retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL); + retVal = Image::validate(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL); EXPECT_EQ(CL_SUCCESS, retVal); } @@ -225,7 +225,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel8BitColorsAndTooLargeRowPitchSpeci imageFormat.image_channel_order = CL_RGBA; const auto surfaceFormat = static_cast(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features)); - retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL); + retVal = Image::validate(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL); EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal); } @@ -239,7 +239,7 @@ TEST_F(Image2dFromBufferTest, givenUnalignedImageWidthAndNoSpaceInBufferForAlign imageFormat.image_channel_order = CL_R; const auto surfaceFormat = static_cast(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features)); - retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL); + retVal = Image::validate(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL); EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal); } diff --git a/opencl/test/unit_test/mem_obj/image2d_tests.cpp b/opencl/test/unit_test/mem_obj/image2d_tests.cpp index 815964eff6..5de2684eaa 100644 --- a/opencl/test/unit_test/mem_obj/image2d_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image2d_tests.cpp @@ -5,7 +5,7 @@ * */ -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/image.h" #include "opencl/test/unit_test/fixtures/device_fixture.h" #include "opencl/test/unit_test/helpers/unit_test_helper.h" @@ -55,7 +55,7 @@ class CreateImage2DTest : public DeviceFixture, } Image *createImageWithFlags(cl_mem_flags flags) { auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - return Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal); + return Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal); } cl_image_format imageFormat; cl_image_desc imageDesc; diff --git a/opencl/test/unit_test/mem_obj/image3d_tests.cpp b/opencl/test/unit_test/mem_obj/image3d_tests.cpp index 0eab9f889a..f24475a069 100644 --- a/opencl/test/unit_test/mem_obj/image3d_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image3d_tests.cpp @@ -7,7 +7,7 @@ #include "shared/source/helpers/aligned_memory.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/image.h" #include "opencl/test/unit_test/fixtures/device_fixture.h" #include "opencl/test/unit_test/helpers/unit_test_helper.h" @@ -61,7 +61,7 @@ class CreateImage3DTest : public DeviceFixture, HWTEST_F(CreateImage3DTest, validTypes) { cl_mem_flags flags = CL_MEM_READ_WRITE; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - auto image = Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal); + auto image = Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal); ASSERT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, image); diff --git a/opencl/test/unit_test/mem_obj/image_array_size_tests.cpp b/opencl/test/unit_test/mem_obj/image_array_size_tests.cpp index 42f4819cec..cf69718615 100644 --- a/opencl/test/unit_test/mem_obj/image_array_size_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image_array_size_tests.cpp @@ -7,7 +7,7 @@ #include "shared/source/helpers/aligned_memory.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/image.h" #include "opencl/test/unit_test/fixtures/device_fixture.h" #include "opencl/test/unit_test/helpers/unit_test_helper.h" @@ -75,7 +75,7 @@ HWTEST_P(CreateImageArraySize, arrayTypes) { auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto image = Image::create( context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -116,7 +116,7 @@ HWTEST_P(CreateImageNonArraySize, NonArrayTypes) { auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto image = Image::create( context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, diff --git a/opencl/test/unit_test/mem_obj/image_from_subbuffer_tests.cpp b/opencl/test/unit_test/mem_obj/image_from_subbuffer_tests.cpp index bdf3a60be5..1ed72f1766 100644 --- a/opencl/test/unit_test/mem_obj/image_from_subbuffer_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image_from_subbuffer_tests.cpp @@ -7,7 +7,7 @@ #include "shared/source/helpers/aligned_memory.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/buffer.h" #include "opencl/source/mem_obj/image.h" #include "opencl/test/unit_test/fixtures/device_fixture.h" @@ -62,7 +62,7 @@ class ImageFromSubBufferTest : public DeviceFixture, public ::testing::Test { Image *createImage() { cl_mem_flags flags = CL_MEM_READ_ONLY; auto surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - return Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, NULL, retVal); + return Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, NULL, retVal); } cl_image_format imageFormat; cl_image_desc imageDesc; diff --git a/opencl/test/unit_test/mem_obj/image_redescribe_tests.cpp b/opencl/test/unit_test/mem_obj/image_redescribe_tests.cpp index 53a6267fa7..8aec7c7952 100644 --- a/opencl/test/unit_test/mem_obj/image_redescribe_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image_redescribe_tests.cpp @@ -7,7 +7,7 @@ #include "shared/source/helpers/aligned_memory.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/helpers/surface_formats.h" #include "opencl/source/mem_obj/image.h" #include "opencl/source/memory_manager/os_agnostic_memory_manager.h" @@ -53,7 +53,7 @@ class ImageRedescribeTest : public testing::TestWithParamgetHardwareInfo().capabilityTable.supportsOcl21Features); image.reset(Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -194,7 +194,7 @@ TEST_P(ImageRedescribeTest, givenImageWithMaxSizesWhenItIsRedescribedThenNewImag cl_mem_flags flags = CL_MEM_READ_WRITE; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto bigImage = std::unique_ptr(Image::create(&context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, diff --git a/opencl/test/unit_test/mem_obj/image_tests.cpp b/opencl/test/unit_test/mem_obj/image_tests.cpp index 569f062dae..72c5066c3c 100644 --- a/opencl/test/unit_test/mem_obj/image_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image_tests.cpp @@ -47,7 +47,7 @@ class CreateImageTest : public DeviceFixture, } Image *createImageWithFlags(cl_mem_flags flags) { auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - return Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + return Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal); } @@ -123,7 +123,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto image = Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -148,7 +148,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc image = Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -173,7 +173,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc image = Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -198,7 +198,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc image = Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -223,7 +223,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc image = Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -248,7 +248,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc image = Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -273,7 +273,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc image = Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -298,7 +298,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc image = Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -349,7 +349,7 @@ TEST(TestCreateImage, UseSharedContextToCreateImage) { auto image = Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -410,7 +410,7 @@ TEST(TestCreateImageUseHostPtr, CheckMemoryAllocationForDifferenHostPtrAlignment for (int i = 0; i < 4; i++) { auto image = Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -448,7 +448,7 @@ TEST(TestCreateImageUseHostPtr, givenZeroCopyImageValuesWhenUsingHostPtrThenZero auto image = std::unique_ptr(Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -557,7 +557,7 @@ struct CreateImageHostPtr auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); return Image::create( context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -972,7 +972,7 @@ HWTEST_F(ImageCompressionTests, givenTiledImageWhenCreatingAllocationThenPreferR MockContext context; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - auto image = std::unique_ptr(Image::create(mockContext.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + auto image = std::unique_ptr(Image::create(mockContext.get(), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); ASSERT_NE(nullptr, image); EXPECT_EQ(UnitTestHelper::tiledImagesSupported, image->isTiledAllocation()); @@ -986,7 +986,7 @@ TEST_F(ImageCompressionTests, givenNonTiledImageWhenCreatingAllocationThenDontPr MockContext context; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - auto image = std::unique_ptr(Image::create(mockContext.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + auto image = std::unique_ptr(Image::create(mockContext.get(), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); ASSERT_NE(nullptr, image); EXPECT_FALSE(image->isTiledAllocation()); @@ -1186,7 +1186,7 @@ TEST(ImageTest, givenClMemForceLinearStorageSetWhenCreateImageThenDisallowTiling auto image = std::unique_ptr(Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, @@ -1231,7 +1231,7 @@ TEST(ImageTest, givenClMemCopyHostPointerPassedToImageCreateWhenAllocationIsNotI MockContext context; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr image(Image::create(&ctx, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, memory, retVal)); + std::unique_ptr image(Image::create(&ctx, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, memory, retVal)); EXPECT_NE(nullptr, image); auto taskCountSent = device->getGpgpuCommandStreamReceiver().peekLatestFlushedTaskCount(); diff --git a/opencl/test/unit_test/mem_obj/image_tiled_tests.cpp b/opencl/test/unit_test/mem_obj/image_tiled_tests.cpp index a3d556faf9..eb239af986 100644 --- a/opencl/test/unit_test/mem_obj/image_tiled_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image_tiled_tests.cpp @@ -73,7 +73,7 @@ HWTEST_P(CreateTiledImageTest, isTiledImageIsSetForTiledImages) { auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, pClDevice->getHardwareInfo().capabilityTable.supportsOcl21Features); auto image = Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, diff --git a/opencl/test/unit_test/mem_obj/image_validate_tests.cpp b/opencl/test/unit_test/mem_obj/image_validate_tests.cpp index c589c2929f..b8ede36f42 100644 --- a/opencl/test/unit_test/mem_obj/image_validate_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image_validate_tests.cpp @@ -683,7 +683,7 @@ TEST(validateAndCreateImage, givenNotSupportedImageFormatWhenValidateAndCreateIm cl_int retVal = CL_SUCCESS; Image *image; cl_mem_flags flags = CL_MEM_READ_WRITE; - image = Image::validateAndCreateImage(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, &imageFormat, &Image1dDefaults::imageDesc, nullptr, retVal); + image = Image::validateAndCreateImage(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, &imageFormat, &Image1dDefaults::imageDesc, nullptr, retVal); EXPECT_EQ(nullptr, image); EXPECT_EQ(CL_IMAGE_FORMAT_NOT_SUPPORTED, retVal); } @@ -711,7 +711,7 @@ TEST(validateAndCreateImage, givenValidImageParamsWhenValidateAndCreateImageIsCa std::unique_ptr image = nullptr; image.reset(Image::validateAndCreateImage( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, &imageFormat, diff --git a/opencl/test/unit_test/mem_obj/mem_obj_destruction_tests.cpp b/opencl/test/unit_test/mem_obj/mem_obj_destruction_tests.cpp index b960d6957e..cee0ae3b6b 100644 --- a/opencl/test/unit_test/mem_obj/mem_obj_destruction_tests.cpp +++ b/opencl/test/unit_test/mem_obj/mem_obj_destruction_tests.cpp @@ -11,7 +11,7 @@ #include "shared/test/unit_test/mocks/mock_device.h" #include "opencl/source/api/api.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/mem_obj.h" #include "opencl/source/platform/platform.h" #include "opencl/test/unit_test/libult/ult_command_stream_receiver.h" @@ -45,7 +45,7 @@ class MemObjDestructionTest : public ::testing::TestWithParam { allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), size}); memObj = new MemObj(context.get(), CL_MEM_OBJECT_BUFFER, - MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0), CL_MEM_READ_WRITE, 0, + MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0), CL_MEM_READ_WRITE, 0, size, nullptr, nullptr, allocation, true, false, false); csr = device->getDefaultEngine().commandStreamReceiver; @@ -224,7 +224,7 @@ HWTEST_P(MemObjAsyncDestructionTest, givenUsedMemObjWithAsyncDestructionsEnabled MemObjSizeArray region = {{1, 1, 1}}; cl_map_flags mapFlags = CL_MAP_READ; memObj = new MemObj(context.get(), CL_MEM_OBJECT_BUFFER, - MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0), CL_MEM_READ_WRITE, 0, + MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0), CL_MEM_READ_WRITE, 0, size, storage, nullptr, allocation, true, false, false); memObj->addMappedPtr(storage, 1, mapFlags, region, origin, 0); diff --git a/opencl/test/unit_test/mem_obj/mem_obj_helper_tests.cpp b/opencl/test/unit_test/mem_obj/mem_obj_helper_tests.cpp index 023793e686..9d3f63c110 100644 --- a/opencl/test/unit_test/mem_obj/mem_obj_helper_tests.cpp +++ b/opencl/test/unit_test/mem_obj/mem_obj_helper_tests.cpp @@ -7,7 +7,7 @@ #include "shared/test/unit_test/utilities/base_object_utils.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/mem_obj_helper.h" #include "opencl/test/unit_test/fixtures/image_fixture.h" #include "opencl/test/unit_test/mocks/mock_context.h" @@ -36,83 +36,83 @@ TEST(MemObjHelper, givenClMemForceLinearStorageFlagWhenCheckForLinearStorageForc flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL; flagsIntel = 0; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); EXPECT_TRUE(memoryProperties.flags.forceLinearStorage); flags = 0; flagsIntel |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); EXPECT_TRUE(memoryProperties.flags.forceLinearStorage); flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL; flagsIntel |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); EXPECT_TRUE(memoryProperties.flags.forceLinearStorage); flags = 0; flagsIntel = 0; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); EXPECT_FALSE(memoryProperties.flags.forceLinearStorage); } TEST(MemObjHelper, givenValidPropertiesWhenValidatingMemoryPropertiesThenTrueIsReturned) { cl_mem_flags flags = 0; cl_mem_flags_intel flagsIntel = 0; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); MockContext context; EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context)); flags = CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL | CL_MEM_NO_ACCESS_INTEL; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); flags = CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL | CL_MEM_NO_ACCESS_INTEL; flagsIntel = 0; EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context)); flags = CL_MEM_NO_ACCESS_INTEL; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); flags = CL_MEM_NO_ACCESS_INTEL; flagsIntel = 0; EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context)); flags = CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR | CL_MEM_HOST_NO_ACCESS; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); flags = CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR | CL_MEM_HOST_NO_ACCESS; flagsIntel = 0; EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context)); flags = CL_MEM_WRITE_ONLY | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_WRITE_ONLY; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); flags = CL_MEM_WRITE_ONLY | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_WRITE_ONLY; flagsIntel = 0; EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context)); flags = CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_NO_ACCESS; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); flags = CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_NO_ACCESS; flagsIntel = 0; EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context)); flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); flags = 0; flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE; EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context)); flagsIntel = CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); flags = 0; flagsIntel = CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE; EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context)); flags = 0; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); flags = 0; flagsIntel = 0; EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context)); @@ -126,7 +126,7 @@ struct Image1dWithAccessFlagsUnrestricted : public Image1dDefaults { TEST(MemObjHelper, givenParentMemObjAndHostPtrFlagsWhenValidatingMemoryPropertiesForImageThenFalseIsReturned) { cl_mem_flags flags = 0; cl_mem_flags_intel flagsIntel = 0; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); MockContext context; auto image = clUniquePtr(Image1dHelper<>::create(&context)); @@ -136,13 +136,13 @@ TEST(MemObjHelper, givenParentMemObjAndHostPtrFlagsWhenValidatingMemoryPropertie for (auto hostPtrFlag : hostPtrFlags) { flags = hostPtrFlag; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); flags = hostPtrFlag; EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, image.get(), context)); EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, imageWithAccessFlagsUnrestricted.get(), context)); flags |= CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0); flags |= CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL; EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, image.get(), context)); EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, imageWithAccessFlagsUnrestricted.get(), context)); diff --git a/opencl/test/unit_test/mem_obj/mem_obj_tests.cpp b/opencl/test/unit_test/mem_obj/mem_obj_tests.cpp index 2aa57be7a2..378ac846c4 100644 --- a/opencl/test/unit_test/mem_obj/mem_obj_tests.cpp +++ b/opencl/test/unit_test/mem_obj/mem_obj_tests.cpp @@ -12,7 +12,7 @@ #include "shared/source/os_interface/os_context.h" #include "shared/test/unit_test/mocks/mock_device.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/helpers/properties_helper.h" #include "opencl/source/mem_obj/mem_obj.h" #include "opencl/source/platform/platform.h" @@ -65,7 +65,7 @@ TEST(MemObj, GivenMemObjWhenInititalizedFromHostPtrThenInitializeFields) { char buffer[size]; MockContext context; MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(buffer, sizeof(buffer)); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0, sizeof(buffer), buffer, buffer, mockAllocation, true, false, false); @@ -81,7 +81,7 @@ TEST(MemObj, givenMemObjectWhenAskedForTransferToHostPtrThenDoNothing) { uint8_t expectedHostPtr[size] = {}; MockContext context; MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(hostPtr, sizeof(hostPtr)); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0, size, hostPtr, hostPtr, mockAllocation, true, false, false); @@ -101,7 +101,7 @@ TEST(MemObj, givenMemObjectWhenAskedForTransferFromHostPtrThenDoNothing) { uint8_t expectedBufferPtr[size] = {}; MockContext context; MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(hostPtr, sizeof(hostPtr)); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_PIPE, memoryProperties, CL_MEM_USE_HOST_PTR, 0, size, hostPtr, hostPtr, mockAllocation, true, false, false); @@ -118,7 +118,7 @@ TEST(MemObj, givenMemObjectWhenAskedForTransferFromHostPtrThenDoNothing) { TEST(MemObj, givenHostPtrAndUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnHostPtr) { uint8_t hostPtr = 0; MockContext context; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0, 1, nullptr, &hostPtr, nullptr, true, false, false); @@ -128,7 +128,7 @@ TEST(MemObj, givenHostPtrAndUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnHostP TEST(MemObj, givenHostPtrWithoutUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnAllocatedPtr) { uint8_t hostPtr = 0; MockContext context; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0, 1, nullptr, &hostPtr, nullptr, true, false, false); @@ -140,7 +140,7 @@ TEST(MemObj, givenMemObjWhenReleaseAllocatedPtrIsCalledTwiceThenItDoesntCrash) { void *allocatedPtr = alignedMalloc(MemoryConstants::cacheLineSize, MemoryConstants::cacheLineSize); MockContext context; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0, 1, nullptr, nullptr, nullptr, true, false, false); @@ -160,7 +160,7 @@ TEST(MemObj, givenNotReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThe auto defaultEngine = context.getDevice(0)->getDefaultEngine(); allocation->updateTaskCount(2, defaultEngine.osContext->getContextId()); *(defaultEngine.commandStreamReceiver->getTagAddress()) = 1; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0, MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false); auto &allocationList = defaultEngine.commandStreamReceiver->getTemporaryAllocations(); @@ -179,7 +179,7 @@ TEST(MemObj, givenReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThenAl auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize}); allocation->updateTaskCount(1, device->getDefaultEngine().osContext->getContextId()); *device->getDefaultEngine().commandStreamReceiver->getTagAddress() = 1; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0, MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false); @@ -197,7 +197,7 @@ TEST(MemObj, givenNotUsedGraphicsAllocationWhenMemObjDestroysAllocationAsyncThen context.memoryManager = &memoryManager; auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize}); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0, MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false); @@ -215,7 +215,7 @@ TEST(MemObj, givenMemoryManagerWithoutDeviceWhenMemObjDestroysAllocationAsyncThe context.memoryManager = &memoryManager; auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize}); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0, MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false); @@ -231,7 +231,7 @@ TEST(MemObj, givenMemObjAndPointerToObjStorageWithProperCommandWhenCheckIfMemTra MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment()); context.memoryManager = &memoryManager; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0, MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false); void *ptr = memObj.getCpuAddressForMemoryTransfer(); @@ -258,7 +258,7 @@ TEST(MemObj, givenMemObjAndPointerToObjStorageBadCommandWhenCheckIfMemTransferRe MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment()); context.memoryManager = &memoryManager; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0, MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false); void *ptr = memObj.getCpuAddressForMemoryTransfer(); @@ -270,7 +270,7 @@ TEST(MemObj, givenMemObjAndPointerToDiffrentStorageAndProperCommandWhenCheckIfMe MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment()); context.memoryManager = &memoryManager; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0, MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false); void *ptr = (void *)0x1234; @@ -282,7 +282,7 @@ TEST(MemObj, givenSharingHandlerWhenAskedForCpuMappingThenReturnFalse) { MockContext context; MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment()); auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize}); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0, MemoryConstants::pageSize, nullptr, nullptr, allocation, true, false, false); memObj.setSharingHandler(new SharingHandler()); @@ -294,7 +294,7 @@ TEST(MemObj, givenTiledObjectWhenAskedForCpuMappingThenReturnFalse) { using MemObj::MemObj; bool isTiledAllocation() const override { return true; } }; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); MyMemObj memObj(nullptr, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0, MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false); @@ -309,7 +309,7 @@ TEST(MemObj, givenRenderCompressedGmmWhenAskingForMappingOnCpuThenDisallow) { auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize}); allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, false)); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0, 1, allocation->getUnderlyingBuffer(), nullptr, allocation, false, false, false); @@ -326,7 +326,7 @@ TEST(MemObj, givenDefaultWhenAskedForCpuMappingThenReturnTrue) { context.memoryManager = &memoryManager; auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize}); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0, 64, allocation->getUnderlyingBuffer(), nullptr, allocation, true, false, false); @@ -343,7 +343,7 @@ TEST(MemObj, givenNonCpuAccessibleMemoryWhenAskingForMappingOnCpuThenDisallow) { auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize}); allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, false)); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0, 1, allocation->getUnderlyingBuffer(), nullptr, allocation, false, false, false); @@ -393,7 +393,7 @@ TEST(MemObj, givenSharedMemObjectWithNullGfxAllocationWhenSettingGfxAllocationTh MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment()); context.memoryManager = &memoryManager; MockGraphicsAllocation *gfxAllocation = new MockGraphicsAllocation(nullptr, 0); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0, 1, nullptr, nullptr, nullptr, true, false, false); memObj.setSharingHandler(new MySharingHandler(&memObj)); @@ -410,7 +410,7 @@ TEST(MemObj, givenSharedMemObjectAndNullGfxAllocationProvidedWhenSettingGfxAlloc MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment()); context.memoryManager = &memoryManager; MockGraphicsAllocation *graphicsAllocation = new MockGraphicsAllocation(nullptr, 0); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0, 1, nullptr, nullptr, graphicsAllocation, true, false, false); memObj.setSharingHandler(new MySharingHandler(&memObj)); @@ -427,7 +427,7 @@ TEST(MemObj, givenSharedMemObjectAndZeroReuseCountWhenChangingGfxAllocationThenO context.memoryManager = &memoryManager; MockGraphicsAllocation *oldGfxAllocation = new MockGraphicsAllocation(nullptr, 0); MockGraphicsAllocation *newGfxAllocation = new MockGraphicsAllocation(nullptr, 0); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0, 1, nullptr, nullptr, oldGfxAllocation, true, false, false); memObj.setSharingHandler(new MySharingHandler(&memObj)); @@ -446,7 +446,7 @@ TEST(MemObj, givenSharedMemObjectAndNonZeroReuseCountWhenChangingGfxAllocationTh context.memoryManager = &memoryManager; MockGraphicsAllocation *oldGfxAllocation = new MockGraphicsAllocation(nullptr, 0); MockGraphicsAllocation *newGfxAllocation = new MockGraphicsAllocation(nullptr, 0); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0, 1, nullptr, nullptr, oldGfxAllocation, true, false, false); memObj.setSharingHandler(new MySharingHandler(&memObj)); @@ -465,7 +465,7 @@ TEST(MemObj, givenNotSharedMemObjectWhenChangingGfxAllocationThenOldAllocationIs context.memoryManager = &memoryManager; MockGraphicsAllocation *oldGfxAllocation = new MockGraphicsAllocation(nullptr, 0); MockGraphicsAllocation *newGfxAllocation = new MockGraphicsAllocation(nullptr, 0); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0, 1, nullptr, nullptr, oldGfxAllocation, true, false, false); @@ -483,7 +483,7 @@ TEST(MemObj, givenGraphicsAllocationWhenCallingIsAllocDumpableThenItReturnsTheCo TEST(MemObj, givenMemObjNotUsingHostPtrWhenGettingBasePtrTwiceReturnSameMapPtr) { MockContext context; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0); MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0, 1, nullptr, nullptr, nullptr, true, false, false); @@ -498,7 +498,7 @@ TEST(MemObj, givenMemObjNotUsingHostPtrWhenGettingBasePtrTwiceReturnSameMapPtr) using MemObjMultiRootDeviceTests = MultiRootDeviceFixture; TEST_F(MemObjMultiRootDeviceTests, memObjMapAllocationHasCorrectRootDeviceIndex) { - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0); MemObj memObj(context.get(), CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0, 1, nullptr, nullptr, nullptr, true, false, false); diff --git a/opencl/test/unit_test/mem_obj/nv12_image_tests.cpp b/opencl/test/unit_test/mem_obj/nv12_image_tests.cpp index 6e9b10f605..7ccfc5891d 100644 --- a/opencl/test/unit_test/mem_obj/nv12_image_tests.cpp +++ b/opencl/test/unit_test/mem_obj/nv12_image_tests.cpp @@ -10,7 +10,7 @@ #include "shared/test/unit_test/helpers/debug_manager_state_restore.h" #include "opencl/source/cl_device/cl_device_get_cap.inl" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/helpers/surface_formats.h" #include "opencl/source/mem_obj/image.h" #include "opencl/test/unit_test/fixtures/device_fixture.h" @@ -74,12 +74,12 @@ class Nv12ImageTest : public testing::Test { void validateImageWithFlags(cl_mem_flags flags) { auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, nullptr); + retVal = Image::validate(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, nullptr); } Image *createImageWithFlags(cl_mem_flags flags) { auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - return Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + return Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal); } @@ -195,7 +195,7 @@ TEST_F(Nv12ImageTest, given2DImageWhenPassedToValidateImageTraitsThenValidateRet imageDesc.mem_object = image; imageDesc.image_depth = 0; - retVal = Image::validateImageTraits(&context, MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0), &imageFormat, &imageDesc, nullptr); + retVal = Image::validateImageTraits(&context, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0), &imageFormat, &imageDesc, nullptr); EXPECT_EQ(CL_SUCCESS, retVal); delete image; @@ -210,7 +210,7 @@ TEST_F(Nv12ImageTest, given1DImageWhenPassedAsParentImageThenValidateImageTraits imageDesc.mem_object = image; imageDesc.image_depth = 0; - retVal = Image::validateImageTraits(&context, MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0), &imageFormat, &imageDesc, nullptr); + retVal = Image::validateImageTraits(&context, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0), &imageFormat, &imageDesc, nullptr); EXPECT_EQ(CL_SUCCESS, retVal); delete image; @@ -222,7 +222,7 @@ TEST_F(Nv12ImageTest, givenBufferWhenPassedAsNV12ParentImageThenValidateImageTra imageDesc.mem_object = &Buffer; imageDesc.image_depth = 0; // Plane of NV12 image - retVal = Image::validateImageTraits(&context, MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0), &imageFormat, &imageDesc, nullptr); + retVal = Image::validateImageTraits(&context, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0), &imageFormat, &imageDesc, nullptr); EXPECT_EQ(CL_INVALID_IMAGE_DESCRIPTOR, retVal); } @@ -397,7 +397,7 @@ HWTEST_F(Nv12ImageTest, checkIfPlanesAreWritten) { // Create Parent NV12 image cl_mem_flags flags = CL_MEM_READ_ONLY | CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL | CL_MEM_USE_HOST_PTR; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - auto imageNV12 = Image::create(contextWithMockCmdQ, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + auto imageNV12 = Image::create(contextWithMockCmdQ, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, hostPtr, retVal); EXPECT_EQ(imageNV12->isTiledAllocation() ? 2u : 0u, cmdQ->EnqueueWriteImageCounter); @@ -575,7 +575,7 @@ TEST_F(Nv12ImageTest, invalidPlanarYUVImageHeight) { pDevice->getCap(reinterpret_cast(maxHeight), srcSize, retSize); imageDesc.image_height = *maxHeight + 12; - retVal = Image::validatePlanarYUV(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), &imageDesc, nullptr); + retVal = Image::validatePlanarYUV(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), &imageDesc, nullptr); EXPECT_EQ(CL_INVALID_IMAGE_SIZE, retVal); } @@ -592,17 +592,17 @@ TEST_F(Nv12ImageTest, invalidPlanarYUVImageWidth) { pDevice->getCap(reinterpret_cast(maxWidth), srcSize, retSize); imageDesc.image_width = *maxWidth + 12; - retVal = Image::validatePlanarYUV(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), &imageDesc, nullptr); + retVal = Image::validatePlanarYUV(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), &imageDesc, nullptr); EXPECT_EQ(CL_INVALID_IMAGE_SIZE, retVal); } TEST_F(Nv12ImageTest, validPlanarYUVImageHeight) { - retVal = Image::validatePlanarYUV(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), &imageDesc, nullptr); + retVal = Image::validatePlanarYUV(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), &imageDesc, nullptr); EXPECT_EQ(CL_SUCCESS, retVal); } TEST_F(Nv12ImageTest, validPlanarYUVImageWidth) { - retVal = Image::validatePlanarYUV(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), &imageDesc, nullptr); + retVal = Image::validatePlanarYUV(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), &imageDesc, nullptr); EXPECT_EQ(CL_SUCCESS, retVal); } diff --git a/opencl/test/unit_test/mem_obj/packed_yuv_image_tests.cpp b/opencl/test/unit_test/mem_obj/packed_yuv_image_tests.cpp index 33bac088d9..c02fff5189 100644 --- a/opencl/test/unit_test/mem_obj/packed_yuv_image_tests.cpp +++ b/opencl/test/unit_test/mem_obj/packed_yuv_image_tests.cpp @@ -7,7 +7,7 @@ #include "shared/source/helpers/aligned_memory.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/helpers/surface_formats.h" #include "opencl/source/helpers/validators.h" #include "opencl/source/mem_obj/image.h" @@ -55,7 +55,7 @@ class PackedYuvImageTest : public testing::Test, if (retVal != CL_SUCCESS) return; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, nullptr); + retVal = Image::validate(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, nullptr); } cl_int retVal = CL_SUCCESS; @@ -73,7 +73,7 @@ TEST_P(PackedYuvImageTest, isPackedYuvImageReturnsTrue) { auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto image = Image::create( &context, - MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, diff --git a/opencl/test/unit_test/memory_manager/memory_manager_allocate_in_device_pool_tests.inl b/opencl/test/unit_test/memory_manager/memory_manager_allocate_in_device_pool_tests.inl index c98e4b939f..ef0b8d2ac9 100644 --- a/opencl/test/unit_test/memory_manager/memory_manager_allocate_in_device_pool_tests.inl +++ b/opencl/test/unit_test/memory_manager/memory_manager_allocate_in_device_pool_tests.inl @@ -7,7 +7,7 @@ #include "shared/source/execution_environment/execution_environment.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/mem_obj_helper.h" #include "opencl/source/memory_manager/os_agnostic_memory_manager.h" #include "opencl/test/unit_test/mocks/mock_execution_environment.h" @@ -50,37 +50,37 @@ TEST(MemoryManagerTest, givenAllowed32BitAndFroce32BitWhenGraphicsAllocationInDe TEST(AllocationFlagsTest, givenAllocateMemoryFlagWhenGetAllocationFlagsIsCalledThenAllocateFlagIsCorrectlySet) { HardwareInfo hwInfo(*defaultHwInfo); - auto allocationProperties = MemoryPropertiesParserHelper::getAllocationProperties(0, {}, true, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {}); + auto allocationProperties = MemoryPropertiesHelper::getAllocationProperties(0, {}, true, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {}); EXPECT_TRUE(allocationProperties.flags.allocateMemory); - auto allocationProperties2 = MemoryPropertiesParserHelper::getAllocationProperties(0, {}, false, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {}); + auto allocationProperties2 = MemoryPropertiesHelper::getAllocationProperties(0, {}, false, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {}); EXPECT_FALSE(allocationProperties2.flags.allocateMemory); } TEST(UncacheableFlagsTest, givenUncachedResourceFlagWhenGetAllocationFlagsIsCalledThenUncacheableFlagIsCorrectlySet) { cl_mem_flags_intel flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE; HardwareInfo hwInfo(*defaultHwInfo); - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, flagsIntel, 0); - auto allocationFlags = MemoryPropertiesParserHelper::getAllocationProperties(0, memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {}); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(0, flagsIntel, 0); + auto allocationFlags = MemoryPropertiesHelper::getAllocationProperties(0, memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {}); EXPECT_TRUE(allocationFlags.flags.uncacheable); flagsIntel = 0; - memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, flagsIntel, 0); - auto allocationFlags2 = MemoryPropertiesParserHelper::getAllocationProperties(0, memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {}); + memoryProperties = MemoryPropertiesHelper::createMemoryProperties(0, flagsIntel, 0); + auto allocationFlags2 = MemoryPropertiesHelper::getAllocationProperties(0, memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {}); EXPECT_FALSE(allocationFlags2.flags.uncacheable); } TEST(AllocationFlagsTest, givenReadOnlyResourceFlagWhenGetAllocationFlagsIsCalledThenFlushL3FlagsAreCorrectlySet) { cl_mem_flags flags = CL_MEM_READ_ONLY; - MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); + MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0); HardwareInfo hwInfo(*defaultHwInfo); auto allocationFlags = - MemoryPropertiesParserHelper::getAllocationProperties(0, memoryProperties, true, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {}); + MemoryPropertiesHelper::getAllocationProperties(0, memoryProperties, true, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {}); EXPECT_FALSE(allocationFlags.flags.flushL3RequiredForRead); EXPECT_FALSE(allocationFlags.flags.flushL3RequiredForWrite); - auto allocationFlags2 = MemoryPropertiesParserHelper::getAllocationProperties(0, {}, true, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {}); + auto allocationFlags2 = MemoryPropertiesHelper::getAllocationProperties(0, {}, true, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {}); EXPECT_TRUE(allocationFlags2.flags.flushL3RequiredForRead); EXPECT_TRUE(allocationFlags2.flags.flushL3RequiredForWrite); } diff --git a/opencl/test/unit_test/mocks/mock_buffer.h b/opencl/test/unit_test/mocks/mock_buffer.h index be77f45b44..a594750f20 100644 --- a/opencl/test/unit_test/mocks/mock_buffer.h +++ b/opencl/test/unit_test/mocks/mock_buffer.h @@ -9,7 +9,7 @@ #include "shared/source/helpers/aligned_memory.h" #include "shared/test/unit_test/mocks/mock_device.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/buffer.h" #include "opencl/test/unit_test/mocks/mock_context.h" #include "opencl/test/unit_test/mocks/mock_graphics_allocation.h" @@ -36,10 +36,10 @@ class MockBuffer : public MockBufferStorage, public Buffer { using MockBufferStorage::device; MockBuffer(GraphicsAllocation &alloc) - : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, alloc.getUnderlyingBufferSize(), alloc.getUnderlyingBuffer(), alloc.getUnderlyingBuffer(), &alloc, true, false, false), + : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, alloc.getUnderlyingBufferSize(), alloc.getUnderlyingBuffer(), alloc.getUnderlyingBuffer(), &alloc, true, false, false), externalAlloc(&alloc) { } - MockBuffer() : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data, &mockGfxAllocation, true, false, false) { + MockBuffer() : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data, &mockGfxAllocation, true, false, false) { } ~MockBuffer() override { if (externalAlloc != nullptr) { @@ -57,9 +57,9 @@ class MockBuffer : public MockBufferStorage, public Buffer { class AlignedBuffer : public MockBufferStorage, public Buffer { public: using MockBufferStorage::device; - AlignedBuffer() : MockBufferStorage(false), Buffer(nullptr, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64), &mockGfxAllocation, true, false, false) { + AlignedBuffer() : MockBufferStorage(false), Buffer(nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64), &mockGfxAllocation, true, false, false) { } - AlignedBuffer(GraphicsAllocation *gfxAllocation) : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64), gfxAllocation, true, false, false) { + AlignedBuffer(GraphicsAllocation *gfxAllocation) : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64), gfxAllocation, true, false, false) { } void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly) override { Buffer::setSurfaceState(device.get(), memory, getSize(), getCpuAddress(), 0, &mockGfxAllocation, 0, 0); @@ -69,9 +69,9 @@ class AlignedBuffer : public MockBufferStorage, public Buffer { class UnalignedBuffer : public MockBufferStorage, public Buffer { public: using MockBufferStorage::device; - UnalignedBuffer() : MockBufferStorage(true), Buffer(nullptr, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4), &mockGfxAllocation, false, false, false) { + UnalignedBuffer() : MockBufferStorage(true), Buffer(nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4), &mockGfxAllocation, false, false, false) { } - UnalignedBuffer(GraphicsAllocation *gfxAllocation) : MockBufferStorage(true), Buffer(nullptr, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4), gfxAllocation, false, false, false) { + UnalignedBuffer(GraphicsAllocation *gfxAllocation) : MockBufferStorage(true), Buffer(nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4), gfxAllocation, false, false, false) { } void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly) override { Buffer::setSurfaceState(device.get(), memory, getSize(), getCpuAddress(), 0, &mockGfxAllocation, 0, 0); diff --git a/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp b/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp index 849df77a18..ab261164af 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp @@ -20,7 +20,7 @@ #include "shared/test/unit_test/cmd_parse/hw_parse.h" #include "shared/test/unit_test/helpers/debug_manager_state_restore.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/buffer.h" #include "opencl/source/os_interface/linux/drm_command_stream.h" #include "opencl/test/unit_test/fixtures/device_fixture.h" @@ -1346,7 +1346,7 @@ class DrmMockBuffer : public Buffer { delete gfxAllocation; } - DrmMockBuffer(char *data, size_t size, DrmAllocation *alloc) : Buffer(nullptr, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, size, data, data, alloc, true, false, false), + DrmMockBuffer(char *data, size_t size, DrmAllocation *alloc) : Buffer(nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, size, data, data, alloc, true, false, false), data(data), gfxAllocation(alloc) { } diff --git a/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp b/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp index 4960221151..932af127fe 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp @@ -28,7 +28,7 @@ #include "shared/test/unit_test/helpers/ult_hw_config.h" #include "opencl/source/event/event.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/buffer.h" #include "opencl/source/mem_obj/image.h" #include "opencl/source/os_interface/linux/drm_command_stream.h" @@ -1333,7 +1333,7 @@ HWTEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageWithMipCountZe cl_mem_flags flags = CL_MEM_WRITE_ONLY; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, dstImage); @@ -1380,7 +1380,7 @@ HWTEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageWithMipCountNo cl_mem_flags flags = CL_MEM_WRITE_ONLY; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, dstImage); @@ -1420,7 +1420,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageIsBeingCreatedAn InjectedFunction method = [&](size_t failureIndex) { cl_mem_flags flags = CL_MEM_WRITE_ONLY; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); if (MemoryManagement::nonfailingAllocation == failureIndex) { EXPECT_NE(nullptr, dstImage.get()); @@ -1481,7 +1481,7 @@ HWTEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageIsBeingCreated cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, data, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, dstImage); @@ -1526,7 +1526,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenMemoryAllocatedForImageThe cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, data, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, dstImage); @@ -1558,7 +1558,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenNonTiledImgWithMipCountZer cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, data, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, dstImage); @@ -1602,7 +1602,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenNonTiledImgWithMipCountNon cl_mem_flags flags = CL_MEM_WRITE_ONLY; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, data, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, dstImage); @@ -1646,7 +1646,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhen1DarrayImageIsBeingCreated cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, data, retVal)); auto imageGraphicsAllocation = dstImage->getGraphicsAllocation(); ASSERT_NE(nullptr, imageGraphicsAllocation); diff --git a/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp b/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp index ff7fe29c78..19d838eb46 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp @@ -21,7 +21,7 @@ #include "shared/test/unit_test/mocks/mock_device.h" #include "shared/test/unit_test/utilities/base_object_utils.h" -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/buffer.h" #include "opencl/source/mem_obj/image.h" #include "opencl/source/mem_obj/mem_obj_helper.h" @@ -643,7 +643,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageWithMipCount cl_mem_flags flags = CL_MEM_WRITE_ONLY; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, dstImage); @@ -672,7 +672,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageWithMipCountNo cl_mem_flags flags = CL_MEM_WRITE_ONLY; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, dstImage); @@ -708,7 +708,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageIsBeingCreat cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, data, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, dstImage); @@ -737,7 +737,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenNonTiledImgWithMipCountZ cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, data, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, dstImage); @@ -765,7 +765,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenNonTiledImgWithMipCountN cl_mem_flags flags = CL_MEM_WRITE_ONLY; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), + std::unique_ptr dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); ASSERT_NE(nullptr, dstImage); diff --git a/opencl/test/unit_test/sharings/sharing_tests.cpp b/opencl/test/unit_test/sharings/sharing_tests.cpp index 02eb3466b1..fa7f7d378c 100644 --- a/opencl/test/unit_test/sharings/sharing_tests.cpp +++ b/opencl/test/unit_test/sharings/sharing_tests.cpp @@ -5,7 +5,7 @@ * */ -#include "opencl/source/helpers/memory_properties_flags_helpers.h" +#include "opencl/source/helpers/memory_properties_helpers.h" #include "opencl/source/mem_obj/mem_obj.h" #include "opencl/source/sharings/sharing.h" #include "opencl/test/unit_test/mocks/mock_context.h" @@ -37,7 +37,7 @@ TEST(sharingHandler, givenMemObjWhenAcquireIncrementCounterThenReleaseShouldDecr char buffer[64]; MockContext context; MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(buffer, sizeof(buffer)); - std::unique_ptr memObj(new MemObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, + std::unique_ptr memObj(new MemObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(buffer), buffer, buffer, mockAllocation, true, false, false)); struct MockSharingHandler : SharingHandler { @@ -62,7 +62,7 @@ TEST(sharingHandler, givenMemObjWhenAcquireTwoTimesThenReleaseShouldBeCalledTwoT char buffer[64]; MockContext context; MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(buffer, sizeof(buffer)); - std::unique_ptr memObj(new MemObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, + std::unique_ptr memObj(new MemObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(buffer), buffer, buffer, mockAllocation, true, false, false)); struct MockSharingHandler : SharingHandler { @@ -107,7 +107,7 @@ TEST(sharingHandler, givenSharingHandlerWhenAcquiringThenReturnErrorCode) { SharingHandler sharingHandler; MockContext context; MockGraphicsAllocation *graphicsAllocation = new MockGraphicsAllocation(nullptr, 0); - MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, + MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, 1, nullptr, nullptr, graphicsAllocation, true, false, false); auto result = sharingHandler.acquire(&memObj); diff --git a/shared/source/memory_manager/unified_memory_manager.cpp b/shared/source/memory_manager/unified_memory_manager.cpp index 44ca10b11a..670d2b8348 100644 --- a/shared/source/memory_manager/unified_memory_manager.cpp +++ b/shared/source/memory_manager/unified_memory_manager.cpp @@ -205,7 +205,7 @@ void *SVMAllocsManager::createZeroCopySvmAllocation(uint32_t rootDeviceIndex, si GraphicsAllocation::AllocationType::SVM_ZERO_COPY, false, // isMultiStorageAllocation deviceBitfield}; - MemoryPropertiesParserHelper::fillCachePolicyInProperties(properties, false, svmProperties.readOnly, false); + MemoryPropertiesHelper::fillCachePolicyInProperties(properties, false, svmProperties.readOnly, false); GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties); if (!allocation) { return nullptr; @@ -229,7 +229,7 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(uint32_t rootDe false, // isMultiStorageAllocation unifiedMemoryProperties.subdeviceBitfield}; cpuProperties.alignment = 2 * MemoryConstants::megaByte; - MemoryPropertiesParserHelper::fillCachePolicyInProperties(cpuProperties, false, svmProperties.readOnly, false); + MemoryPropertiesHelper::fillCachePolicyInProperties(cpuProperties, false, svmProperties.readOnly, false); GraphicsAllocation *allocationCpu = memoryManager->allocateGraphicsMemoryWithProperties(cpuProperties); if (!allocationCpu) { return nullptr; @@ -247,7 +247,7 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(uint32_t rootDe unifiedMemoryProperties.subdeviceBitfield}; gpuProperties.alignment = 2 * MemoryConstants::megaByte; - MemoryPropertiesParserHelper::fillCachePolicyInProperties(gpuProperties, false, svmProperties.readOnly, false); + MemoryPropertiesHelper::fillCachePolicyInProperties(gpuProperties, false, svmProperties.readOnly, false); GraphicsAllocation *allocationGpu = memoryManager->allocateGraphicsMemoryWithProperties(gpuProperties, svmPtr); if (!allocationGpu) { memoryManager->freeGraphicsMemory(allocationCpu);