Remove OCL object from MemoryProperties 13/n

Refactor parseMemoryProperties and createMemoryPropertiesFlags functions

Related-To: NEO-3132
Change-Id: I61aaae69b84d8b0f77c08a59010879cc3a93e6cf
Signed-off-by: Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Gibala
2019-10-22 19:51:53 +02:00
committed by sys_ocldev
parent 37136df1b4
commit a32f537601
60 changed files with 397 additions and 378 deletions

View File

@@ -593,7 +593,7 @@ cl_mem CL_API_CALL clCreateBuffer(cl_context context,
propertiesStruct.flags = flags;
if (isFieldValid(propertiesStruct.flags, MemObjHelper::validFlagsForBuffer)) {
Buffer::validateInputAndCreateBuffer(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(propertiesStruct), flags, 0, size, hostPtr, retVal, buffer);
Buffer::validateInputAndCreateBuffer(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, size, hostPtr, retVal, buffer);
} else {
retVal = CL_INVALID_VALUE;
}
@@ -620,9 +620,11 @@ cl_mem CL_API_CALL clCreateBufferWithPropertiesINTEL(cl_context context,
cl_mem buffer = nullptr;
ErrorCodeHelper err(errcodeRet, CL_SUCCESS);
MemoryProperties propertiesStruct;
if (MemoryPropertiesParser::parseMemoryProperties(properties, propertiesStruct, MemoryPropertiesParser::MemoryPropertiesParser::ObjType::BUFFER)) {
Buffer::validateInputAndCreateBuffer(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(propertiesStruct), propertiesStruct.flags, propertiesStruct.flagsIntel, size, hostPtr, retVal, buffer);
MemoryPropertiesFlags memoryProperties;
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
if (MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, MemoryPropertiesParser::MemoryPropertiesParser::ObjType::BUFFER)) {
Buffer::validateInputAndCreateBuffer(context, memoryProperties, flags, flagsIntel, size, hostPtr, retVal, buffer);
} else {
retVal = CL_INVALID_VALUE;
}
@@ -660,6 +662,7 @@ cl_mem CL_API_CALL clCreateSubBuffer(cl_mem buffer,
}
cl_mem_flags parentFlags = parentBuffer->getMemoryPropertiesFlags();
cl_mem_flags_intel parentFlagsIntel = parentBuffer->getMemoryPropertiesFlagsIntel();
if (parentBuffer->isSubBuffer() == true) {
retVal = CL_INVALID_MEM_OBJECT;
@@ -725,7 +728,7 @@ cl_mem CL_API_CALL clCreateSubBuffer(cl_mem buffer,
break;
}
subBuffer = parentBuffer->createSubBuffer(flags, region, retVal);
subBuffer = parentBuffer->createSubBuffer(flags, parentFlagsIntel, region, retVal);
} while (false);
if (errcodeRet) {
@@ -765,7 +768,7 @@ cl_mem CL_API_CALL clCreateImage(cl_context context,
if (retVal == CL_SUCCESS) {
MemoryProperties propertiesStruct(flags);
if (isFieldValid(propertiesStruct.flags, MemObjHelper::validFlagsForImage)) {
image = Image::validateAndCreateImage(pContext, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(propertiesStruct), flags, 0, imageFormat, imageDesc, hostPtr, retVal);
image = Image::validateAndCreateImage(pContext, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, imageFormat, imageDesc, hostPtr, retVal);
} else {
retVal = CL_INVALID_VALUE;
}
@@ -799,12 +802,14 @@ cl_mem CL_API_CALL clCreateImageWithPropertiesINTEL(cl_context context,
cl_mem image = nullptr;
Context *pContext = nullptr;
MemoryProperties propertiesStruct{};
MemoryPropertiesFlags memoryProperties;
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
retVal = validateObjects(WithCastToInternal(context, &pContext));
if (retVal == CL_SUCCESS) {
if (MemoryPropertiesParser::parseMemoryProperties(properties, propertiesStruct, MemoryPropertiesParser::MemoryPropertiesParser::ObjType::IMAGE)) {
image = Image::validateAndCreateImage(pContext, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(propertiesStruct), propertiesStruct.flags, propertiesStruct.flagsIntel, imageFormat, imageDesc, hostPtr, retVal);
if (MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, MemoryPropertiesParser::MemoryPropertiesParser::ObjType::IMAGE)) {
image = Image::validateAndCreateImage(pContext, memoryProperties, flags, flagsIntel, imageFormat, imageDesc, hostPtr, retVal);
} else {
retVal = CL_INVALID_VALUE;
}
@@ -851,7 +856,7 @@ cl_mem CL_API_CALL clCreateImage2D(cl_context context,
if (retVal == CL_SUCCESS) {
MemoryProperties propertiesStruct(flags);
image2D = Image::validateAndCreateImage(pContext, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(propertiesStruct), flags, 0, imageFormat, &imageDesc, hostPtr, retVal);
image2D = Image::validateAndCreateImage(pContext, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(propertiesStruct.flags, propertiesStruct.flagsIntel), flags, 0, imageFormat, &imageDesc, hostPtr, retVal);
}
ErrorCodeHelper err(errcodeRet, retVal);
@@ -902,7 +907,7 @@ cl_mem CL_API_CALL clCreateImage3D(cl_context context,
if (retVal == CL_SUCCESS) {
MemoryProperties propertiesStruct(flags);
image3D = Image::validateAndCreateImage(pContext, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(propertiesStruct), flags, 0, imageFormat, &imageDesc, hostPtr, retVal);
image3D = Image::validateAndCreateImage(pContext, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, imageFormat, &imageDesc, hostPtr, retVal);
}
ErrorCodeHelper err(errcodeRet, retVal);
@@ -1063,7 +1068,7 @@ cl_int CL_API_CALL clGetImageParamsINTEL(cl_context context,
}
if (CL_SUCCESS == retVal) {
surfaceFormat = (SurfaceFormatInfo *)Image::getSurfaceFormatFromTable(memFlags, imageFormat);
retVal = Image::validate(pContext, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({memFlags}), surfaceFormat, imageDesc, nullptr);
retVal = Image::validate(pContext, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(memFlags, 0), surfaceFormat, imageDesc, nullptr);
}
if (CL_SUCCESS == retVal) {
retVal = Image::getImageParams(pContext, memFlags, surfaceFormat, imageDesc, imageRowPitch, imageSlicePitch);

View File

@@ -7,11 +7,12 @@
#include "runtime/helpers/mem_properties_parser_helper.h"
#include "runtime/helpers/memory_properties_flags_helpers.h"
#include "runtime/mem_obj/mem_obj_helper.h"
namespace NEO {
bool NEO::MemoryPropertiesParser::parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryProperties &propertiesStruct, ObjType objectType) {
bool NEO::MemoryPropertiesParser::parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryPropertiesFlags &memoryProperties, cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel, ObjType objectType) {
if (properties == nullptr) {
return true;
}
@@ -19,23 +20,25 @@ bool NEO::MemoryPropertiesParser::parseMemoryProperties(const cl_mem_properties_
for (int i = 0; properties[i] != 0; i += 2) {
switch (properties[i]) {
case CL_MEM_FLAGS:
propertiesStruct.flags |= static_cast<cl_mem_flags>(properties[i + 1]);
flags |= static_cast<cl_mem_flags>(properties[i + 1]);
break;
case CL_MEM_FLAGS_INTEL:
propertiesStruct.flagsIntel |= static_cast<cl_mem_flags_intel>(properties[i + 1]);
flagsIntel |= static_cast<cl_mem_flags_intel>(properties[i + 1]);
break;
default:
return false;
}
}
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
switch (objectType) {
case MemoryPropertiesParser::ObjType::BUFFER:
return isFieldValid(propertiesStruct.flags, MemObjHelper::validFlagsForBuffer) &&
isFieldValid(propertiesStruct.flagsIntel, MemObjHelper::validFlagsForBufferIntel);
return isFieldValid(flags, MemObjHelper::validFlagsForBuffer) &&
isFieldValid(flagsIntel, MemObjHelper::validFlagsForBufferIntel);
case MemoryPropertiesParser::ObjType::IMAGE:
return isFieldValid(propertiesStruct.flags, MemObjHelper::validFlagsForImage) &&
isFieldValid(propertiesStruct.flagsIntel, MemObjHelper::validFlagsForImageIntel);
return isFieldValid(flags, MemObjHelper::validFlagsForImage) &&
isFieldValid(flagsIntel, MemObjHelper::validFlagsForImageIntel);
default:
break;
}

View File

@@ -22,7 +22,7 @@ class MemoryPropertiesParser {
IMAGE,
};
static bool parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryProperties &propertiesStruct, ObjType objectType);
static bool parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryPropertiesFlags &memoryProperties, cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel, ObjType objectType);
static AllocationProperties getAllocationProperties(MemoryPropertiesFlags memoryProperties, bool allocateMemory,
size_t size, GraphicsAllocation::AllocationType type, bool multiStorageResource) {

View File

@@ -9,7 +9,7 @@
namespace NEO {
void MemoryPropertiesFlagsParser::addExtraMemoryPropertiesFlags(MemoryPropertiesFlags &propertiesFlag, MemoryProperties properties) {
void MemoryPropertiesFlagsParser::addExtraMemoryPropertiesFlags(MemoryPropertiesFlags &propertiesFlag, cl_mem_flags flags, cl_mem_flags_intel flagsIntel) {
}
} // namespace NEO

View File

@@ -13,8 +13,8 @@ namespace NEO {
class MemoryPropertiesFlagsParser {
public:
static void addExtraMemoryPropertiesFlags(MemoryPropertiesFlags &propertiesFlags, MemoryProperties properties);
static void addExtraMemoryPropertiesFlags(MemoryPropertiesFlags &propertiesFlags, cl_mem_flags flags, cl_mem_flags_intel flagsIntel);
static MemoryPropertiesFlags createMemoryPropertiesFlags(MemoryProperties properties);
static MemoryPropertiesFlags createMemoryPropertiesFlags(cl_mem_flags flags, cl_mem_flags_intel flagsIntel);
};
} // namespace NEO

View File

@@ -13,66 +13,66 @@
namespace NEO {
MemoryPropertiesFlags MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(MemoryProperties properties) {
MemoryPropertiesFlags MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(cl_mem_flags flags, cl_mem_flags_intel flagsIntel) {
MemoryPropertiesFlags memoryPropertiesFlags;
if (isValueSet(properties.flags, CL_MEM_READ_WRITE)) {
if (isValueSet(flags, CL_MEM_READ_WRITE)) {
memoryPropertiesFlags.flags.readWrite = true;
}
if (isValueSet(properties.flags, CL_MEM_WRITE_ONLY)) {
if (isValueSet(flags, CL_MEM_WRITE_ONLY)) {
memoryPropertiesFlags.flags.writeOnly = true;
}
if (isValueSet(properties.flags, CL_MEM_READ_ONLY)) {
if (isValueSet(flags, CL_MEM_READ_ONLY)) {
memoryPropertiesFlags.flags.readOnly = true;
}
if (isValueSet(properties.flags, CL_MEM_USE_HOST_PTR)) {
if (isValueSet(flags, CL_MEM_USE_HOST_PTR)) {
memoryPropertiesFlags.flags.useHostPtr = true;
}
if (isValueSet(properties.flags, CL_MEM_ALLOC_HOST_PTR)) {
if (isValueSet(flags, CL_MEM_ALLOC_HOST_PTR)) {
memoryPropertiesFlags.flags.allocHostPtr = true;
}
if (isValueSet(properties.flags, CL_MEM_COPY_HOST_PTR)) {
if (isValueSet(flags, CL_MEM_COPY_HOST_PTR)) {
memoryPropertiesFlags.flags.copyHostPtr = true;
}
if (isValueSet(properties.flags, CL_MEM_HOST_WRITE_ONLY)) {
if (isValueSet(flags, CL_MEM_HOST_WRITE_ONLY)) {
memoryPropertiesFlags.flags.hostWriteOnly = true;
}
if (isValueSet(properties.flags, CL_MEM_HOST_READ_ONLY)) {
if (isValueSet(flags, CL_MEM_HOST_READ_ONLY)) {
memoryPropertiesFlags.flags.hostReadOnly = true;
}
if (isValueSet(properties.flags, CL_MEM_HOST_NO_ACCESS)) {
if (isValueSet(flags, CL_MEM_HOST_NO_ACCESS)) {
memoryPropertiesFlags.flags.hostNoAccess = true;
}
if (isValueSet(properties.flags, CL_MEM_KERNEL_READ_AND_WRITE)) {
if (isValueSet(flags, CL_MEM_KERNEL_READ_AND_WRITE)) {
memoryPropertiesFlags.flags.kernelReadAndWrite = true;
}
if (isValueSet(properties.flags, CL_MEM_FORCE_LINEAR_STORAGE_INTEL) ||
isValueSet(properties.flagsIntel, CL_MEM_FORCE_LINEAR_STORAGE_INTEL)) {
if (isValueSet(flags, CL_MEM_FORCE_LINEAR_STORAGE_INTEL) ||
isValueSet(flagsIntel, CL_MEM_FORCE_LINEAR_STORAGE_INTEL)) {
memoryPropertiesFlags.flags.forceLinearStorage = true;
}
if (isValueSet(properties.flags, CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL)) {
if (isValueSet(flags, CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL)) {
memoryPropertiesFlags.flags.accessFlagsUnrestricted = true;
}
if (isValueSet(properties.flags, CL_MEM_NO_ACCESS_INTEL)) {
if (isValueSet(flags, CL_MEM_NO_ACCESS_INTEL)) {
memoryPropertiesFlags.flags.noAccess = true;
}
if (isValueSet(properties.flags, CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL) ||
isValueSet(properties.flagsIntel, CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL)) {
if (isValueSet(flags, CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL) ||
isValueSet(flagsIntel, CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL)) {
memoryPropertiesFlags.flags.allowUnrestrictedSize = true;
}
if (isValueSet(properties.flagsIntel, CL_MEM_LOCALLY_UNCACHED_RESOURCE)) {
if (isValueSet(flagsIntel, CL_MEM_LOCALLY_UNCACHED_RESOURCE)) {
memoryPropertiesFlags.flags.locallyUncachedResource = true;
}
if (isValueSet(properties.flagsIntel, CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE)) {
if (isValueSet(flagsIntel, CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE)) {
memoryPropertiesFlags.flags.locallyUncachedInSurfaceState = true;
}
if (isValueSet(properties.flags, CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL)) {
if (isValueSet(flags, CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL)) {
memoryPropertiesFlags.flags.forceSharedPhysicalMemory = true;
}
addExtraMemoryPropertiesFlags(memoryPropertiesFlags, properties);
addExtraMemoryPropertiesFlags(memoryPropertiesFlags, flags, flagsIntel);
return memoryPropertiesFlags;
}

View File

@@ -126,7 +126,7 @@ Buffer *Buffer::create(Context *context,
size_t size,
void *hostPtr,
cl_int &errcodeRet) {
return create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, size, hostPtr, errcodeRet);
return create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, size, hostPtr, errcodeRet);
}
Buffer *Buffer::create(Context *context,
@@ -321,7 +321,7 @@ Buffer *Buffer::create(Context *context,
Buffer *Buffer::createSharedBuffer(Context *context, cl_mem_flags flags, SharingHandler *sharingHandler,
GraphicsAllocation *graphicsAllocation) {
auto sharedBuffer = createBufferHw(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, graphicsAllocation->getUnderlyingBufferSize(), nullptr, nullptr, graphicsAllocation, false, false, false);
auto sharedBuffer = createBufferHw(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, graphicsAllocation->getUnderlyingBufferSize(), nullptr, nullptr, graphicsAllocation, false, false, false);
sharedBuffer->setSharingHandler(sharingHandler);
return sharedBuffer;
@@ -401,10 +401,11 @@ bool Buffer::isReadOnlyMemoryPermittedByFlags(const MemoryPropertiesFlags &prope
}
Buffer *Buffer::createSubBuffer(cl_mem_flags flags,
cl_mem_flags_intel flagsIntel,
const cl_buffer_region *region,
cl_int &errcodeRet) {
DEBUG_BREAK_IF(nullptr == createFunction);
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
auto buffer = createFunction(this->context, memoryProperties, flags, 0, region->size,
ptrOffset(this->memoryStorage, region->origin),
this->hostPtr ? ptrOffset(this->hostPtr, region->origin) : nullptr,
@@ -536,7 +537,7 @@ Buffer *Buffer::createBufferHwFromDevice(const Device *device,
auto funcCreate = bufferFactory[hwInfo.platform.eRenderCoreFamily].createBufferFunction;
DEBUG_BREAK_IF(nullptr == funcCreate);
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
auto pBuffer = funcCreate(nullptr, memoryProperties, flags, flagsIntel, size, memoryStorage, hostPtr, gfxAllocation,
zeroCopy, isHostPtrSVM, isImageRedescribed);
pBuffer->executionEnvironment = device->getExecutionEnvironment();

View File

@@ -19,7 +19,6 @@ namespace NEO {
class Buffer;
class Device;
class MemoryManager;
struct MemoryProperties;
typedef Buffer *(*BufferCreatFunc)(Context *context,
MemoryPropertiesFlags memoryProperties,
@@ -100,6 +99,7 @@ class Buffer : public MemObj {
bool isImageRedescribed);
Buffer *createSubBuffer(cl_mem_flags flags,
cl_mem_flags_intel flagsIntel,
const cl_buffer_region *region,
cl_int &errcodeRet);

View File

@@ -421,7 +421,7 @@ Image *Image::createImageHw(Context *context, const MemoryPropertiesFlags &memor
Image *Image::createSharedImage(Context *context, SharingHandler *sharingHandler, McsSurfaceInfo &mcsSurfaceInfo,
GraphicsAllocation *graphicsAllocation, GraphicsAllocation *mcsAllocation,
cl_mem_flags flags, ImageInfo &imgInfo, uint32_t cubeFaceIndex, uint32_t baseMipLevel, uint32_t mipCount) {
auto sharedImage = createImageHw(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, graphicsAllocation->getUnderlyingBufferSize(),
auto sharedImage = createImageHw(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, graphicsAllocation->getUnderlyingBufferSize(),
nullptr, imgInfo.surfaceFormat->OCLImageFormat, *imgInfo.imgDesc, false, graphicsAllocation, false, baseMipLevel, mipCount, imgInfo.surfaceFormat);
sharedImage->setSharingHandler(sharingHandler);
sharedImage->setMcsAllocation(mcsAllocation);
@@ -859,7 +859,7 @@ Image *Image::redescribeFillImage() {
imageFormatNew.image_channel_data_type = surfaceFormat->OCLImageFormat.image_channel_data_type;
DEBUG_BREAK_IF(nullptr == createFunction);
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags | CL_MEM_USE_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags | CL_MEM_USE_HOST_PTR, flagsIntel);
auto image = createFunction(context,
memoryProperties,
flags | CL_MEM_USE_HOST_PTR,
@@ -909,7 +909,7 @@ Image *Image::redescribe() {
imageFormatNew.image_channel_data_type = surfaceFormat->OCLImageFormat.image_channel_data_type;
DEBUG_BREAK_IF(nullptr == createFunction);
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags | CL_MEM_USE_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags | CL_MEM_USE_HOST_PTR, flagsIntel);
auto image = createFunction(context,
memoryProperties,
flags | CL_MEM_USE_HOST_PTR,
@@ -971,7 +971,7 @@ cl_int Image::writeNV12Planes(const void *hostPtr, size_t hostPtrRowPitch) {
// Create NV12 UV Plane image
std::unique_ptr<Image> imageYPlane(Image::create(
context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -995,7 +995,7 @@ cl_int Image::writeNV12Planes(const void *hostPtr, size_t hostPtrRowPitch) {
// Create NV12 UV Plane image
std::unique_ptr<Image> imageUVPlane(Image::create(
context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,

View File

@@ -124,6 +124,7 @@ class MemObj : public BaseObject<_cl_mem> {
}
const cl_mem_flags &getMemoryPropertiesFlags() const { return flags; }
const cl_mem_flags &getMemoryPropertiesFlagsIntel() const { return flagsIntel; }
protected:
void getOsSpecificMemObjectInfo(const cl_mem_info &paramName, size_t *srcParamSize, void **srcParam);

View File

@@ -24,7 +24,7 @@ Pipe::Pipe(Context *context,
GraphicsAllocation *gfxAllocation)
: MemObj(context,
CL_MEM_OBJECT_PIPE,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace),
@@ -51,8 +51,7 @@ Pipe *Pipe::create(Context *context,
MemoryManager *memoryManager = context->getMemoryManager();
DEBUG_BREAK_IF(!memoryManager);
MemoryProperties memoryProperties{flags};
MemoryPropertiesFlags memoryPropertiesFlags = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(memoryProperties);
MemoryPropertiesFlags memoryPropertiesFlags = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0);
while (true) {
auto size = static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace);
AllocationProperties allocProperties =

View File

@@ -93,8 +93,7 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo
imgDesc.image_width /= 2;
imgDesc.image_height /= 2;
}
MemoryProperties properties{flags};
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0);
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(imgInfo, true, memoryProperties);
allocProperties.allocationType = GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY;

View File

@@ -86,7 +86,7 @@ HWTEST_P(AUBCopyImage, simple) {
auto retVal = CL_INVALID_VALUE;
srcImage.reset(Image::create(
context.get(),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -97,7 +97,7 @@ HWTEST_P(AUBCopyImage, simple) {
dstImage.reset(Image::create(
context.get(),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,

View File

@@ -175,7 +175,7 @@ HWTEST_P(AubFillImage, simple) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
image.reset(Image::create(
context.get(),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,

View File

@@ -125,7 +125,7 @@ HWTEST_P(AUBMapImage, MapUpdateUnmapVerify) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
srcImage.reset(Image::create(
context.get(),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,

View File

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

View File

@@ -143,7 +143,7 @@ HWTEST_P(AUBReadImage, simpleUnalignedMemory) {
auto retVal = CL_INVALID_VALUE;
srcImage.reset(Image::create(
context.get(),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,

View File

@@ -81,7 +81,7 @@ struct AUBImageUnaligned
auto image = std::unique_ptr<Image>(Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -176,7 +176,7 @@ struct AUBImageUnaligned
auto image = std::unique_ptr<Image>(Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,

View File

@@ -72,7 +72,7 @@ HWTEST_P(VerifyMemoryImageHw, givenDifferentImagesWhenValidatingMemoryThenSucces
auto retVal = CL_INVALID_VALUE;
std::unique_ptr<Image> image(Image::create(
context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,

View File

@@ -137,7 +137,7 @@ HWTEST_P(AUBWriteImage, simpleUnalignedMemory) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
dstImage.reset(Image::create(
context.get(),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,

View File

@@ -332,7 +332,7 @@ SKLTEST_F(AUBRunKernelIntegrateTest, deviceSideVme) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
auto srcImage = Image::create(
context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -343,7 +343,7 @@ SKLTEST_F(AUBRunKernelIntegrateTest, deviceSideVme) {
auto refImage = Image::create(
context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,

View File

@@ -111,7 +111,7 @@ HWTEST_P(AUBCreateImageArray, CheckArrayImages) {
image.reset(Image::create(
context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -230,7 +230,7 @@ HWTEST_P(AUBCreateImageHostPtr, imageWithDoubledRowPitchThatIsCreatedWithCopyHos
data += passedRowPitch;
}
image.reset(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
image.reset(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, pHostPtr, retVal));
ASSERT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(image->getImageDesc().image_row_pitch, imgInfo.rowPitch);
@@ -303,7 +303,7 @@ HWTEST_P(AUBCreateImageHostPtr, imageWithRowPitchCreatedWithUseHostPtrFlagCopied
}
image.reset(Image::create(
context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -400,7 +400,7 @@ HWTEST_F(AUBCreateImage, image3DCreatedWithDoubledSlicePitchWhenQueriedForDataRe
}
cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
image.reset(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
image.reset(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, host_ptr, retVal));
depthToCopy = imageDesc.image_depth;

View File

@@ -919,7 +919,7 @@ TEST_F(EnqueueMapImageTest, givenImage1DArrayWhenEnqueueMapImageIsCalledThenRetu
class MockImage : public Image {
public:
MockImage(Context *context, cl_mem_flags flags, GraphicsAllocation *allocation, const SurfaceFormatInfo &surfaceFormat,
const cl_image_format &imageFormat, const cl_image_desc &imageDesc) : Image(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0,
const cl_image_format &imageFormat, const cl_image_desc &imageDesc) : Image(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0,
0, nullptr,
imageFormat, imageDesc,
true,

View File

@@ -214,7 +214,7 @@ HWTEST_F(EnqueueThreading, enqueueCopyBufferToImage) {
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> dstImage(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
std::unique_ptr<Image> dstImage(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, dstImage.get());
size_t dstOrigin[3] = {1024u, 1, 0};
@@ -238,9 +238,9 @@ HWTEST_F(EnqueueThreading, enqueueCopyImage) {
imageDesc.image_width = 1024u;
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> srcImage(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
std::unique_ptr<Image> srcImage(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, srcImage.get());
std::unique_ptr<Image> dstImage(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
std::unique_ptr<Image> dstImage(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, srcImage.get());
size_t srcOrigin[3] = {1024u, 1, 0};
@@ -266,7 +266,7 @@ HWTEST_F(EnqueueThreading, enqueueCopyImageToBuffer) {
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> srcImage(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
std::unique_ptr<Image> srcImage(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, srcImage.get());
std::unique_ptr<Buffer> dstBuffer(Buffer::create(context, CL_MEM_READ_WRITE, 1024u, nullptr, retVal));
@@ -305,7 +305,7 @@ HWTEST_F(EnqueueThreading, enqueueFillImage) {
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> image(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
std::unique_ptr<Image> image(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, image.get());
size_t origin[3] = {1024u, 1, 0};
@@ -351,7 +351,7 @@ HWTEST_F(EnqueueThreading, enqueueReadImage) {
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> image(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
std::unique_ptr<Image> image(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, image.get());
void *ptr = ::alignedMalloc(1024u, 4096);
@@ -401,7 +401,7 @@ HWTEST_F(EnqueueThreading, enqueueWriteImage) {
cl_mem_flags flags = CL_MEM_READ_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> image(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
std::unique_ptr<Image> image(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, image.get());
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);
cl_int retVal = CL_SUCCESS;
auto img = Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({Traits::flags}), Traits::flags, 0, surfaceFormat, &Traits::imageDesc, Traits::hostPtr, retVal);
auto img = Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(Traits::flags, 0), Traits::flags, 0, surfaceFormat, &Traits::imageDesc, Traits::hostPtr, retVal);
auto mockImage = static_cast<MockImage<FamilyType> *>(img);
return std::unique_ptr<MockImage<FamilyType>>(mockImage);

View File

@@ -632,7 +632,7 @@ HWTEST_F(BcsTests, givenBufferWhenBlitOperationCalledThenProgramCorrectGpuAddres
const size_t subBuffer1Offset = 0x23;
cl_buffer_region subBufferRegion1 = {subBuffer1Offset, 1};
auto subBuffer1 = clUniquePtr<Buffer>(buffer1->createSubBuffer(CL_MEM_READ_WRITE, &subBufferRegion1, retVal));
auto subBuffer1 = clUniquePtr<Buffer>(buffer1->createSubBuffer(CL_MEM_READ_WRITE, 0, &subBufferRegion1, retVal));
{
// from hostPtr

View File

@@ -465,13 +465,12 @@ TEST_F(PerformanceHintTest, given64bitCompressedBufferWhenItsCreatedThenProperPe
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
cl_device_id deviceId = static_cast<cl_device_id>(device.get());
const MemoryProperties properties(1 << 21);
size_t size = 8192u;
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, DeviceVector(&deviceId, 1), callbackFunction, static_cast<void *>(userData), retVal));
context->isSharedContext = false;
auto buffer = std::unique_ptr<Buffer>(Buffer::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties), (1 << 21), 0, size, static_cast<void *>(NULL), retVal));
auto buffer = std::unique_ptr<Buffer>(Buffer::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags((1 << 21), 0), (1 << 21), 0, size, static_cast<void *>(NULL), retVal));
snprintf(expectedHint, DriverDiagnostics::maxHintStringSize, DriverDiagnostics::hintFormat[BUFFER_IS_COMPRESSED], buffer.get());
auto compressionSupported = HwHelper::get(hwInfo.platform.eRenderCoreFamily).obtainRenderBufferCompressionPreference(hwInfo, size) &&
HwHelper::renderCompressedBuffersSupported(hwInfo);
@@ -489,8 +488,7 @@ TEST_F(PerformanceHintTest, givenUncompressedBufferWhenItsCreatedThenProperPerfo
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
cl_device_id deviceId = static_cast<cl_device_id>(device.get());
const MemoryProperties properties(CL_MEM_READ_WRITE);
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0);
size_t size = 0u;
@@ -562,7 +560,7 @@ TEST_F(PerformanceHintTest, givenCompressedImageWhenItsCreatedThenProperPerforma
auto image = std::unique_ptr<Image>(Image::create(
context.get(),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -621,7 +619,7 @@ TEST_F(PerformanceHintTest, givenImageWithNoGmmWhenItsCreatedThenNoPerformanceHi
auto image = std::unique_ptr<Image>(Image::create(
context.get(),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -682,7 +680,7 @@ TEST_F(PerformanceHintTest, givenUncompressedImageWhenItsCreatedThenProperPerfor
auto image = std::unique_ptr<Image>(Image::create(
context.get(),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,

View File

@@ -76,7 +76,7 @@ struct ImageHelper {
auto surfaceFormat = Image::getSurfaceFormatFromTable(Traits::flags, imgFormat);
auto image = Image::create(
context,
NEO::MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({Traits::flags}),
NEO::MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(Traits::flags, 0),
Traits::flags,
0,
surfaceFormat,

View File

@@ -36,7 +36,7 @@ struct AppendSurfaceStateParamsTest : public ::testing::Test {
void createImage() {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
EXPECT_NE(nullptr, surfaceFormat);
image.reset(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
image.reset(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
}
cl_int retVal = CL_SUCCESS;

View File

@@ -275,7 +275,7 @@ TEST(CastToImage, fromMemObj) {
extern std::thread::id tempThreadID;
class MockBuffer : public MockBufferStorage, public Buffer {
public:
MockBuffer() : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data, &mockGfxAllocation, true, false, false) {
MockBuffer() : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 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 {

View File

@@ -14,17 +14,21 @@
using namespace NEO;
TEST(MemoryPropertiesParser, givenNullPropertiesWhenParsingMemoryPropertiesThenTrueIsReturned) {
MemoryProperties propertiesStruct;
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(nullptr, propertiesStruct, MemoryPropertiesParser::MemoryPropertiesParser::ObjType::UNKNOWN));
MemoryPropertiesFlags memoryProperties;
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(nullptr, memoryProperties, flags, flagsIntel, MemoryPropertiesParser::MemoryPropertiesParser::ObjType::UNKNOWN));
}
TEST(MemoryPropertiesParser, givenEmptyPropertiesWhenParsingMemoryPropertiesThenTrueIsReturned) {
cl_mem_properties_intel properties[] = {0};
MemoryProperties propertiesStruct;
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(properties, propertiesStruct, MemoryPropertiesParser::MemoryPropertiesParser::ObjType::UNKNOWN));
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(properties, propertiesStruct, MemoryPropertiesParser::MemoryPropertiesParser::ObjType::BUFFER));
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(properties, propertiesStruct, MemoryPropertiesParser::MemoryPropertiesParser::ObjType::IMAGE));
MemoryPropertiesFlags memoryProperties;
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, MemoryPropertiesParser::MemoryPropertiesParser::ObjType::UNKNOWN));
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, MemoryPropertiesParser::MemoryPropertiesParser::ObjType::BUFFER));
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, MemoryPropertiesParser::MemoryPropertiesParser::ObjType::IMAGE));
}
TEST(MemoryPropertiesParser, givenValidPropertiesWhenParsingMemoryPropertiesThenTrueIsReturned) {
@@ -36,8 +40,10 @@ TEST(MemoryPropertiesParser, givenValidPropertiesWhenParsingMemoryPropertiesThen
CL_MEM_LOCALLY_UNCACHED_RESOURCE | CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE,
0};
MemoryProperties propertiesStruct;
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(properties, propertiesStruct, MemoryPropertiesParser::ObjType::UNKNOWN));
MemoryPropertiesFlags memoryProperties;
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, MemoryPropertiesParser::ObjType::UNKNOWN));
}
TEST(MemoryPropertiesParser, givenValidPropertiesWhenParsingMemoryPropertiesForBufferThenTrueIsReturned) {
@@ -48,8 +54,10 @@ TEST(MemoryPropertiesParser, givenValidPropertiesWhenParsingMemoryPropertiesForB
MemObjHelper::validFlagsForBufferIntel,
0};
MemoryProperties propertiesStruct;
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(properties, propertiesStruct, MemoryPropertiesParser::ObjType::BUFFER));
MemoryPropertiesFlags memoryProperties;
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, MemoryPropertiesParser::ObjType::BUFFER));
}
TEST(MemoryPropertiesParser, givenValidPropertiesWhenParsingMemoryPropertiesForImageThenTrueIsReturned) {
@@ -60,8 +68,10 @@ TEST(MemoryPropertiesParser, givenValidPropertiesWhenParsingMemoryPropertiesForI
MemObjHelper::validFlagsForImageIntel,
0};
MemoryProperties propertiesStruct;
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(properties, propertiesStruct, MemoryPropertiesParser::ObjType::IMAGE));
MemoryPropertiesFlags memoryProperties;
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, MemoryPropertiesParser::ObjType::IMAGE));
}
TEST(MemoryPropertiesParser, givenInvalidPropertiesWhenParsingMemoryPropertiesThenFalseIsReturned) {
@@ -69,10 +79,12 @@ TEST(MemoryPropertiesParser, givenInvalidPropertiesWhenParsingMemoryPropertiesTh
(1 << 30), CL_MEM_ALLOC_HOST_PTR | CL_MEM_COPY_HOST_PTR | CL_MEM_USE_HOST_PTR,
0};
MemoryProperties propertiesStruct;
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, propertiesStruct, MemoryPropertiesParser::ObjType::UNKNOWN));
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, propertiesStruct, MemoryPropertiesParser::ObjType::BUFFER));
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, propertiesStruct, MemoryPropertiesParser::ObjType::IMAGE));
MemoryPropertiesFlags memoryProperties;
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, MemoryPropertiesParser::ObjType::UNKNOWN));
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, MemoryPropertiesParser::ObjType::BUFFER));
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, MemoryPropertiesParser::ObjType::IMAGE));
}
TEST(MemoryPropertiesParser, givenInvalidPropertiesWhenParsingMemoryPropertiesForImageThenFalseIsReturned) {
@@ -83,8 +95,10 @@ TEST(MemoryPropertiesParser, givenInvalidPropertiesWhenParsingMemoryPropertiesFo
MemObjHelper::validFlagsForBufferIntel,
0};
MemoryProperties propertiesStruct;
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, propertiesStruct, MemoryPropertiesParser::ObjType::IMAGE));
MemoryPropertiesFlags memoryProperties;
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, MemoryPropertiesParser::ObjType::IMAGE));
}
TEST(MemoryPropertiesParser, givenInvalidFlagsWhenParsingMemoryPropertiesForImageThenFalseIsReturned) {
@@ -95,8 +109,10 @@ TEST(MemoryPropertiesParser, givenInvalidFlagsWhenParsingMemoryPropertiesForImag
MemObjHelper::validFlagsForImageIntel,
0};
MemoryProperties propertiesStruct;
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, propertiesStruct, MemoryPropertiesParser::ObjType::IMAGE));
MemoryPropertiesFlags memoryProperties;
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, MemoryPropertiesParser::ObjType::IMAGE));
}
TEST(MemoryPropertiesParser, givenInvalidFlagsIntelWhenParsingMemoryPropertiesForImageThenFalseIsReturned) {
@@ -107,8 +123,10 @@ TEST(MemoryPropertiesParser, givenInvalidFlagsIntelWhenParsingMemoryPropertiesFo
(1 << 30),
0};
MemoryProperties propertiesStruct;
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, propertiesStruct, MemoryPropertiesParser::ObjType::IMAGE));
MemoryPropertiesFlags memoryProperties;
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, MemoryPropertiesParser::ObjType::IMAGE));
}
TEST(MemoryPropertiesParser, givenInvalidPropertiesWhenParsingMemoryPropertiesForBufferThenFalseIsReturned) {
@@ -119,8 +137,10 @@ TEST(MemoryPropertiesParser, givenInvalidPropertiesWhenParsingMemoryPropertiesFo
MemObjHelper::validFlagsForImageIntel,
0};
MemoryProperties propertiesStruct;
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, propertiesStruct, MemoryPropertiesParser::ObjType::BUFFER));
MemoryPropertiesFlags memoryProperties;
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, MemoryPropertiesParser::ObjType::BUFFER));
}
TEST(MemoryPropertiesParser, givenInvalidFlagsWhenParsingMemoryPropertiesForBufferThenFalseIsReturned) {
@@ -131,8 +151,10 @@ TEST(MemoryPropertiesParser, givenInvalidFlagsWhenParsingMemoryPropertiesForBuff
MemObjHelper::validFlagsForBufferIntel,
0};
MemoryProperties propertiesStruct;
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, propertiesStruct, MemoryPropertiesParser::ObjType::BUFFER));
MemoryPropertiesFlags memoryProperties;
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, MemoryPropertiesParser::ObjType::BUFFER));
}
TEST(MemoryPropertiesParser, givenInvalidFlagsIntelWhenParsingMemoryPropertiesForBufferThenFalseIsReturned) {
@@ -143,8 +165,10 @@ TEST(MemoryPropertiesParser, givenInvalidFlagsIntelWhenParsingMemoryPropertiesFo
(1 << 30),
0};
MemoryProperties propertiesStruct;
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, propertiesStruct, MemoryPropertiesParser::ObjType::BUFFER));
MemoryPropertiesFlags memoryProperties;
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, MemoryPropertiesParser::ObjType::BUFFER));
}
TEST(MemoryPropertiesParser, givenDifferentParametersWhenCallingFillCachePolicyInPropertiesThenFlushL3FlagsAreCorrectlySet) {

View File

@@ -15,101 +15,100 @@ using namespace NEO;
TEST(MemoryPropertiesFlags, givenValidPropertiesWhenCreateMemoryPropertiesFlagsThenTrueIsReturned) {
MemoryPropertiesFlags properties;
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0);
EXPECT_TRUE(properties.flags.readWrite);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_WRITE_ONLY);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_WRITE_ONLY, 0);
EXPECT_TRUE(properties.flags.writeOnly);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_ONLY);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_ONLY, 0);
EXPECT_TRUE(properties.flags.readOnly);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0);
EXPECT_TRUE(properties.flags.useHostPtr);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_ALLOC_HOST_PTR);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_ALLOC_HOST_PTR, 0);
EXPECT_TRUE(properties.flags.allocHostPtr);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_COPY_HOST_PTR);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_COPY_HOST_PTR, 0);
EXPECT_TRUE(properties.flags.copyHostPtr);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_HOST_WRITE_ONLY);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_HOST_WRITE_ONLY, 0);
EXPECT_TRUE(properties.flags.hostWriteOnly);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_HOST_READ_ONLY);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_HOST_READ_ONLY, 0);
EXPECT_TRUE(properties.flags.hostReadOnly);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_HOST_NO_ACCESS);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_HOST_NO_ACCESS, 0);
EXPECT_TRUE(properties.flags.hostNoAccess);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_KERNEL_READ_AND_WRITE);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_KERNEL_READ_AND_WRITE, 0);
EXPECT_TRUE(properties.flags.kernelReadAndWrite);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL, 0);
EXPECT_TRUE(properties.flags.accessFlagsUnrestricted);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_NO_ACCESS_INTEL);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_NO_ACCESS_INTEL, 0);
EXPECT_TRUE(properties.flags.noAccess);
MemoryProperties memoryProperties;
memoryProperties.flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE;
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(memoryProperties);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, CL_MEM_LOCALLY_UNCACHED_RESOURCE);
EXPECT_TRUE(properties.flags.locallyUncachedResource);
memoryProperties.flagsIntel = CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE;
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(memoryProperties);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE);
EXPECT_TRUE(properties.flags.locallyUncachedInSurfaceState);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL);
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL, 0);
EXPECT_TRUE(properties.flags.forceSharedPhysicalMemory);
}
TEST(MemoryPropertiesFlags, givenClMemForceLinearStorageFlagWhenCreateMemoryPropertiesFlagsThenReturnProperValue) {
MemoryPropertiesFlags properties;
MemoryProperties memoryProperties;
MemoryPropertiesFlags memoryProperties;
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
memoryProperties.flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
memoryProperties.flagsIntel = 0;
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(memoryProperties);
EXPECT_TRUE(properties.flags.forceLinearStorage);
flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
flagsIntel = 0;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
EXPECT_TRUE(memoryProperties.flags.forceLinearStorage);
memoryProperties.flags = 0;
memoryProperties.flagsIntel |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(memoryProperties);
EXPECT_TRUE(properties.flags.forceLinearStorage);
flags = 0;
flagsIntel |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
EXPECT_TRUE(memoryProperties.flags.forceLinearStorage);
memoryProperties.flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
memoryProperties.flagsIntel |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(memoryProperties);
EXPECT_TRUE(properties.flags.forceLinearStorage);
flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
flagsIntel |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
EXPECT_TRUE(memoryProperties.flags.forceLinearStorage);
memoryProperties.flags = 0;
memoryProperties.flagsIntel = 0;
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(memoryProperties);
EXPECT_FALSE(properties.flags.forceLinearStorage);
flags = 0;
flagsIntel = 0;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
EXPECT_FALSE(memoryProperties.flags.forceLinearStorage);
}
TEST(MemoryPropertiesFlags, givenClAllowUnrestrictedSizeFlagWhenCreateMemoryPropertiesFlagsThenReturnProperValue) {
MemoryPropertiesFlags properties;
MemoryProperties memoryProperties;
MemoryPropertiesFlags memoryProperties;
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
memoryProperties.flags |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL;
memoryProperties.flagsIntel = 0;
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(memoryProperties);
EXPECT_TRUE(properties.flags.allowUnrestrictedSize);
flags |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL;
flagsIntel = 0;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
EXPECT_TRUE(memoryProperties.flags.allowUnrestrictedSize);
memoryProperties.flags = 0;
memoryProperties.flagsIntel |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL;
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(memoryProperties);
EXPECT_TRUE(properties.flags.allowUnrestrictedSize);
flags = 0;
flagsIntel |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
EXPECT_TRUE(memoryProperties.flags.allowUnrestrictedSize);
memoryProperties.flags |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL;
memoryProperties.flagsIntel |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL;
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(memoryProperties);
EXPECT_TRUE(properties.flags.allowUnrestrictedSize);
flags |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL;
flagsIntel |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
EXPECT_TRUE(memoryProperties.flags.allowUnrestrictedSize);
memoryProperties.flags = 0;
memoryProperties.flagsIntel = 0;
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(memoryProperties);
EXPECT_FALSE(properties.flags.allowUnrestrictedSize);
flags = 0;
flagsIntel = 0;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
EXPECT_FALSE(memoryProperties.flags.allowUnrestrictedSize);
}

View File

@@ -92,7 +92,7 @@ TEST_F(KernelImageArgTest, givenImageWithWriteOnlyAccessAndReadOnlyArgWhenCheckC
imgDesc.image_width = 5;
imgDesc.image_height = 5;
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat);
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
pKernelInfo->kernelArgInfo[0].accessQualifier = CL_KERNEL_ARG_ACCESS_READ_ONLY;
cl_mem memObj = img.get();
retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj);
@@ -131,7 +131,7 @@ TEST_F(KernelImageArgTest, givenImageWithReadOnlyAccessAndWriteOnlyArgWhenCheckC
imgDesc.image_width = 5;
imgDesc.image_height = 5;
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat);
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
pKernelInfo->kernelArgInfo[0].accessQualifier = CL_KERNEL_ARG_ACCESS_WRITE_ONLY;
cl_mem memObj = img.get();
retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj);
@@ -151,7 +151,7 @@ TEST_F(KernelImageArgTest, givenImageWithReadOnlyAccessAndReadOnlyArgWhenCheckCo
imgDesc.image_width = 5;
imgDesc.image_height = 5;
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat);
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
pKernelInfo->kernelArgInfo[0].accessQualifier = CL_KERNEL_ARG_ACCESS_READ_ONLY;
cl_mem memObj = img.get();
retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj);
@@ -167,7 +167,7 @@ TEST_F(KernelImageArgTest, givenImageWithWriteOnlyAccessAndWriteOnlyArgWhenCheck
imgDesc.image_width = 5;
imgDesc.image_height = 5;
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat);
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
pKernelInfo->kernelArgInfo[0].accessQualifier = CL_KERNEL_ARG_ACCESS_WRITE_ONLY;
cl_mem memObj = img.get();
retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj);
@@ -212,7 +212,7 @@ TEST_F(KernelImageArgTest, givenKernelWithSettedArgWhenUnSetCalledThenArgIsUnset
imgDesc.image_width = 5;
imgDesc.image_height = 5;
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat);
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
cl_mem memObj = img.get();
retVal = pKernel->setArg(0, sizeof(memObj), &memObj);
@@ -249,7 +249,7 @@ TEST_F(KernelImageArgTest, givenKernelWithSharedImageWhenSetArgCalledThenUsingSh
imgDesc.image_width = 5;
imgDesc.image_height = 5;
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat);
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
cl_mem memObj = img.get();
MockSharingHandler *mockSharingHandler = new MockSharingHandler;

View File

@@ -2051,7 +2051,7 @@ HWTEST_F(KernelResidencyTest, test_MakeArgsResidentCheckImageFromImage) {
cl_int retVal;
MockContext context;
std::unique_ptr<NEO::Image> imageNV12(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
std::unique_ptr<NEO::Image> imageNV12(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
EXPECT_EQ(imageNV12->getMediaPlaneType(), 0u);
@@ -2065,7 +2065,7 @@ HWTEST_F(KernelResidencyTest, test_MakeArgsResidentCheckImageFromImage) {
imageDesc.image_depth = 0;
imageDesc.mem_object = imageNV12.get();
std::unique_ptr<NEO::Image> imageY(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
std::unique_ptr<NEO::Image> imageY(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
EXPECT_EQ(imageY->getMediaPlaneType(), 0u);

View File

@@ -221,7 +221,7 @@ TEST_F(BufferSetArgTest, givenBufferWhenOffsetedSubbufferIsPassedToSetKernelArgT
region.origin = 0xc0;
region.size = 32;
cl_int error = 0;
auto subBuffer = buffer->createSubBuffer(buffer->getMemoryPropertiesFlags(), &region, error);
auto subBuffer = buffer->createSubBuffer(buffer->getMemoryPropertiesFlags(), buffer->getMemoryPropertiesFlagsIntel(), &region, error);
ASSERT_NE(nullptr, subBuffer);

View File

@@ -80,13 +80,11 @@ TEST(Buffer, givenReadOnlySetOfInputFlagsWhenPassedToisReadOnlyMemoryPermittedBy
using Buffer::isReadOnlyMemoryPermittedByFlags;
};
cl_mem_flags flags = CL_MEM_HOST_NO_ACCESS | CL_MEM_READ_ONLY;
MemoryProperties properties{flags};
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0);
EXPECT_TRUE(MockBuffer::isReadOnlyMemoryPermittedByFlags(memoryProperties));
flags = CL_MEM_HOST_READ_ONLY | CL_MEM_READ_ONLY;
properties = flags;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0);
EXPECT_TRUE(MockBuffer::isReadOnlyMemoryPermittedByFlags(memoryProperties));
}
@@ -100,8 +98,7 @@ TEST_P(BufferReadOnlyTest, givenNonReadOnlySetOfInputFlagsWhenPassedToisReadOnly
};
cl_mem_flags flags = GetParam() | CL_MEM_USE_HOST_PTR;
MemoryProperties properties{flags};
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0);
EXPECT_FALSE(MockBuffer::isReadOnlyMemoryPermittedByFlags(memoryProperties));
}
static cl_mem_flags nonReadOnlyFlags[] = {
@@ -329,7 +326,7 @@ TEST(Buffer, givenAllocHostPtrFlagPassedToBufferCreateWhenNoSharedContextOrRende
}
TEST(Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturnedIn64Bit) {
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, 0);
MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false;
@@ -342,7 +339,7 @@ TEST(Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenB
}
TEST(Buffer, givenRenderCompressedBuffersDisabledLocalMemoryEnabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturnedIn64Bit) {
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, 0);
MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false;
@@ -355,7 +352,7 @@ TEST(Buffer, givenRenderCompressedBuffersDisabledLocalMemoryEnabledWhenAllocatio
}
TEST(Buffer, givenSharedContextWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, 0);
MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = true;
@@ -364,7 +361,7 @@ TEST(Buffer, givenSharedContextWhenAllocationTypeIsQueriedThenBufferHostMemoryTy
}
TEST(Buffer, givenSharedContextAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, 0);
MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = true;
@@ -373,9 +370,8 @@ TEST(Buffer, givenSharedContextAndRenderCompressedBuffersEnabledWhenAllocationTy
}
TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
MemoryProperties properties;
properties.flags = CL_MEM_USE_HOST_PTR;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
cl_mem_flags flags = CL_MEM_USE_HOST_PTR;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0);
MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false;
@@ -384,9 +380,8 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledWhenAllocationTypeIsQuerie
}
TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
MemoryProperties properties;
properties.flags = CL_MEM_USE_HOST_PTR;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
cl_mem_flags flags = CL_MEM_USE_HOST_PTR;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0);
MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false;
@@ -399,9 +394,8 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledWhenAllocationTypeIsQueried
}
TEST(Buffer, givenAllocHostPtrFlagWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
MemoryProperties properties;
properties.flags = CL_MEM_ALLOC_HOST_PTR;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
cl_mem_flags flags = CL_MEM_ALLOC_HOST_PTR;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0);
MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false;
@@ -414,9 +408,8 @@ TEST(Buffer, givenAllocHostPtrFlagWhenAllocationTypeIsQueriedThenBufferTypeIsRet
}
TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferMemoryTypeIsReturned) {
MemoryProperties properties;
properties.flags = CL_MEM_USE_HOST_PTR;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
cl_mem_flags flags = CL_MEM_USE_HOST_PTR;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0);
MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false;
@@ -425,9 +418,8 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledAndRenderCompressedBuffers
}
TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferMemoryTypeIsReturned) {
MemoryProperties properties;
properties.flags = CL_MEM_USE_HOST_PTR;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
cl_mem_flags flags = CL_MEM_USE_HOST_PTR;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0);
MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false;
@@ -440,9 +432,8 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledAndRenderCompressedBuffersE
}
TEST(Buffer, givenUseHostPointerFlagAndForceSharedPhysicalStorageWhenLocalMemoryIsEnabledThenBufferHostMemoryTypeIsReturned) {
MemoryProperties properties;
properties.flags = CL_MEM_USE_HOST_PTR | CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
cl_mem_flags flags = CL_MEM_USE_HOST_PTR | CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0);
MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false;
@@ -451,9 +442,8 @@ TEST(Buffer, givenUseHostPointerFlagAndForceSharedPhysicalStorageWhenLocalMemory
}
TEST(Buffer, givenAllocHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturned) {
MemoryProperties properties;
properties.flags = CL_MEM_ALLOC_HOST_PTR;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
cl_mem_flags flags = CL_MEM_ALLOC_HOST_PTR;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0);
MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false;
@@ -466,7 +456,7 @@ TEST(Buffer, givenAllocHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocatio
}
TEST(Buffer, givenZeroFlagsNoSharedContextAndRenderCompressedBuffersDisabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, 0);
MockContext context;
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
context.isSharedContext = false;
@@ -1954,7 +1944,7 @@ HWTEST_F(BufferSetSurfaceTests, givenBufferWithOffsetWhenSetArgStatefulIsCalledT
cl_buffer_region region = {4, 8};
retVal = -1;
auto subBuffer = buffer->createSubBuffer(CL_MEM_READ_WRITE, &region, retVal);
auto subBuffer = buffer->createSubBuffer(CL_MEM_READ_WRITE, 0, &region, retVal);
ASSERT_NE(nullptr, subBuffer);
ASSERT_EQ(CL_SUCCESS, retVal);

View File

@@ -63,7 +63,7 @@ typedef CreateImageFormatTest<CL_MEM_READ_WRITE> ReadWriteFormatTest;
TEST_P(ReadWriteFormatTest, returnsSuccess) {
auto image = Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -88,7 +88,7 @@ typedef CreateImageFormatTest<CL_MEM_READ_ONLY> ReadOnlyFormatTest;
TEST_P(ReadOnlyFormatTest, returnsSuccess) {
auto image = Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -111,7 +111,7 @@ typedef CreateImageFormatTest<CL_MEM_WRITE_ONLY> WriteOnlyFormatTest;
TEST_P(WriteOnlyFormatTest, returnsSuccess) {
auto image = Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,

View File

@@ -39,7 +39,7 @@ struct GetMemObjectSubBufferInfo : public ::testing::Test {
}
void createSubBuffer(cl_mem_flags flags = CL_MEM_READ_WRITE) {
cl_int retVal;
subBuffer = buffer->createSubBuffer(flags, &region, retVal);
subBuffer = buffer->createSubBuffer(flags, 0, &region, retVal);
ASSERT_NE(nullptr, subBuffer);
}

View File

@@ -77,7 +77,7 @@ HWTEST_P(CreateImage1DType, validTypes) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
auto image = Image::create(
context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,

View File

@@ -56,7 +56,7 @@ class Image2dFromBufferTest : public DeviceFixture, public ::testing::Test {
Image *createImage() {
cl_mem_flags flags = CL_MEM_READ_ONLY;
auto surfaceFormat = (SurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat);
return Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imageDesc, NULL, retVal);
return Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imageDesc, NULL, retVal);
}
cl_image_format imageFormat;
cl_image_desc imageDesc;
@@ -87,7 +87,7 @@ TEST_F(Image2dFromBufferTest, givenBufferWhenCreateImage2dArrayFromBufferThenIma
imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
cl_mem_flags flags = CL_MEM_READ_ONLY;
auto surfaceFormat = (SurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat);
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), surfaceFormat, &imageDesc, NULL);
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), surfaceFormat, &imageDesc, NULL);
EXPECT_EQ(CL_INVALID_IMAGE_DESCRIPTOR, retVal);
}
TEST_F(Image2dFromBufferTest, CalculateRowPitch) {
@@ -102,7 +102,7 @@ TEST_F(Image2dFromBufferTest, givenInvalidRowPitchWhenCreateImage2dFromBufferThe
imageDesc.image_row_pitch = 255;
cl_mem_flags flags = CL_MEM_READ_ONLY;
auto surfaceFormat = (SurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat);
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), surfaceFormat, &imageDesc, ptr);
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), surfaceFormat, &imageDesc, ptr);
EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
}
@@ -130,7 +130,7 @@ TEST_F(Image2dFromBufferTest, InvalidHostPtrAlignment) {
ASSERT_NE(nullptr, imageDesc.mem_object);
cl_mem_flags flags = CL_MEM_READ_ONLY;
auto surfaceFormat = (SurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat);
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), surfaceFormat, &imageDesc, NULL);
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), surfaceFormat, &imageDesc, NULL);
EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
clReleaseMemObject(imageDesc.mem_object);
@@ -142,7 +142,7 @@ TEST_F(Image2dFromBufferTest, givenInvalidFlagsWhenValidateIsCalledThenReturnErr
for (auto flag : flags) {
const auto surfaceFormat = Image::getSurfaceFormatFromTable(flag, &imageFormat);
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flag}), surfaceFormat, &imageDesc, reinterpret_cast<void *>(0x12345));
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flag, 0), surfaceFormat, &imageDesc, reinterpret_cast<void *>(0x12345));
EXPECT_EQ(CL_INVALID_VALUE, retVal);
}
}
@@ -154,7 +154,7 @@ TEST_F(Image2dFromBufferTest, givenOneChannel8BitColorsNoRowPitchSpecifiedAndToo
imageFormat.image_channel_order = CL_R;
const auto surfaceFormat = static_cast<const SurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat));
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), surfaceFormat, &imageDesc, NULL);
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), surfaceFormat, &imageDesc, NULL);
EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
}
@@ -165,7 +165,7 @@ TEST_F(Image2dFromBufferTest, givenOneChannel16BitColorsNoRowPitchSpecifiedAndTo
imageFormat.image_channel_order = CL_R;
const auto surfaceFormat = static_cast<const SurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat));
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), surfaceFormat, &imageDesc, NULL);
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), surfaceFormat, &imageDesc, NULL);
EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
}
@@ -176,7 +176,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel8BitColorsNoRowPitchSpecifiedAndTo
imageFormat.image_channel_order = CL_RGBA;
const auto surfaceFormat = static_cast<const SurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat));
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), surfaceFormat, &imageDesc, NULL);
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), surfaceFormat, &imageDesc, NULL);
EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
}
@@ -187,7 +187,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel16BitColorsNoRowPitchSpecifiedAndT
imageFormat.image_channel_order = CL_RGBA;
const auto surfaceFormat = static_cast<const SurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat));
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), surfaceFormat, &imageDesc, NULL);
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), surfaceFormat, &imageDesc, NULL);
EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
}
@@ -199,7 +199,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel8BitColorsAndNotTooLargeRowPitchSp
imageFormat.image_channel_order = CL_RGBA;
const auto surfaceFormat = static_cast<const SurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat));
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), surfaceFormat, &imageDesc, NULL);
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), surfaceFormat, &imageDesc, NULL);
EXPECT_EQ(CL_SUCCESS, retVal);
}
@@ -212,7 +212,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel8BitColorsAndTooLargeRowPitchSpeci
imageFormat.image_channel_order = CL_RGBA;
const auto surfaceFormat = static_cast<const SurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat));
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), surfaceFormat, &imageDesc, NULL);
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), surfaceFormat, &imageDesc, NULL);
EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
}
@@ -225,7 +225,7 @@ TEST_F(Image2dFromBufferTest, givenUnalignedImageWidthAndNoSpaceInBufferForAlign
imageFormat.image_channel_order = CL_R;
const auto surfaceFormat = static_cast<const SurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat));
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), surfaceFormat, &imageDesc, NULL);
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), surfaceFormat, &imageDesc, NULL);
EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
}

