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 <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala
2020-05-04 11:04:43 +02:00
committed by sys_ocldev
parent fd65d45744
commit cb8e9656ee
61 changed files with 598 additions and 640 deletions

View File

@@ -34,8 +34,7 @@
#include "opencl/source/execution_environment/cl_execution_environment.h" #include "opencl/source/execution_environment/cl_execution_environment.h"
#include "opencl/source/gtpin/gtpin_notify.h" #include "opencl/source/gtpin/gtpin_notify.h"
#include "opencl/source/helpers/get_info_status_mapper.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_helpers.h"
#include "opencl/source/helpers/memory_properties_flags_helpers.h"
#include "opencl/source/helpers/queue_helpers.h" #include "opencl/source/helpers/queue_helpers.h"
#include "opencl/source/helpers/validators.h" #include "opencl/source/helpers/validators.h"
#include "opencl/source/kernel/kernel.h" #include "opencl/source/kernel/kernel.h"
@@ -661,7 +660,7 @@ cl_mem CL_API_CALL clCreateBuffer(cl_context context,
return nullptr; return nullptr;
} }
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0);
if (isFieldValid(flags, MemObjHelper::validFlagsForBuffer)) { if (isFieldValid(flags, MemObjHelper::validFlagsForBuffer)) {
Buffer::validateInputAndCreateBuffer(*pContext, memoryProperties, flags, 0, size, hostPtr, retVal, buffer); Buffer::validateInputAndCreateBuffer(*pContext, memoryProperties, flags, 0, size, hostPtr, retVal, buffer);
} else { } else {
@@ -701,8 +700,8 @@ cl_mem CL_API_CALL clCreateBufferWithPropertiesINTEL(cl_context context,
cl_mem_flags flags = 0; cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0; cl_mem_flags_intel flagsIntel = 0;
cl_mem_alloc_flags_intel allocflags = 0; cl_mem_alloc_flags_intel allocflags = 0;
if (MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, if (MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::BUFFER, *pContext)) { MemoryPropertiesHelper::ObjType::BUFFER, *pContext)) {
Buffer::validateInputAndCreateBuffer(*pContext, memoryProperties, flags, flagsIntel, size, hostPtr, retVal, buffer); Buffer::validateInputAndCreateBuffer(*pContext, memoryProperties, flags, flagsIntel, size, hostPtr, retVal, buffer);
} else { } else {
retVal = CL_INVALID_VALUE; retVal = CL_INVALID_VALUE;
@@ -845,7 +844,7 @@ cl_mem CL_API_CALL clCreateImage(cl_context context,
retVal = validateObjects(WithCastToInternal(context, &pContext)); retVal = validateObjects(WithCastToInternal(context, &pContext));
if (retVal == CL_SUCCESS) { if (retVal == CL_SUCCESS) {
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0);
if (isFieldValid(flags, MemObjHelper::validFlagsForImage)) { if (isFieldValid(flags, MemObjHelper::validFlagsForImage)) {
image = Image::validateAndCreateImage(pContext, memoryProperties, flags, 0, imageFormat, imageDesc, hostPtr, retVal); image = Image::validateAndCreateImage(pContext, memoryProperties, flags, 0, imageFormat, imageDesc, hostPtr, retVal);
} else { } else {
@@ -888,8 +887,8 @@ cl_mem CL_API_CALL clCreateImageWithPropertiesINTEL(cl_context context,
retVal = validateObjects(WithCastToInternal(context, &pContext)); retVal = validateObjects(WithCastToInternal(context, &pContext));
if (retVal == CL_SUCCESS) { if (retVal == CL_SUCCESS) {
if (MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags, if (MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::IMAGE, *pContext)) { MemoryPropertiesHelper::ObjType::IMAGE, *pContext)) {
image = Image::validateAndCreateImage(pContext, memoryProperties, flags, flagsIntel, imageFormat, imageDesc, hostPtr, retVal); image = Image::validateAndCreateImage(pContext, memoryProperties, flags, flagsIntel, imageFormat, imageDesc, hostPtr, retVal);
} else { } else {
retVal = CL_INVALID_VALUE; retVal = CL_INVALID_VALUE;
@@ -936,7 +935,7 @@ cl_mem CL_API_CALL clCreateImage2D(cl_context context,
retVal = validateObjects(WithCastToInternal(context, &pContext)); retVal = validateObjects(WithCastToInternal(context, &pContext));
if (retVal == CL_SUCCESS) { 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); 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)); retVal = validateObjects(WithCastToInternal(context, &pContext));
if (retVal == CL_SUCCESS) { 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); 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) { if (CL_SUCCESS == retVal) {
surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(memFlags, imageFormat, pContext->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); 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) { if (CL_SUCCESS == retVal) {
retVal = Image::getImageParams(pContext, memFlags, surfaceFormat, imageDesc, imageRowPitch, imageSlicePitch); retVal = Image::getImageParams(pContext, memFlags, surfaceFormat, imageDesc, imageRowPitch, imageSlicePitch);
@@ -3502,9 +3501,9 @@ void *clHostMemAllocINTEL(
cl_mem_flags flags = 0; cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0; cl_mem_flags_intel flagsIntel = 0;
cl_mem_alloc_flags_intel allocflags = 0; cl_mem_alloc_flags_intel allocflags = 0;
if (!MemoryPropertiesParserHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel, if (!MemoryPropertiesHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel,
allocflags, MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::UNKNOWN, allocflags, MemoryPropertiesHelper::ObjType::UNKNOWN,
*neoContext)) { *neoContext)) {
err.set(CL_INVALID_VALUE); err.set(CL_INVALID_VALUE);
return nullptr; return nullptr;
} }
@@ -3540,9 +3539,9 @@ void *clDeviceMemAllocINTEL(
cl_mem_flags flags = 0; cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0; cl_mem_flags_intel flagsIntel = 0;
cl_mem_alloc_flags_intel allocflags = 0; cl_mem_alloc_flags_intel allocflags = 0;
if (!MemoryPropertiesParserHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel, if (!MemoryPropertiesHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel,
allocflags, MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::UNKNOWN, allocflags, MemoryPropertiesHelper::ObjType::UNKNOWN,
*neoContext)) { *neoContext)) {
err.set(CL_INVALID_VALUE); err.set(CL_INVALID_VALUE);
return nullptr; return nullptr;
} }
@@ -3581,9 +3580,9 @@ void *clSharedMemAllocINTEL(
cl_mem_flags flags = 0; cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0; cl_mem_flags_intel flagsIntel = 0;
cl_mem_alloc_flags_intel allocflags = 0; cl_mem_alloc_flags_intel allocflags = 0;
if (!MemoryPropertiesParserHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel, if (!MemoryPropertiesHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel,
allocflags, MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::UNKNOWN, allocflags, MemoryPropertiesHelper::ObjType::UNKNOWN,
*neoContext)) { *neoContext)) {
err.set(CL_INVALID_VALUE); err.set(CL_INVALID_VALUE);
return nullptr; return nullptr;
} }

View File

@@ -29,11 +29,9 @@ set(RUNTIME_SRCS_HELPERS_BASE
${CMAKE_CURRENT_SOURCE_DIR}/hardware_context_controller.cpp ${CMAKE_CURRENT_SOURCE_DIR}/hardware_context_controller.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hardware_context_controller.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware_context_controller.h
${CMAKE_CURRENT_SOURCE_DIR}/helper_options.cpp ${CMAKE_CURRENT_SOURCE_DIR}/helper_options.cpp
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/mem_properties_parser_helper.cpp ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/memory_properties_helpers.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mem_properties_parser_helper.h ${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_helpers.h
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/memory_properties_flags_helpers.cpp ${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_helpers_base.inl
${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_flags_helpers.h
${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_flags_helpers_base.inl
${CMAKE_CURRENT_SOURCE_DIR}/mipmap.cpp ${CMAKE_CURRENT_SOURCE_DIR}/mipmap.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mipmap.h ${CMAKE_CURRENT_SOURCE_DIR}/mipmap.h
${CMAKE_CURRENT_SOURCE_DIR}/per_thread_data.cpp ${CMAKE_CURRENT_SOURCE_DIR}/per_thread_data.cpp

View File

@@ -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

View File

@@ -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

View File

@@ -5,16 +5,17 @@
* *
*/ */
#include "opencl/source/helpers/mem_properties_parser_helper.h" #include "opencl/source/helpers/memory_properties_helpers_base.inl"
#include "opencl/source/helpers/memory_properties_flags_helpers.h"
#include "opencl/source/mem_obj/mem_obj_helper.h" #include "opencl/source/mem_obj/mem_obj_helper.h"
namespace NEO { namespace NEO {
bool MemoryPropertiesParserHelper::parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryProperties &memoryProperties, void MemoryPropertiesHelper::addExtraMemoryProperties(MemoryProperties &properties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel) {
cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel, }
cl_mem_alloc_flags_intel &allocflags, ObjType objectType, Context &context) {
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) { if (properties == nullptr) {
return true; 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) { switch (objectType) {
case MemoryPropertiesParserHelper::ObjType::BUFFER: case MemoryPropertiesHelper::ObjType::BUFFER:
return isFieldValid(flags, MemObjHelper::validFlagsForBuffer) && return isFieldValid(flags, MemObjHelper::validFlagsForBuffer) &&
isFieldValid(flagsIntel, MemObjHelper::validFlagsForBufferIntel); isFieldValid(flagsIntel, MemObjHelper::validFlagsForBufferIntel);
case MemoryPropertiesParserHelper::ObjType::IMAGE: case MemoryPropertiesHelper::ObjType::IMAGE:
return isFieldValid(flags, MemObjHelper::validFlagsForImage) && return isFieldValid(flags, MemObjHelper::validFlagsForImage) &&
isFieldValid(flagsIntel, MemObjHelper::validFlagsForImageIntel); isFieldValid(flagsIntel, MemObjHelper::validFlagsForImageIntel);
default: default:
@@ -50,7 +51,7 @@ bool MemoryPropertiesParserHelper::parseMemoryProperties(const cl_mem_properties
return true; 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, fillCachePolicyInProperties(allocationProperties,
memoryProperties.flags.locallyUncachedResource, memoryProperties.flags.locallyUncachedResource,
memoryProperties.flags.readOnly, memoryProperties.flags.readOnly,

View File

@@ -17,7 +17,7 @@ namespace NEO {
class Context; class Context;
class MemoryPropertiesParserHelper { class MemoryPropertiesHelper {
public: public:
enum class ObjType { enum class ObjType {
UNKNOWN, UNKNOWN,
@@ -25,25 +25,20 @@ class MemoryPropertiesParserHelper {
IMAGE, 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, 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, cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel, cl_mem_alloc_flags_intel &allocflags,
ObjType objectType, Context &context); ObjType objectType, Context &context);
static AllocationProperties getAllocationProperties(uint32_t rootDeviceIndex, MemoryProperties memoryProperties, bool allocateMemory, size_t size, static AllocationProperties getAllocationProperties(uint32_t rootDeviceIndex, MemoryProperties memoryProperties, bool allocateMemory, size_t size,
GraphicsAllocation::AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo, DeviceBitfield subDevicesBitfieldParam) { GraphicsAllocation::AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo, DeviceBitfield subDevicesBitfieldParam);
AllocationProperties allocationProperties(rootDeviceIndex, allocateMemory, size, type, multiStorageResource, subDevicesBitfieldParam);
fillPoliciesInProperties(allocationProperties, memoryProperties, hwInfo);
return allocationProperties;
}
static void fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryProperties &memoryProperties, const HardwareInfo &hwInfo); static void fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryProperties &memoryProperties, const HardwareInfo &hwInfo);
static void fillCachePolicyInProperties(AllocationProperties &allocationProperties, bool uncached, bool readOnly, static void fillCachePolicyInProperties(AllocationProperties &allocationProperties, bool uncached, bool readOnly,
bool deviceOnlyVisibilty) { bool deviceOnlyVisibilty);
allocationProperties.flags.uncacheable = uncached;
auto cacheFlushRequired = !uncached && !readOnly && !deviceOnlyVisibilty;
allocationProperties.flags.flushL3RequiredForRead = cacheFlushRequired;
allocationProperties.flags.flushL3RequiredForWrite = cacheFlushRequired;
}
}; };
} // namespace NEO } // namespace NEO

View File

@@ -8,13 +8,13 @@
#include "shared/source/helpers/bit_helpers.h" #include "shared/source/helpers/bit_helpers.h"
#include "opencl/extensions/public/cl_ext_private.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" #include "CL/cl_ext_intel.h"
namespace NEO { 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; MemoryProperties memoryProperties;
if (isValueSet(flags, CL_MEM_READ_WRITE)) { if (isValueSet(flags, CL_MEM_READ_WRITE)) {
@@ -86,4 +86,19 @@ MemoryProperties MemoryPropertiesParser::createMemoryProperties(cl_mem_flags fla
return memoryProperties; 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 } // namespace NEO

View File

@@ -26,7 +26,7 @@
#include "opencl/source/cl_device/cl_device.h" #include "opencl/source/cl_device/cl_device.h"
#include "opencl/source/command_queue/command_queue.h" #include "opencl/source/command_queue/command_queue.h"
#include "opencl/source/context/context.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/helpers/validators.h"
#include "opencl/source/mem_obj/mem_obj_helper.h" #include "opencl/source/mem_obj/mem_obj_helper.h"
@@ -124,7 +124,7 @@ Buffer *Buffer::create(Context *context,
size_t size, size_t size,
void *hostPtr, void *hostPtr,
cl_int &errcodeRet) { 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, Buffer *Buffer::create(Context *context,
@@ -223,9 +223,9 @@ Buffer *Buffer::create(Context *context,
} }
if (!memory) { if (!memory) {
AllocationProperties allocProperties = MemoryPropertiesParserHelper::getAllocationProperties(rootDeviceIndex, memoryProperties, AllocationProperties allocProperties = MemoryPropertiesHelper::getAllocationProperties(rootDeviceIndex, memoryProperties,
allocateMemory, size, allocationType, context->areMultiStorageAllocationsPreferred(), allocateMemory, size, allocationType, context->areMultiStorageAllocationsPreferred(),
context->getDevice(0)->getHardwareInfo(), context->getDeviceBitfieldForAllocation()); context->getDevice(0)->getHardwareInfo(), context->getDeviceBitfieldForAllocation());
memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties, hostPtr); memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties, hostPtr);
} }
@@ -238,10 +238,10 @@ Buffer *Buffer::create(Context *context,
allocationType = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY; allocationType = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
zeroCopyAllowed = false; zeroCopyAllowed = false;
copyMemoryFromHostPtr = true; copyMemoryFromHostPtr = true;
AllocationProperties allocProperties = MemoryPropertiesParserHelper::getAllocationProperties(rootDeviceIndex, memoryProperties, AllocationProperties allocProperties = MemoryPropertiesHelper::getAllocationProperties(rootDeviceIndex, memoryProperties,
true, // allocateMemory true, // allocateMemory
size, allocationType, context->areMultiStorageAllocationsPreferred(), size, allocationType, context->areMultiStorageAllocationsPreferred(),
context->getDevice(0)->getHardwareInfo(), context->getDeviceBitfieldForAllocation()); context->getDevice(0)->getHardwareInfo(), context->getDeviceBitfieldForAllocation());
memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties); memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties);
} }
@@ -337,7 +337,7 @@ Buffer *Buffer::create(Context *context,
Buffer *Buffer::createSharedBuffer(Context *context, cl_mem_flags flags, SharingHandler *sharingHandler, Buffer *Buffer::createSharedBuffer(Context *context, cl_mem_flags flags, SharingHandler *sharingHandler,
GraphicsAllocation *graphicsAllocation) { 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); sharedBuffer->setSharingHandler(sharingHandler);
return sharedBuffer; return sharedBuffer;
@@ -422,7 +422,7 @@ Buffer *Buffer::createSubBuffer(cl_mem_flags flags,
const cl_buffer_region *region, const cl_buffer_region *region,
cl_int &errcodeRet) { cl_int &errcodeRet) {
DEBUG_BREAK_IF(nullptr == createFunction); 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, auto buffer = createFunction(this->context, memoryProperties, flags, 0, region->size,
ptrOffset(this->memoryStorage, region->origin), ptrOffset(this->memoryStorage, region->origin),
this->hostPtr ? ptrOffset(this->hostPtr, region->origin) : nullptr, 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; auto funcCreate = bufferFactory[hwInfo.platform.eRenderCoreFamily].createBufferFunction;
DEBUG_BREAK_IF(nullptr == funcCreate); 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, auto pBuffer = funcCreate(nullptr, memoryProperties, flags, flagsIntel, size, memoryStorage, hostPtr, gfxAllocation,
zeroCopy, isHostPtrSVM, isImageRedescribed); zeroCopy, isHostPtrSVM, isImageRedescribed);
pBuffer->offset = offset; pBuffer->offset = offset;

View File

@@ -26,7 +26,7 @@
#include "opencl/source/context/context.h" #include "opencl/source/context/context.h"
#include "opencl/source/helpers/get_info_status_mapper.h" #include "opencl/source/helpers/get_info_status_mapper.h"
#include "opencl/source/helpers/gmm_types_converter.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/mipmap.h"
#include "opencl/source/helpers/surface_formats.h" #include "opencl/source/helpers/surface_formats.h"
#include "opencl/source/mem_obj/buffer.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, Image *Image::createSharedImage(Context *context, SharingHandler *sharingHandler, const McsSurfaceInfo &mcsSurfaceInfo,
GraphicsAllocation *graphicsAllocation, GraphicsAllocation *mcsAllocation, 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) { 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); nullptr, surfaceFormat->OCLImageFormat, Image::convertDescriptor(imgInfo.imgDesc), false, graphicsAllocation, false, baseMipLevel, mipCount, surfaceFormat);
sharedImage->setSharingHandler(sharingHandler); sharedImage->setSharingHandler(sharingHandler);
sharedImage->setMcsAllocation(mcsAllocation); sharedImage->setMcsAllocation(mcsAllocation);
@@ -917,7 +917,7 @@ Image *Image::redescribeFillImage() {
imageFormatNew.image_channel_data_type = surfaceFormat->OCLImageFormat.image_channel_data_type; imageFormatNew.image_channel_data_type = surfaceFormat->OCLImageFormat.image_channel_data_type;
DEBUG_BREAK_IF(nullptr == createFunction); 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, auto image = createFunction(context,
memoryProperties, memoryProperties,
flags | CL_MEM_USE_HOST_PTR, flags | CL_MEM_USE_HOST_PTR,
@@ -973,7 +973,7 @@ Image *Image::redescribe() {
imageFormatNew.image_channel_data_type = surfaceFormat->OCLImageFormat.image_channel_data_type; imageFormatNew.image_channel_data_type = surfaceFormat->OCLImageFormat.image_channel_data_type;
DEBUG_BREAK_IF(nullptr == createFunction); 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, auto image = createFunction(context,
memoryProperties, memoryProperties,
flags | CL_MEM_USE_HOST_PTR, 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 // Create NV12 UV Plane image
std::unique_ptr<Image> imageYPlane(Image::create( std::unique_ptr<Image> imageYPlane(Image::create(
context, context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -1059,7 +1059,7 @@ cl_int Image::writeNV12Planes(const void *hostPtr, size_t hostPtrRowPitch) {
// Create NV12 UV Plane image // Create NV12 UV Plane image
std::unique_ptr<Image> imageUVPlane(Image::create( std::unique_ptr<Image> imageUVPlane(Image::create(
context, context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,

View File

@@ -11,7 +11,7 @@
#include "shared/source/memory_manager/unified_memory_manager.h" #include "shared/source/memory_manager/unified_memory_manager.h"
#include "opencl/extensions/public/cl_ext_private.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 "opencl/source/mem_obj/mem_obj.h"
#include "CL/cl.h" #include "CL/cl.h"

View File

@@ -72,7 +72,7 @@ bool MemObjHelper::validateMemoryPropertiesForImage(const MemoryProperties &memo
AllocationProperties MemObjHelper::getAllocationPropertiesWithImageInfo(uint32_t rootDeviceIndex, ImageInfo &imgInfo, bool allocateMemory, AllocationProperties MemObjHelper::getAllocationPropertiesWithImageInfo(uint32_t rootDeviceIndex, ImageInfo &imgInfo, bool allocateMemory,
const MemoryProperties &memoryProperties, const HardwareInfo &hwInfo, DeviceBitfield subDevicesBitfieldParam) { const MemoryProperties &memoryProperties, const HardwareInfo &hwInfo, DeviceBitfield subDevicesBitfieldParam) {
AllocationProperties allocationProperties{rootDeviceIndex, allocateMemory, imgInfo, GraphicsAllocation::AllocationType::IMAGE, subDevicesBitfieldParam}; AllocationProperties allocationProperties{rootDeviceIndex, allocateMemory, imgInfo, GraphicsAllocation::AllocationType::IMAGE, subDevicesBitfieldParam};
MemoryPropertiesParserHelper::fillPoliciesInProperties(allocationProperties, memoryProperties, hwInfo); MemoryPropertiesHelper::fillPoliciesInProperties(allocationProperties, memoryProperties, hwInfo);
return allocationProperties; return allocationProperties;
} }

View File

@@ -13,7 +13,7 @@
#include "opencl/source/cl_device/cl_device.h" #include "opencl/source/cl_device/cl_device.h"
#include "opencl/source/context/context.h" #include "opencl/source/context/context.h"
#include "opencl/source/helpers/get_info_status_mapper.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" #include "opencl/source/mem_obj/mem_obj_helper.h"
namespace NEO { namespace NEO {
@@ -27,7 +27,7 @@ Pipe::Pipe(Context *context,
GraphicsAllocation *gfxAllocation) GraphicsAllocation *gfxAllocation)
: MemObj(context, : MemObj(context,
CL_MEM_OBJECT_PIPE, CL_MEM_OBJECT_PIPE,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace), static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace),
@@ -54,16 +54,16 @@ Pipe *Pipe::create(Context *context,
MemoryManager *memoryManager = context->getMemoryManager(); MemoryManager *memoryManager = context->getMemoryManager();
DEBUG_BREAK_IF(!memoryManager); DEBUG_BREAK_IF(!memoryManager);
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0); MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0);
while (true) { while (true) {
auto size = static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace); auto size = static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace);
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex(); auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
AllocationProperties allocProperties = AllocationProperties allocProperties =
MemoryPropertiesParserHelper::getAllocationProperties(rootDeviceIndex, memoryProperties, MemoryPropertiesHelper::getAllocationProperties(rootDeviceIndex, memoryProperties,
true, // allocateMemory true, // allocateMemory
size, GraphicsAllocation::AllocationType::PIPE, size, GraphicsAllocation::AllocationType::PIPE,
false, // isMultiStorageAllocation false, // isMultiStorageAllocation
context->getDevice(0)->getHardwareInfo(), context->getDeviceBitfieldForAllocation()); context->getDevice(0)->getHardwareInfo(), context->getDeviceBitfieldForAllocation());
GraphicsAllocation *memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties); GraphicsAllocation *memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties);
if (!memory) { if (!memory) {
errcodeRet = CL_OUT_OF_HOST_MEMORY; errcodeRet = CL_OUT_OF_HOST_MEMORY;

View File

@@ -14,7 +14,7 @@
#include "opencl/source/cl_device/cl_device.h" #include "opencl/source/cl_device/cl_device.h"
#include "opencl/source/context/context.h" #include "opencl/source/context/context.h"
#include "opencl/source/helpers/gmm_types_converter.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/image.h"
#include "opencl/source/mem_obj/mem_obj_helper.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.imageWidth /= 2;
imgInfo.imgDesc.imageHeight /= 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, AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(rootDeviceIndex, imgInfo,
true, // allocateMemory true, // allocateMemory
memoryProperties, context->getDevice(0)->getHardwareInfo(), memoryProperties, context->getDevice(0)->getHardwareInfo(),

View File

@@ -87,7 +87,7 @@ HWTEST_P(AUBCopyImage, simple) {
auto retVal = CL_INVALID_VALUE; auto retVal = CL_INVALID_VALUE;
srcImage.reset(Image::create( srcImage.reset(Image::create(
context.get(), context.get(),
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -98,7 +98,7 @@ HWTEST_P(AUBCopyImage, simple) {
dstImage.reset(Image::create( dstImage.reset(Image::create(
context.get(), context.get(),
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,

View File

@@ -185,7 +185,7 @@ HWTEST_P(AubFillImage, simple) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
image.reset(Image::create( image.reset(Image::create(
context.get(), context.get(),
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,

View File

@@ -995,7 +995,7 @@ HWTEST2_F(AUBBindlessKernel, DISABLED_givenBindlessCopyImageKernelWhenEnqueuedTh
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, device->getHardwareInfo().capabilityTable.clVersionSupport); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, device->getHardwareInfo().capabilityTable.clVersionSupport);
auto image = std::unique_ptr<Image>(Image::create( auto image = std::unique_ptr<Image>(Image::create(
contextCl, contextCl,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,

View File

@@ -127,7 +127,7 @@ HWTEST_P(AUBMapImage, MapUpdateUnmapVerify) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, pClDevice->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, pClDevice->getHardwareInfo().capabilityTable.supportsOcl21Features);
srcImage.reset(Image::create( srcImage.reset(Image::create(
context.get(), context.get(),
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,

View File

@@ -124,7 +124,7 @@ HWTEST_F(AUBReadBuffer, reserveCanonicalGpuAddress) {
MemoryPool::MemoryNull); MemoryPool::MemoryNull);
std::unique_ptr<Buffer> srcBuffer(Buffer::createBufferHw(&context, std::unique_ptr<Buffer> 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, CL_MEM_USE_HOST_PTR,
0, 0,
sizeof(srcMemory), sizeof(srcMemory),

View File

@@ -145,7 +145,7 @@ HWTEST_P(AUBReadImage, simpleUnalignedMemory) {
auto retVal = CL_INVALID_VALUE; auto retVal = CL_INVALID_VALUE;
srcImage.reset(Image::create( srcImage.reset(Image::create(
context.get(), context.get(),
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,

View File

@@ -82,7 +82,7 @@ struct AUBImageUnaligned
auto image = std::unique_ptr<Image>(Image::create( auto image = std::unique_ptr<Image>(Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -177,7 +177,7 @@ struct AUBImageUnaligned
auto image = std::unique_ptr<Image>(Image::create( auto image = std::unique_ptr<Image>(Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,

View File

@@ -74,7 +74,7 @@ HWTEST_P(VerifyMemoryImageHw, givenDifferentImagesWhenValidatingMemoryThenSucces
auto retVal = CL_INVALID_VALUE; auto retVal = CL_INVALID_VALUE;
std::unique_ptr<Image> image(Image::create( std::unique_ptr<Image> image(Image::create(
context, context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,

View File

@@ -139,7 +139,7 @@ HWTEST_P(AUBWriteImage, simpleUnalignedMemory) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
dstImage.reset(Image::create( dstImage.reset(Image::create(
context.get(), context.get(),
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,

View File

@@ -332,7 +332,7 @@ SKLTEST_F(AUBRunKernelIntegrateTest, deviceSideVme) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto srcImage = Image::create( auto srcImage = Image::create(
context, context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -343,7 +343,7 @@ SKLTEST_F(AUBRunKernelIntegrateTest, deviceSideVme) {
auto refImage = Image::create( auto refImage = Image::create(
context, context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,

View File

@@ -112,7 +112,7 @@ HWTEST_P(AUBCreateImageArray, CheckArrayImages) {
image.reset(Image::create( image.reset(Image::create(
context, context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -242,7 +242,7 @@ HWTEST_P(CopyHostPtrTest, imageWithDoubledRowPitchThatIsCreatedWithCopyHostPtrFl
data += passedRowPitch; 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)); flags, 0, surfaceFormat, &imageDesc, pHostPtr, retVal));
ASSERT_EQ(CL_SUCCESS, retVal); ASSERT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(image->getImageDesc().image_row_pitch, imgInfo.rowPitch); EXPECT_EQ(image->getImageDesc().image_row_pitch, imgInfo.rowPitch);
@@ -312,7 +312,7 @@ HWTEST_P(UseHostPtrTest, imageWithRowPitchCreatedWithUseHostPtrFlagCopiedActuall
} }
image.reset(Image::create( image.reset(Image::create(
context, context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -408,7 +408,7 @@ HWTEST_F(AUBCreateImage, image3DCreatedWithDoubledSlicePitchWhenQueriedForDataRe
} }
cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR; 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); 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)); flags, 0, surfaceFormat, &imageDesc, host_ptr, retVal));
depthToCopy = imageDesc.image_depth; depthToCopy = imageDesc.image_depth;

View File

@@ -10,7 +10,7 @@
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h" #include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
#include "opencl/source/event/user_event.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_enqueue_fixture.h"
#include "opencl/test/unit_test/command_queue/command_queue_fixture.h" #include "opencl/test/unit_test/command_queue/command_queue_fixture.h"
#include "opencl/test/unit_test/fixtures/device_fixture.h" #include "opencl/test/unit_test/fixtures/device_fixture.h"
@@ -922,7 +922,7 @@ TEST_F(EnqueueMapImageTest, givenImage1DArrayWhenEnqueueMapImageIsCalledThenRetu
class MockImage : public Image { class MockImage : public Image {
public: public:
MockImage(Context *context, cl_mem_flags flags, GraphicsAllocation *allocation, const ClSurfaceFormatInfo &surfaceFormat, 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, 0, nullptr,
imageFormat, imageDesc, imageFormat, imageDesc,
true, true,

View File

@@ -9,7 +9,7 @@
#include "shared/source/helpers/aligned_memory.h" #include "shared/source/helpers/aligned_memory.h"
#include "opencl/source/command_queue/command_queue_hw.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/kernel/kernel.h"
#include "opencl/source/mem_obj/buffer.h" #include "opencl/source/mem_obj/buffer.h"
#include "opencl/source/mem_obj/image.h" #include "opencl/source/mem_obj/image.h"
@@ -217,7 +217,7 @@ HWTEST_F(EnqueueThreading, enqueueCopyBufferToImage) {
cl_mem_flags flags = CL_MEM_WRITE_ONLY; cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> dstImage(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); std::unique_ptr<Image> dstImage(Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, dstImage.get()); ASSERT_NE(nullptr, dstImage.get());
size_t dstOrigin[3] = {1024u, 1, 0}; size_t dstOrigin[3] = {1024u, 1, 0};
@@ -241,9 +241,9 @@ HWTEST_F(EnqueueThreading, enqueueCopyImage) {
imageDesc.image_width = 1024u; imageDesc.image_width = 1024u;
cl_mem_flags flags = CL_MEM_WRITE_ONLY; cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> srcImage(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); std::unique_ptr<Image> srcImage(Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, srcImage.get()); ASSERT_NE(nullptr, srcImage.get());
std::unique_ptr<Image> dstImage(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); std::unique_ptr<Image> dstImage(Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, srcImage.get()); ASSERT_NE(nullptr, srcImage.get());
size_t srcOrigin[3] = {1024u, 1, 0}; size_t srcOrigin[3] = {1024u, 1, 0};
@@ -269,7 +269,7 @@ HWTEST_F(EnqueueThreading, enqueueCopyImageToBuffer) {
cl_mem_flags flags = CL_MEM_WRITE_ONLY; cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> srcImage(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); std::unique_ptr<Image> srcImage(Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, srcImage.get()); ASSERT_NE(nullptr, srcImage.get());
std::unique_ptr<Buffer> dstBuffer(Buffer::create(context, CL_MEM_READ_WRITE, 1024u, nullptr, retVal)); std::unique_ptr<Buffer> 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; cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> image(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); std::unique_ptr<Image> image(Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, image.get()); ASSERT_NE(nullptr, image.get());
size_t origin[3] = {1024u, 1, 0}; size_t origin[3] = {1024u, 1, 0};
@@ -354,7 +354,7 @@ HWTEST_F(EnqueueThreading, enqueueReadImage) {
cl_mem_flags flags = CL_MEM_WRITE_ONLY; cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> image(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); std::unique_ptr<Image> image(Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, image.get()); ASSERT_NE(nullptr, image.get());
void *ptr = ::alignedMalloc(1024u, 4096); void *ptr = ::alignedMalloc(1024u, 4096);
@@ -404,7 +404,7 @@ HWTEST_F(EnqueueThreading, enqueueWriteImage) {
cl_mem_flags flags = CL_MEM_READ_ONLY; cl_mem_flags flags = CL_MEM_READ_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> image(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); std::unique_ptr<Image> image(Image::create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, image.get()); ASSERT_NE(nullptr, image.get());
void *ptr = ::alignedMalloc(1024u, 4096); void *ptr = ::alignedMalloc(1024u, 4096);

View File

@@ -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); auto surfaceFormat = Image::getSurfaceFormatFromTable(Traits::flags, &Traits::imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
cl_int retVal = CL_SUCCESS; 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<MockImage<FamilyType> *>(img); auto mockImage = static_cast<MockImage<FamilyType> *>(img);
return std::unique_ptr<MockImage<FamilyType>>(mockImage); return std::unique_ptr<MockImage<FamilyType>>(mockImage);

View File

@@ -9,7 +9,7 @@
#include "shared/test/unit_test/helpers/debug_manager_state_restore.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/mem_obj_helper.h" #include "opencl/source/mem_obj/mem_obj_helper.h"
#include "opencl/test/unit_test/mocks/mock_gmm.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}; cl_context_properties validProperties[3] = {CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL, CL_CONTEXT_DIAGNOSTICS_LEVEL_ALL_INTEL, 0};
auto context = std::unique_ptr<MockContext>(Context::create<NEO::MockContext>(validProperties, ClDeviceVector(&deviceId, 1), callbackFunction, static_cast<void *>(userData), retVal)); auto context = std::unique_ptr<MockContext>(Context::create<NEO::MockContext>(validProperties, ClDeviceVector(&deviceId, 1), callbackFunction, static_cast<void *>(userData), retVal));
context->isSharedContext = false; context->isSharedContext = false;
auto buffer = std::unique_ptr<Buffer>(Buffer::create(context.get(), MemoryPropertiesParser::createMemoryProperties((1 << 21), 0, 0), (1 << 21), 0, size, static_cast<void *>(NULL), retVal)); auto buffer = std::unique_ptr<Buffer>(Buffer::create(context.get(), MemoryPropertiesHelper::createMemoryProperties((1 << 21), 0, 0), (1 << 21), 0, size, static_cast<void *>(NULL), retVal));
snprintf(expectedHint, DriverDiagnostics::maxHintStringSize, DriverDiagnostics::hintFormat[BUFFER_IS_COMPRESSED], buffer.get()); snprintf(expectedHint, DriverDiagnostics::maxHintStringSize, DriverDiagnostics::hintFormat[BUFFER_IS_COMPRESSED], buffer.get());
auto compressionSupported = HwHelper::get(hwInfo.platform.eRenderCoreFamily).obtainRenderBufferCompressionPreference(hwInfo, size) && auto compressionSupported = HwHelper::get(hwInfo.platform.eRenderCoreFamily).obtainRenderBufferCompressionPreference(hwInfo, size) &&
HwHelper::renderCompressedBuffersSupported(hwInfo); HwHelper::renderCompressedBuffersSupported(hwInfo);
@@ -491,7 +491,7 @@ TEST_F(PerformanceHintTest, givenUncompressedBufferWhenItsCreatedThenProperPerfo
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo)); auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
cl_device_id deviceId = device.get(); 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; size_t size = 0u;
@@ -563,7 +563,7 @@ TEST_F(PerformanceHintTest, givenCompressedImageWhenItsCreatedThenProperPerforma
auto image = std::unique_ptr<Image>(Image::create( auto image = std::unique_ptr<Image>(Image::create(
context.get(), context.get(),
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -622,7 +622,7 @@ TEST_F(PerformanceHintTest, givenImageWithNoGmmWhenItsCreatedThenNoPerformanceHi
auto image = std::unique_ptr<Image>(Image::create( auto image = std::unique_ptr<Image>(Image::create(
context.get(), context.get(),
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -683,7 +683,7 @@ TEST_F(PerformanceHintTest, givenUncompressedImageWhenItsCreatedThenProperPerfor
auto image = std::unique_ptr<Image>(Image::create( auto image = std::unique_ptr<Image>(Image::create(
context.get(), context.get(),
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,

View File

@@ -10,7 +10,7 @@
#include "shared/source/helpers/hw_info.h" #include "shared/source/helpers/hw_info.h"
#include "shared/test/unit_test/helpers/default_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/mem_obj/image.h"
#include "opencl/source/platform/platform.h" #include "opencl/source/platform/platform.h"
#include "opencl/test/unit_test/fixtures/device_fixture.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 surfaceFormat = Image::getSurfaceFormatFromTable(Traits::flags, imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto image = Image::create( auto image = Image::create(
context, context,
NEO::MemoryPropertiesParser::createMemoryProperties(Traits::flags, 0, 0), NEO::MemoryPropertiesHelper::createMemoryProperties(Traits::flags, 0, 0),
Traits::flags, Traits::flags,
0, 0,
surfaceFormat, surfaceFormat,

View File

@@ -38,7 +38,7 @@ struct AppendSurfaceStateParamsTest : public ::testing::Test {
void createImage() { void createImage() {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
EXPECT_NE(nullptr, surfaceFormat); 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; cl_int retVal = CL_SUCCESS;

View File

@@ -32,9 +32,8 @@ set(IGDRCL_SRCS_tests_helpers
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests.h ${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests.h
${CMAKE_CURRENT_SOURCE_DIR}/kernel_filename_helper.h ${CMAKE_CURRENT_SOURCE_DIR}/kernel_filename_helper.h
${CMAKE_CURRENT_SOURCE_DIR}/kmd_notify_tests.cpp ${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_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}/mipmap_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/per_thread_data_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/per_thread_data_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ptr_math_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ptr_math_tests.cpp

View File

@@ -288,7 +288,7 @@ TEST(CastToImage, WhenCastingFromMemObjThenBehavesAsExpected) {
extern std::thread::id tempThreadID; extern std::thread::id tempThreadID;
class MockBuffer : public MockBufferStorage, public Buffer { class MockBuffer : public MockBufferStorage, public Buffer {
public: 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 { void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly) override {

View File

@@ -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);
}
}
}
}
}

View File

@@ -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);
}

View File

@@ -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);
}
}
}
}
}

View File

@@ -9,7 +9,7 @@
#include "shared/source/helpers/ptr_math.h" #include "shared/source/helpers/ptr_math.h"
#include "shared/test/unit_test/helpers/debug_manager_state_restore.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/source/kernel/kernel.h"
#include "opencl/test/unit_test/fixtures/kernel_arg_fixture.h" #include "opencl/test/unit_test/fixtures/kernel_arg_fixture.h"
#include "opencl/test/unit_test/mocks/mock_allocation_properties.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_width = 5;
imgDesc.image_height = 5; imgDesc.image_height = 5;
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal)); std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
pKernelInfo->kernelArgInfo[0].metadata.accessQualifier = NEO::KernelArgMetadata::AccessReadOnly; pKernelInfo->kernelArgInfo[0].metadata.accessQualifier = NEO::KernelArgMetadata::AccessReadOnly;
cl_mem memObj = img.get(); cl_mem memObj = img.get();
retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj); retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj);
@@ -160,7 +160,7 @@ TEST_F(KernelImageArgTest, givenImageWithReadOnlyAccessAndWriteOnlyArgWhenCheckC
imgDesc.image_width = 5; imgDesc.image_width = 5;
imgDesc.image_height = 5; imgDesc.image_height = 5;
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal)); std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
pKernelInfo->kernelArgInfo[0].metadata.accessQualifier = NEO::KernelArgMetadata::AccessWriteOnly; pKernelInfo->kernelArgInfo[0].metadata.accessQualifier = NEO::KernelArgMetadata::AccessWriteOnly;
cl_mem memObj = img.get(); cl_mem memObj = img.get();
retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj); retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj);
@@ -180,7 +180,7 @@ TEST_F(KernelImageArgTest, givenImageWithReadOnlyAccessAndReadOnlyArgWhenCheckCo
imgDesc.image_width = 5; imgDesc.image_width = 5;
imgDesc.image_height = 5; imgDesc.image_height = 5;
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal)); std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
pKernelInfo->kernelArgInfo[0].metadata.accessQualifier = NEO::KernelArgMetadata::AccessReadOnly; pKernelInfo->kernelArgInfo[0].metadata.accessQualifier = NEO::KernelArgMetadata::AccessReadOnly;
cl_mem memObj = img.get(); cl_mem memObj = img.get();
retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj); retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj);
@@ -196,7 +196,7 @@ TEST_F(KernelImageArgTest, givenImageWithWriteOnlyAccessAndWriteOnlyArgWhenCheck
imgDesc.image_width = 5; imgDesc.image_width = 5;
imgDesc.image_height = 5; imgDesc.image_height = 5;
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal)); std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
pKernelInfo->kernelArgInfo[0].metadata.accessQualifier = NEO::KernelArgMetadata::AccessWriteOnly; pKernelInfo->kernelArgInfo[0].metadata.accessQualifier = NEO::KernelArgMetadata::AccessWriteOnly;
cl_mem memObj = img.get(); cl_mem memObj = img.get();
retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj); retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj);
@@ -241,7 +241,7 @@ TEST_F(KernelImageArgTest, givenKernelWithSettedArgWhenUnSetCalledThenArgIsUnset
imgDesc.image_width = 5; imgDesc.image_width = 5;
imgDesc.image_height = 5; imgDesc.image_height = 5;
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal)); std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
cl_mem memObj = img.get(); cl_mem memObj = img.get();
retVal = pKernel->setArg(0, sizeof(memObj), &memObj); retVal = pKernel->setArg(0, sizeof(memObj), &memObj);
@@ -278,7 +278,7 @@ TEST_F(KernelImageArgTest, givenKernelWithSharedImageWhenSetArgCalledThenUsingSh
imgDesc.image_width = 5; imgDesc.image_width = 5;
imgDesc.image_height = 5; imgDesc.image_height = 5;
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal)); std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
cl_mem memObj = img.get(); cl_mem memObj = img.get();
MockSharingHandler *mockSharingHandler = new MockSharingHandler; MockSharingHandler *mockSharingHandler = new MockSharingHandler;

View File

@@ -18,7 +18,7 @@
#include "shared/test/unit_test/utilities/base_object_utils.h" #include "shared/test/unit_test/utilities/base_object_utils.h"
#include "opencl/source/built_ins/builtins_dispatch_builder.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/helpers/surface_formats.h"
#include "opencl/source/kernel/kernel.h" #include "opencl/source/kernel/kernel.h"
#include "opencl/source/mem_obj/image.h" #include "opencl/source/mem_obj/image.h"
@@ -2089,7 +2089,7 @@ HWTEST_F(KernelResidencyTest, WhenMakingArgsResidentThenImageFromImageCheckIsCor
cl_int retVal; cl_int retVal;
MockContext context; MockContext context;
std::unique_ptr<NEO::Image> imageNV12(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), std::unique_ptr<NEO::Image> imageNV12(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
EXPECT_EQ(imageNV12->getMediaPlaneType(), 0u); EXPECT_EQ(imageNV12->getMediaPlaneType(), 0u);
@@ -2103,7 +2103,7 @@ HWTEST_F(KernelResidencyTest, WhenMakingArgsResidentThenImageFromImageCheckIsCor
imageDesc.image_depth = 0; imageDesc.image_depth = 0;
imageDesc.mem_object = imageNV12.get(); imageDesc.mem_object = imageNV12.get();
std::unique_ptr<NEO::Image> imageY(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), std::unique_ptr<NEO::Image> imageY(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
EXPECT_EQ(imageY->getMediaPlaneType(), 0u); EXPECT_EQ(imageY->getMediaPlaneType(), 0u);

View File

@@ -25,7 +25,7 @@
#include "opencl/source/command_queue/command_queue_hw.h" #include "opencl/source/command_queue/command_queue_hw.h"
#include "opencl/source/command_queue/gpgpu_walker.h" #include "opencl/source/command_queue/gpgpu_walker.h"
#include "opencl/source/event/user_event.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/mem_obj/buffer.h"
#include "opencl/source/platform/platform.h" #include "opencl/source/platform/platform.h"
#include "opencl/test/unit_test/fixtures/device_fixture.h" #include "opencl/test/unit_test/fixtures/device_fixture.h"
@@ -88,11 +88,11 @@ TEST(Buffer, givenReadOnlySetOfInputFlagsWhenPassedToisReadOnlyMemoryPermittedBy
using Buffer::isReadOnlyMemoryPermittedByFlags; using Buffer::isReadOnlyMemoryPermittedByFlags;
}; };
cl_mem_flags flags = CL_MEM_HOST_NO_ACCESS | CL_MEM_READ_ONLY; 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)); EXPECT_TRUE(MockBuffer::isReadOnlyMemoryPermittedByFlags(memoryProperties));
flags = CL_MEM_HOST_READ_ONLY | CL_MEM_READ_ONLY; 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)); EXPECT_TRUE(MockBuffer::isReadOnlyMemoryPermittedByFlags(memoryProperties));
} }
@@ -106,7 +106,7 @@ TEST_P(BufferReadOnlyTest, givenNonReadOnlySetOfInputFlagsWhenPassedToisReadOnly
}; };
cl_mem_flags flags = GetParam() | CL_MEM_USE_HOST_PTR; 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)); EXPECT_FALSE(MockBuffer::isReadOnlyMemoryPermittedByFlags(memoryProperties));
} }
static cl_mem_flags nonReadOnlyFlags[] = { static cl_mem_flags nonReadOnlyFlags[] = {
@@ -334,7 +334,7 @@ TEST(Buffer, givenAllocHostPtrFlagPassedToBufferCreateWhenNoSharedContextOrRende
} }
TEST(Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturnedIn64Bit) { TEST(Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturnedIn64Bit) {
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, 0, 0); MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(0, 0, 0);
MockContext context; MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false; context.isSharedContext = false;
@@ -343,7 +343,7 @@ TEST(Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenB
} }
TEST(Buffer, givenRenderCompressedBuffersDisabledLocalMemoryEnabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturnedIn64Bit) { TEST(Buffer, givenRenderCompressedBuffersDisabledLocalMemoryEnabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturnedIn64Bit) {
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, 0, 0); MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(0, 0, 0);
MockContext context; MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false; context.isSharedContext = false;
@@ -352,7 +352,7 @@ TEST(Buffer, givenRenderCompressedBuffersDisabledLocalMemoryEnabledWhenAllocatio
} }
TEST(Buffer, givenSharedContextWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) { TEST(Buffer, givenSharedContextWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, 0, 0); MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(0, 0, 0);
MockContext context; MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = true; context.isSharedContext = true;
@@ -361,7 +361,7 @@ TEST(Buffer, givenSharedContextWhenAllocationTypeIsQueriedThenBufferHostMemoryTy
} }
TEST(Buffer, givenSharedContextAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) { TEST(Buffer, givenSharedContextAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, 0, 0); MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(0, 0, 0);
MockContext context; MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = true; context.isSharedContext = true;
@@ -371,7 +371,7 @@ TEST(Buffer, givenSharedContextAndRenderCompressedBuffersEnabledWhenAllocationTy
TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) { TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
cl_mem_flags flags = CL_MEM_USE_HOST_PTR; 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; MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false; context.isSharedContext = false;
@@ -381,7 +381,7 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledWhenAllocationTypeIsQuerie
TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) { TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
cl_mem_flags flags = CL_MEM_USE_HOST_PTR; 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; MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false; context.isSharedContext = false;
@@ -391,7 +391,7 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledWhenAllocationTypeIsQueried
TEST(Buffer, givenAllocHostPtrFlagWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) { TEST(Buffer, givenAllocHostPtrFlagWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
cl_mem_flags flags = CL_MEM_ALLOC_HOST_PTR; 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; MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false; context.isSharedContext = false;
@@ -401,7 +401,7 @@ TEST(Buffer, givenAllocHostPtrFlagWhenAllocationTypeIsQueriedThenBufferTypeIsRet
TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferMemoryTypeIsReturned) { TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferMemoryTypeIsReturned) {
cl_mem_flags flags = CL_MEM_USE_HOST_PTR; 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; MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false; context.isSharedContext = false;
@@ -411,7 +411,7 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledAndRenderCompressedBuffers
TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferMemoryTypeIsReturned) { TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferMemoryTypeIsReturned) {
cl_mem_flags flags = CL_MEM_USE_HOST_PTR; 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; MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false; context.isSharedContext = false;
@@ -421,7 +421,7 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledAndRenderCompressedBuffersE
TEST(Buffer, givenUseHostPointerFlagAndForceSharedPhysicalStorageWhenLocalMemoryIsEnabledThenBufferHostMemoryTypeIsReturned) { TEST(Buffer, givenUseHostPointerFlagAndForceSharedPhysicalStorageWhenLocalMemoryIsEnabledThenBufferHostMemoryTypeIsReturned) {
cl_mem_flags flags = CL_MEM_USE_HOST_PTR | CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL; 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; MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false; context.isSharedContext = false;
@@ -431,7 +431,7 @@ TEST(Buffer, givenUseHostPointerFlagAndForceSharedPhysicalStorageWhenLocalMemory
TEST(Buffer, givenAllocHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturned) { TEST(Buffer, givenAllocHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturned) {
cl_mem_flags flags = CL_MEM_ALLOC_HOST_PTR; 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; MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false; context.isSharedContext = false;
@@ -440,7 +440,7 @@ TEST(Buffer, givenAllocHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocatio
} }
TEST(Buffer, givenZeroFlagsNoSharedContextAndRenderCompressedBuffersDisabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) { TEST(Buffer, givenZeroFlagsNoSharedContextAndRenderCompressedBuffersDisabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, 0, 0); MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(0, 0, 0);
MockContext context; MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE; context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false; context.isSharedContext = false;

View File

@@ -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/helpers/surface_formats.h"
#include "opencl/source/mem_obj/image.h" #include "opencl/source/mem_obj/image.h"
#include "opencl/test/unit_test/fixtures/device_fixture.h" #include "opencl/test/unit_test/fixtures/device_fixture.h"
@@ -64,7 +64,7 @@ typedef CreateImageFormatTest<CL_MEM_READ_WRITE> ReadWriteFormatTest;
TEST_P(ReadWriteFormatTest, returnsSuccess) { TEST_P(ReadWriteFormatTest, returnsSuccess) {
auto image = Image::create( auto image = Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -89,7 +89,7 @@ typedef CreateImageFormatTest<CL_MEM_READ_ONLY> ReadOnlyFormatTest;
TEST_P(ReadOnlyFormatTest, returnsSuccess) { TEST_P(ReadOnlyFormatTest, returnsSuccess) {
auto image = Image::create( auto image = Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -112,7 +112,7 @@ typedef CreateImageFormatTest<CL_MEM_WRITE_ONLY> WriteOnlyFormatTest;
TEST_P(WriteOnlyFormatTest, returnsSuccess) { TEST_P(WriteOnlyFormatTest, returnsSuccess) {
auto image = Image::create( auto image = Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,

View File

@@ -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/buffer.h"
#include "opencl/source/mem_obj/image.h" #include "opencl/source/mem_obj/image.h"
#include "opencl/test/unit_test/fixtures/device_fixture.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 surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, pClDevice->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto image = Image::create( auto image = Image::create(
context, context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,

View File

@@ -9,7 +9,7 @@
#include "shared/source/helpers/hw_helper.h" #include "shared/source/helpers/hw_helper.h"
#include "opencl/source/cl_device/cl_device_info_map.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/buffer.h"
#include "opencl/source/mem_obj/image.h" #include "opencl/source/mem_obj/image.h"
#include "opencl/source/platform/extensions.h" #include "opencl/source/platform/extensions.h"
@@ -60,7 +60,7 @@ class Image2dFromBufferTest : public DeviceFixture, public ::testing::Test {
Image *createImage() { Image *createImage() {
cl_mem_flags flags = CL_MEM_READ_ONLY; cl_mem_flags flags = CL_MEM_READ_ONLY;
auto surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); 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_format imageFormat;
cl_image_desc imageDesc; cl_image_desc imageDesc;
@@ -91,7 +91,7 @@ TEST_F(Image2dFromBufferTest, givenBufferWhenCreateImage2dArrayFromBufferThenIma
imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D_ARRAY; imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
cl_mem_flags flags = CL_MEM_READ_ONLY; cl_mem_flags flags = CL_MEM_READ_ONLY;
auto surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); 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); EXPECT_EQ(CL_INVALID_IMAGE_DESCRIPTOR, retVal);
} }
TEST_F(Image2dFromBufferTest, CalculateRowPitch) { TEST_F(Image2dFromBufferTest, CalculateRowPitch) {
@@ -107,7 +107,7 @@ TEST_F(Image2dFromBufferTest, givenInvalidRowPitchWhenCreateImage2dFromBufferThe
imageDesc.image_row_pitch = 255; imageDesc.image_row_pitch = 255;
cl_mem_flags flags = CL_MEM_READ_ONLY; cl_mem_flags flags = CL_MEM_READ_ONLY;
auto surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); 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); EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
} }
@@ -136,7 +136,7 @@ TEST_F(Image2dFromBufferTest, InvalidHostPtrAlignment) {
ASSERT_NE(nullptr, imageDesc.mem_object); ASSERT_NE(nullptr, imageDesc.mem_object);
cl_mem_flags flags = CL_MEM_READ_ONLY; cl_mem_flags flags = CL_MEM_READ_ONLY;
auto surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); 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); EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
clReleaseMemObject(imageDesc.mem_object); clReleaseMemObject(imageDesc.mem_object);
@@ -149,7 +149,7 @@ TEST_F(Image2dFromBufferTest, givenInvalidFlagsWhenValidateIsCalledThenReturnErr
for (auto flag : flags) { for (auto flag : flags) {
const auto surfaceFormat = Image::getSurfaceFormatFromTable(flag, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); 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<void *>(0x12345)); retVal = Image::validate(&context, MemoryPropertiesHelper::createMemoryProperties(flag, 0, 0), surfaceFormat, &imageDesc, reinterpret_cast<void *>(0x12345));
EXPECT_EQ(CL_INVALID_VALUE, retVal); EXPECT_EQ(CL_INVALID_VALUE, retVal);
} }
} }
@@ -162,7 +162,7 @@ TEST_F(Image2dFromBufferTest, givenOneChannel8BitColorsNoRowPitchSpecifiedAndToo
imageFormat.image_channel_order = CL_R; imageFormat.image_channel_order = CL_R;
const auto surfaceFormat = static_cast<const ClSurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features)); const auto surfaceFormat = static_cast<const 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); EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
} }
@@ -174,7 +174,7 @@ TEST_F(Image2dFromBufferTest, givenOneChannel16BitColorsNoRowPitchSpecifiedAndTo
imageFormat.image_channel_order = CL_R; imageFormat.image_channel_order = CL_R;
const auto surfaceFormat = static_cast<const ClSurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features)); const auto surfaceFormat = static_cast<const 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); EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
} }
@@ -186,7 +186,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel8BitColorsNoRowPitchSpecifiedAndTo
imageFormat.image_channel_order = CL_RGBA; imageFormat.image_channel_order = CL_RGBA;
const auto surfaceFormat = static_cast<const ClSurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features)); const auto surfaceFormat = static_cast<const 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); EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
} }
@@ -198,7 +198,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel16BitColorsNoRowPitchSpecifiedAndT
imageFormat.image_channel_order = CL_RGBA; imageFormat.image_channel_order = CL_RGBA;
const auto surfaceFormat = static_cast<const ClSurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features)); const auto surfaceFormat = static_cast<const 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); EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
} }
@@ -211,7 +211,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel8BitColorsAndNotTooLargeRowPitchSp
imageFormat.image_channel_order = CL_RGBA; imageFormat.image_channel_order = CL_RGBA;
const auto surfaceFormat = static_cast<const ClSurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features)); const auto surfaceFormat = static_cast<const 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_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
} }
@@ -225,7 +225,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel8BitColorsAndTooLargeRowPitchSpeci
imageFormat.image_channel_order = CL_RGBA; imageFormat.image_channel_order = CL_RGBA;
const auto surfaceFormat = static_cast<const ClSurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features)); const auto surfaceFormat = static_cast<const 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); EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
} }
@@ -239,7 +239,7 @@ TEST_F(Image2dFromBufferTest, givenUnalignedImageWidthAndNoSpaceInBufferForAlign
imageFormat.image_channel_order = CL_R; imageFormat.image_channel_order = CL_R;
const auto surfaceFormat = static_cast<const ClSurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features)); const auto surfaceFormat = static_cast<const 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); EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
} }

View File

@@ -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/source/mem_obj/image.h"
#include "opencl/test/unit_test/fixtures/device_fixture.h" #include "opencl/test/unit_test/fixtures/device_fixture.h"
#include "opencl/test/unit_test/helpers/unit_test_helper.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) { Image *createImageWithFlags(cl_mem_flags flags) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); 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_format imageFormat;
cl_image_desc imageDesc; cl_image_desc imageDesc;

View File

@@ -7,7 +7,7 @@
#include "shared/source/helpers/aligned_memory.h" #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/source/mem_obj/image.h"
#include "opencl/test/unit_test/fixtures/device_fixture.h" #include "opencl/test/unit_test/fixtures/device_fixture.h"
#include "opencl/test/unit_test/helpers/unit_test_helper.h" #include "opencl/test/unit_test/helpers/unit_test_helper.h"
@@ -61,7 +61,7 @@ class CreateImage3DTest : public DeviceFixture,
HWTEST_F(CreateImage3DTest, validTypes) { HWTEST_F(CreateImage3DTest, validTypes) {
cl_mem_flags flags = CL_MEM_READ_WRITE; cl_mem_flags flags = CL_MEM_READ_WRITE;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); 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_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, image); ASSERT_NE(nullptr, image);

View File

@@ -7,7 +7,7 @@
#include "shared/source/helpers/aligned_memory.h" #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/source/mem_obj/image.h"
#include "opencl/test/unit_test/fixtures/device_fixture.h" #include "opencl/test/unit_test/fixtures/device_fixture.h"
#include "opencl/test/unit_test/helpers/unit_test_helper.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 surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto image = Image::create( auto image = Image::create(
context, context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -116,7 +116,7 @@ HWTEST_P(CreateImageNonArraySize, NonArrayTypes) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto image = Image::create( auto image = Image::create(
context, context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,

View File

@@ -7,7 +7,7 @@
#include "shared/source/helpers/aligned_memory.h" #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/buffer.h"
#include "opencl/source/mem_obj/image.h" #include "opencl/source/mem_obj/image.h"
#include "opencl/test/unit_test/fixtures/device_fixture.h" #include "opencl/test/unit_test/fixtures/device_fixture.h"
@@ -62,7 +62,7 @@ class ImageFromSubBufferTest : public DeviceFixture, public ::testing::Test {
Image *createImage() { Image *createImage() {
cl_mem_flags flags = CL_MEM_READ_ONLY; cl_mem_flags flags = CL_MEM_READ_ONLY;
auto surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); 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_format imageFormat;
cl_image_desc imageDesc; cl_image_desc imageDesc;

View File

@@ -7,7 +7,7 @@
#include "shared/source/helpers/aligned_memory.h" #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/surface_formats.h"
#include "opencl/source/mem_obj/image.h" #include "opencl/source/mem_obj/image.h"
#include "opencl/source/memory_manager/os_agnostic_memory_manager.h" #include "opencl/source/memory_manager/os_agnostic_memory_manager.h"
@@ -53,7 +53,7 @@ class ImageRedescribeTest : public testing::TestWithParam<std::tuple<size_t, uin
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
image.reset(Image::create( image.reset(Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -194,7 +194,7 @@ TEST_P(ImageRedescribeTest, givenImageWithMaxSizesWhenItIsRedescribedThenNewImag
cl_mem_flags flags = CL_MEM_READ_WRITE; cl_mem_flags flags = CL_MEM_READ_WRITE;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto bigImage = std::unique_ptr<Image>(Image::create(&context, auto bigImage = std::unique_ptr<Image>(Image::create(&context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,

View File

@@ -47,7 +47,7 @@ class CreateImageTest : public DeviceFixture,
} }
Image *createImageWithFlags(cl_mem_flags flags) { Image *createImageWithFlags(cl_mem_flags flags) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); 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); 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 surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto image = Image::create( auto image = Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -148,7 +148,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
image = Image::create( image = Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -173,7 +173,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
image = Image::create( image = Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -198,7 +198,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
image = Image::create( image = Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -223,7 +223,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
image = Image::create( image = Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -248,7 +248,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
image = Image::create( image = Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -273,7 +273,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
image = Image::create( image = Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -298,7 +298,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
image = Image::create( image = Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -349,7 +349,7 @@ TEST(TestCreateImage, UseSharedContextToCreateImage) {
auto image = Image::create( auto image = Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -410,7 +410,7 @@ TEST(TestCreateImageUseHostPtr, CheckMemoryAllocationForDifferenHostPtrAlignment
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
auto image = Image::create( auto image = Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -448,7 +448,7 @@ TEST(TestCreateImageUseHostPtr, givenZeroCopyImageValuesWhenUsingHostPtrThenZero
auto image = std::unique_ptr<Image>(Image::create( auto image = std::unique_ptr<Image>(Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -557,7 +557,7 @@ struct CreateImageHostPtr
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
return Image::create( return Image::create(
context, context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -972,7 +972,7 @@ HWTEST_F(ImageCompressionTests, givenTiledImageWhenCreatingAllocationThenPreferR
MockContext context; MockContext context;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto image = std::unique_ptr<Image>(Image::create(mockContext.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), auto image = std::unique_ptr<Image>(Image::create(mockContext.get(), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, image); ASSERT_NE(nullptr, image);
EXPECT_EQ(UnitTestHelper<FamilyType>::tiledImagesSupported, image->isTiledAllocation()); EXPECT_EQ(UnitTestHelper<FamilyType>::tiledImagesSupported, image->isTiledAllocation());
@@ -986,7 +986,7 @@ TEST_F(ImageCompressionTests, givenNonTiledImageWhenCreatingAllocationThenDontPr
MockContext context; MockContext context;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto image = std::unique_ptr<Image>(Image::create(mockContext.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), auto image = std::unique_ptr<Image>(Image::create(mockContext.get(), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, image); ASSERT_NE(nullptr, image);
EXPECT_FALSE(image->isTiledAllocation()); EXPECT_FALSE(image->isTiledAllocation());
@@ -1186,7 +1186,7 @@ TEST(ImageTest, givenClMemForceLinearStorageSetWhenCreateImageThenDisallowTiling
auto image = std::unique_ptr<Image>(Image::create( auto image = std::unique_ptr<Image>(Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,
@@ -1231,7 +1231,7 @@ TEST(ImageTest, givenClMemCopyHostPointerPassedToImageCreateWhenAllocationIsNotI
MockContext context; MockContext context;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> image(Image::create(&ctx, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, memory, retVal)); std::unique_ptr<Image> image(Image::create(&ctx, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, memory, retVal));
EXPECT_NE(nullptr, image); EXPECT_NE(nullptr, image);
auto taskCountSent = device->getGpgpuCommandStreamReceiver().peekLatestFlushedTaskCount(); auto taskCountSent = device->getGpgpuCommandStreamReceiver().peekLatestFlushedTaskCount();

View File

@@ -73,7 +73,7 @@ HWTEST_P(CreateTiledImageTest, isTiledImageIsSetForTiledImages) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, pClDevice->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, pClDevice->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto image = Image::create( auto image = Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,

View File

@@ -683,7 +683,7 @@ TEST(validateAndCreateImage, givenNotSupportedImageFormatWhenValidateAndCreateIm
cl_int retVal = CL_SUCCESS; cl_int retVal = CL_SUCCESS;
Image *image; Image *image;
cl_mem_flags flags = CL_MEM_READ_WRITE; 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(nullptr, image);
EXPECT_EQ(CL_IMAGE_FORMAT_NOT_SUPPORTED, retVal); EXPECT_EQ(CL_IMAGE_FORMAT_NOT_SUPPORTED, retVal);
} }
@@ -711,7 +711,7 @@ TEST(validateAndCreateImage, givenValidImageParamsWhenValidateAndCreateImageIsCa
std::unique_ptr<Image> image = nullptr; std::unique_ptr<Image> image = nullptr;
image.reset(Image::validateAndCreateImage( image.reset(Image::validateAndCreateImage(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
&imageFormat, &imageFormat,

View File

@@ -11,7 +11,7 @@
#include "shared/test/unit_test/mocks/mock_device.h" #include "shared/test/unit_test/mocks/mock_device.h"
#include "opencl/source/api/api.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/mem_obj/mem_obj.h"
#include "opencl/source/platform/platform.h" #include "opencl/source/platform/platform.h"
#include "opencl/test/unit_test/libult/ult_command_stream_receiver.h" #include "opencl/test/unit_test/libult/ult_command_stream_receiver.h"
@@ -45,7 +45,7 @@ class MemObjDestructionTest : public ::testing::TestWithParam<bool> {
allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), size}); allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), size});
memObj = new MemObj(context.get(), CL_MEM_OBJECT_BUFFER, 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, size,
nullptr, nullptr, allocation, true, false, false); nullptr, nullptr, allocation, true, false, false);
csr = device->getDefaultEngine().commandStreamReceiver; csr = device->getDefaultEngine().commandStreamReceiver;
@@ -224,7 +224,7 @@ HWTEST_P(MemObjAsyncDestructionTest, givenUsedMemObjWithAsyncDestructionsEnabled
MemObjSizeArray region = {{1, 1, 1}}; MemObjSizeArray region = {{1, 1, 1}};
cl_map_flags mapFlags = CL_MAP_READ; cl_map_flags mapFlags = CL_MAP_READ;
memObj = new MemObj(context.get(), CL_MEM_OBJECT_BUFFER, 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, size,
storage, nullptr, allocation, true, false, false); storage, nullptr, allocation, true, false, false);
memObj->addMappedPtr(storage, 1, mapFlags, region, origin, 0); memObj->addMappedPtr(storage, 1, mapFlags, region, origin, 0);

View File

@@ -7,7 +7,7 @@
#include "shared/test/unit_test/utilities/base_object_utils.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/mem_obj_helper.h" #include "opencl/source/mem_obj/mem_obj_helper.h"
#include "opencl/test/unit_test/fixtures/image_fixture.h" #include "opencl/test/unit_test/fixtures/image_fixture.h"
#include "opencl/test/unit_test/mocks/mock_context.h" #include "opencl/test/unit_test/mocks/mock_context.h"
@@ -36,83 +36,83 @@ TEST(MemObjHelper, givenClMemForceLinearStorageFlagWhenCheckForLinearStorageForc
flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL; flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
flagsIntel = 0; flagsIntel = 0;
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0);
EXPECT_TRUE(memoryProperties.flags.forceLinearStorage); EXPECT_TRUE(memoryProperties.flags.forceLinearStorage);
flags = 0; flags = 0;
flagsIntel |= 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); EXPECT_TRUE(memoryProperties.flags.forceLinearStorage);
flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL; flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
flagsIntel |= 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); EXPECT_TRUE(memoryProperties.flags.forceLinearStorage);
flags = 0; flags = 0;
flagsIntel = 0; flagsIntel = 0;
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0);
EXPECT_FALSE(memoryProperties.flags.forceLinearStorage); EXPECT_FALSE(memoryProperties.flags.forceLinearStorage);
} }
TEST(MemObjHelper, givenValidPropertiesWhenValidatingMemoryPropertiesThenTrueIsReturned) { TEST(MemObjHelper, givenValidPropertiesWhenValidatingMemoryPropertiesThenTrueIsReturned) {
cl_mem_flags flags = 0; cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0; cl_mem_flags_intel flagsIntel = 0;
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0);
MockContext context; MockContext context;
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context));
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context));
flags = CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL | CL_MEM_NO_ACCESS_INTEL; 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; flags = CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL | CL_MEM_NO_ACCESS_INTEL;
flagsIntel = 0; flagsIntel = 0;
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context));
flags = CL_MEM_NO_ACCESS_INTEL; flags = CL_MEM_NO_ACCESS_INTEL;
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0);
flags = CL_MEM_NO_ACCESS_INTEL; flags = CL_MEM_NO_ACCESS_INTEL;
flagsIntel = 0; flagsIntel = 0;
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context));
flags = CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR | CL_MEM_HOST_NO_ACCESS; 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; flags = CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR | CL_MEM_HOST_NO_ACCESS;
flagsIntel = 0; flagsIntel = 0;
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context));
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, 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; 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; flags = CL_MEM_WRITE_ONLY | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_WRITE_ONLY;
flagsIntel = 0; flagsIntel = 0;
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context));
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, 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; 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; flags = CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_NO_ACCESS;
flagsIntel = 0; flagsIntel = 0;
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context));
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context));
flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE; flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE;
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0);
flags = 0; flags = 0;
flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE; flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE;
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context));
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context));
flagsIntel = CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE; flagsIntel = CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE;
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0);
flags = 0; flags = 0;
flagsIntel = CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE; flagsIntel = CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE;
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context));
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context));
flags = 0; flags = 0;
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0);
flags = 0; flags = 0;
flagsIntel = 0; flagsIntel = 0;
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context)); EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context));
@@ -126,7 +126,7 @@ struct Image1dWithAccessFlagsUnrestricted : public Image1dDefaults {
TEST(MemObjHelper, givenParentMemObjAndHostPtrFlagsWhenValidatingMemoryPropertiesForImageThenFalseIsReturned) { TEST(MemObjHelper, givenParentMemObjAndHostPtrFlagsWhenValidatingMemoryPropertiesForImageThenFalseIsReturned) {
cl_mem_flags flags = 0; cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0; cl_mem_flags_intel flagsIntel = 0;
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0);
MockContext context; MockContext context;
auto image = clUniquePtr(Image1dHelper<>::create(&context)); auto image = clUniquePtr(Image1dHelper<>::create(&context));
@@ -136,13 +136,13 @@ TEST(MemObjHelper, givenParentMemObjAndHostPtrFlagsWhenValidatingMemoryPropertie
for (auto hostPtrFlag : hostPtrFlags) { for (auto hostPtrFlag : hostPtrFlags) {
flags = hostPtrFlag; flags = hostPtrFlag;
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0); memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0);
flags = hostPtrFlag; flags = hostPtrFlag;
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, image.get(), context)); EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, image.get(), context));
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, imageWithAccessFlagsUnrestricted.get(), context)); EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, imageWithAccessFlagsUnrestricted.get(), context));
flags |= CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL; 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; flags |= CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL;
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, image.get(), context)); EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, image.get(), context));
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, imageWithAccessFlagsUnrestricted.get(), context)); EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, imageWithAccessFlagsUnrestricted.get(), context));

View File

@@ -12,7 +12,7 @@
#include "shared/source/os_interface/os_context.h" #include "shared/source/os_interface/os_context.h"
#include "shared/test/unit_test/mocks/mock_device.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/helpers/properties_helper.h"
#include "opencl/source/mem_obj/mem_obj.h" #include "opencl/source/mem_obj/mem_obj.h"
#include "opencl/source/platform/platform.h" #include "opencl/source/platform/platform.h"
@@ -65,7 +65,7 @@ TEST(MemObj, GivenMemObjWhenInititalizedFromHostPtrThenInitializeFields) {
char buffer[size]; char buffer[size];
MockContext context; MockContext context;
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(buffer, sizeof(buffer)); 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
sizeof(buffer), buffer, buffer, mockAllocation, true, false, false); sizeof(buffer), buffer, buffer, mockAllocation, true, false, false);
@@ -81,7 +81,7 @@ TEST(MemObj, givenMemObjectWhenAskedForTransferToHostPtrThenDoNothing) {
uint8_t expectedHostPtr[size] = {}; uint8_t expectedHostPtr[size] = {};
MockContext context; MockContext context;
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(hostPtr, sizeof(hostPtr)); 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
size, hostPtr, hostPtr, mockAllocation, true, false, false); size, hostPtr, hostPtr, mockAllocation, true, false, false);
@@ -101,7 +101,7 @@ TEST(MemObj, givenMemObjectWhenAskedForTransferFromHostPtrThenDoNothing) {
uint8_t expectedBufferPtr[size] = {}; uint8_t expectedBufferPtr[size] = {};
MockContext context; MockContext context;
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(hostPtr, sizeof(hostPtr)); 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, MemObj memObj(&context, CL_MEM_OBJECT_PIPE, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
size, hostPtr, hostPtr, mockAllocation, true, false, false); size, hostPtr, hostPtr, mockAllocation, true, false, false);
@@ -118,7 +118,7 @@ TEST(MemObj, givenMemObjectWhenAskedForTransferFromHostPtrThenDoNothing) {
TEST(MemObj, givenHostPtrAndUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnHostPtr) { TEST(MemObj, givenHostPtrAndUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnHostPtr) {
uint8_t hostPtr = 0; uint8_t hostPtr = 0;
MockContext context; 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
1, nullptr, &hostPtr, nullptr, true, false, false); 1, nullptr, &hostPtr, nullptr, true, false, false);
@@ -128,7 +128,7 @@ TEST(MemObj, givenHostPtrAndUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnHostP
TEST(MemObj, givenHostPtrWithoutUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnAllocatedPtr) { TEST(MemObj, givenHostPtrWithoutUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnAllocatedPtr) {
uint8_t hostPtr = 0; uint8_t hostPtr = 0;
MockContext context; 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
1, nullptr, &hostPtr, nullptr, true, false, false); 1, nullptr, &hostPtr, nullptr, true, false, false);
@@ -140,7 +140,7 @@ TEST(MemObj, givenMemObjWhenReleaseAllocatedPtrIsCalledTwiceThenItDoesntCrash) {
void *allocatedPtr = alignedMalloc(MemoryConstants::cacheLineSize, MemoryConstants::cacheLineSize); void *allocatedPtr = alignedMalloc(MemoryConstants::cacheLineSize, MemoryConstants::cacheLineSize);
MockContext context; 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
1, nullptr, nullptr, nullptr, true, false, false); 1, nullptr, nullptr, nullptr, true, false, false);
@@ -160,7 +160,7 @@ TEST(MemObj, givenNotReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThe
auto defaultEngine = context.getDevice(0)->getDefaultEngine(); auto defaultEngine = context.getDevice(0)->getDefaultEngine();
allocation->updateTaskCount(2, defaultEngine.osContext->getContextId()); allocation->updateTaskCount(2, defaultEngine.osContext->getContextId());
*(defaultEngine.commandStreamReceiver->getTagAddress()) = 1; *(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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false); MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
auto &allocationList = defaultEngine.commandStreamReceiver->getTemporaryAllocations(); auto &allocationList = defaultEngine.commandStreamReceiver->getTemporaryAllocations();
@@ -179,7 +179,7 @@ TEST(MemObj, givenReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThenAl
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize}); auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
allocation->updateTaskCount(1, device->getDefaultEngine().osContext->getContextId()); allocation->updateTaskCount(1, device->getDefaultEngine().osContext->getContextId());
*device->getDefaultEngine().commandStreamReceiver->getTagAddress() = 1; *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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false); MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
@@ -197,7 +197,7 @@ TEST(MemObj, givenNotUsedGraphicsAllocationWhenMemObjDestroysAllocationAsyncThen
context.memoryManager = &memoryManager; context.memoryManager = &memoryManager;
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize}); 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false); MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
@@ -215,7 +215,7 @@ TEST(MemObj, givenMemoryManagerWithoutDeviceWhenMemObjDestroysAllocationAsyncThe
context.memoryManager = &memoryManager; context.memoryManager = &memoryManager;
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize}); 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false); MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
@@ -231,7 +231,7 @@ TEST(MemObj, givenMemObjAndPointerToObjStorageWithProperCommandWhenCheckIfMemTra
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment()); MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
context.memoryManager = &memoryManager; 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false); MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
void *ptr = memObj.getCpuAddressForMemoryTransfer(); void *ptr = memObj.getCpuAddressForMemoryTransfer();
@@ -258,7 +258,7 @@ TEST(MemObj, givenMemObjAndPointerToObjStorageBadCommandWhenCheckIfMemTransferRe
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment()); MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
context.memoryManager = &memoryManager; 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false); MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
void *ptr = memObj.getCpuAddressForMemoryTransfer(); void *ptr = memObj.getCpuAddressForMemoryTransfer();
@@ -270,7 +270,7 @@ TEST(MemObj, givenMemObjAndPointerToDiffrentStorageAndProperCommandWhenCheckIfMe
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment()); MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
context.memoryManager = &memoryManager; 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false); MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
void *ptr = (void *)0x1234; void *ptr = (void *)0x1234;
@@ -282,7 +282,7 @@ TEST(MemObj, givenSharingHandlerWhenAskedForCpuMappingThenReturnFalse) {
MockContext context; MockContext context;
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment()); MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize}); 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
MemoryConstants::pageSize, nullptr, nullptr, allocation, true, false, false); MemoryConstants::pageSize, nullptr, nullptr, allocation, true, false, false);
memObj.setSharingHandler(new SharingHandler()); memObj.setSharingHandler(new SharingHandler());
@@ -294,7 +294,7 @@ TEST(MemObj, givenTiledObjectWhenAskedForCpuMappingThenReturnFalse) {
using MemObj::MemObj; using MemObj::MemObj;
bool isTiledAllocation() const override { return true; } 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, MyMemObj memObj(nullptr, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false); 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}); auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, false)); 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
1, allocation->getUnderlyingBuffer(), nullptr, allocation, false, false, false); 1, allocation->getUnderlyingBuffer(), nullptr, allocation, false, false, false);
@@ -326,7 +326,7 @@ TEST(MemObj, givenDefaultWhenAskedForCpuMappingThenReturnTrue) {
context.memoryManager = &memoryManager; context.memoryManager = &memoryManager;
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize}); 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
64, allocation->getUnderlyingBuffer(), nullptr, allocation, true, false, false); 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}); auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, false)); 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
1, allocation->getUnderlyingBuffer(), nullptr, allocation, false, false, false); 1, allocation->getUnderlyingBuffer(), nullptr, allocation, false, false, false);
@@ -393,7 +393,7 @@ TEST(MemObj, givenSharedMemObjectWithNullGfxAllocationWhenSettingGfxAllocationTh
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment()); MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
context.memoryManager = &memoryManager; context.memoryManager = &memoryManager;
MockGraphicsAllocation *gfxAllocation = new MockGraphicsAllocation(nullptr, 0); 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
1, nullptr, nullptr, nullptr, true, false, false); 1, nullptr, nullptr, nullptr, true, false, false);
memObj.setSharingHandler(new MySharingHandler(&memObj)); memObj.setSharingHandler(new MySharingHandler(&memObj));
@@ -410,7 +410,7 @@ TEST(MemObj, givenSharedMemObjectAndNullGfxAllocationProvidedWhenSettingGfxAlloc
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment()); MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
context.memoryManager = &memoryManager; context.memoryManager = &memoryManager;
MockGraphicsAllocation *graphicsAllocation = new MockGraphicsAllocation(nullptr, 0); 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
1, nullptr, nullptr, graphicsAllocation, true, false, false); 1, nullptr, nullptr, graphicsAllocation, true, false, false);
memObj.setSharingHandler(new MySharingHandler(&memObj)); memObj.setSharingHandler(new MySharingHandler(&memObj));
@@ -427,7 +427,7 @@ TEST(MemObj, givenSharedMemObjectAndZeroReuseCountWhenChangingGfxAllocationThenO
context.memoryManager = &memoryManager; context.memoryManager = &memoryManager;
MockGraphicsAllocation *oldGfxAllocation = new MockGraphicsAllocation(nullptr, 0); MockGraphicsAllocation *oldGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
MockGraphicsAllocation *newGfxAllocation = 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
1, nullptr, nullptr, oldGfxAllocation, true, false, false); 1, nullptr, nullptr, oldGfxAllocation, true, false, false);
memObj.setSharingHandler(new MySharingHandler(&memObj)); memObj.setSharingHandler(new MySharingHandler(&memObj));
@@ -446,7 +446,7 @@ TEST(MemObj, givenSharedMemObjectAndNonZeroReuseCountWhenChangingGfxAllocationTh
context.memoryManager = &memoryManager; context.memoryManager = &memoryManager;
MockGraphicsAllocation *oldGfxAllocation = new MockGraphicsAllocation(nullptr, 0); MockGraphicsAllocation *oldGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
MockGraphicsAllocation *newGfxAllocation = 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
1, nullptr, nullptr, oldGfxAllocation, true, false, false); 1, nullptr, nullptr, oldGfxAllocation, true, false, false);
memObj.setSharingHandler(new MySharingHandler(&memObj)); memObj.setSharingHandler(new MySharingHandler(&memObj));
@@ -465,7 +465,7 @@ TEST(MemObj, givenNotSharedMemObjectWhenChangingGfxAllocationThenOldAllocationIs
context.memoryManager = &memoryManager; context.memoryManager = &memoryManager;
MockGraphicsAllocation *oldGfxAllocation = new MockGraphicsAllocation(nullptr, 0); MockGraphicsAllocation *oldGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
MockGraphicsAllocation *newGfxAllocation = 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
1, nullptr, nullptr, oldGfxAllocation, true, false, false); 1, nullptr, nullptr, oldGfxAllocation, true, false, false);
@@ -483,7 +483,7 @@ TEST(MemObj, givenGraphicsAllocationWhenCallingIsAllocDumpableThenItReturnsTheCo
TEST(MemObj, givenMemObjNotUsingHostPtrWhenGettingBasePtrTwiceReturnSameMapPtr) { TEST(MemObj, givenMemObjNotUsingHostPtrWhenGettingBasePtrTwiceReturnSameMapPtr) {
MockContext context; 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, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
1, nullptr, nullptr, nullptr, true, false, false); 1, nullptr, nullptr, nullptr, true, false, false);
@@ -498,7 +498,7 @@ TEST(MemObj, givenMemObjNotUsingHostPtrWhenGettingBasePtrTwiceReturnSameMapPtr)
using MemObjMultiRootDeviceTests = MultiRootDeviceFixture; using MemObjMultiRootDeviceTests = MultiRootDeviceFixture;
TEST_F(MemObjMultiRootDeviceTests, memObjMapAllocationHasCorrectRootDeviceIndex) { 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, MemObj memObj(context.get(), CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
1, nullptr, nullptr, nullptr, true, false, false); 1, nullptr, nullptr, nullptr, true, false, false);

View File

@@ -10,7 +10,7 @@
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h" #include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
#include "opencl/source/cl_device/cl_device_get_cap.inl" #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/helpers/surface_formats.h"
#include "opencl/source/mem_obj/image.h" #include "opencl/source/mem_obj/image.h"
#include "opencl/test/unit_test/fixtures/device_fixture.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) { void validateImageWithFlags(cl_mem_flags flags) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); 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) { Image *createImageWithFlags(cl_mem_flags flags) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); 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); flags, 0, surfaceFormat, &imageDesc, nullptr, retVal);
} }
@@ -195,7 +195,7 @@ TEST_F(Nv12ImageTest, given2DImageWhenPassedToValidateImageTraitsThenValidateRet
imageDesc.mem_object = image; imageDesc.mem_object = image;
imageDesc.image_depth = 0; 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); EXPECT_EQ(CL_SUCCESS, retVal);
delete image; delete image;
@@ -210,7 +210,7 @@ TEST_F(Nv12ImageTest, given1DImageWhenPassedAsParentImageThenValidateImageTraits
imageDesc.mem_object = image; imageDesc.mem_object = image;
imageDesc.image_depth = 0; 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); EXPECT_EQ(CL_SUCCESS, retVal);
delete image; delete image;
@@ -222,7 +222,7 @@ TEST_F(Nv12ImageTest, givenBufferWhenPassedAsNV12ParentImageThenValidateImageTra
imageDesc.mem_object = &Buffer; imageDesc.mem_object = &Buffer;
imageDesc.image_depth = 0; // Plane of NV12 image 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); EXPECT_EQ(CL_INVALID_IMAGE_DESCRIPTOR, retVal);
} }
@@ -397,7 +397,7 @@ HWTEST_F(Nv12ImageTest, checkIfPlanesAreWritten) {
// Create Parent NV12 image // Create Parent NV12 image
cl_mem_flags flags = CL_MEM_READ_ONLY | CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL | CL_MEM_USE_HOST_PTR; 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 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); flags, 0, surfaceFormat, &imageDesc, hostPtr, retVal);
EXPECT_EQ(imageNV12->isTiledAllocation() ? 2u : 0u, cmdQ->EnqueueWriteImageCounter); EXPECT_EQ(imageNV12->isTiledAllocation() ? 2u : 0u, cmdQ->EnqueueWriteImageCounter);
@@ -575,7 +575,7 @@ TEST_F(Nv12ImageTest, invalidPlanarYUVImageHeight) {
pDevice->getCap<CL_DEVICE_PLANAR_YUV_MAX_HEIGHT_INTEL>(reinterpret_cast<const void *&>(maxHeight), srcSize, retSize); pDevice->getCap<CL_DEVICE_PLANAR_YUV_MAX_HEIGHT_INTEL>(reinterpret_cast<const void *&>(maxHeight), srcSize, retSize);
imageDesc.image_height = *maxHeight + 12; 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); EXPECT_EQ(CL_INVALID_IMAGE_SIZE, retVal);
} }
@@ -592,17 +592,17 @@ TEST_F(Nv12ImageTest, invalidPlanarYUVImageWidth) {
pDevice->getCap<CL_DEVICE_PLANAR_YUV_MAX_WIDTH_INTEL>(reinterpret_cast<const void *&>(maxWidth), srcSize, retSize); pDevice->getCap<CL_DEVICE_PLANAR_YUV_MAX_WIDTH_INTEL>(reinterpret_cast<const void *&>(maxWidth), srcSize, retSize);
imageDesc.image_width = *maxWidth + 12; 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); EXPECT_EQ(CL_INVALID_IMAGE_SIZE, retVal);
} }
TEST_F(Nv12ImageTest, validPlanarYUVImageHeight) { 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); EXPECT_EQ(CL_SUCCESS, retVal);
} }
TEST_F(Nv12ImageTest, validPlanarYUVImageWidth) { 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); EXPECT_EQ(CL_SUCCESS, retVal);
} }

View File

@@ -7,7 +7,7 @@
#include "shared/source/helpers/aligned_memory.h" #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/surface_formats.h"
#include "opencl/source/helpers/validators.h" #include "opencl/source/helpers/validators.h"
#include "opencl/source/mem_obj/image.h" #include "opencl/source/mem_obj/image.h"
@@ -55,7 +55,7 @@ class PackedYuvImageTest : public testing::Test,
if (retVal != CL_SUCCESS) if (retVal != CL_SUCCESS)
return; return;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); 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; 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 surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto image = Image::create( auto image = Image::create(
&context, &context,
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, flags,
0, 0,
surfaceFormat, surfaceFormat,

View File

@@ -7,7 +7,7 @@
#include "shared/source/execution_environment/execution_environment.h" #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/mem_obj/mem_obj_helper.h"
#include "opencl/source/memory_manager/os_agnostic_memory_manager.h" #include "opencl/source/memory_manager/os_agnostic_memory_manager.h"
#include "opencl/test/unit_test/mocks/mock_execution_environment.h" #include "opencl/test/unit_test/mocks/mock_execution_environment.h"
@@ -50,37 +50,37 @@ TEST(MemoryManagerTest, givenAllowed32BitAndFroce32BitWhenGraphicsAllocationInDe
TEST(AllocationFlagsTest, givenAllocateMemoryFlagWhenGetAllocationFlagsIsCalledThenAllocateFlagIsCorrectlySet) { TEST(AllocationFlagsTest, givenAllocateMemoryFlagWhenGetAllocationFlagsIsCalledThenAllocateFlagIsCorrectlySet) {
HardwareInfo hwInfo(*defaultHwInfo); 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); 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); EXPECT_FALSE(allocationProperties2.flags.allocateMemory);
} }
TEST(UncacheableFlagsTest, givenUncachedResourceFlagWhenGetAllocationFlagsIsCalledThenUncacheableFlagIsCorrectlySet) { TEST(UncacheableFlagsTest, givenUncachedResourceFlagWhenGetAllocationFlagsIsCalledThenUncacheableFlagIsCorrectlySet) {
cl_mem_flags_intel flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE; cl_mem_flags_intel flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE;
HardwareInfo hwInfo(*defaultHwInfo); HardwareInfo hwInfo(*defaultHwInfo);
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, flagsIntel, 0); MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(0, flagsIntel, 0);
auto allocationFlags = MemoryPropertiesParserHelper::getAllocationProperties(0, memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {}); auto allocationFlags = MemoryPropertiesHelper::getAllocationProperties(0, memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {});
EXPECT_TRUE(allocationFlags.flags.uncacheable); EXPECT_TRUE(allocationFlags.flags.uncacheable);
flagsIntel = 0; flagsIntel = 0;
memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, flagsIntel, 0); memoryProperties = MemoryPropertiesHelper::createMemoryProperties(0, flagsIntel, 0);
auto allocationFlags2 = MemoryPropertiesParserHelper::getAllocationProperties(0, memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {}); auto allocationFlags2 = MemoryPropertiesHelper::getAllocationProperties(0, memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {});
EXPECT_FALSE(allocationFlags2.flags.uncacheable); EXPECT_FALSE(allocationFlags2.flags.uncacheable);
} }
TEST(AllocationFlagsTest, givenReadOnlyResourceFlagWhenGetAllocationFlagsIsCalledThenFlushL3FlagsAreCorrectlySet) { TEST(AllocationFlagsTest, givenReadOnlyResourceFlagWhenGetAllocationFlagsIsCalledThenFlushL3FlagsAreCorrectlySet) {
cl_mem_flags flags = CL_MEM_READ_ONLY; 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); HardwareInfo hwInfo(*defaultHwInfo);
auto allocationFlags = 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.flushL3RequiredForRead);
EXPECT_FALSE(allocationFlags.flags.flushL3RequiredForWrite); 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.flushL3RequiredForRead);
EXPECT_TRUE(allocationFlags2.flags.flushL3RequiredForWrite); EXPECT_TRUE(allocationFlags2.flags.flushL3RequiredForWrite);
} }