View File

@@ -57,7 +57,7 @@ class CreateImage2DTest : public DeviceFixture,
}
Image *createImageWithFlags(cl_mem_flags flags) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
return Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal);
return Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal);
}
cl_image_format imageFormat;
cl_image_desc imageDesc;

View File

@@ -62,7 +62,7 @@ class CreateImage3DTest : public DeviceFixture,
HWTEST_F(CreateImage3DTest, validTypes) {
cl_mem_flags flags = CL_MEM_READ_WRITE;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
auto image = Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal);
auto image = Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal);
ASSERT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, image);

View File

@@ -76,7 +76,7 @@ HWTEST_P(CreateImageArraySize, arrayTypes) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
auto image = Image::create(
context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -117,7 +117,7 @@ HWTEST_P(CreateImageNonArraySize, NonArrayTypes) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
auto image = Image::create(
context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,

View File

@@ -61,7 +61,7 @@ class ImageFromSubBufferTest : public DeviceFixture, public ::testing::Test {
Image *createImage() {
cl_mem_flags flags = CL_MEM_READ_ONLY;
auto surfaceFormat = (SurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat);
return Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imageDesc, NULL, retVal);
return Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imageDesc, NULL, retVal);
}
cl_image_format imageFormat;
cl_image_desc imageDesc;
@@ -98,7 +98,7 @@ TEST_F(ImageFromSubBufferTest, givenSubbufferWithOffsetGreaterThan4GBWhenImageIs
region = {static_cast<size_t>(offsetExpected), size / 2};
}
Buffer *subBufferWithBigOffset = buffer->createSubBuffer(CL_MEM_READ_WRITE, &region, retVal);
Buffer *subBufferWithBigOffset = buffer->createSubBuffer(CL_MEM_READ_WRITE, 0, &region, retVal);
imageDesc.mem_object = subBufferWithBigOffset;
std::unique_ptr<Image> imageFromSubBuffer(createImage());

View File

@@ -52,7 +52,7 @@ class ImageRedescribeTest : public testing::TestWithParam<std::tuple<size_t, uin
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
image.reset(Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -192,7 +192,7 @@ TEST_P(ImageRedescribeTest, givenImageWithMaxSizesWhenItIsRedescribedThenNewImag
cl_mem_flags flags = CL_MEM_READ_WRITE;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
auto bigImage = std::unique_ptr<Image>(Image::create(&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,

View File

@@ -42,7 +42,7 @@ class CreateImageTest : public DeviceFixture,
}
Image *createImageWithFlags(cl_mem_flags flags) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
return Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
return Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal);
}
@@ -118,7 +118,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
auto image = Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -143,7 +143,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
image = Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -168,7 +168,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
image = Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -193,7 +193,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
image = Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -218,7 +218,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
image = Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -243,7 +243,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
image = Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -268,7 +268,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
image = Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -293,7 +293,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
image = Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -344,7 +344,7 @@ TEST(TestCreateImage, UseSharedContextToCreateImage) {
auto image = Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -405,7 +405,7 @@ TEST(TestCreateImageUseHostPtr, CheckMemoryAllocationForDifferenHostPtrAlignment
for (int i = 0; i < 4; i++) {
auto image = Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -443,7 +443,7 @@ TEST(TestCreateImageUseHostPtr, givenZeroCopyImageValuesWhenUsingHostPtrThenZero
auto image = std::unique_ptr<Image>(Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -547,7 +547,7 @@ struct CreateImageHostPtr
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
return Image::create(
context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -969,7 +969,7 @@ HWTEST_F(ImageCompressionTests, givenTiledImageWhenCreatingAllocationThenPreferR
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
auto image = std::unique_ptr<Image>(Image::create(mockContext.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
auto image = std::unique_ptr<Image>(Image::create(mockContext.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, image);
EXPECT_EQ(UnitTestHelper<FamilyType>::tiledImagesSupported, image->isTiledAllocation());
@@ -983,7 +983,7 @@ TEST_F(ImageCompressionTests, givenNonTiledImageWhenCreatingAllocationThenDontPr
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
auto image = std::unique_ptr<Image>(Image::create(mockContext.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
auto image = std::unique_ptr<Image>(Image::create(mockContext.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, image);
EXPECT_FALSE(image->isTiledAllocation());
@@ -1188,7 +1188,7 @@ TEST(ImageTest, givenClMemForceLinearStorageSetWhenCreateImageThenDisallowTiling
auto image = std::unique_ptr<Image>(Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,
@@ -1396,7 +1396,7 @@ TEST(ImageTest, givenClMemCopyHostPointerPassedToImageCreateWhenAllocationIsNotI
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> image(Image::create(&ctx, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, surfaceFormat, &imageDesc, memory, retVal));
std::unique_ptr<Image> image(Image::create(&ctx, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, surfaceFormat, &imageDesc, memory, retVal));
EXPECT_NE(nullptr, image);
auto taskCountSent = device->getGpgpuCommandStreamReceiver().peekLatestFlushedTaskCount();

View File

@@ -72,7 +72,7 @@ HWTEST_P(CreateTiledImageTest, isTiledImageIsSetForTiledImages) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
auto image = Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,

View File

@@ -680,7 +680,7 @@ TEST(validateAndCreateImage, givenNotSupportedImageFormatWhenValidateAndCreateIm
cl_int retVal = CL_SUCCESS;
Image *image;
cl_mem_flags flags = CL_MEM_READ_WRITE;
image = Image::validateAndCreateImage(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0, &imageFormat, &Image1dDefaults::imageDesc, nullptr, retVal);
image = Image::validateAndCreateImage(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), flags, 0, &imageFormat, &Image1dDefaults::imageDesc, nullptr, retVal);
EXPECT_EQ(nullptr, image);
EXPECT_EQ(CL_IMAGE_FORMAT_NOT_SUPPORTED, retVal);
}
@@ -708,7 +708,7 @@ TEST(validateAndCreateImage, givenValidImageParamsWhenValidateAndCreateImageIsCa
std::unique_ptr<Image> image = nullptr;
image.reset(Image::validateAndCreateImage(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
&imageFormat,

View File

@@ -39,7 +39,7 @@ class MemObjDestructionTest : public ::testing::TestWithParam<bool> {
allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{size});
memObj = new MemObj(context.get(), CL_MEM_OBJECT_BUFFER,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_READ_WRITE}), CL_MEM_READ_WRITE, 0,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0), CL_MEM_READ_WRITE, 0,
size,
nullptr, nullptr, allocation, true, false, false);
csr = device->getDefaultEngine().commandStreamReceiver;
@@ -218,7 +218,7 @@ HWTEST_P(MemObjAsyncDestructionTest, givenUsedMemObjWithAsyncDestructionsEnabled
MemObjSizeArray region = {{1, 1, 1}};
cl_map_flags mapFlags = CL_MAP_READ;
memObj = new MemObj(context.get(), CL_MEM_OBJECT_BUFFER,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_READ_WRITE}), CL_MEM_READ_WRITE, 0,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0), CL_MEM_READ_WRITE, 0,
size,
storage, nullptr, allocation, true, false, false);
memObj->addMappedPtr(storage, 1, mapFlags, region, origin, 0);

View File

@@ -28,87 +28,88 @@ TEST(MemObjHelper, givenInvalidMemFlagsForSubBufferWhenFlagsAreCheckedThenTrueIs
}
TEST(MemObjHelper, givenClMemForceLinearStorageFlagWhenCheckForLinearStorageForceThenReturnProperValue) {
MemoryProperties properties;
MemoryPropertiesFlags memoryProperties;
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
properties.flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
properties.flagsIntel = 0;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
flagsIntel = 0;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
EXPECT_TRUE(memoryProperties.flags.forceLinearStorage);
properties.flags = 0;
properties.flagsIntel |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
flags = 0;
flagsIntel |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
EXPECT_TRUE(memoryProperties.flags.forceLinearStorage);
properties.flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
properties.flagsIntel |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
flagsIntel |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
EXPECT_TRUE(memoryProperties.flags.forceLinearStorage);
properties.flags = 0;
properties.flagsIntel = 0;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
flags = 0;
flagsIntel = 0;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
EXPECT_FALSE(memoryProperties.flags.forceLinearStorage);
}
TEST(MemObjHelper, givenValidPropertiesWhenValidatingMemoryPropertiesThenTrueIsReturned) {
MemoryProperties properties;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel));
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr));
properties.flags = CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL | CL_MEM_NO_ACCESS_INTEL;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
flags = CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL | CL_MEM_NO_ACCESS_INTEL;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
flags = CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL | CL_MEM_NO_ACCESS_INTEL;
flagsIntel = 0;
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr));
properties.flags = CL_MEM_NO_ACCESS_INTEL;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
flags = CL_MEM_NO_ACCESS_INTEL;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
flags = CL_MEM_NO_ACCESS_INTEL;
flagsIntel = 0;
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr));
properties.flags = CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR | CL_MEM_HOST_NO_ACCESS;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
flags = CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR | CL_MEM_HOST_NO_ACCESS;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
flags = CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR | CL_MEM_HOST_NO_ACCESS;
flagsIntel = 0;
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel));
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr));
properties.flags = CL_MEM_WRITE_ONLY | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_WRITE_ONLY;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
flags = CL_MEM_WRITE_ONLY | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_WRITE_ONLY;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
flags = CL_MEM_WRITE_ONLY | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_WRITE_ONLY;
flagsIntel = 0;
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel));
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr));
properties.flags = CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_NO_ACCESS;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
flags = CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_NO_ACCESS;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
flags = CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_NO_ACCESS;
flagsIntel = 0;
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel));
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr));
properties.flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
flags = 0;
flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE;
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel));
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr));
properties.flagsIntel = CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
flagsIntel = CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
flags = 0;
flagsIntel = CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE;
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel));
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr));
properties.flags = 0;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
flags = 0;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
flags = 0;
flagsIntel = 0;
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel));
@@ -120,25 +121,26 @@ struct Image1dWithAccessFlagsUnrestricted : public Image1dDefaults {
};
TEST(MemObjHelper, givenParentMemObjAndHostPtrFlagsWhenValidatingMemoryPropertiesForImageThenFalseIsReturned) {
MemoryProperties properties;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
MockContext context;
auto image = clUniquePtr(Image1dHelper<>::create(&context));
auto imageWithAccessFlagsUnrestricted = clUniquePtr(ImageHelper<Image1dWithAccessFlagsUnrestricted>::create(&context));
cl_mem_flags hostPtrFlags[] = {CL_MEM_USE_HOST_PTR, CL_MEM_ALLOC_HOST_PTR, CL_MEM_COPY_HOST_PTR};
cl_mem_flags flags = 0;
flags = 0;
for (auto hostPtrFlag : hostPtrFlags) {
properties.flags = hostPtrFlag;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
flags = hostPtrFlag;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
flags = hostPtrFlag;
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, image.get()));
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, imageWithAccessFlagsUnrestricted.get()));
properties.flags |= CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
flags |= CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
flags |= CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL;
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, image.get()));
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, imageWithAccessFlagsUnrestricted.get()));

View File

@@ -61,7 +61,7 @@ TEST(MemObj, GivenMemObjWhenInititalizedFromHostPtrThenInitializeFields) {
char buffer[size];
MockContext context;
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(buffer, sizeof(buffer));
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
@@ -77,7 +77,7 @@ TEST(MemObj, givenMemObjectWhenAskedForTransferToHostPtrThenDoNothing) {
uint8_t expectedHostPtr[size] = {};
MockContext context;
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(hostPtr, sizeof(hostPtr));
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
@@ -97,7 +97,7 @@ TEST(MemObj, givenMemObjectWhenAskedForTransferFromHostPtrThenDoNothing) {
uint8_t expectedBufferPtr[size] = {};
MockContext context;
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(hostPtr, sizeof(hostPtr));
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
@@ -114,7 +114,7 @@ TEST(MemObj, givenMemObjectWhenAskedForTransferFromHostPtrThenDoNothing) {
TEST(MemObj, givenHostPtrAndUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnHostPtr) {
uint8_t hostPtr = 0;
MockContext context;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
@@ -124,7 +124,7 @@ TEST(MemObj, givenHostPtrAndUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnHostP
TEST(MemObj, givenHostPtrWithoutUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnAllocatedPtr) {
uint8_t hostPtr = 0;
MockContext context;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
@@ -136,7 +136,7 @@ TEST(MemObj, givenMemObjWhenReleaseAllocatedPtrIsCalledTwiceThenItDoesntCrash) {
void *allocatedPtr = alignedMalloc(MemoryConstants::cacheLineSize, MemoryConstants::cacheLineSize);
MockContext context;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
@@ -156,7 +156,7 @@ TEST(MemObj, givenNotReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThe
auto defaultEngine = context.getDevice(0)->getDefaultEngine();
allocation->updateTaskCount(2, defaultEngine.osContext->getContextId());
*(defaultEngine.commandStreamReceiver->getTagAddress()) = 1;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
auto &allocationList = defaultEngine.commandStreamReceiver->getTemporaryAllocations();
@@ -175,7 +175,7 @@ TEST(MemObj, givenReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThenAl
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
allocation->updateTaskCount(1, device->getDefaultEngine().osContext->getContextId());
*device->getDefaultEngine().commandStreamReceiver->getTagAddress() = 1;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_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);
@@ -193,7 +193,7 @@ TEST(MemObj, givenNotUsedGraphicsAllocationWhenMemObjDestroysAllocationAsyncThen
context.memoryManager = &memoryManager;
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
@@ -211,7 +211,7 @@ TEST(MemObj, givenMemoryManagerWithoutDeviceWhenMemObjDestroysAllocationAsyncThe
context.memoryManager = &memoryManager;
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
@@ -227,7 +227,7 @@ TEST(MemObj, givenMemObjAndPointerToObjStorageWithProperCommandWhenCheckIfMemTra
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
context.memoryManager = &memoryManager;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
void *ptr = memObj.getCpuAddressForMemoryTransfer();
@@ -254,7 +254,7 @@ TEST(MemObj, givenMemObjAndPointerToObjStorageBadCommandWhenCheckIfMemTransferRe
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
context.memoryManager = &memoryManager;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
void *ptr = memObj.getCpuAddressForMemoryTransfer();
@@ -266,7 +266,7 @@ TEST(MemObj, givenMemObjAndPointerToDiffrentStorageAndProperCommandWhenCheckIfMe
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
context.memoryManager = &memoryManager;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
void *ptr = (void *)0x1234;
@@ -278,7 +278,7 @@ TEST(MemObj, givenSharingHandlerWhenAskedForCpuMappingThenReturnFalse) {
MockContext context;
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
memObj.setSharingHandler(new SharingHandler());
@@ -290,7 +290,7 @@ TEST(MemObj, givenTiledObjectWhenAskedForCpuMappingThenReturnFalse) {
using MemObj::MemObj;
bool isTiledAllocation() const override { return true; }
};
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
@@ -305,7 +305,7 @@ TEST(MemObj, givenRenderCompressedGmmWhenAskingForMappingOnCpuThenDisallow) {
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
allocation->setDefaultGmm(new Gmm(nullptr, 1, false));
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_READ_WRITE});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
@@ -322,7 +322,7 @@ TEST(MemObj, givenDefaultWhenAskedForCpuMappingThenReturnTrue) {
context.memoryManager = &memoryManager;
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
@@ -339,7 +339,7 @@ TEST(MemObj, givenNonCpuAccessibleMemoryWhenAskingForMappingOnCpuThenDisallow) {
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
allocation->setDefaultGmm(new Gmm(nullptr, 1, false));
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_READ_WRITE});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
@@ -389,7 +389,7 @@ TEST(MemObj, givenSharedMemObjectWithNullGfxAllocationWhenSettingGfxAllocationTh
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
context.memoryManager = &memoryManager;
MockGraphicsAllocation *gfxAllocation = new MockGraphicsAllocation(nullptr, 0);
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
memObj.setSharingHandler(new MySharingHandler(&memObj));
@@ -406,7 +406,7 @@ TEST(MemObj, givenSharedMemObjectAndNullGfxAllocationProvidedWhenSettingGfxAlloc
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
context.memoryManager = &memoryManager;
MockGraphicsAllocation *graphicsAllocation = new MockGraphicsAllocation(nullptr, 0);
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
memObj.setSharingHandler(new MySharingHandler(&memObj));
@@ -423,7 +423,7 @@ TEST(MemObj, givenSharedMemObjectAndZeroReuseCountWhenChangingGfxAllocationThenO
context.memoryManager = &memoryManager;
MockGraphicsAllocation *oldGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
MockGraphicsAllocation *newGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
memObj.setSharingHandler(new MySharingHandler(&memObj));
@@ -442,7 +442,7 @@ TEST(MemObj, givenSharedMemObjectAndNonZeroReuseCountWhenChangingGfxAllocationTh
context.memoryManager = &memoryManager;
MockGraphicsAllocation *oldGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
MockGraphicsAllocation *newGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
memObj.setSharingHandler(new MySharingHandler(&memObj));
@@ -461,7 +461,7 @@ TEST(MemObj, givenNotSharedMemObjectWhenChangingGfxAllocationThenOldAllocationIs
context.memoryManager = &memoryManager;
MockGraphicsAllocation *oldGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
MockGraphicsAllocation *newGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);
@@ -479,7 +479,7 @@ TEST(MemObj, givenGraphicsAllocationWhenCallingIsAllocDumpableThenItReturnsTheCo
TEST(MemObj, givenMemObjNotUsingHostPtrWhenGettingBasePtrTwiceReturnSameMapPtr) {
MockContext context;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_READ_WRITE});
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(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);

View File

@@ -71,12 +71,12 @@ class Nv12ImageTest : public testing::Test {
void validateImageWithFlags(cl_mem_flags flags) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), surfaceFormat, &imageDesc, nullptr);
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), surfaceFormat, &imageDesc, nullptr);
}
Image *createImageWithFlags(cl_mem_flags flags) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
return Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
return Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal);
}
@@ -189,7 +189,7 @@ TEST_F(Nv12ImageTest, given2DImageWhenPassedToValidateImageTraitsThenValidateRet
imageDesc.mem_object = image;
imageDesc.image_depth = 0;
retVal = Image::validateImageTraits(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_READ_WRITE}), &imageFormat, &imageDesc, nullptr);
retVal = Image::validateImageTraits(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0), &imageFormat, &imageDesc, nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
delete image;
@@ -204,7 +204,7 @@ TEST_F(Nv12ImageTest, given1DImageWhenPassedAsParentImageThenValidateImageTraits
imageDesc.mem_object = image;
imageDesc.image_depth = 0;
retVal = Image::validateImageTraits(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_READ_WRITE}), &imageFormat, &imageDesc, nullptr);
retVal = Image::validateImageTraits(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0), &imageFormat, &imageDesc, nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
delete image;
@@ -216,7 +216,7 @@ TEST_F(Nv12ImageTest, givenBufferWhenPassedAsNV12ParentImageThenValidateImageTra
imageDesc.mem_object = &Buffer;
imageDesc.image_depth = 0; // Plane of NV12 image
retVal = Image::validateImageTraits(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_READ_WRITE}), &imageFormat, &imageDesc, nullptr);
retVal = Image::validateImageTraits(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0), &imageFormat, &imageDesc, nullptr);
EXPECT_EQ(CL_INVALID_IMAGE_DESCRIPTOR, retVal);
}
@@ -391,7 +391,7 @@ HWTEST_F(Nv12ImageTest, checkIfPlanesAreWritten) {
// Create Parent NV12 image
cl_mem_flags flags = CL_MEM_READ_ONLY | CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL | CL_MEM_USE_HOST_PTR;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
auto imageNV12 = Image::create(contextWithMockCmdQ, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
auto imageNV12 = Image::create(contextWithMockCmdQ, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, hostPtr, retVal);
EXPECT_EQ(imageNV12->isTiledAllocation() ? 2u : 0u, cmdQ->EnqueueWriteImageCounter);
@@ -569,7 +569,7 @@ TEST_F(Nv12ImageTest, invalidPlanarYUVImageHeight) {
pDevice->getCap<CL_DEVICE_PLANAR_YUV_MAX_HEIGHT_INTEL>(reinterpret_cast<const void *&>(maxHeight), srcSize, retSize);
imageDesc.image_height = *maxHeight + 12;
retVal = Image::validatePlanarYUV(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), &imageDesc, nullptr);
retVal = Image::validatePlanarYUV(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), &imageDesc, nullptr);
EXPECT_EQ(CL_INVALID_IMAGE_SIZE, retVal);
}
@@ -586,17 +586,17 @@ TEST_F(Nv12ImageTest, invalidPlanarYUVImageWidth) {
pDevice->getCap<CL_DEVICE_PLANAR_YUV_MAX_WIDTH_INTEL>(reinterpret_cast<const void *&>(maxWidth), srcSize, retSize);
imageDesc.image_width = *maxWidth + 12;
retVal = Image::validatePlanarYUV(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), &imageDesc, nullptr);
retVal = Image::validatePlanarYUV(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), &imageDesc, nullptr);
EXPECT_EQ(CL_INVALID_IMAGE_SIZE, retVal);
}
TEST_F(Nv12ImageTest, validPlanarYUVImageHeight) {
retVal = Image::validatePlanarYUV(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), &imageDesc, nullptr);
retVal = Image::validatePlanarYUV(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), &imageDesc, nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
}
TEST_F(Nv12ImageTest, validPlanarYUVImageWidth) {
retVal = Image::validatePlanarYUV(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), &imageDesc, nullptr);
retVal = Image::validatePlanarYUV(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), &imageDesc, nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
}

View File

@@ -54,7 +54,7 @@ class PackedYuvImageTest : public testing::Test,
if (retVal != CL_SUCCESS)
return;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), surfaceFormat, &imageDesc, nullptr);
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0), surfaceFormat, &imageDesc, nullptr);
}
cl_int retVal = CL_SUCCESS;
@@ -72,7 +72,7 @@ TEST_P(PackedYuvImageTest, isPackedYuvImageReturnsTrue) {
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
auto image = Image::create(
&context,
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags,
0,
surfaceFormat,

View File

@@ -49,7 +49,7 @@ TEST_F(SubBufferTest, createSubBuffer) {
cl_buffer_region region = {2, 12};
EXPECT_EQ(1, buffer->getRefInternalCount());
auto subBuffer = buffer->createSubBuffer(CL_MEM_READ_ONLY, &region, retVal);
auto subBuffer = buffer->createSubBuffer(CL_MEM_READ_ONLY, 0, &region, retVal);
EXPECT_EQ(2, buffer->getRefInternalCount());
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_NE(nullptr, subBuffer);
@@ -68,7 +68,7 @@ TEST_F(SubBufferTest, GivenUnalignedHostPtrBufferWhenSubBufferIsCreatedThenItIsN
ASSERT_NE(nullptr, buffer);
ASSERT_EQ(CL_SUCCESS, retVal);
auto subBuffer = buffer->createSubBuffer(CL_MEM_READ_ONLY, &region, retVal);
auto subBuffer = buffer->createSubBuffer(CL_MEM_READ_ONLY, 0, &region, retVal);
EXPECT_NE(nullptr, subBuffer);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_FALSE(subBuffer->isMemObjZeroCopy());
@@ -106,7 +106,7 @@ TEST_F(SubBufferTest, givenSharingHandlerFromParentBufferWhenCreateThenShareHand
auto handler = new SharingHandler();
buffer->setSharingHandler(handler);
auto subBuffer = buffer->createSubBuffer(CL_MEM_READ_ONLY, &region, retVal);
auto subBuffer = buffer->createSubBuffer(CL_MEM_READ_ONLY, 0, &region, retVal);
ASSERT_NE(nullptr, subBuffer);
EXPECT_EQ(subBuffer->getSharingHandler().get(), handler);
@@ -127,7 +127,7 @@ TEST_F(SubBufferTest, GivenBufferWithAlignedHostPtrAndSameMemoryStorageWhenSubBu
EXPECT_EQ(alignedPointer, buffer->getHostPtr());
EXPECT_EQ(alignedPointer, buffer->getCpuAddress());
auto subBuffer = buffer->createSubBuffer(CL_MEM_READ_ONLY, &region, retVal);
auto subBuffer = buffer->createSubBuffer(CL_MEM_READ_ONLY, 0, &region, retVal);
EXPECT_NE(nullptr, subBuffer);
EXPECT_EQ(CL_SUCCESS, retVal);
@@ -151,7 +151,7 @@ TEST_F(SubBufferTest, GivenBufferWithMemoryStorageAndNullHostPtrWhenSubBufferIsC
EXPECT_EQ(nullptr, buffer->getHostPtr());
EXPECT_NE(nullptr, buffer->getCpuAddress());
auto subBuffer = buffer->createSubBuffer(CL_MEM_READ_ONLY, &region, retVal);
auto subBuffer = buffer->createSubBuffer(CL_MEM_READ_ONLY, 0, &region, retVal);
EXPECT_NE(nullptr, subBuffer);
EXPECT_EQ(CL_SUCCESS, retVal);
@@ -165,7 +165,7 @@ TEST_F(SubBufferTest, GivenBufferWithMemoryStorageAndNullHostPtrWhenSubBufferIsC
TEST_F(SubBufferTest, givenBufferWithHostPtrWhenSubbufferGetsMapPtrThenExpectBufferHostPtr) {
cl_buffer_region region = {0, 16};
auto subBuffer = buffer->createSubBuffer(CL_MEM_READ_WRITE, &region, retVal);
auto subBuffer = buffer->createSubBuffer(CL_MEM_READ_WRITE, 0, &region, retVal);
ASSERT_NE(nullptr, subBuffer);
ASSERT_EQ(CL_SUCCESS, retVal);
@@ -185,7 +185,7 @@ TEST_F(SubBufferTest, givenBufferWithNoHostPtrWhenSubbufferGetsMapPtrThenExpectB
ASSERT_NE(nullptr, buffer);
ASSERT_EQ(CL_SUCCESS, retVal);
auto subBuffer = buffer->createSubBuffer(CL_MEM_READ_WRITE, &region, retVal);
auto subBuffer = buffer->createSubBuffer(CL_MEM_READ_WRITE, 0, &region, retVal);
ASSERT_NE(nullptr, subBuffer);
ASSERT_EQ(CL_SUCCESS, retVal);

View File

@@ -56,22 +56,20 @@ TEST(AllocationFlagsTest, givenAllocateMemoryFlagWhenGetAllocationFlagsIsCalledT
}
TEST(UncacheableFlagsTest, givenUncachedResourceFlagWhenGetAllocationFlagsIsCalledThenUncacheableFlagIsCorrectlySet) {
MemoryProperties properties;
properties.flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
cl_mem_flags_intel flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, flagsIntel);
auto allocationFlags = MemoryPropertiesParser::getAllocationProperties(memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false);
EXPECT_TRUE(allocationFlags.flags.uncacheable);
properties.flagsIntel = 0;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
flagsIntel = 0;
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, flagsIntel);
allocationFlags = MemoryPropertiesParser::getAllocationProperties(memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false);
EXPECT_FALSE(allocationFlags.flags.uncacheable);
}
TEST(AllocationFlagsTest, givenReadOnlyResourceFlagWhenGetAllocationFlagsIsCalledThenFlushL3FlagsAreCorrectlySet) {
MemoryProperties properties;
properties.flags = CL_MEM_READ_ONLY;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
cl_mem_flags flags = CL_MEM_READ_ONLY;
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0);
auto allocationFlags =
MemoryPropertiesParser::getAllocationProperties(memoryProperties, true, 0, GraphicsAllocation::AllocationType::BUFFER, false);

View File

@@ -34,10 +34,10 @@ class MockBuffer : public MockBufferStorage, public Buffer {
using MockBufferStorage::device;
MockBuffer(GraphicsAllocation &alloc)
: MockBufferStorage(), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), CL_MEM_USE_HOST_PTR, 0, alloc.getUnderlyingBufferSize(), alloc.getUnderlyingBuffer(), alloc.getUnderlyingBuffer(), &alloc, true, false, false),
: MockBufferStorage(), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0), CL_MEM_USE_HOST_PTR, 0, alloc.getUnderlyingBufferSize(), alloc.getUnderlyingBuffer(), alloc.getUnderlyingBuffer(), &alloc, true, false, false),
externalAlloc(&alloc) {
}
MockBuffer() : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data, &mockGfxAllocation, true, false, false) {
MockBuffer() : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data, &mockGfxAllocation, true, false, false) {
}
~MockBuffer() override {
if (externalAlloc != nullptr) {
@@ -55,9 +55,9 @@ class MockBuffer : public MockBufferStorage, public Buffer {
class AlignedBuffer : public MockBufferStorage, public Buffer {
public:
using MockBufferStorage::device;
AlignedBuffer() : MockBufferStorage(false), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64), &mockGfxAllocation, true, false, false) {
AlignedBuffer() : MockBufferStorage(false), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 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, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), 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, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64), gfxAllocation, true, false, false) {
}
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly) override {
Buffer::setSurfaceState(device.get(), memory, getSize(), getCpuAddress(), &mockGfxAllocation);
@@ -67,9 +67,9 @@ class AlignedBuffer : public MockBufferStorage, public Buffer {
class UnalignedBuffer : public MockBufferStorage, public Buffer {
public:
using MockBufferStorage::device;
UnalignedBuffer() : MockBufferStorage(true), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4), &mockGfxAllocation, false, false, false) {
UnalignedBuffer() : MockBufferStorage(true), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 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, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), 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, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4), gfxAllocation, false, false, false) {
}
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly) override {
Buffer::setSurfaceState(device.get(), memory, getSize(), getCpuAddress(), &mockGfxAllocation);

View File

@@ -1331,7 +1331,7 @@ class DrmMockBuffer : public Buffer {
delete gfxAllocation;
}
DrmMockBuffer(char *data, size_t size, DrmAllocation *alloc) : Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), CL_MEM_USE_HOST_PTR, 0, size, data, data, alloc, true, false, false),
DrmMockBuffer(char *data, size_t size, DrmAllocation *alloc) : Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0), CL_MEM_USE_HOST_PTR, 0, size, data, data, alloc, true, false, false),
data(data),
gfxAllocation(alloc) {
}