View File

@@ -9,7 +9,7 @@
#include "shared/source/helpers/aligned_memory.h" #include "shared/source/helpers/aligned_memory.h"
#include "shared/test/unit_test/mocks/mock_device.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/source/mem_obj/buffer.h"
#include "opencl/test/unit_test/mocks/mock_context.h" #include "opencl/test/unit_test/mocks/mock_context.h"
#include "opencl/test/unit_test/mocks/mock_graphics_allocation.h" #include "opencl/test/unit_test/mocks/mock_graphics_allocation.h"
@@ -36,10 +36,10 @@ class MockBuffer : public MockBufferStorage, public Buffer {
using MockBufferStorage::device; using MockBufferStorage::device;
MockBuffer(GraphicsAllocation &alloc) 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) { 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 { ~MockBuffer() override {
if (externalAlloc != nullptr) { if (externalAlloc != nullptr) {
@@ -57,9 +57,9 @@ class MockBuffer : public MockBufferStorage, public Buffer {
class AlignedBuffer : public MockBufferStorage, public Buffer { class AlignedBuffer : public MockBufferStorage, public Buffer {
public: public:
using MockBufferStorage::device; 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 { void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly) override {
Buffer::setSurfaceState(device.get(), memory, getSize(), getCpuAddress(), 0, &mockGfxAllocation, 0, 0); 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 { class UnalignedBuffer : public MockBufferStorage, public Buffer {
public: public:
using MockBufferStorage::device; 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 { void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly) override {
Buffer::setSurfaceState(device.get(), memory, getSize(), getCpuAddress(), 0, &mockGfxAllocation, 0, 0); Buffer::setSurfaceState(device.get(), memory, getSize(), getCpuAddress(), 0, &mockGfxAllocation, 0, 0);

View File

@@ -20,7 +20,7 @@
#include "shared/test/unit_test/cmd_parse/hw_parse.h" #include "shared/test/unit_test/cmd_parse/hw_parse.h"
#include "shared/test/unit_test/helpers/debug_manager_state_restore.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/mem_obj/buffer.h"
#include "opencl/source/os_interface/linux/drm_command_stream.h" #include "opencl/source/os_interface/linux/drm_command_stream.h"
#include "opencl/test/unit_test/fixtures/device_fixture.h" #include "opencl/test/unit_test/fixtures/device_fixture.h"
@@ -1346,7 +1346,7 @@ class DrmMockBuffer : public Buffer {
delete gfxAllocation; 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), data(data),
gfxAllocation(alloc) { gfxAllocation(alloc) {
} }

View File

@@ -28,7 +28,7 @@
#include "shared/test/unit_test/helpers/ult_hw_config.h" #include "shared/test/unit_test/helpers/ult_hw_config.h"
#include "opencl/source/event/event.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/buffer.h"
#include "opencl/source/mem_obj/image.h" #include "opencl/source/mem_obj/image.h"
#include "opencl/source/os_interface/linux/drm_command_stream.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; cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage); ASSERT_NE(nullptr, dstImage);
@@ -1380,7 +1380,7 @@ HWTEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageWithMipCountNo
cl_mem_flags flags = CL_MEM_WRITE_ONLY; cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage); ASSERT_NE(nullptr, dstImage);
@@ -1420,7 +1420,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageIsBeingCreatedAn
InjectedFunction method = [&](size_t failureIndex) { InjectedFunction method = [&](size_t failureIndex) {
cl_mem_flags flags = CL_MEM_WRITE_ONLY; cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
if (MemoryManagement::nonfailingAllocation == failureIndex) { if (MemoryManagement::nonfailingAllocation == failureIndex) {
EXPECT_NE(nullptr, dstImage.get()); 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; 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); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, 0, surfaceFormat, &imageDesc, data, retVal)); flags, 0, surfaceFormat, &imageDesc, data, retVal));
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage); 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; 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); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, 0, surfaceFormat, &imageDesc, data, retVal)); flags, 0, surfaceFormat, &imageDesc, data, retVal));
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage); 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; 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); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, 0, surfaceFormat, &imageDesc, data, retVal)); flags, 0, surfaceFormat, &imageDesc, data, retVal));
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage); ASSERT_NE(nullptr, dstImage);
@@ -1602,7 +1602,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenNonTiledImgWithMipCountNon
cl_mem_flags flags = CL_MEM_WRITE_ONLY; cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, 0, surfaceFormat, &imageDesc, data, retVal)); flags, 0, surfaceFormat, &imageDesc, data, retVal));
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage); 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; 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); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, 0, surfaceFormat, &imageDesc, data, retVal)); flags, 0, surfaceFormat, &imageDesc, data, retVal));
auto imageGraphicsAllocation = dstImage->getGraphicsAllocation(); auto imageGraphicsAllocation = dstImage->getGraphicsAllocation();
ASSERT_NE(nullptr, imageGraphicsAllocation); ASSERT_NE(nullptr, imageGraphicsAllocation);

View File

@@ -21,7 +21,7 @@
#include "shared/test/unit_test/mocks/mock_device.h" #include "shared/test/unit_test/mocks/mock_device.h"
#include "shared/test/unit_test/utilities/base_object_utils.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/buffer.h"
#include "opencl/source/mem_obj/image.h" #include "opencl/source/mem_obj/image.h"
#include "opencl/source/mem_obj/mem_obj_helper.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; cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage); ASSERT_NE(nullptr, dstImage);
@@ -672,7 +672,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageWithMipCountNo
cl_mem_flags flags = CL_MEM_WRITE_ONLY; cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage); 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; 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); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, 0, surfaceFormat, &imageDesc, data, retVal)); flags, 0, surfaceFormat, &imageDesc, data, retVal));
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage); 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; 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); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, 0, surfaceFormat, &imageDesc, data, retVal)); flags, 0, surfaceFormat, &imageDesc, data, retVal));
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage); ASSERT_NE(nullptr, dstImage);
@@ -765,7 +765,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenNonTiledImgWithMipCountN
cl_mem_flags flags = CL_MEM_WRITE_ONLY; cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal)); flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage); ASSERT_NE(nullptr, dstImage);

View File

@@ -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/mem_obj/mem_obj.h"
#include "opencl/source/sharings/sharing.h" #include "opencl/source/sharings/sharing.h"
#include "opencl/test/unit_test/mocks/mock_context.h" #include "opencl/test/unit_test/mocks/mock_context.h"
@@ -37,7 +37,7 @@ TEST(sharingHandler, givenMemObjWhenAcquireIncrementCounterThenReleaseShouldDecr
char buffer[64]; char buffer[64];
MockContext context; MockContext context;
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(buffer, sizeof(buffer)); MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(buffer, sizeof(buffer));
std::unique_ptr<MemObj> 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> 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)); sizeof(buffer), buffer, buffer, mockAllocation, true, false, false));
struct MockSharingHandler : SharingHandler { struct MockSharingHandler : SharingHandler {
@@ -62,7 +62,7 @@ TEST(sharingHandler, givenMemObjWhenAcquireTwoTimesThenReleaseShouldBeCalledTwoT
char buffer[64]; char buffer[64];
MockContext context; MockContext context;
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(buffer, sizeof(buffer)); MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(buffer, sizeof(buffer));
std::unique_ptr<MemObj> 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> 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)); sizeof(buffer), buffer, buffer, mockAllocation, true, false, false));
struct MockSharingHandler : SharingHandler { struct MockSharingHandler : SharingHandler {
@@ -107,7 +107,7 @@ TEST(sharingHandler, givenSharingHandlerWhenAcquiringThenReturnErrorCode) {
SharingHandler sharingHandler; SharingHandler sharingHandler;
MockContext context; MockContext context;
MockGraphicsAllocation *graphicsAllocation = new MockGraphicsAllocation(nullptr, 0); 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); 1, nullptr, nullptr, graphicsAllocation, true, false, false);
auto result = sharingHandler.acquire(&memObj); auto result = sharingHandler.acquire(&memObj);

View File

@@ -205,7 +205,7 @@ void *SVMAllocsManager::createZeroCopySvmAllocation(uint32_t rootDeviceIndex, si
GraphicsAllocation::AllocationType::SVM_ZERO_COPY, GraphicsAllocation::AllocationType::SVM_ZERO_COPY,
false, // isMultiStorageAllocation false, // isMultiStorageAllocation
deviceBitfield}; deviceBitfield};
MemoryPropertiesParserHelper::fillCachePolicyInProperties(properties, false, svmProperties.readOnly, false); MemoryPropertiesHelper::fillCachePolicyInProperties(properties, false, svmProperties.readOnly, false);
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties); GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
if (!allocation) { if (!allocation) {
return nullptr; return nullptr;
@@ -229,7 +229,7 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(uint32_t rootDe
false, // isMultiStorageAllocation false, // isMultiStorageAllocation
unifiedMemoryProperties.subdeviceBitfield}; unifiedMemoryProperties.subdeviceBitfield};
cpuProperties.alignment = 2 * MemoryConstants::megaByte; cpuProperties.alignment = 2 * MemoryConstants::megaByte;
MemoryPropertiesParserHelper::fillCachePolicyInProperties(cpuProperties, false, svmProperties.readOnly, false); MemoryPropertiesHelper::fillCachePolicyInProperties(cpuProperties, false, svmProperties.readOnly, false);
GraphicsAllocation *allocationCpu = memoryManager->allocateGraphicsMemoryWithProperties(cpuProperties); GraphicsAllocation *allocationCpu = memoryManager->allocateGraphicsMemoryWithProperties(cpuProperties);
if (!allocationCpu) { if (!allocationCpu) {
return nullptr; return nullptr;
@@ -247,7 +247,7 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(uint32_t rootDe
unifiedMemoryProperties.subdeviceBitfield}; unifiedMemoryProperties.subdeviceBitfield};
gpuProperties.alignment = 2 * MemoryConstants::megaByte; 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); GraphicsAllocation *allocationGpu = memoryManager->allocateGraphicsMemoryWithProperties(gpuProperties, svmPtr);
if (!allocationGpu) { if (!allocationGpu) {
memoryManager->freeGraphicsMemory(allocationCpu); memoryManager->freeGraphicsMemory(allocationCpu);