View File

@@ -1167,7 +1167,7 @@ HWTEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageWithMipCountZe
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage);
@@ -1215,7 +1215,7 @@ HWTEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageWithMipCountNo
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage);
@@ -1256,7 +1256,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageIsBeingCreatedAn
InjectedFunction method = [&](size_t failureIndex) {
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
if (MemoryManagement::nonfailingAllocation == failureIndex) {
EXPECT_NE(nullptr, dstImage.get());
@@ -1299,7 +1299,7 @@ HWTEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageIsBeingCreated
cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, data, retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage);
@@ -1345,7 +1345,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenMemoryAllocatedForImageThe
cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, data, retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage);
@@ -1378,7 +1378,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenNonTiledImgWithMipCountZer
cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, data, retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage);
@@ -1423,7 +1423,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenNonTiledImgWithMipCountNon
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, data, retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage);
@@ -1468,7 +1468,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhen1DarrayImageIsBeingCreated
cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, data, retVal));
auto imageGraphicsAllocation = dstImage->getGraphicsAllocation();
ASSERT_NE(nullptr, imageGraphicsAllocation);

View File

@@ -600,7 +600,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageWithMipCount
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage);
@@ -629,7 +629,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageWithMipCountNo
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage);
@@ -664,7 +664,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageIsBeingCreat
cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, data, retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage);
@@ -693,7 +693,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenNonTiledImgWithMipCountZ
cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, data, retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage);
@@ -721,7 +721,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenNonTiledImgWithMipCountN
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, dstImage);

View File

@@ -37,7 +37,7 @@ TEST(sharingHandler, givenMemObjWhenAcquireIncrementCounterThenReleaseShouldDecr
char buffer[64];
MockContext context;
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(buffer, sizeof(buffer));
std::unique_ptr<MemObj> memObj(new MemObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), CL_MEM_USE_HOST_PTR, 0,
std::unique_ptr<MemObj> memObj(new MemObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0), CL_MEM_USE_HOST_PTR, 0,
sizeof(buffer), buffer, buffer, mockAllocation, true, false, false));
struct MockSharingHandler : SharingHandler {
@@ -62,7 +62,7 @@ TEST(sharingHandler, givenMemObjWhenAcquireTwoTimesThenReleaseShouldBeCalledTwoT
char buffer[64];
MockContext context;
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(buffer, sizeof(buffer));
std::unique_ptr<MemObj> memObj(new MemObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), CL_MEM_USE_HOST_PTR, 0,
std::unique_ptr<MemObj> memObj(new MemObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0), CL_MEM_USE_HOST_PTR, 0,
sizeof(buffer), buffer, buffer, mockAllocation, true, false, false));
struct MockSharingHandler : SharingHandler {
@@ -107,7 +107,7 @@ TEST(sharingHandler, givenSharingHandlerWhenAcquiringThenReturnErrorCode) {
SharingHandler sharingHandler;
MockContext context;
MockGraphicsAllocation *graphicsAllocation = new MockGraphicsAllocation(nullptr, 0);
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), CL_MEM_USE_HOST_PTR, 0,
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0), CL_MEM_USE_HOST_PTR, 0,
1, nullptr, nullptr, graphicsAllocation, true, false, false);
auto result = sharingHandler.acquire(&memObj);