mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 17:29:14 +08:00
Refactor MemoryPropertiesFlags
Rename: - MemoryPropertiesFlags to MemoryProperties - MemoryPropertiesParser to MemoryPropertiesParserHelper - getMemoryPropertiesFlags to getFlags - getMemoryPropertiesFlagsIntel to getFlagsIntel - functions involved with MemoryPropertiesFlags Related-To: NEO-4143 Change-Id: I4eec67bba95dd5354d0df43c31e6ca724909138e Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
9cdd0574c1
commit
b0ed3b2ab1
@@ -661,7 +661,7 @@ cl_mem CL_API_CALL clCreateBuffer(cl_context context,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0);
|
||||
if (isFieldValid(flags, MemObjHelper::validFlagsForBuffer)) {
|
||||
Buffer::validateInputAndCreateBuffer(*pContext, memoryProperties, flags, 0, size, hostPtr, retVal, buffer);
|
||||
} else {
|
||||
@@ -697,12 +697,12 @@ cl_mem CL_API_CALL clCreateBufferWithPropertiesINTEL(cl_context context,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MemoryPropertiesFlags memoryProperties;
|
||||
MemoryProperties memoryProperties;
|
||||
cl_mem_flags flags = 0;
|
||||
cl_mem_flags_intel flagsIntel = 0;
|
||||
cl_mem_alloc_flags_intel allocflags = 0;
|
||||
if (MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParser::MemoryPropertiesParser::ObjType::BUFFER, *pContext)) {
|
||||
if (MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::BUFFER, *pContext)) {
|
||||
Buffer::validateInputAndCreateBuffer(*pContext, memoryProperties, flags, flagsIntel, size, hostPtr, retVal, buffer);
|
||||
} else {
|
||||
retVal = CL_INVALID_VALUE;
|
||||
@@ -740,8 +740,8 @@ cl_mem CL_API_CALL clCreateSubBuffer(cl_mem buffer,
|
||||
break;
|
||||
}
|
||||
|
||||
cl_mem_flags parentFlags = parentBuffer->getMemoryPropertiesFlags();
|
||||
cl_mem_flags_intel parentFlagsIntel = parentBuffer->getMemoryPropertiesFlagsIntel();
|
||||
cl_mem_flags parentFlags = parentBuffer->getFlags();
|
||||
cl_mem_flags_intel parentFlagsIntel = parentBuffer->getFlagsIntel();
|
||||
|
||||
if (parentBuffer->isSubBuffer() == true) {
|
||||
retVal = CL_INVALID_MEM_OBJECT;
|
||||
@@ -845,7 +845,7 @@ cl_mem CL_API_CALL clCreateImage(cl_context context,
|
||||
retVal = validateObjects(WithCastToInternal(context, &pContext));
|
||||
|
||||
if (retVal == CL_SUCCESS) {
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0);
|
||||
if (isFieldValid(flags, MemObjHelper::validFlagsForImage)) {
|
||||
image = Image::validateAndCreateImage(pContext, memoryProperties, flags, 0, imageFormat, imageDesc, hostPtr, retVal);
|
||||
} else {
|
||||
@@ -881,15 +881,15 @@ cl_mem CL_API_CALL clCreateImageWithPropertiesINTEL(cl_context context,
|
||||
|
||||
cl_mem image = nullptr;
|
||||
Context *pContext = nullptr;
|
||||
MemoryPropertiesFlags memoryProperties;
|
||||
MemoryProperties memoryProperties;
|
||||
cl_mem_flags flags = 0;
|
||||
cl_mem_flags_intel flagsIntel = 0;
|
||||
cl_mem_alloc_flags_intel allocflags = 0;
|
||||
retVal = validateObjects(WithCastToInternal(context, &pContext));
|
||||
|
||||
if (retVal == CL_SUCCESS) {
|
||||
if (MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParser::MemoryPropertiesParser::ObjType::IMAGE, *pContext)) {
|
||||
if (MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::IMAGE, *pContext)) {
|
||||
image = Image::validateAndCreateImage(pContext, memoryProperties, flags, flagsIntel, imageFormat, imageDesc, hostPtr, retVal);
|
||||
} else {
|
||||
retVal = CL_INVALID_VALUE;
|
||||
@@ -936,7 +936,7 @@ cl_mem CL_API_CALL clCreateImage2D(cl_context context,
|
||||
retVal = validateObjects(WithCastToInternal(context, &pContext));
|
||||
|
||||
if (retVal == CL_SUCCESS) {
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0);
|
||||
image2D = Image::validateAndCreateImage(pContext, memoryProperties, flags, 0, imageFormat, &imageDesc, hostPtr, retVal);
|
||||
}
|
||||
|
||||
@@ -987,7 +987,7 @@ cl_mem CL_API_CALL clCreateImage3D(cl_context context,
|
||||
retVal = validateObjects(WithCastToInternal(context, &pContext));
|
||||
|
||||
if (retVal == CL_SUCCESS) {
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0);
|
||||
image3D = Image::validateAndCreateImage(pContext, memoryProperties, flags, 0, imageFormat, &imageDesc, hostPtr, retVal);
|
||||
}
|
||||
|
||||
@@ -1154,7 +1154,7 @@ cl_int CL_API_CALL clGetImageParamsINTEL(cl_context context,
|
||||
}
|
||||
if (CL_SUCCESS == retVal) {
|
||||
surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(memFlags, imageFormat, pContext->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
retVal = Image::validate(pContext, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(memFlags, 0, 0), surfaceFormat, imageDesc, nullptr);
|
||||
retVal = Image::validate(pContext, MemoryPropertiesParser::createMemoryProperties(memFlags, 0, 0), surfaceFormat, imageDesc, nullptr);
|
||||
}
|
||||
if (CL_SUCCESS == retVal) {
|
||||
retVal = Image::getImageParams(pContext, memFlags, surfaceFormat, imageDesc, imageRowPitch, imageSlicePitch);
|
||||
@@ -3502,9 +3502,9 @@ void *clHostMemAllocINTEL(
|
||||
cl_mem_flags flags = 0;
|
||||
cl_mem_flags_intel flagsIntel = 0;
|
||||
cl_mem_alloc_flags_intel allocflags = 0;
|
||||
if (!MemoryPropertiesParser::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel,
|
||||
allocflags, MemoryPropertiesParser::MemoryPropertiesParser::ObjType::UNKNOWN,
|
||||
*neoContext)) {
|
||||
if (!MemoryPropertiesParserHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel,
|
||||
allocflags, MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::UNKNOWN,
|
||||
*neoContext)) {
|
||||
err.set(CL_INVALID_VALUE);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -3540,9 +3540,9 @@ void *clDeviceMemAllocINTEL(
|
||||
cl_mem_flags flags = 0;
|
||||
cl_mem_flags_intel flagsIntel = 0;
|
||||
cl_mem_alloc_flags_intel allocflags = 0;
|
||||
if (!MemoryPropertiesParser::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel,
|
||||
allocflags, MemoryPropertiesParser::MemoryPropertiesParser::ObjType::UNKNOWN,
|
||||
*neoContext)) {
|
||||
if (!MemoryPropertiesParserHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel,
|
||||
allocflags, MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::UNKNOWN,
|
||||
*neoContext)) {
|
||||
err.set(CL_INVALID_VALUE);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -3581,9 +3581,9 @@ void *clSharedMemAllocINTEL(
|
||||
cl_mem_flags flags = 0;
|
||||
cl_mem_flags_intel flagsIntel = 0;
|
||||
cl_mem_alloc_flags_intel allocflags = 0;
|
||||
if (!MemoryPropertiesParser::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel,
|
||||
allocflags, MemoryPropertiesParser::MemoryPropertiesParser::ObjType::UNKNOWN,
|
||||
*neoContext)) {
|
||||
if (!MemoryPropertiesParserHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel,
|
||||
allocflags, MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::UNKNOWN,
|
||||
*neoContext)) {
|
||||
err.set(CL_INVALID_VALUE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
bool MemoryPropertiesParser::parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryPropertiesFlags &memoryProperties,
|
||||
cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel,
|
||||
cl_mem_alloc_flags_intel &allocflags, ObjType objectType, Context &context) {
|
||||
bool MemoryPropertiesParserHelper::parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryProperties &memoryProperties,
|
||||
cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel,
|
||||
cl_mem_alloc_flags_intel &allocflags, ObjType objectType, Context &context) {
|
||||
if (properties == nullptr) {
|
||||
return true;
|
||||
}
|
||||
@@ -35,13 +35,13 @@ bool MemoryPropertiesParser::parseMemoryProperties(const cl_mem_properties_intel
|
||||
}
|
||||
}
|
||||
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, allocflags);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, allocflags);
|
||||
|
||||
switch (objectType) {
|
||||
case MemoryPropertiesParser::ObjType::BUFFER:
|
||||
case MemoryPropertiesParserHelper::ObjType::BUFFER:
|
||||
return isFieldValid(flags, MemObjHelper::validFlagsForBuffer) &&
|
||||
isFieldValid(flagsIntel, MemObjHelper::validFlagsForBufferIntel);
|
||||
case MemoryPropertiesParser::ObjType::IMAGE:
|
||||
case MemoryPropertiesParserHelper::ObjType::IMAGE:
|
||||
return isFieldValid(flags, MemObjHelper::validFlagsForImage) &&
|
||||
isFieldValid(flagsIntel, MemObjHelper::validFlagsForImageIntel);
|
||||
default:
|
||||
@@ -50,7 +50,7 @@ bool MemoryPropertiesParser::parseMemoryProperties(const cl_mem_properties_intel
|
||||
return true;
|
||||
}
|
||||
|
||||
void MemoryPropertiesParser::fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryPropertiesFlags &memoryProperties, const HardwareInfo &hwInfo) {
|
||||
void MemoryPropertiesParserHelper::fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryProperties &memoryProperties, const HardwareInfo &hwInfo) {
|
||||
fillCachePolicyInProperties(allocationProperties,
|
||||
memoryProperties.flags.locallyUncachedResource,
|
||||
memoryProperties.flags.readOnly,
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace NEO {
|
||||
|
||||
class Context;
|
||||
|
||||
class MemoryPropertiesParser {
|
||||
class MemoryPropertiesParserHelper {
|
||||
public:
|
||||
enum class ObjType {
|
||||
UNKNOWN,
|
||||
@@ -25,18 +25,18 @@ class MemoryPropertiesParser {
|
||||
IMAGE,
|
||||
};
|
||||
|
||||
static bool parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryPropertiesFlags &memoryProperties,
|
||||
static bool parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryProperties &memoryProperties,
|
||||
cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel, cl_mem_alloc_flags_intel &allocflags,
|
||||
ObjType objectType, Context &context);
|
||||
|
||||
static AllocationProperties getAllocationProperties(uint32_t rootDeviceIndex, MemoryPropertiesFlags memoryProperties, bool allocateMemory, size_t size,
|
||||
static AllocationProperties getAllocationProperties(uint32_t rootDeviceIndex, MemoryProperties memoryProperties, bool allocateMemory, size_t size,
|
||||
GraphicsAllocation::AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo, DeviceBitfield subDevicesBitfieldParam) {
|
||||
AllocationProperties allocationProperties(rootDeviceIndex, allocateMemory, size, type, multiStorageResource, subDevicesBitfieldParam);
|
||||
fillPoliciesInProperties(allocationProperties, memoryProperties, hwInfo);
|
||||
return allocationProperties;
|
||||
}
|
||||
|
||||
static void fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryPropertiesFlags &memoryProperties, const HardwareInfo &hwInfo);
|
||||
static void fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryProperties &memoryProperties, const HardwareInfo &hwInfo);
|
||||
|
||||
static void fillCachePolicyInProperties(AllocationProperties &allocationProperties, bool uncached, bool readOnly,
|
||||
bool deviceOnlyVisibilty) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
void MemoryPropertiesFlagsParser::addExtraMemoryPropertiesFlags(MemoryPropertiesFlags &propertiesFlag, cl_mem_flags flags, cl_mem_flags_intel flagsIntel) {
|
||||
void MemoryPropertiesParser::addExtraMemoryProperties(MemoryProperties &properties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel) {
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class MemoryPropertiesFlagsParser {
|
||||
class MemoryPropertiesParser {
|
||||
public:
|
||||
static void addExtraMemoryPropertiesFlags(MemoryPropertiesFlags &propertiesFlags, cl_mem_flags flags, cl_mem_flags_intel flagsIntel);
|
||||
static void addExtraMemoryProperties(MemoryProperties &properties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel);
|
||||
|
||||
static MemoryPropertiesFlags createMemoryPropertiesFlags(cl_mem_flags flags, cl_mem_flags_intel flagsIntel, cl_mem_alloc_flags_intel allocflags);
|
||||
static MemoryProperties createMemoryProperties(cl_mem_flags flags, cl_mem_flags_intel flagsIntel, cl_mem_alloc_flags_intel allocflags);
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -14,76 +14,76 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
MemoryPropertiesFlags MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(cl_mem_flags flags, cl_mem_flags_intel flagsIntel, cl_mem_alloc_flags_intel allocflags) {
|
||||
MemoryPropertiesFlags memoryPropertiesFlags;
|
||||
MemoryProperties MemoryPropertiesParser::createMemoryProperties(cl_mem_flags flags, cl_mem_flags_intel flagsIntel, cl_mem_alloc_flags_intel allocflags) {
|
||||
MemoryProperties memoryProperties;
|
||||
|
||||
if (isValueSet(flags, CL_MEM_READ_WRITE)) {
|
||||
memoryPropertiesFlags.flags.readWrite = true;
|
||||
memoryProperties.flags.readWrite = true;
|
||||
}
|
||||
if (isValueSet(flags, CL_MEM_WRITE_ONLY)) {
|
||||
memoryPropertiesFlags.flags.writeOnly = true;
|
||||
memoryProperties.flags.writeOnly = true;
|
||||
}
|
||||
if (isValueSet(flags, CL_MEM_READ_ONLY)) {
|
||||
memoryPropertiesFlags.flags.readOnly = true;
|
||||
memoryProperties.flags.readOnly = true;
|
||||
}
|
||||
if (isValueSet(flags, CL_MEM_USE_HOST_PTR)) {
|
||||
memoryPropertiesFlags.flags.useHostPtr = true;
|
||||
memoryProperties.flags.useHostPtr = true;
|
||||
}
|
||||
if (isValueSet(flags, CL_MEM_ALLOC_HOST_PTR)) {
|
||||
memoryPropertiesFlags.flags.allocHostPtr = true;
|
||||
memoryProperties.flags.allocHostPtr = true;
|
||||
}
|
||||
if (isValueSet(flags, CL_MEM_COPY_HOST_PTR)) {
|
||||
memoryPropertiesFlags.flags.copyHostPtr = true;
|
||||
memoryProperties.flags.copyHostPtr = true;
|
||||
}
|
||||
if (isValueSet(flags, CL_MEM_HOST_WRITE_ONLY)) {
|
||||
memoryPropertiesFlags.flags.hostWriteOnly = true;
|
||||
memoryProperties.flags.hostWriteOnly = true;
|
||||
}
|
||||
if (isValueSet(flags, CL_MEM_HOST_READ_ONLY)) {
|
||||
memoryPropertiesFlags.flags.hostReadOnly = true;
|
||||
memoryProperties.flags.hostReadOnly = true;
|
||||
}
|
||||
if (isValueSet(flags, CL_MEM_HOST_NO_ACCESS)) {
|
||||
memoryPropertiesFlags.flags.hostNoAccess = true;
|
||||
memoryProperties.flags.hostNoAccess = true;
|
||||
}
|
||||
if (isValueSet(flags, CL_MEM_KERNEL_READ_AND_WRITE)) {
|
||||
memoryPropertiesFlags.flags.kernelReadAndWrite = true;
|
||||
memoryProperties.flags.kernelReadAndWrite = true;
|
||||
}
|
||||
if (isValueSet(flags, CL_MEM_FORCE_LINEAR_STORAGE_INTEL) ||
|
||||
isValueSet(flagsIntel, CL_MEM_FORCE_LINEAR_STORAGE_INTEL)) {
|
||||
memoryPropertiesFlags.flags.forceLinearStorage = true;
|
||||
memoryProperties.flags.forceLinearStorage = true;
|
||||
}
|
||||
if (isValueSet(flags, CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL)) {
|
||||
memoryPropertiesFlags.flags.accessFlagsUnrestricted = true;
|
||||
memoryProperties.flags.accessFlagsUnrestricted = true;
|
||||
}
|
||||
if (isValueSet(flags, CL_MEM_NO_ACCESS_INTEL)) {
|
||||
memoryPropertiesFlags.flags.noAccess = true;
|
||||
memoryProperties.flags.noAccess = true;
|
||||
}
|
||||
if (isValueSet(flags, CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL) ||
|
||||
isValueSet(flagsIntel, CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL)) {
|
||||
memoryPropertiesFlags.flags.allowUnrestrictedSize = true;
|
||||
memoryProperties.flags.allowUnrestrictedSize = true;
|
||||
}
|
||||
if (isValueSet(flagsIntel, CL_MEM_LOCALLY_UNCACHED_RESOURCE)) {
|
||||
memoryPropertiesFlags.flags.locallyUncachedResource = true;
|
||||
memoryProperties.flags.locallyUncachedResource = true;
|
||||
}
|
||||
|
||||
if (isValueSet(flagsIntel, CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE)) {
|
||||
memoryPropertiesFlags.flags.locallyUncachedInSurfaceState = true;
|
||||
memoryProperties.flags.locallyUncachedInSurfaceState = true;
|
||||
}
|
||||
|
||||
if (isValueSet(flags, CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL)) {
|
||||
memoryPropertiesFlags.flags.forceSharedPhysicalMemory = true;
|
||||
memoryProperties.flags.forceSharedPhysicalMemory = true;
|
||||
}
|
||||
|
||||
if (isValueSet(allocflags, CL_MEM_ALLOC_WRITE_COMBINED_INTEL)) {
|
||||
memoryPropertiesFlags.allocFlags.allocWriteCombined = true;
|
||||
memoryProperties.allocFlags.allocWriteCombined = true;
|
||||
}
|
||||
|
||||
if (isValueSet(flagsIntel, CL_MEM_48BIT_RESOURCE_INTEL)) {
|
||||
memoryPropertiesFlags.flags.resource48Bit = true;
|
||||
memoryProperties.flags.resource48Bit = true;
|
||||
}
|
||||
|
||||
addExtraMemoryPropertiesFlags(memoryPropertiesFlags, flags, flagsIntel);
|
||||
addExtraMemoryProperties(memoryProperties, flags, flagsIntel);
|
||||
|
||||
return memoryPropertiesFlags;
|
||||
return memoryProperties;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -2312,7 +2312,7 @@ cl_int Kernel::checkCorrectImageAccessQualifier(cl_uint argIndex,
|
||||
WithCastToInternal(mem, &pMemObj);
|
||||
if (pMemObj) {
|
||||
auto accessQualifier = getKernelInfo().kernelArgInfo[argIndex].metadata.accessQualifier;
|
||||
cl_mem_flags flags = pMemObj->getMemoryPropertiesFlags();
|
||||
cl_mem_flags flags = pMemObj->getFlags();
|
||||
if ((accessQualifier == KernelArgMetadata::AccessReadOnly && ((flags | CL_MEM_WRITE_ONLY) == flags)) ||
|
||||
(accessQualifier == KernelArgMetadata::AccessWriteOnly && ((flags | CL_MEM_READ_ONLY) == flags))) {
|
||||
return CL_INVALID_ARG_VALUE;
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace NEO {
|
||||
BufferFuncs bufferFactory[IGFX_MAX_CORE] = {};
|
||||
|
||||
Buffer::Buffer(Context *context,
|
||||
MemoryPropertiesFlags memoryProperties,
|
||||
MemoryProperties memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -86,7 +86,7 @@ bool Buffer::isValidSubBufferOffset(size_t offset) {
|
||||
}
|
||||
|
||||
void Buffer::validateInputAndCreateBuffer(Context &context,
|
||||
MemoryPropertiesFlags memoryProperties,
|
||||
MemoryProperties memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -124,11 +124,11 @@ Buffer *Buffer::create(Context *context,
|
||||
size_t size,
|
||||
void *hostPtr,
|
||||
cl_int &errcodeRet) {
|
||||
return create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, size, hostPtr, errcodeRet);
|
||||
return create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, size, hostPtr, errcodeRet);
|
||||
}
|
||||
|
||||
Buffer *Buffer::create(Context *context,
|
||||
MemoryPropertiesFlags memoryProperties,
|
||||
MemoryProperties memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -223,9 +223,9 @@ Buffer *Buffer::create(Context *context,
|
||||
}
|
||||
|
||||
if (!memory) {
|
||||
AllocationProperties allocProperties = MemoryPropertiesParser::getAllocationProperties(rootDeviceIndex, memoryProperties,
|
||||
allocateMemory, size, allocationType, context->areMultiStorageAllocationsPreferred(),
|
||||
context->getDevice(0)->getHardwareInfo(), context->getDevice(0)->getDeviceBitfield());
|
||||
AllocationProperties allocProperties = MemoryPropertiesParserHelper::getAllocationProperties(rootDeviceIndex, memoryProperties,
|
||||
allocateMemory, size, allocationType, context->areMultiStorageAllocationsPreferred(),
|
||||
context->getDevice(0)->getHardwareInfo(), context->getDevice(0)->getDeviceBitfield());
|
||||
memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties, hostPtr);
|
||||
}
|
||||
|
||||
@@ -238,10 +238,10 @@ Buffer *Buffer::create(Context *context,
|
||||
allocationType = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
|
||||
zeroCopyAllowed = false;
|
||||
copyMemoryFromHostPtr = true;
|
||||
AllocationProperties allocProperties = MemoryPropertiesParser::getAllocationProperties(rootDeviceIndex, memoryProperties,
|
||||
true, // allocateMemory
|
||||
size, allocationType, context->areMultiStorageAllocationsPreferred(),
|
||||
context->getDevice(0)->getHardwareInfo(), context->getDevice(0)->getDeviceBitfield());
|
||||
AllocationProperties allocProperties = MemoryPropertiesParserHelper::getAllocationProperties(rootDeviceIndex, memoryProperties,
|
||||
true, // allocateMemory
|
||||
size, allocationType, context->areMultiStorageAllocationsPreferred(),
|
||||
context->getDevice(0)->getHardwareInfo(), context->getDevice(0)->getDeviceBitfield());
|
||||
memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties);
|
||||
}
|
||||
|
||||
@@ -337,13 +337,13 @@ 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, 0, 0), flags, 0, graphicsAllocation->getUnderlyingBufferSize(), nullptr, nullptr, graphicsAllocation, false, false, false);
|
||||
auto sharedBuffer = createBufferHw(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, graphicsAllocation->getUnderlyingBufferSize(), nullptr, nullptr, graphicsAllocation, false, false, false);
|
||||
|
||||
sharedBuffer->setSharingHandler(sharingHandler);
|
||||
return sharedBuffer;
|
||||
}
|
||||
|
||||
void Buffer::checkMemory(MemoryPropertiesFlags memoryProperties,
|
||||
void Buffer::checkMemory(MemoryProperties memoryProperties,
|
||||
size_t size,
|
||||
void *hostPtr,
|
||||
cl_int &errcodeRet,
|
||||
@@ -394,7 +394,7 @@ void Buffer::checkMemory(MemoryPropertiesFlags memoryProperties,
|
||||
return;
|
||||
}
|
||||
|
||||
GraphicsAllocation::AllocationType Buffer::getGraphicsAllocationType(const MemoryPropertiesFlags &properties, Context &context,
|
||||
GraphicsAllocation::AllocationType Buffer::getGraphicsAllocationType(const MemoryProperties &properties, Context &context,
|
||||
bool renderCompressedBuffers, bool isLocalMemoryEnabled,
|
||||
bool preferCompression) {
|
||||
if (context.isSharedContext || properties.flags.forceSharedPhysicalMemory) {
|
||||
@@ -412,7 +412,7 @@ GraphicsAllocation::AllocationType Buffer::getGraphicsAllocationType(const Memor
|
||||
return GraphicsAllocation::AllocationType::BUFFER;
|
||||
}
|
||||
|
||||
bool Buffer::isReadOnlyMemoryPermittedByFlags(const MemoryPropertiesFlags &properties) {
|
||||
bool Buffer::isReadOnlyMemoryPermittedByFlags(const MemoryProperties &properties) {
|
||||
// Host won't access or will only read and kernel will only read
|
||||
return (properties.flags.hostNoAccess || properties.flags.hostReadOnly) && properties.flags.readOnly;
|
||||
}
|
||||
@@ -422,7 +422,7 @@ Buffer *Buffer::createSubBuffer(cl_mem_flags flags,
|
||||
const cl_buffer_region *region,
|
||||
cl_int &errcodeRet) {
|
||||
DEBUG_BREAK_IF(nullptr == createFunction);
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
auto buffer = createFunction(this->context, memoryProperties, flags, 0, region->size,
|
||||
ptrOffset(this->memoryStorage, region->origin),
|
||||
this->hostPtr ? ptrOffset(this->hostPtr, region->origin) : nullptr,
|
||||
@@ -543,7 +543,7 @@ bool Buffer::isReadWriteOnCpuPreffered(void *ptr, size_t size) {
|
||||
}
|
||||
|
||||
Buffer *Buffer::createBufferHw(Context *context,
|
||||
MemoryPropertiesFlags memoryProperties,
|
||||
MemoryProperties memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -583,7 +583,7 @@ Buffer *Buffer::createBufferHwFromDevice(const Device *device,
|
||||
|
||||
auto funcCreate = bufferFactory[hwInfo.platform.eRenderCoreFamily].createBufferFunction;
|
||||
DEBUG_BREAK_IF(nullptr == funcCreate);
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
auto pBuffer = funcCreate(nullptr, memoryProperties, flags, flagsIntel, size, memoryStorage, hostPtr, gfxAllocation,
|
||||
zeroCopy, isHostPtrSVM, isImageRedescribed);
|
||||
pBuffer->offset = offset;
|
||||
@@ -604,7 +604,7 @@ uint32_t Buffer::getMocsValue(bool disableL3Cache, bool isReadOnlyArgument) cons
|
||||
}
|
||||
bufferAddress += this->offset;
|
||||
|
||||
bool readOnlyMemObj = isValueSet(getMemoryPropertiesFlags(), CL_MEM_READ_ONLY) || isReadOnlyArgument;
|
||||
bool readOnlyMemObj = isValueSet(getFlags(), CL_MEM_READ_ONLY) || isReadOnlyArgument;
|
||||
bool alignedMemObj = isAligned<MemoryConstants::cacheLineSize>(bufferAddress) &&
|
||||
isAligned<MemoryConstants::cacheLineSize>(bufferSize);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class ClDevice;
|
||||
class MemoryManager;
|
||||
|
||||
typedef Buffer *(*BufferCreatFunc)(Context *context,
|
||||
MemoryPropertiesFlags memoryProperties,
|
||||
MemoryProperties memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -50,7 +50,7 @@ class Buffer : public MemObj {
|
||||
~Buffer() override;
|
||||
|
||||
static void validateInputAndCreateBuffer(Context &context,
|
||||
MemoryPropertiesFlags memoryProperties,
|
||||
MemoryProperties memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -65,7 +65,7 @@ class Buffer : public MemObj {
|
||||
cl_int &errcodeRet);
|
||||
|
||||
static Buffer *create(Context *context,
|
||||
MemoryPropertiesFlags properties,
|
||||
MemoryProperties properties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -78,7 +78,7 @@ class Buffer : public MemObj {
|
||||
GraphicsAllocation *graphicsAllocation);
|
||||
|
||||
static Buffer *createBufferHw(Context *context,
|
||||
MemoryPropertiesFlags memoryProperties,
|
||||
MemoryProperties memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -146,7 +146,7 @@ class Buffer : public MemObj {
|
||||
|
||||
protected:
|
||||
Buffer(Context *context,
|
||||
MemoryPropertiesFlags memoryProperties,
|
||||
MemoryProperties memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -159,17 +159,17 @@ class Buffer : public MemObj {
|
||||
|
||||
Buffer();
|
||||
|
||||
static void checkMemory(MemoryPropertiesFlags memoryProperties,
|
||||
static void checkMemory(MemoryProperties memoryProperties,
|
||||
size_t size,
|
||||
void *hostPtr,
|
||||
cl_int &errcodeRet,
|
||||
bool &isZeroCopy,
|
||||
bool ©MemoryFromHostPtr,
|
||||
MemoryManager *memMngr);
|
||||
static GraphicsAllocation::AllocationType getGraphicsAllocationType(const MemoryPropertiesFlags &properties, Context &context,
|
||||
static GraphicsAllocation::AllocationType getGraphicsAllocationType(const MemoryProperties &properties, Context &context,
|
||||
bool renderCompressedBuffers, bool localMemoryEnabled,
|
||||
bool preferCompression);
|
||||
static bool isReadOnlyMemoryPermittedByFlags(const MemoryPropertiesFlags &properties);
|
||||
static bool isReadOnlyMemoryPermittedByFlags(const MemoryProperties &properties);
|
||||
|
||||
void transferData(void *dst, void *src, size_t copySize, size_t copyOffset);
|
||||
};
|
||||
@@ -178,7 +178,7 @@ template <typename GfxFamily>
|
||||
class BufferHw : public Buffer {
|
||||
public:
|
||||
BufferHw(Context *context,
|
||||
MemoryPropertiesFlags memoryProperties,
|
||||
MemoryProperties memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -196,7 +196,7 @@ class BufferHw : public Buffer {
|
||||
void appendSurfaceStateExt(void *memory);
|
||||
|
||||
static Buffer *create(Context *context,
|
||||
MemoryPropertiesFlags memoryProperties,
|
||||
MemoryProperties memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace NEO {
|
||||
ImageFuncs imageFactory[IGFX_MAX_CORE] = {};
|
||||
|
||||
Image::Image(Context *context,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -115,7 +115,7 @@ void Image::transferData(void *dest, size_t destRowPitch, size_t destSlicePitch,
|
||||
Image::~Image() = default;
|
||||
|
||||
Image *Image::create(Context *context,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
const ClSurfaceFormatInfo *surfaceFormat,
|
||||
@@ -424,7 +424,7 @@ Image *Image::create(Context *context,
|
||||
return image;
|
||||
}
|
||||
|
||||
Image *Image::createImageHw(Context *context, const MemoryPropertiesFlags &memoryProperties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel, size_t size, void *hostPtr,
|
||||
Image *Image::createImageHw(Context *context, const MemoryProperties &memoryProperties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel, size_t size, void *hostPtr,
|
||||
const cl_image_format &imageFormat, const cl_image_desc &imageDesc,
|
||||
bool zeroCopy, GraphicsAllocation *graphicsAllocation,
|
||||
bool isObjectRedescribed, uint32_t baseMipLevel, uint32_t mipCount,
|
||||
@@ -444,7 +444,7 @@ Image *Image::createImageHw(Context *context, const MemoryPropertiesFlags &memor
|
||||
Image *Image::createSharedImage(Context *context, SharingHandler *sharingHandler, const McsSurfaceInfo &mcsSurfaceInfo,
|
||||
GraphicsAllocation *graphicsAllocation, GraphicsAllocation *mcsAllocation,
|
||||
cl_mem_flags flags, const ClSurfaceFormatInfo *surfaceFormat, ImageInfo &imgInfo, uint32_t cubeFaceIndex, uint32_t baseMipLevel, uint32_t mipCount) {
|
||||
auto sharedImage = createImageHw(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, graphicsAllocation->getUnderlyingBufferSize(),
|
||||
auto sharedImage = createImageHw(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, graphicsAllocation->getUnderlyingBufferSize(),
|
||||
nullptr, surfaceFormat->OCLImageFormat, Image::convertDescriptor(imgInfo.imgDesc), false, graphicsAllocation, false, baseMipLevel, mipCount, surfaceFormat);
|
||||
sharedImage->setSharingHandler(sharingHandler);
|
||||
sharedImage->setMcsAllocation(mcsAllocation);
|
||||
@@ -458,7 +458,7 @@ Image *Image::createSharedImage(Context *context, SharingHandler *sharingHandler
|
||||
}
|
||||
|
||||
cl_int Image::validate(Context *context,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
const ClSurfaceFormatInfo *surfaceFormat,
|
||||
const cl_image_desc *imageDesc,
|
||||
const void *hostPtr) {
|
||||
@@ -494,7 +494,7 @@ cl_int Image::validate(Context *context,
|
||||
const auto minimumBufferSize = imageDesc->image_height * rowSize;
|
||||
|
||||
if ((imageDesc->image_row_pitch % (*pitchAlignment)) ||
|
||||
((parentBuffer->getMemoryPropertiesFlags() & CL_MEM_USE_HOST_PTR) && (reinterpret_cast<uint64_t>(parentBuffer->getHostPtr()) % (*baseAddressAlignment))) ||
|
||||
((parentBuffer->getFlags() & CL_MEM_USE_HOST_PTR) && (reinterpret_cast<uint64_t>(parentBuffer->getHostPtr()) % (*baseAddressAlignment))) ||
|
||||
(minimumBufferSize > parentBuffer->getSize())) {
|
||||
return CL_INVALID_IMAGE_FORMAT_DESCRIPTOR;
|
||||
} else if (memoryProperties.flags.useHostPtr || memoryProperties.flags.copyHostPtr) {
|
||||
@@ -558,7 +558,7 @@ cl_int Image::validateImageFormat(const cl_image_format *imageFormat) {
|
||||
}
|
||||
|
||||
cl_int Image::validatePlanarYUV(Context *context,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
const cl_image_desc *imageDesc,
|
||||
const void *hostPtr) {
|
||||
cl_int errorCode = CL_SUCCESS;
|
||||
@@ -607,7 +607,7 @@ cl_int Image::validatePlanarYUV(Context *context,
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
cl_int Image::validatePackedYUV(const MemoryPropertiesFlags &memoryProperties, const cl_image_desc *imageDesc) {
|
||||
cl_int Image::validatePackedYUV(const MemoryProperties &memoryProperties, const cl_image_desc *imageDesc) {
|
||||
cl_int errorCode = CL_SUCCESS;
|
||||
while (true) {
|
||||
if (!memoryProperties.flags.readOnly) {
|
||||
@@ -625,7 +625,7 @@ cl_int Image::validatePackedYUV(const MemoryPropertiesFlags &memoryProperties, c
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
cl_int Image::validateImageTraits(Context *context, const MemoryPropertiesFlags &memoryProperties, const cl_image_format *imageFormat, const cl_image_desc *imageDesc, const void *hostPtr) {
|
||||
cl_int Image::validateImageTraits(Context *context, const MemoryProperties &memoryProperties, const cl_image_format *imageFormat, const cl_image_desc *imageDesc, const void *hostPtr) {
|
||||
if (IsNV12Image(imageFormat))
|
||||
return validatePlanarYUV(context, memoryProperties, imageDesc, hostPtr);
|
||||
else if (IsPackedYuvImage(imageFormat))
|
||||
@@ -917,7 +917,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, flagsIntel, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags | CL_MEM_USE_HOST_PTR, flagsIntel, 0);
|
||||
auto image = createFunction(context,
|
||||
memoryProperties,
|
||||
flags | CL_MEM_USE_HOST_PTR,
|
||||
@@ -973,7 +973,7 @@ Image *Image::redescribe() {
|
||||
imageFormatNew.image_channel_data_type = surfaceFormat->OCLImageFormat.image_channel_data_type;
|
||||
|
||||
DEBUG_BREAK_IF(nullptr == createFunction);
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags | CL_MEM_USE_HOST_PTR, flagsIntel, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags | CL_MEM_USE_HOST_PTR, flagsIntel, 0);
|
||||
auto image = createFunction(context,
|
||||
memoryProperties,
|
||||
flags | CL_MEM_USE_HOST_PTR,
|
||||
@@ -1035,7 +1035,7 @@ cl_int Image::writeNV12Planes(const void *hostPtr, size_t hostPtrRowPitch) {
|
||||
// Create NV12 UV Plane image
|
||||
std::unique_ptr<Image> imageYPlane(Image::create(
|
||||
context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -1059,7 +1059,7 @@ cl_int Image::writeNV12Planes(const void *hostPtr, size_t hostPtrRowPitch) {
|
||||
// Create NV12 UV Plane image
|
||||
std::unique_ptr<Image> imageUVPlane(Image::create(
|
||||
context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -1111,7 +1111,7 @@ bool Image::isDepthFormat(const cl_image_format &imageFormat) {
|
||||
}
|
||||
|
||||
Image *Image::validateAndCreateImage(Context *context,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
const cl_image_format *imageFormat,
|
||||
|
||||
@@ -20,7 +20,7 @@ struct KernelInfo;
|
||||
struct SurfaceFormatInfo;
|
||||
|
||||
typedef Image *(*ImageCreatFunc)(Context *context,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
uint64_t flags,
|
||||
uint64_t flagsIntel,
|
||||
size_t size,
|
||||
@@ -47,7 +47,7 @@ class Image : public MemObj {
|
||||
~Image() override;
|
||||
|
||||
static Image *create(Context *context,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
const ClSurfaceFormatInfo *surfaceFormat,
|
||||
@@ -56,7 +56,7 @@ class Image : public MemObj {
|
||||
cl_int &errcodeRet);
|
||||
|
||||
static Image *validateAndCreateImage(Context *context,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
const cl_image_format *imageFormat,
|
||||
@@ -64,7 +64,7 @@ class Image : public MemObj {
|
||||
const void *hostPtr,
|
||||
cl_int &errcodeRet);
|
||||
|
||||
static Image *createImageHw(Context *context, const MemoryPropertiesFlags &memoryProperties, cl_mem_flags flags,
|
||||
static Image *createImageHw(Context *context, const MemoryProperties &memoryProperties, cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel, size_t size, void *hostPtr,
|
||||
const cl_image_format &imageFormat, const cl_image_desc &imageDesc,
|
||||
bool zeroCopy, GraphicsAllocation *graphicsAllocation,
|
||||
@@ -75,20 +75,20 @@ class Image : public MemObj {
|
||||
cl_mem_flags flags, const ClSurfaceFormatInfo *surfaceFormat, ImageInfo &imgInfo, uint32_t cubeFaceIndex, uint32_t baseMipLevel, uint32_t mipCount);
|
||||
|
||||
static cl_int validate(Context *context,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
const ClSurfaceFormatInfo *surfaceFormat,
|
||||
const cl_image_desc *imageDesc,
|
||||
const void *hostPtr);
|
||||
static cl_int validateImageFormat(const cl_image_format *imageFormat);
|
||||
|
||||
static int32_t validatePlanarYUV(Context *context,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
const cl_image_desc *imageDesc,
|
||||
const void *hostPtr);
|
||||
|
||||
static int32_t validatePackedYUV(const MemoryPropertiesFlags &memoryProperties, const cl_image_desc *imageDesc);
|
||||
static int32_t validatePackedYUV(const MemoryProperties &memoryProperties, const cl_image_desc *imageDesc);
|
||||
|
||||
static cl_int validateImageTraits(Context *context, const MemoryPropertiesFlags &memoryProperties, const cl_image_format *imageFormat, const cl_image_desc *imageDesc, const void *hostPtr);
|
||||
static cl_int validateImageTraits(Context *context, const MemoryProperties &memoryProperties, const cl_image_format *imageFormat, const cl_image_desc *imageDesc, const void *hostPtr);
|
||||
|
||||
static size_t calculateHostPtrSize(const size_t *region, size_t rowPitch, size_t slicePitch, size_t pixelSize, uint32_t imageType);
|
||||
|
||||
@@ -187,7 +187,7 @@ class Image : public MemObj {
|
||||
|
||||
protected:
|
||||
Image(Context *context,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -243,7 +243,7 @@ class ImageHw : public Image {
|
||||
|
||||
public:
|
||||
ImageHw(Context *context,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -296,7 +296,7 @@ class ImageHw : public Image {
|
||||
void transformImage2dArrayTo3d(void *memory) override;
|
||||
void transformImage3dTo2dArray(void *memory) override;
|
||||
static Image *create(Context *context,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace NEO {
|
||||
|
||||
MemObj::MemObj(Context *context,
|
||||
cl_mem_object_type memObjectType,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -327,7 +327,7 @@ void *MemObj::getBasePtrForMap(uint32_t rootDeviceIndex) {
|
||||
if (associatedMemObject) {
|
||||
return associatedMemObject->getBasePtrForMap(rootDeviceIndex);
|
||||
}
|
||||
if (getMemoryPropertiesFlags() & CL_MEM_USE_HOST_PTR) {
|
||||
if (getFlags() & CL_MEM_USE_HOST_PTR) {
|
||||
return getHostPtr();
|
||||
} else {
|
||||
TakeOwnershipWrapper<MemObj> memObjOwnership(*this);
|
||||
|
||||
@@ -41,7 +41,7 @@ class MemObj : public BaseObject<_cl_mem> {
|
||||
|
||||
MemObj(Context *context,
|
||||
cl_mem_object_type memObjectType,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -125,15 +125,15 @@ class MemObj : public BaseObject<_cl_mem> {
|
||||
return mapAllocation;
|
||||
}
|
||||
|
||||
const cl_mem_flags &getMemoryPropertiesFlags() const { return flags; }
|
||||
const cl_mem_flags &getMemoryPropertiesFlagsIntel() const { return flagsIntel; }
|
||||
const cl_mem_flags &getFlags() const { return flags; }
|
||||
const cl_mem_flags &getFlagsIntel() const { return flagsIntel; }
|
||||
|
||||
protected:
|
||||
void getOsSpecificMemObjectInfo(const cl_mem_info ¶mName, size_t *srcParamSize, void **srcParam);
|
||||
|
||||
Context *context;
|
||||
cl_mem_object_type memObjectType;
|
||||
MemoryPropertiesFlags memoryProperties;
|
||||
MemoryProperties memoryProperties;
|
||||
cl_mem_flags flags = 0;
|
||||
cl_mem_flags_intel flagsIntel = 0;
|
||||
size_t size;
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
bool MemObjHelper::isSuitableForRenderCompression(bool renderCompressed, const MemoryPropertiesFlags &properties, Context &context, bool preferCompression) {
|
||||
bool MemObjHelper::isSuitableForRenderCompression(bool renderCompressed, const MemoryProperties &properties, Context &context, bool preferCompression) {
|
||||
return renderCompressed && preferCompression;
|
||||
}
|
||||
|
||||
bool MemObjHelper::validateExtraMemoryProperties(const MemoryPropertiesFlags &memoryProperties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel, const Context &context) {
|
||||
bool MemObjHelper::validateExtraMemoryProperties(const MemoryProperties &memoryProperties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel, const Context &context) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,20 +30,20 @@ class MemObjHelper {
|
||||
static const uint64_t validFlagsForImage;
|
||||
static const uint64_t validFlagsForImageIntel;
|
||||
|
||||
static bool validateMemoryPropertiesForBuffer(const MemoryPropertiesFlags &memoryProperties, cl_mem_flags flags,
|
||||
static bool validateMemoryPropertiesForBuffer(const MemoryProperties &memoryProperties, cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel, const Context &context);
|
||||
static bool validateMemoryPropertiesForImage(const MemoryPropertiesFlags &memoryProperties, cl_mem_flags flags,
|
||||
static bool validateMemoryPropertiesForImage(const MemoryProperties &memoryProperties, cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel, cl_mem parent, const Context &context);
|
||||
static AllocationProperties getAllocationPropertiesWithImageInfo(uint32_t rootDeviceIndex, ImageInfo &imgInfo, bool allocateMemory,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
const HardwareInfo &hwInfo, DeviceBitfield subDevicesBitfieldParam);
|
||||
static bool checkMemFlagsForSubBuffer(cl_mem_flags flags);
|
||||
static SVMAllocsManager::SvmAllocationProperties getSvmAllocationProperties(cl_mem_flags flags);
|
||||
static bool isSuitableForRenderCompression(bool renderCompressed, const MemoryPropertiesFlags &properties, Context &context,
|
||||
static bool isSuitableForRenderCompression(bool renderCompressed, const MemoryProperties &properties, Context &context,
|
||||
bool preferCompression);
|
||||
|
||||
protected:
|
||||
static bool validateExtraMemoryProperties(const MemoryPropertiesFlags &memoryProperties, cl_mem_flags flags,
|
||||
static bool validateExtraMemoryProperties(const MemoryProperties &memoryProperties, cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel, const Context &context);
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
bool MemObjHelper::validateMemoryPropertiesForBuffer(const MemoryPropertiesFlags &memoryProperties, cl_mem_flags flags,
|
||||
bool MemObjHelper::validateMemoryPropertiesForBuffer(const MemoryProperties &memoryProperties, cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel, const Context &context) {
|
||||
/* Check all the invalid flags combination. */
|
||||
if ((isValueSet(flags, CL_MEM_READ_WRITE | CL_MEM_READ_ONLY)) ||
|
||||
@@ -26,7 +26,7 @@ bool MemObjHelper::validateMemoryPropertiesForBuffer(const MemoryPropertiesFlags
|
||||
return validateExtraMemoryProperties(memoryProperties, flags, flagsIntel, context);
|
||||
}
|
||||
|
||||
bool MemObjHelper::validateMemoryPropertiesForImage(const MemoryPropertiesFlags &memoryProperties, cl_mem_flags flags,
|
||||
bool MemObjHelper::validateMemoryPropertiesForImage(const MemoryProperties &memoryProperties, cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel, cl_mem parent, const Context &context) {
|
||||
/* Check all the invalid flags combination. */
|
||||
if ((!isValueSet(flags, CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL)) &&
|
||||
@@ -46,7 +46,7 @@ bool MemObjHelper::validateMemoryPropertiesForImage(const MemoryPropertiesFlags
|
||||
|
||||
auto parentMemObj = castToObject<MemObj>(parent);
|
||||
if (parentMemObj != nullptr && flags) {
|
||||
auto parentFlags = parentMemObj->getMemoryPropertiesFlags();
|
||||
auto parentFlags = parentMemObj->getFlags();
|
||||
/* Check whether flags are compatible with parent. */
|
||||
if (isValueSet(flags, CL_MEM_ALLOC_HOST_PTR) ||
|
||||
isValueSet(flags, CL_MEM_COPY_HOST_PTR) ||
|
||||
@@ -70,9 +70,9 @@ bool MemObjHelper::validateMemoryPropertiesForImage(const MemoryPropertiesFlags
|
||||
}
|
||||
|
||||
AllocationProperties MemObjHelper::getAllocationPropertiesWithImageInfo(uint32_t rootDeviceIndex, ImageInfo &imgInfo, bool allocateMemory,
|
||||
const MemoryPropertiesFlags &memoryProperties, const HardwareInfo &hwInfo, DeviceBitfield subDevicesBitfieldParam) {
|
||||
const MemoryProperties &memoryProperties, const HardwareInfo &hwInfo, DeviceBitfield subDevicesBitfieldParam) {
|
||||
AllocationProperties allocationProperties{rootDeviceIndex, allocateMemory, imgInfo, GraphicsAllocation::AllocationType::IMAGE, subDevicesBitfieldParam};
|
||||
MemoryPropertiesParser::fillPoliciesInProperties(allocationProperties, memoryProperties, hwInfo);
|
||||
MemoryPropertiesParserHelper::fillPoliciesInProperties(allocationProperties, memoryProperties, hwInfo);
|
||||
return allocationProperties;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ Pipe::Pipe(Context *context,
|
||||
GraphicsAllocation *gfxAllocation)
|
||||
: MemObj(context,
|
||||
CL_MEM_OBJECT_PIPE,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace),
|
||||
@@ -54,16 +54,16 @@ Pipe *Pipe::create(Context *context,
|
||||
MemoryManager *memoryManager = context->getMemoryManager();
|
||||
DEBUG_BREAK_IF(!memoryManager);
|
||||
|
||||
MemoryPropertiesFlags memoryPropertiesFlags = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0);
|
||||
while (true) {
|
||||
auto size = static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace);
|
||||
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
|
||||
AllocationProperties allocProperties =
|
||||
MemoryPropertiesParser::getAllocationProperties(rootDeviceIndex, memoryPropertiesFlags,
|
||||
true, // allocateMemory
|
||||
size, GraphicsAllocation::AllocationType::PIPE,
|
||||
false, // isMultiStorageAllocation
|
||||
context->getDevice(0)->getHardwareInfo(), context->getDevice(0)->getDeviceBitfield());
|
||||
MemoryPropertiesParserHelper::getAllocationProperties(rootDeviceIndex, memoryProperties,
|
||||
true, // allocateMemory
|
||||
size, GraphicsAllocation::AllocationType::PIPE,
|
||||
false, // isMultiStorageAllocation
|
||||
context->getDevice(0)->getHardwareInfo(), context->getDevice(0)->getDeviceBitfield());
|
||||
GraphicsAllocation *memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties);
|
||||
if (!memory) {
|
||||
errcodeRet = CL_OUT_OF_HOST_MEMORY;
|
||||
|
||||
@@ -99,7 +99,7 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo
|
||||
imgInfo.imgDesc.imageWidth /= 2;
|
||||
imgInfo.imgDesc.imageHeight /= 2;
|
||||
}
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0);
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(rootDeviceIndex, imgInfo,
|
||||
true, // allocateMemory
|
||||
memoryProperties, context->getDevice(0)->getHardwareInfo(),
|
||||
|
||||
@@ -188,7 +188,7 @@ void FileLogger<DebugLevel>::dumpKernelArgs(const Kernel *kernel) {
|
||||
if (memObj != nullptr) {
|
||||
ptr = static_cast<char *>(memObj->getCpuAddress());
|
||||
size = memObj->getSize();
|
||||
flags = memObj->getMemoryPropertiesFlags();
|
||||
flags = memObj->getFlags();
|
||||
}
|
||||
} else if (argInfo.isSampler) {
|
||||
type = "sampler";
|
||||
@@ -199,7 +199,7 @@ void FileLogger<DebugLevel>::dumpKernelArgs(const Kernel *kernel) {
|
||||
if (memObj != nullptr) {
|
||||
ptr = static_cast<char *>(memObj->getCpuAddress());
|
||||
size = memObj->getSize();
|
||||
flags = memObj->getMemoryPropertiesFlags();
|
||||
flags = memObj->getFlags();
|
||||
}
|
||||
} else {
|
||||
type = "immediate";
|
||||
|
||||
@@ -87,7 +87,7 @@ HWTEST_P(AUBCopyImage, simple) {
|
||||
auto retVal = CL_INVALID_VALUE;
|
||||
srcImage.reset(Image::create(
|
||||
context.get(),
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -98,7 +98,7 @@ HWTEST_P(AUBCopyImage, simple) {
|
||||
|
||||
dstImage.reset(Image::create(
|
||||
context.get(),
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
|
||||
@@ -185,7 +185,7 @@ HWTEST_P(AubFillImage, simple) {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
image.reset(Image::create(
|
||||
context.get(),
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
|
||||
@@ -127,7 +127,7 @@ HWTEST_P(AUBMapImage, MapUpdateUnmapVerify) {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, pClDevice->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
srcImage.reset(Image::create(
|
||||
context.get(),
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
|
||||
@@ -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, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0),
|
||||
CL_MEM_USE_HOST_PTR,
|
||||
0,
|
||||
sizeof(srcMemory),
|
||||
|
||||
@@ -145,7 +145,7 @@ HWTEST_P(AUBReadImage, simpleUnalignedMemory) {
|
||||
auto retVal = CL_INVALID_VALUE;
|
||||
srcImage.reset(Image::create(
|
||||
context.get(),
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
|
||||
@@ -82,7 +82,7 @@ struct AUBImageUnaligned
|
||||
|
||||
auto image = std::unique_ptr<Image>(Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -177,7 +177,7 @@ struct AUBImageUnaligned
|
||||
|
||||
auto image = std::unique_ptr<Image>(Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
|
||||
@@ -74,7 +74,7 @@ HWTEST_P(VerifyMemoryImageHw, givenDifferentImagesWhenValidatingMemoryThenSucces
|
||||
auto retVal = CL_INVALID_VALUE;
|
||||
std::unique_ptr<Image> image(Image::create(
|
||||
context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
|
||||
@@ -139,7 +139,7 @@ HWTEST_P(AUBWriteImage, simpleUnalignedMemory) {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
dstImage.reset(Image::create(
|
||||
context.get(),
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
|
||||
@@ -332,7 +332,7 @@ SKLTEST_F(AUBRunKernelIntegrateTest, deviceSideVme) {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
auto srcImage = Image::create(
|
||||
context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -343,7 +343,7 @@ SKLTEST_F(AUBRunKernelIntegrateTest, deviceSideVme) {
|
||||
|
||||
auto refImage = Image::create(
|
||||
context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
|
||||
@@ -112,7 +112,7 @@ HWTEST_P(AUBCreateImageArray, CheckArrayImages) {
|
||||
|
||||
image.reset(Image::create(
|
||||
context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -242,7 +242,7 @@ HWTEST_P(CopyHostPtrTest, imageWithDoubledRowPitchThatIsCreatedWithCopyHostPtrFl
|
||||
data += passedRowPitch;
|
||||
}
|
||||
|
||||
image.reset(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
image.reset(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, pHostPtr, retVal));
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_EQ(image->getImageDesc().image_row_pitch, imgInfo.rowPitch);
|
||||
@@ -312,7 +312,7 @@ HWTEST_P(UseHostPtrTest, imageWithRowPitchCreatedWithUseHostPtrFlagCopiedActuall
|
||||
}
|
||||
image.reset(Image::create(
|
||||
context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -408,7 +408,7 @@ HWTEST_F(AUBCreateImage, image3DCreatedWithDoubledSlicePitchWhenQueriedForDataRe
|
||||
}
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
image.reset(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
image.reset(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, host_ptr, retVal));
|
||||
|
||||
depthToCopy = imageDesc.image_depth;
|
||||
|
||||
@@ -922,7 +922,7 @@ TEST_F(EnqueueMapImageTest, givenImage1DArrayWhenEnqueueMapImageIsCalledThenRetu
|
||||
class MockImage : public Image {
|
||||
public:
|
||||
MockImage(Context *context, cl_mem_flags flags, GraphicsAllocation *allocation, const ClSurfaceFormatInfo &surfaceFormat,
|
||||
const cl_image_format &imageFormat, const cl_image_desc &imageDesc) : Image(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0,
|
||||
const cl_image_format &imageFormat, const cl_image_desc &imageDesc) : Image(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0,
|
||||
0, nullptr,
|
||||
imageFormat, imageDesc,
|
||||
true,
|
||||
|
||||
@@ -217,7 +217,7 @@ HWTEST_F(EnqueueThreading, enqueueCopyBufferToImage) {
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> dstImage(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
std::unique_ptr<Image> dstImage(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
ASSERT_NE(nullptr, dstImage.get());
|
||||
|
||||
size_t dstOrigin[3] = {1024u, 1, 0};
|
||||
@@ -241,9 +241,9 @@ HWTEST_F(EnqueueThreading, enqueueCopyImage) {
|
||||
imageDesc.image_width = 1024u;
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> srcImage(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
std::unique_ptr<Image> srcImage(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
ASSERT_NE(nullptr, srcImage.get());
|
||||
std::unique_ptr<Image> dstImage(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
std::unique_ptr<Image> dstImage(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
ASSERT_NE(nullptr, srcImage.get());
|
||||
|
||||
size_t srcOrigin[3] = {1024u, 1, 0};
|
||||
@@ -269,7 +269,7 @@ HWTEST_F(EnqueueThreading, enqueueCopyImageToBuffer) {
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> srcImage(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
std::unique_ptr<Image> srcImage(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 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));
|
||||
@@ -308,7 +308,7 @@ HWTEST_F(EnqueueThreading, enqueueFillImage) {
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> image(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
std::unique_ptr<Image> image(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
ASSERT_NE(nullptr, image.get());
|
||||
|
||||
size_t origin[3] = {1024u, 1, 0};
|
||||
@@ -354,7 +354,7 @@ HWTEST_F(EnqueueThreading, enqueueReadImage) {
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> image(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
std::unique_ptr<Image> image(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
ASSERT_NE(nullptr, image.get());
|
||||
|
||||
void *ptr = ::alignedMalloc(1024u, 4096);
|
||||
@@ -404,7 +404,7 @@ HWTEST_F(EnqueueThreading, enqueueWriteImage) {
|
||||
|
||||
cl_mem_flags flags = CL_MEM_READ_ONLY;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> image(Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
std::unique_ptr<Image> image(Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
ASSERT_NE(nullptr, image.get());
|
||||
|
||||
void *ptr = ::alignedMalloc(1024u, 4096);
|
||||
|
||||
@@ -90,7 +90,7 @@ struct MultipleMapBufferTest : public DeviceFixture, public ::testing::Test {
|
||||
|
||||
template <typename FamilyType>
|
||||
std::unique_ptr<MockBuffer<FamilyType>> createMockBuffer(bool mapOnGpu) {
|
||||
MemoryPropertiesFlags memoryProperties;
|
||||
MemoryProperties memoryProperties;
|
||||
auto mockAlloc = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
auto buffer = new MockBuffer<FamilyType>(context, memoryProperties, 0, 0, 1024, mockAlloc->getUnderlyingBuffer(), mockAlloc->getUnderlyingBuffer(),
|
||||
mockAlloc, false, false, false);
|
||||
|
||||
@@ -26,7 +26,7 @@ struct MultipleMapImageTest : public DeviceFixture, public ::testing::Test {
|
||||
using ImageHw<T>::ImageHw;
|
||||
|
||||
static Image *createMockImage(Context *context,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
uint64_t flags,
|
||||
uint64_t flagsIntel,
|
||||
size_t size,
|
||||
@@ -115,7 +115,7 @@ struct MultipleMapImageTest : public DeviceFixture, public ::testing::Test {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(Traits::flags, &Traits::imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto img = Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(Traits::flags, 0, 0), Traits::flags, 0, surfaceFormat, &Traits::imageDesc, Traits::hostPtr, retVal);
|
||||
auto img = Image::create(context, MemoryPropertiesParser::createMemoryProperties(Traits::flags, 0, 0), Traits::flags, 0, surfaceFormat, &Traits::imageDesc, Traits::hostPtr, retVal);
|
||||
auto mockImage = static_cast<MockImage<FamilyType> *>(img);
|
||||
|
||||
return std::unique_ptr<MockImage<FamilyType>>(mockImage);
|
||||
|
||||
@@ -473,7 +473,7 @@ TEST_F(PerformanceHintTest, given64bitCompressedBufferWhenItsCreatedThenProperPe
|
||||
cl_context_properties validProperties[3] = {CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL, CL_CONTEXT_DIAGNOSTICS_LEVEL_ALL_INTEL, 0};
|
||||
auto context = std::unique_ptr<MockContext>(Context::create<NEO::MockContext>(validProperties, ClDeviceVector(&deviceId, 1), callbackFunction, static_cast<void *>(userData), retVal));
|
||||
context->isSharedContext = false;
|
||||
auto buffer = std::unique_ptr<Buffer>(Buffer::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags((1 << 21), 0, 0), (1 << 21), 0, size, static_cast<void *>(NULL), retVal));
|
||||
auto buffer = std::unique_ptr<Buffer>(Buffer::create(context.get(), MemoryPropertiesParser::createMemoryProperties((1 << 21), 0, 0), (1 << 21), 0, size, static_cast<void *>(NULL), retVal));
|
||||
snprintf(expectedHint, DriverDiagnostics::maxHintStringSize, DriverDiagnostics::hintFormat[BUFFER_IS_COMPRESSED], buffer.get());
|
||||
auto compressionSupported = HwHelper::get(hwInfo.platform.eRenderCoreFamily).obtainRenderBufferCompressionPreference(hwInfo, size) &&
|
||||
HwHelper::renderCompressedBuffersSupported(hwInfo);
|
||||
@@ -491,7 +491,7 @@ TEST_F(PerformanceHintTest, givenUncompressedBufferWhenItsCreatedThenProperPerfo
|
||||
|
||||
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
|
||||
cl_device_id deviceId = device.get();
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0);
|
||||
|
||||
size_t size = 0u;
|
||||
|
||||
@@ -563,7 +563,7 @@ TEST_F(PerformanceHintTest, givenCompressedImageWhenItsCreatedThenProperPerforma
|
||||
|
||||
auto image = std::unique_ptr<Image>(Image::create(
|
||||
context.get(),
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -622,7 +622,7 @@ TEST_F(PerformanceHintTest, givenImageWithNoGmmWhenItsCreatedThenNoPerformanceHi
|
||||
|
||||
auto image = std::unique_ptr<Image>(Image::create(
|
||||
context.get(),
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -683,7 +683,7 @@ TEST_F(PerformanceHintTest, givenUncompressedImageWhenItsCreatedThenProperPerfor
|
||||
|
||||
auto image = std::unique_ptr<Image>(Image::create(
|
||||
context.get(),
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
|
||||
@@ -189,7 +189,7 @@ TEST_F(D3D9Tests, WhenCreatingSurfaceThenImagePropertiesAreSetCorrectly) {
|
||||
auto image = castToObject<Image>(memObj);
|
||||
EXPECT_NE(nullptr, image->getSharingHandler());
|
||||
|
||||
EXPECT_TRUE(CL_MEM_READ_WRITE == image->getMemoryPropertiesFlags());
|
||||
EXPECT_TRUE(CL_MEM_READ_WRITE == image->getFlags());
|
||||
|
||||
EXPECT_TRUE(expectedImgFormat.image_channel_data_type == image->getImageFormat().image_channel_data_type);
|
||||
EXPECT_TRUE(expectedImgFormat.image_channel_order == image->getImageFormat().image_channel_order);
|
||||
@@ -223,7 +223,7 @@ TEST_F(D3D9Tests, WhenCreatingSurfaceIntelThenImagePropertiesAreSetCorrectly) {
|
||||
auto image = castToObject<Image>(memObj);
|
||||
EXPECT_NE(nullptr, image->getSharingHandler());
|
||||
|
||||
EXPECT_TRUE(CL_MEM_READ_WRITE == image->getMemoryPropertiesFlags());
|
||||
EXPECT_TRUE(CL_MEM_READ_WRITE == image->getFlags());
|
||||
|
||||
EXPECT_TRUE(expectedImgFormat.image_channel_data_type == image->getImageFormat().image_channel_data_type);
|
||||
EXPECT_TRUE(expectedImgFormat.image_channel_order == image->getImageFormat().image_channel_order);
|
||||
|
||||
@@ -136,7 +136,7 @@ TYPED_TEST_P(D3DTests, WhenCreatingFromD3DBufferKhrApiThenValidBufferIsReturned)
|
||||
auto bufferObj = static_cast<D3DBuffer<TypeParam> *>(buffer->getSharingHandler().get());
|
||||
|
||||
EXPECT_EQ((D3DResource *)&this->dummyD3DBuffer, *bufferObj->getResourceHandler());
|
||||
EXPECT_TRUE(buffer->getMemoryPropertiesFlags() == CL_MEM_READ_WRITE);
|
||||
EXPECT_TRUE(buffer->getFlags() == CL_MEM_READ_WRITE);
|
||||
|
||||
clReleaseMemObject(memObj);
|
||||
}
|
||||
@@ -256,7 +256,7 @@ TYPED_TEST_P(D3DTests, WhenCreatingFromD3D2dTextureKhrApiThenValidImageIsReturne
|
||||
auto textureObj = static_cast<D3DTexture<TypeParam> *>(image->getSharingHandler().get());
|
||||
|
||||
EXPECT_EQ((D3DResource *)&this->dummyD3DTexture, *textureObj->getResourceHandler());
|
||||
EXPECT_TRUE(image->getMemoryPropertiesFlags() == CL_MEM_READ_WRITE);
|
||||
EXPECT_TRUE(image->getFlags() == CL_MEM_READ_WRITE);
|
||||
EXPECT_TRUE(image->getImageDesc().image_type == CL_MEM_OBJECT_IMAGE2D);
|
||||
EXPECT_EQ(1u, textureObj->getSubresource());
|
||||
|
||||
@@ -288,7 +288,7 @@ TYPED_TEST_P(D3DTests, WhenCreatingFromD3D3dTextureKhrApiThenValidImageIsReturne
|
||||
auto textureObj = static_cast<D3DTexture<TypeParam> *>(image->getSharingHandler().get());
|
||||
|
||||
EXPECT_EQ((D3DResource *)&this->dummyD3DTexture, *textureObj->getResourceHandler());
|
||||
EXPECT_TRUE(image->getMemoryPropertiesFlags() == CL_MEM_READ_WRITE);
|
||||
EXPECT_TRUE(image->getFlags() == CL_MEM_READ_WRITE);
|
||||
EXPECT_TRUE(image->getImageDesc().image_type == CL_MEM_OBJECT_IMAGE3D);
|
||||
EXPECT_EQ(1u, textureObj->getSubresource());
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ struct ImageHelper {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(Traits::flags, imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
auto image = Image::create(
|
||||
context,
|
||||
NEO::MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(Traits::flags, 0, 0),
|
||||
NEO::MemoryPropertiesParser::createMemoryProperties(Traits::flags, 0, 0),
|
||||
Traits::flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
|
||||
@@ -38,7 +38,7 @@ struct AppendSurfaceStateParamsTest : public ::testing::Test {
|
||||
void createImage() {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
EXPECT_NE(nullptr, surfaceFormat);
|
||||
image.reset(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
image.reset(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
}
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
|
||||
@@ -288,7 +288,7 @@ TEST(CastToImage, WhenCastingFromMemObjThenBehavesAsExpected) {
|
||||
extern std::thread::id tempThreadID;
|
||||
class MockBuffer : public MockBufferStorage, public Buffer {
|
||||
public:
|
||||
MockBuffer() : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data, &mockGfxAllocation, true, false, false) {
|
||||
MockBuffer() : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data, &mockGfxAllocation, true, false, false) {
|
||||
}
|
||||
|
||||
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly) override {
|
||||
|
||||
@@ -14,31 +14,31 @@
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct MemoryPropertiesParserTests : ::testing::Test {
|
||||
struct MemoryPropertiesParserHelperTests : ::testing::Test {
|
||||
MockContext context;
|
||||
MemoryPropertiesFlags memoryProperties;
|
||||
MemoryProperties memoryProperties;
|
||||
cl_mem_flags flags = 0;
|
||||
cl_mem_flags_intel flagsIntel = 0;
|
||||
cl_mem_alloc_flags_intel allocflags = 0;
|
||||
};
|
||||
|
||||
TEST_F(MemoryPropertiesParserTests, givenNullPropertiesWhenParsingMemoryPropertiesThenTrueIsReturned) {
|
||||
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(nullptr, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParser::MemoryPropertiesParser::ObjType::UNKNOWN, context));
|
||||
TEST_F(MemoryPropertiesParserHelperTests, givenNullPropertiesWhenParsingMemoryPropertiesThenTrueIsReturned) {
|
||||
EXPECT_TRUE(MemoryPropertiesParserHelper::parseMemoryProperties(nullptr, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::UNKNOWN, context));
|
||||
}
|
||||
|
||||
TEST_F(MemoryPropertiesParserTests, givenEmptyPropertiesWhenParsingMemoryPropertiesThenTrueIsReturned) {
|
||||
TEST_F(MemoryPropertiesParserHelperTests, givenEmptyPropertiesWhenParsingMemoryPropertiesThenTrueIsReturned) {
|
||||
cl_mem_properties_intel properties[] = {0};
|
||||
|
||||
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParser::MemoryPropertiesParser::ObjType::UNKNOWN, context));
|
||||
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParser::MemoryPropertiesParser::ObjType::BUFFER, context));
|
||||
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParser::MemoryPropertiesParser::ObjType::IMAGE, context));
|
||||
EXPECT_TRUE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::UNKNOWN, context));
|
||||
EXPECT_TRUE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::BUFFER, context));
|
||||
EXPECT_TRUE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParserHelper::MemoryPropertiesParserHelper::ObjType::IMAGE, context));
|
||||
}
|
||||
|
||||
TEST_F(MemoryPropertiesParserTests, givenValidPropertiesWhenParsingMemoryPropertiesThenTrueIsReturned) {
|
||||
TEST_F(MemoryPropertiesParserHelperTests, givenValidPropertiesWhenParsingMemoryPropertiesThenTrueIsReturned) {
|
||||
cl_mem_properties_intel properties[] = {
|
||||
CL_MEM_FLAGS,
|
||||
CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY | CL_MEM_ALLOC_HOST_PTR | CL_MEM_COPY_HOST_PTR |
|
||||
@@ -49,11 +49,11 @@ TEST_F(MemoryPropertiesParserTests, givenValidPropertiesWhenParsingMemoryPropert
|
||||
CL_MEM_ALLOC_WRITE_COMBINED_INTEL, CL_MEM_ALLOC_DEFAULT_INTEL,
|
||||
0};
|
||||
|
||||
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParser::ObjType::UNKNOWN, context));
|
||||
EXPECT_TRUE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParserHelper::ObjType::UNKNOWN, context));
|
||||
}
|
||||
|
||||
TEST_F(MemoryPropertiesParserTests, givenValidPropertiesWhenParsingMemoryPropertiesForBufferThenTrueIsReturned) {
|
||||
TEST_F(MemoryPropertiesParserHelperTests, givenValidPropertiesWhenParsingMemoryPropertiesForBufferThenTrueIsReturned) {
|
||||
cl_mem_properties_intel properties[] = {
|
||||
CL_MEM_FLAGS,
|
||||
MemObjHelper::validFlagsForBuffer,
|
||||
@@ -61,11 +61,11 @@ TEST_F(MemoryPropertiesParserTests, givenValidPropertiesWhenParsingMemoryPropert
|
||||
MemObjHelper::validFlagsForBufferIntel,
|
||||
0};
|
||||
|
||||
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParser::ObjType::BUFFER, context));
|
||||
EXPECT_TRUE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParserHelper::ObjType::BUFFER, context));
|
||||
}
|
||||
|
||||
TEST_F(MemoryPropertiesParserTests, givenValidPropertiesWhenParsingMemoryPropertiesForImageThenTrueIsReturned) {
|
||||
TEST_F(MemoryPropertiesParserHelperTests, givenValidPropertiesWhenParsingMemoryPropertiesForImageThenTrueIsReturned) {
|
||||
cl_mem_properties_intel properties[] = {
|
||||
CL_MEM_FLAGS,
|
||||
MemObjHelper::validFlagsForImage,
|
||||
@@ -73,24 +73,24 @@ TEST_F(MemoryPropertiesParserTests, givenValidPropertiesWhenParsingMemoryPropert
|
||||
MemObjHelper::validFlagsForImageIntel,
|
||||
0};
|
||||
|
||||
EXPECT_TRUE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParser::ObjType::IMAGE, context));
|
||||
EXPECT_TRUE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParserHelper::ObjType::IMAGE, context));
|
||||
}
|
||||
|
||||
TEST_F(MemoryPropertiesParserTests, givenInvalidPropertiesWhenParsingMemoryPropertiesThenFalseIsReturned) {
|
||||
TEST_F(MemoryPropertiesParserHelperTests, givenInvalidPropertiesWhenParsingMemoryPropertiesThenFalseIsReturned) {
|
||||
cl_mem_properties_intel properties[] = {
|
||||
(1 << 30), CL_MEM_ALLOC_HOST_PTR | CL_MEM_COPY_HOST_PTR | CL_MEM_USE_HOST_PTR,
|
||||
0};
|
||||
|
||||
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParser::ObjType::UNKNOWN, context));
|
||||
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParser::ObjType::BUFFER, context));
|
||||
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParser::ObjType::IMAGE, context));
|
||||
EXPECT_FALSE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParserHelper::ObjType::UNKNOWN, context));
|
||||
EXPECT_FALSE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParserHelper::ObjType::BUFFER, context));
|
||||
EXPECT_FALSE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParserHelper::ObjType::IMAGE, context));
|
||||
}
|
||||
|
||||
TEST_F(MemoryPropertiesParserTests, givenInvalidPropertiesWhenParsingMemoryPropertiesForImageThenFalseIsReturned) {
|
||||
TEST_F(MemoryPropertiesParserHelperTests, givenInvalidPropertiesWhenParsingMemoryPropertiesForImageThenFalseIsReturned) {
|
||||
cl_mem_properties_intel properties[] = {
|
||||
CL_MEM_FLAGS,
|
||||
MemObjHelper::validFlagsForBuffer,
|
||||
@@ -98,11 +98,11 @@ TEST_F(MemoryPropertiesParserTests, givenInvalidPropertiesWhenParsingMemoryPrope
|
||||
MemObjHelper::validFlagsForBufferIntel,
|
||||
0};
|
||||
|
||||
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParser::ObjType::IMAGE, context));
|
||||
EXPECT_FALSE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParserHelper::ObjType::IMAGE, context));
|
||||
}
|
||||
|
||||
TEST_F(MemoryPropertiesParserTests, givenInvalidFlagsWhenParsingMemoryPropertiesForImageThenFalseIsReturned) {
|
||||
TEST_F(MemoryPropertiesParserHelperTests, givenInvalidFlagsWhenParsingMemoryPropertiesForImageThenFalseIsReturned) {
|
||||
cl_mem_properties_intel properties[] = {
|
||||
CL_MEM_FLAGS,
|
||||
(1 << 30),
|
||||
@@ -110,11 +110,11 @@ TEST_F(MemoryPropertiesParserTests, givenInvalidFlagsWhenParsingMemoryProperties
|
||||
MemObjHelper::validFlagsForImageIntel,
|
||||
0};
|
||||
|
||||
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParser::ObjType::IMAGE, context));
|
||||
EXPECT_FALSE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParserHelper::ObjType::IMAGE, context));
|
||||
}
|
||||
|
||||
TEST_F(MemoryPropertiesParserTests, givenInvalidFlagsIntelWhenParsingMemoryPropertiesForImageThenFalseIsReturned) {
|
||||
TEST_F(MemoryPropertiesParserHelperTests, givenInvalidFlagsIntelWhenParsingMemoryPropertiesForImageThenFalseIsReturned) {
|
||||
cl_mem_properties_intel properties[] = {
|
||||
CL_MEM_FLAGS,
|
||||
MemObjHelper::validFlagsForImage,
|
||||
@@ -122,11 +122,11 @@ TEST_F(MemoryPropertiesParserTests, givenInvalidFlagsIntelWhenParsingMemoryPrope
|
||||
(1 << 30),
|
||||
0};
|
||||
|
||||
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParser::ObjType::IMAGE, context));
|
||||
EXPECT_FALSE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParserHelper::ObjType::IMAGE, context));
|
||||
}
|
||||
|
||||
TEST_F(MemoryPropertiesParserTests, givenInvalidPropertiesWhenParsingMemoryPropertiesForBufferThenFalseIsReturned) {
|
||||
TEST_F(MemoryPropertiesParserHelperTests, givenInvalidPropertiesWhenParsingMemoryPropertiesForBufferThenFalseIsReturned) {
|
||||
cl_mem_properties_intel properties[] = {
|
||||
CL_MEM_FLAGS,
|
||||
MemObjHelper::validFlagsForImage,
|
||||
@@ -134,11 +134,11 @@ TEST_F(MemoryPropertiesParserTests, givenInvalidPropertiesWhenParsingMemoryPrope
|
||||
MemObjHelper::validFlagsForImageIntel,
|
||||
0};
|
||||
|
||||
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParser::ObjType::BUFFER, context));
|
||||
EXPECT_FALSE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParserHelper::ObjType::BUFFER, context));
|
||||
}
|
||||
|
||||
TEST_F(MemoryPropertiesParserTests, givenInvalidFlagsWhenParsingMemoryPropertiesForBufferThenFalseIsReturned) {
|
||||
TEST_F(MemoryPropertiesParserHelperTests, givenInvalidFlagsWhenParsingMemoryPropertiesForBufferThenFalseIsReturned) {
|
||||
cl_mem_properties_intel properties[] = {
|
||||
CL_MEM_FLAGS,
|
||||
(1 << 30),
|
||||
@@ -146,11 +146,11 @@ TEST_F(MemoryPropertiesParserTests, givenInvalidFlagsWhenParsingMemoryProperties
|
||||
MemObjHelper::validFlagsForBufferIntel,
|
||||
0};
|
||||
|
||||
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParser::ObjType::BUFFER, context));
|
||||
EXPECT_FALSE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParserHelper::ObjType::BUFFER, context));
|
||||
}
|
||||
|
||||
TEST_F(MemoryPropertiesParserTests, givenInvalidFlagsIntelWhenParsingMemoryPropertiesForBufferThenFalseIsReturned) {
|
||||
TEST_F(MemoryPropertiesParserHelperTests, givenInvalidFlagsIntelWhenParsingMemoryPropertiesForBufferThenFalseIsReturned) {
|
||||
cl_mem_properties_intel properties[] = {
|
||||
CL_MEM_FLAGS,
|
||||
MemObjHelper::validFlagsForBuffer,
|
||||
@@ -158,11 +158,11 @@ TEST_F(MemoryPropertiesParserTests, givenInvalidFlagsIntelWhenParsingMemoryPrope
|
||||
(1 << 30),
|
||||
0};
|
||||
|
||||
EXPECT_FALSE(MemoryPropertiesParser::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParser::ObjType::BUFFER, context));
|
||||
EXPECT_FALSE(MemoryPropertiesParserHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesParserHelper::ObjType::BUFFER, context));
|
||||
}
|
||||
|
||||
TEST_F(MemoryPropertiesParserTests, givenDifferentParametersWhenCallingFillCachePolicyInPropertiesThenFlushL3FlagsAreCorrectlySet) {
|
||||
TEST_F(MemoryPropertiesParserHelperTests, givenDifferentParametersWhenCallingFillCachePolicyInPropertiesThenFlushL3FlagsAreCorrectlySet) {
|
||||
AllocationProperties allocationProperties{0, 0, GraphicsAllocation::AllocationType::BUFFER};
|
||||
|
||||
for (auto uncached : ::testing::Bool()) {
|
||||
@@ -171,13 +171,13 @@ TEST_F(MemoryPropertiesParserTests, givenDifferentParametersWhenCallingFillCache
|
||||
if (uncached || readOnly || deviceOnlyVisibilty) {
|
||||
allocationProperties.flags.flushL3RequiredForRead = true;
|
||||
allocationProperties.flags.flushL3RequiredForWrite = true;
|
||||
MemoryPropertiesParser::fillCachePolicyInProperties(allocationProperties, uncached, readOnly, deviceOnlyVisibilty);
|
||||
MemoryPropertiesParserHelper::fillCachePolicyInProperties(allocationProperties, uncached, readOnly, deviceOnlyVisibilty);
|
||||
EXPECT_FALSE(allocationProperties.flags.flushL3RequiredForRead);
|
||||
EXPECT_FALSE(allocationProperties.flags.flushL3RequiredForWrite);
|
||||
} else {
|
||||
allocationProperties.flags.flushL3RequiredForRead = false;
|
||||
allocationProperties.flags.flushL3RequiredForWrite = false;
|
||||
MemoryPropertiesParser::fillCachePolicyInProperties(allocationProperties, uncached, readOnly, deviceOnlyVisibilty);
|
||||
MemoryPropertiesParserHelper::fillCachePolicyInProperties(allocationProperties, uncached, readOnly, deviceOnlyVisibilty);
|
||||
EXPECT_TRUE(allocationProperties.flags.flushL3RequiredForRead);
|
||||
EXPECT_TRUE(allocationProperties.flags.flushL3RequiredForWrite);
|
||||
}
|
||||
|
||||
@@ -12,109 +12,109 @@
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
TEST(MemoryPropertiesFlags, givenValidPropertiesWhenCreateMemoryPropertiesFlagsThenTrueIsReturned) {
|
||||
MemoryPropertiesFlags properties;
|
||||
TEST(MemoryProperties, givenValidPropertiesWhenCreateMemoryPropertiesThenTrueIsReturned) {
|
||||
MemoryProperties properties;
|
||||
|
||||
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0, 0);
|
||||
properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0);
|
||||
EXPECT_TRUE(properties.flags.readWrite);
|
||||
|
||||
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_WRITE_ONLY, 0, 0);
|
||||
properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_WRITE_ONLY, 0, 0);
|
||||
EXPECT_TRUE(properties.flags.writeOnly);
|
||||
|
||||
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_ONLY, 0, 0);
|
||||
properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_ONLY, 0, 0);
|
||||
EXPECT_TRUE(properties.flags.readOnly);
|
||||
|
||||
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
EXPECT_TRUE(properties.flags.useHostPtr);
|
||||
|
||||
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_ALLOC_HOST_PTR, 0, 0);
|
||||
properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_ALLOC_HOST_PTR, 0, 0);
|
||||
EXPECT_TRUE(properties.flags.allocHostPtr);
|
||||
|
||||
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
EXPECT_TRUE(properties.flags.copyHostPtr);
|
||||
|
||||
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_HOST_WRITE_ONLY, 0, 0);
|
||||
properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_HOST_WRITE_ONLY, 0, 0);
|
||||
EXPECT_TRUE(properties.flags.hostWriteOnly);
|
||||
|
||||
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_HOST_READ_ONLY, 0, 0);
|
||||
properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_HOST_READ_ONLY, 0, 0);
|
||||
EXPECT_TRUE(properties.flags.hostReadOnly);
|
||||
|
||||
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_HOST_NO_ACCESS, 0, 0);
|
||||
properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_HOST_NO_ACCESS, 0, 0);
|
||||
EXPECT_TRUE(properties.flags.hostNoAccess);
|
||||
|
||||
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_KERNEL_READ_AND_WRITE, 0, 0);
|
||||
properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_KERNEL_READ_AND_WRITE, 0, 0);
|
||||
EXPECT_TRUE(properties.flags.kernelReadAndWrite);
|
||||
|
||||
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL, 0, 0);
|
||||
properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL, 0, 0);
|
||||
EXPECT_TRUE(properties.flags.accessFlagsUnrestricted);
|
||||
|
||||
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_NO_ACCESS_INTEL, 0, 0);
|
||||
properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_NO_ACCESS_INTEL, 0, 0);
|
||||
EXPECT_TRUE(properties.flags.noAccess);
|
||||
|
||||
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, CL_MEM_LOCALLY_UNCACHED_RESOURCE, 0);
|
||||
properties = MemoryPropertiesParser::createMemoryProperties(0, CL_MEM_LOCALLY_UNCACHED_RESOURCE, 0);
|
||||
EXPECT_TRUE(properties.flags.locallyUncachedResource);
|
||||
|
||||
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE, 0);
|
||||
properties = MemoryPropertiesParser::createMemoryProperties(0, CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE, 0);
|
||||
EXPECT_TRUE(properties.flags.locallyUncachedInSurfaceState);
|
||||
|
||||
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL, 0, 0);
|
||||
properties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL, 0, 0);
|
||||
EXPECT_TRUE(properties.flags.forceSharedPhysicalMemory);
|
||||
|
||||
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, 0, CL_MEM_ALLOC_WRITE_COMBINED_INTEL);
|
||||
properties = MemoryPropertiesParser::createMemoryProperties(0, 0, CL_MEM_ALLOC_WRITE_COMBINED_INTEL);
|
||||
EXPECT_TRUE(properties.allocFlags.allocWriteCombined);
|
||||
|
||||
properties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, CL_MEM_48BIT_RESOURCE_INTEL, 0);
|
||||
properties = MemoryPropertiesParser::createMemoryProperties(0, CL_MEM_48BIT_RESOURCE_INTEL, 0);
|
||||
EXPECT_TRUE(properties.flags.resource48Bit);
|
||||
}
|
||||
|
||||
TEST(MemoryPropertiesFlags, givenClMemForceLinearStorageFlagWhenCreateMemoryPropertiesFlagsThenReturnProperValue) {
|
||||
MemoryPropertiesFlags memoryProperties;
|
||||
TEST(MemoryProperties, givenClMemForceLinearStorageFlagWhenCreateMemoryPropertiesThenReturnProperValue) {
|
||||
MemoryProperties memoryProperties;
|
||||
cl_mem_flags flags = 0;
|
||||
cl_mem_flags_intel flagsIntel = 0;
|
||||
|
||||
flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
|
||||
flagsIntel = 0;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
EXPECT_TRUE(memoryProperties.flags.forceLinearStorage);
|
||||
|
||||
flags = 0;
|
||||
flagsIntel |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
EXPECT_TRUE(memoryProperties.flags.forceLinearStorage);
|
||||
|
||||
flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
|
||||
flagsIntel |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
EXPECT_TRUE(memoryProperties.flags.forceLinearStorage);
|
||||
|
||||
flags = 0;
|
||||
flagsIntel = 0;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
EXPECT_FALSE(memoryProperties.flags.forceLinearStorage);
|
||||
}
|
||||
|
||||
TEST(MemoryPropertiesFlags, givenClAllowUnrestrictedSizeFlagWhenCreateMemoryPropertiesFlagsThenReturnProperValue) {
|
||||
MemoryPropertiesFlags memoryProperties;
|
||||
TEST(MemoryProperties, givenClAllowUnrestrictedSizeFlagWhenCreateMemoryPropertiesThenReturnProperValue) {
|
||||
MemoryProperties memoryProperties;
|
||||
cl_mem_flags flags = 0;
|
||||
cl_mem_flags_intel flagsIntel = 0;
|
||||
|
||||
flags |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL;
|
||||
flagsIntel = 0;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
EXPECT_TRUE(memoryProperties.flags.allowUnrestrictedSize);
|
||||
|
||||
flags = 0;
|
||||
flagsIntel |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
EXPECT_TRUE(memoryProperties.flags.allowUnrestrictedSize);
|
||||
|
||||
flags |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL;
|
||||
flagsIntel |= CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
EXPECT_TRUE(memoryProperties.flags.allowUnrestrictedSize);
|
||||
|
||||
flags = 0;
|
||||
flagsIntel = 0;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
EXPECT_FALSE(memoryProperties.flags.allowUnrestrictedSize);
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ TEST_F(KernelImageArgTest, givenImageWithWriteOnlyAccessAndReadOnlyArgWhenCheckC
|
||||
imgDesc.image_width = 5;
|
||||
imgDesc.image_height = 5;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
|
||||
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
|
||||
pKernelInfo->kernelArgInfo[0].metadata.accessQualifier = NEO::KernelArgMetadata::AccessReadOnly;
|
||||
cl_mem memObj = img.get();
|
||||
retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj);
|
||||
@@ -160,7 +160,7 @@ TEST_F(KernelImageArgTest, givenImageWithReadOnlyAccessAndWriteOnlyArgWhenCheckC
|
||||
imgDesc.image_width = 5;
|
||||
imgDesc.image_height = 5;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
|
||||
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
|
||||
pKernelInfo->kernelArgInfo[0].metadata.accessQualifier = NEO::KernelArgMetadata::AccessWriteOnly;
|
||||
cl_mem memObj = img.get();
|
||||
retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj);
|
||||
@@ -180,7 +180,7 @@ TEST_F(KernelImageArgTest, givenImageWithReadOnlyAccessAndReadOnlyArgWhenCheckCo
|
||||
imgDesc.image_width = 5;
|
||||
imgDesc.image_height = 5;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
|
||||
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
|
||||
pKernelInfo->kernelArgInfo[0].metadata.accessQualifier = NEO::KernelArgMetadata::AccessReadOnly;
|
||||
cl_mem memObj = img.get();
|
||||
retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj);
|
||||
@@ -196,7 +196,7 @@ TEST_F(KernelImageArgTest, givenImageWithWriteOnlyAccessAndWriteOnlyArgWhenCheck
|
||||
imgDesc.image_width = 5;
|
||||
imgDesc.image_height = 5;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
|
||||
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
|
||||
pKernelInfo->kernelArgInfo[0].metadata.accessQualifier = NEO::KernelArgMetadata::AccessWriteOnly;
|
||||
cl_mem memObj = img.get();
|
||||
retVal = pKernel->checkCorrectImageAccessQualifier(0, sizeof(memObj), &memObj);
|
||||
@@ -241,7 +241,7 @@ TEST_F(KernelImageArgTest, givenKernelWithSettedArgWhenUnSetCalledThenArgIsUnset
|
||||
imgDesc.image_width = 5;
|
||||
imgDesc.image_height = 5;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
|
||||
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
|
||||
cl_mem memObj = img.get();
|
||||
|
||||
retVal = pKernel->setArg(0, sizeof(memObj), &memObj);
|
||||
@@ -278,7 +278,7 @@ TEST_F(KernelImageArgTest, givenKernelWithSharedImageWhenSetArgCalledThenUsingSh
|
||||
imgDesc.image_width = 5;
|
||||
imgDesc.image_height = 5;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imgFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
|
||||
std::unique_ptr<Image> img(Image::create(context.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imgDesc, nullptr, retVal));
|
||||
cl_mem memObj = img.get();
|
||||
|
||||
MockSharingHandler *mockSharingHandler = new MockSharingHandler;
|
||||
|
||||
@@ -2089,7 +2089,7 @@ HWTEST_F(KernelResidencyTest, test_MakeArgsResidentCheckImageFromImage) {
|
||||
|
||||
cl_int retVal;
|
||||
MockContext context;
|
||||
std::unique_ptr<NEO::Image> imageNV12(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
std::unique_ptr<NEO::Image> imageNV12(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
EXPECT_EQ(imageNV12->getMediaPlaneType(), 0u);
|
||||
|
||||
@@ -2103,7 +2103,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, 0, 0),
|
||||
std::unique_ptr<NEO::Image> imageY(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
EXPECT_EQ(imageY->getMediaPlaneType(), 0u);
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ TEST_F(BufferSetArgTest, givenBufferWhenOffsetedSubbufferIsPassedToSetKernelArgT
|
||||
region.origin = 0xc0;
|
||||
region.size = 32;
|
||||
cl_int error = 0;
|
||||
auto subBuffer = buffer->createSubBuffer(buffer->getMemoryPropertiesFlags(), buffer->getMemoryPropertiesFlagsIntel(), ®ion, error);
|
||||
auto subBuffer = buffer->createSubBuffer(buffer->getFlags(), buffer->getFlagsIntel(), ®ion, error);
|
||||
|
||||
ASSERT_NE(nullptr, subBuffer);
|
||||
|
||||
|
||||
@@ -88,11 +88,11 @@ TEST(Buffer, givenReadOnlySetOfInputFlagsWhenPassedToisReadOnlyMemoryPermittedBy
|
||||
using Buffer::isReadOnlyMemoryPermittedByFlags;
|
||||
};
|
||||
cl_mem_flags flags = CL_MEM_HOST_NO_ACCESS | CL_MEM_READ_ONLY;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0);
|
||||
EXPECT_TRUE(MockBuffer::isReadOnlyMemoryPermittedByFlags(memoryProperties));
|
||||
|
||||
flags = CL_MEM_HOST_READ_ONLY | CL_MEM_READ_ONLY;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0);
|
||||
EXPECT_TRUE(MockBuffer::isReadOnlyMemoryPermittedByFlags(memoryProperties));
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ TEST_P(BufferReadOnlyTest, givenNonReadOnlySetOfInputFlagsWhenPassedToisReadOnly
|
||||
};
|
||||
|
||||
cl_mem_flags flags = GetParam() | CL_MEM_USE_HOST_PTR;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0);
|
||||
EXPECT_FALSE(MockBuffer::isReadOnlyMemoryPermittedByFlags(memoryProperties));
|
||||
}
|
||||
static cl_mem_flags nonReadOnlyFlags[] = {
|
||||
@@ -334,7 +334,7 @@ TEST(Buffer, givenAllocHostPtrFlagPassedToBufferCreateWhenNoSharedContextOrRende
|
||||
}
|
||||
|
||||
TEST(Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturnedIn64Bit) {
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, 0, 0);
|
||||
MockContext context;
|
||||
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
|
||||
context.isSharedContext = false;
|
||||
@@ -343,7 +343,7 @@ TEST(Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenB
|
||||
}
|
||||
|
||||
TEST(Buffer, givenRenderCompressedBuffersDisabledLocalMemoryEnabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturnedIn64Bit) {
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, 0, 0);
|
||||
MockContext context;
|
||||
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
|
||||
context.isSharedContext = false;
|
||||
@@ -352,7 +352,7 @@ TEST(Buffer, givenRenderCompressedBuffersDisabledLocalMemoryEnabledWhenAllocatio
|
||||
}
|
||||
|
||||
TEST(Buffer, givenSharedContextWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, 0, 0);
|
||||
MockContext context;
|
||||
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
|
||||
context.isSharedContext = true;
|
||||
@@ -361,7 +361,7 @@ TEST(Buffer, givenSharedContextWhenAllocationTypeIsQueriedThenBufferHostMemoryTy
|
||||
}
|
||||
|
||||
TEST(Buffer, givenSharedContextAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, 0, 0);
|
||||
MockContext context;
|
||||
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
|
||||
context.isSharedContext = true;
|
||||
@@ -371,7 +371,7 @@ TEST(Buffer, givenSharedContextAndRenderCompressedBuffersEnabledWhenAllocationTy
|
||||
|
||||
TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
|
||||
cl_mem_flags flags = CL_MEM_USE_HOST_PTR;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0);
|
||||
MockContext context;
|
||||
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
|
||||
context.isSharedContext = false;
|
||||
@@ -381,7 +381,7 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledWhenAllocationTypeIsQuerie
|
||||
|
||||
TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
|
||||
cl_mem_flags flags = CL_MEM_USE_HOST_PTR;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0);
|
||||
MockContext context;
|
||||
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
|
||||
context.isSharedContext = false;
|
||||
@@ -391,7 +391,7 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledWhenAllocationTypeIsQueried
|
||||
|
||||
TEST(Buffer, givenAllocHostPtrFlagWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
|
||||
cl_mem_flags flags = CL_MEM_ALLOC_HOST_PTR;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0);
|
||||
MockContext context;
|
||||
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
|
||||
context.isSharedContext = false;
|
||||
@@ -401,7 +401,7 @@ TEST(Buffer, givenAllocHostPtrFlagWhenAllocationTypeIsQueriedThenBufferTypeIsRet
|
||||
|
||||
TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferMemoryTypeIsReturned) {
|
||||
cl_mem_flags flags = CL_MEM_USE_HOST_PTR;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0);
|
||||
MockContext context;
|
||||
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
|
||||
context.isSharedContext = false;
|
||||
@@ -411,7 +411,7 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledAndRenderCompressedBuffers
|
||||
|
||||
TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferMemoryTypeIsReturned) {
|
||||
cl_mem_flags flags = CL_MEM_USE_HOST_PTR;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0);
|
||||
MockContext context;
|
||||
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
|
||||
context.isSharedContext = false;
|
||||
@@ -421,7 +421,7 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledAndRenderCompressedBuffersE
|
||||
|
||||
TEST(Buffer, givenUseHostPointerFlagAndForceSharedPhysicalStorageWhenLocalMemoryIsEnabledThenBufferHostMemoryTypeIsReturned) {
|
||||
cl_mem_flags flags = CL_MEM_USE_HOST_PTR | CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0);
|
||||
MockContext context;
|
||||
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
|
||||
context.isSharedContext = false;
|
||||
@@ -431,7 +431,7 @@ TEST(Buffer, givenUseHostPointerFlagAndForceSharedPhysicalStorageWhenLocalMemory
|
||||
|
||||
TEST(Buffer, givenAllocHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturned) {
|
||||
cl_mem_flags flags = CL_MEM_ALLOC_HOST_PTR;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0);
|
||||
MockContext context;
|
||||
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
|
||||
context.isSharedContext = false;
|
||||
@@ -440,7 +440,7 @@ TEST(Buffer, givenAllocHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocatio
|
||||
}
|
||||
|
||||
TEST(Buffer, givenZeroFlagsNoSharedContextAndRenderCompressedBuffersDisabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, 0, 0);
|
||||
MockContext context;
|
||||
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
|
||||
context.isSharedContext = false;
|
||||
@@ -1897,7 +1897,7 @@ TEST_P(NoHostPtr, GivenNoHostPtrWhenHwBufferCreationFailsThenReturnNullptr) {
|
||||
BufferFuncsBackup[i] = bufferFactory[i];
|
||||
bufferFactory[i].createBufferFunction =
|
||||
[](Context *,
|
||||
MemoryPropertiesFlags,
|
||||
MemoryProperties,
|
||||
cl_mem_flags,
|
||||
cl_mem_flags_intel,
|
||||
size_t,
|
||||
|
||||
@@ -64,7 +64,7 @@ typedef CreateImageFormatTest<CL_MEM_READ_WRITE> ReadWriteFormatTest;
|
||||
TEST_P(ReadWriteFormatTest, returnsSuccess) {
|
||||
auto image = Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -89,7 +89,7 @@ typedef CreateImageFormatTest<CL_MEM_READ_ONLY> ReadOnlyFormatTest;
|
||||
TEST_P(ReadOnlyFormatTest, returnsSuccess) {
|
||||
auto image = Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -112,7 +112,7 @@ typedef CreateImageFormatTest<CL_MEM_WRITE_ONLY> WriteOnlyFormatTest;
|
||||
TEST_P(WriteOnlyFormatTest, returnsSuccess) {
|
||||
auto image = Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
|
||||
@@ -75,7 +75,7 @@ HWTEST_P(CreateImage1DType, validTypes) {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, pClDevice->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
auto image = Image::create(
|
||||
context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
|
||||
@@ -60,7 +60,7 @@ class Image2dFromBufferTest : public DeviceFixture, public ::testing::Test {
|
||||
Image *createImage() {
|
||||
cl_mem_flags flags = CL_MEM_READ_ONLY;
|
||||
auto surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
return Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, NULL, retVal);
|
||||
return Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, NULL, retVal);
|
||||
}
|
||||
cl_image_format imageFormat;
|
||||
cl_image_desc imageDesc;
|
||||
@@ -91,7 +91,7 @@ TEST_F(Image2dFromBufferTest, givenBufferWhenCreateImage2dArrayFromBufferThenIma
|
||||
imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
||||
cl_mem_flags flags = CL_MEM_READ_ONLY;
|
||||
auto surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), surfaceFormat, &imageDesc, NULL);
|
||||
retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL);
|
||||
EXPECT_EQ(CL_INVALID_IMAGE_DESCRIPTOR, retVal);
|
||||
}
|
||||
TEST_F(Image2dFromBufferTest, CalculateRowPitch) {
|
||||
@@ -107,7 +107,7 @@ TEST_F(Image2dFromBufferTest, givenInvalidRowPitchWhenCreateImage2dFromBufferThe
|
||||
imageDesc.image_row_pitch = 255;
|
||||
cl_mem_flags flags = CL_MEM_READ_ONLY;
|
||||
auto surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), surfaceFormat, &imageDesc, ptr);
|
||||
retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, ptr);
|
||||
EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ TEST_F(Image2dFromBufferTest, InvalidHostPtrAlignment) {
|
||||
ASSERT_NE(nullptr, imageDesc.mem_object);
|
||||
cl_mem_flags flags = CL_MEM_READ_ONLY;
|
||||
auto surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), surfaceFormat, &imageDesc, NULL);
|
||||
retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL);
|
||||
EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
|
||||
|
||||
clReleaseMemObject(imageDesc.mem_object);
|
||||
@@ -149,7 +149,7 @@ TEST_F(Image2dFromBufferTest, givenInvalidFlagsWhenValidateIsCalledThenReturnErr
|
||||
|
||||
for (auto flag : flags) {
|
||||
const auto surfaceFormat = Image::getSurfaceFormatFromTable(flag, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flag, 0, 0), surfaceFormat, &imageDesc, reinterpret_cast<void *>(0x12345));
|
||||
retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flag, 0, 0), surfaceFormat, &imageDesc, reinterpret_cast<void *>(0x12345));
|
||||
EXPECT_EQ(CL_INVALID_VALUE, retVal);
|
||||
}
|
||||
}
|
||||
@@ -162,7 +162,7 @@ TEST_F(Image2dFromBufferTest, givenOneChannel8BitColorsNoRowPitchSpecifiedAndToo
|
||||
imageFormat.image_channel_order = CL_R;
|
||||
|
||||
const auto surfaceFormat = static_cast<const ClSurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport));
|
||||
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), surfaceFormat, &imageDesc, NULL);
|
||||
retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL);
|
||||
EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ TEST_F(Image2dFromBufferTest, givenOneChannel16BitColorsNoRowPitchSpecifiedAndTo
|
||||
imageFormat.image_channel_order = CL_R;
|
||||
|
||||
const auto surfaceFormat = static_cast<const ClSurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport));
|
||||
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), surfaceFormat, &imageDesc, NULL);
|
||||
retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL);
|
||||
EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel8BitColorsNoRowPitchSpecifiedAndTo
|
||||
imageFormat.image_channel_order = CL_RGBA;
|
||||
|
||||
const auto surfaceFormat = static_cast<const ClSurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport));
|
||||
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), surfaceFormat, &imageDesc, NULL);
|
||||
retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL);
|
||||
EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel16BitColorsNoRowPitchSpecifiedAndT
|
||||
imageFormat.image_channel_order = CL_RGBA;
|
||||
|
||||
const auto surfaceFormat = static_cast<const ClSurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport));
|
||||
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), surfaceFormat, &imageDesc, NULL);
|
||||
retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL);
|
||||
EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel8BitColorsAndNotTooLargeRowPitchSp
|
||||
imageFormat.image_channel_order = CL_RGBA;
|
||||
|
||||
const auto surfaceFormat = static_cast<const ClSurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport));
|
||||
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), surfaceFormat, &imageDesc, NULL);
|
||||
retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel8BitColorsAndTooLargeRowPitchSpeci
|
||||
imageFormat.image_channel_order = CL_RGBA;
|
||||
|
||||
const auto surfaceFormat = static_cast<const ClSurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport));
|
||||
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), surfaceFormat, &imageDesc, NULL);
|
||||
retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL);
|
||||
EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ TEST_F(Image2dFromBufferTest, givenUnalignedImageWidthAndNoSpaceInBufferForAlign
|
||||
imageFormat.image_channel_order = CL_R;
|
||||
|
||||
const auto surfaceFormat = static_cast<const ClSurfaceFormatInfo *>(Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport));
|
||||
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), surfaceFormat, &imageDesc, NULL);
|
||||
retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, NULL);
|
||||
EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, retVal);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ class CreateImage2DTest : public DeviceFixture,
|
||||
}
|
||||
Image *createImageWithFlags(cl_mem_flags flags) {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
return Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal);
|
||||
return Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal);
|
||||
}
|
||||
cl_image_format imageFormat;
|
||||
cl_image_desc imageDesc;
|
||||
|
||||
@@ -61,7 +61,7 @@ class CreateImage3DTest : public DeviceFixture,
|
||||
HWTEST_F(CreateImage3DTest, validTypes) {
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
auto image = Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal);
|
||||
auto image = Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, nullptr, retVal);
|
||||
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, image);
|
||||
|
||||
@@ -75,7 +75,7 @@ HWTEST_P(CreateImageArraySize, arrayTypes) {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
auto image = Image::create(
|
||||
context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -116,7 +116,7 @@ HWTEST_P(CreateImageNonArraySize, NonArrayTypes) {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
auto image = Image::create(
|
||||
context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
|
||||
@@ -62,7 +62,7 @@ class ImageFromSubBufferTest : public DeviceFixture, public ::testing::Test {
|
||||
Image *createImage() {
|
||||
cl_mem_flags flags = CL_MEM_READ_ONLY;
|
||||
auto surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
return Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, NULL, retVal);
|
||||
return Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, NULL, retVal);
|
||||
}
|
||||
cl_image_format imageFormat;
|
||||
cl_image_desc imageDesc;
|
||||
|
||||
@@ -53,7 +53,7 @@ class ImageRedescribeTest : public testing::TestWithParam<std::tuple<size_t, uin
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
image.reset(Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -76,7 +76,7 @@ TEST_P(ImageRedescribeTest, givenImageWhenItIsRedescribedThenItContainsProperFor
|
||||
ASSERT_NE(nullptr, imageNew);
|
||||
ASSERT_NE(image, imageNew);
|
||||
|
||||
EXPECT_EQ(static_cast<cl_mem_flags>(CL_MEM_USE_HOST_PTR), imageNew->getMemoryPropertiesFlags() & CL_MEM_USE_HOST_PTR);
|
||||
EXPECT_EQ(static_cast<cl_mem_flags>(CL_MEM_USE_HOST_PTR), imageNew->getFlags() & CL_MEM_USE_HOST_PTR);
|
||||
EXPECT_EQ(image->getCpuAddress(), imageNew->getCpuAddress());
|
||||
EXPECT_NE(static_cast<cl_channel_type>(CL_FLOAT), imageNew->getSurfaceFormatInfo().OCLImageFormat.image_channel_data_type);
|
||||
EXPECT_NE(static_cast<cl_channel_type>(CL_HALF_FLOAT), imageNew->getSurfaceFormatInfo().OCLImageFormat.image_channel_data_type);
|
||||
@@ -194,7 +194,7 @@ TEST_P(ImageRedescribeTest, givenImageWithMaxSizesWhenItIsRedescribedThenNewImag
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
auto bigImage = std::unique_ptr<Image>(Image::create(&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
|
||||
@@ -47,7 +47,7 @@ class CreateImageTest : public DeviceFixture,
|
||||
}
|
||||
Image *createImageWithFlags(cl_mem_flags flags) {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
return Image::create(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
return Image::create(context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
auto image = Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -148,7 +148,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
|
||||
|
||||
image = Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -173,7 +173,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
|
||||
|
||||
image = Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -198,7 +198,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
|
||||
|
||||
image = Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -223,7 +223,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
|
||||
|
||||
image = Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -248,7 +248,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
|
||||
|
||||
image = Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -273,7 +273,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
|
||||
|
||||
image = Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -298,7 +298,7 @@ TEST(TestSliceAndRowPitch, ForDifferentDescriptorsGetHostPtrSlicePitchAndRowPitc
|
||||
|
||||
image = Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -349,7 +349,7 @@ TEST(TestCreateImage, UseSharedContextToCreateImage) {
|
||||
|
||||
auto image = Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -410,7 +410,7 @@ TEST(TestCreateImageUseHostPtr, CheckMemoryAllocationForDifferenHostPtrAlignment
|
||||
for (int i = 0; i < 4; i++) {
|
||||
auto image = Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -448,7 +448,7 @@ TEST(TestCreateImageUseHostPtr, givenZeroCopyImageValuesWhenUsingHostPtrThenZero
|
||||
|
||||
auto image = std::unique_ptr<Image>(Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -557,7 +557,7 @@ struct CreateImageHostPtr
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
return Image::create(
|
||||
context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -972,7 +972,7 @@ HWTEST_F(ImageCompressionTests, givenTiledImageWhenCreatingAllocationThenPreferR
|
||||
MockContext context;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
|
||||
auto image = std::unique_ptr<Image>(Image::create(mockContext.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
auto image = std::unique_ptr<Image>(Image::create(mockContext.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
ASSERT_NE(nullptr, image);
|
||||
EXPECT_EQ(UnitTestHelper<FamilyType>::tiledImagesSupported, image->isTiledAllocation());
|
||||
@@ -986,7 +986,7 @@ TEST_F(ImageCompressionTests, givenNonTiledImageWhenCreatingAllocationThenDontPr
|
||||
MockContext context;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
|
||||
auto image = std::unique_ptr<Image>(Image::create(mockContext.get(), MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
auto image = std::unique_ptr<Image>(Image::create(mockContext.get(), MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
ASSERT_NE(nullptr, image);
|
||||
EXPECT_FALSE(image->isTiledAllocation());
|
||||
@@ -1186,7 +1186,7 @@ TEST(ImageTest, givenClMemForceLinearStorageSetWhenCreateImageThenDisallowTiling
|
||||
|
||||
auto image = std::unique_ptr<Image>(Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -1231,7 +1231,7 @@ TEST(ImageTest, givenClMemCopyHostPointerPassedToImageCreateWhenAllocationIsNotI
|
||||
MockContext context;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
|
||||
std::unique_ptr<Image> image(Image::create(&ctx, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, memory, retVal));
|
||||
std::unique_ptr<Image> image(Image::create(&ctx, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, surfaceFormat, &imageDesc, memory, retVal));
|
||||
EXPECT_NE(nullptr, image);
|
||||
|
||||
auto taskCountSent = device->getGpgpuCommandStreamReceiver().peekLatestFlushedTaskCount();
|
||||
|
||||
@@ -73,7 +73,7 @@ HWTEST_P(CreateTiledImageTest, isTiledImageIsSetForTiledImages) {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, pClDevice->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
auto image = Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
|
||||
@@ -683,7 +683,7 @@ TEST(validateAndCreateImage, givenNotSupportedImageFormatWhenValidateAndCreateIm
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
Image *image;
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE;
|
||||
image = Image::validateAndCreateImage(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, &imageFormat, &Image1dDefaults::imageDesc, nullptr, retVal);
|
||||
image = Image::validateAndCreateImage(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), flags, 0, &imageFormat, &Image1dDefaults::imageDesc, nullptr, retVal);
|
||||
EXPECT_EQ(nullptr, image);
|
||||
EXPECT_EQ(CL_IMAGE_FORMAT_NOT_SUPPORTED, retVal);
|
||||
}
|
||||
@@ -711,7 +711,7 @@ TEST(validateAndCreateImage, givenValidImageParamsWhenValidateAndCreateImageIsCa
|
||||
std::unique_ptr<Image> image = nullptr;
|
||||
image.reset(Image::validateAndCreateImage(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
&imageFormat,
|
||||
@@ -763,7 +763,7 @@ struct NullImage : public Image {
|
||||
using Image::imageDesc;
|
||||
using Image::imageFormat;
|
||||
|
||||
NullImage() : Image(nullptr, MemoryPropertiesFlags(), cl_mem_flags{}, 0, 0, nullptr, cl_image_format{},
|
||||
NullImage() : Image(nullptr, MemoryProperties(), cl_mem_flags{}, 0, 0, nullptr, cl_image_format{},
|
||||
cl_image_desc{}, false, new MockGraphicsAllocation(nullptr, 0), false,
|
||||
0, 0, ClSurfaceFormatInfo{}, nullptr) {
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class MemObjDestructionTest : public ::testing::TestWithParam<bool> {
|
||||
|
||||
allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), size});
|
||||
memObj = new MemObj(context.get(), CL_MEM_OBJECT_BUFFER,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0, 0), CL_MEM_READ_WRITE, 0,
|
||||
MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0), CL_MEM_READ_WRITE, 0,
|
||||
size,
|
||||
nullptr, nullptr, allocation, true, false, false);
|
||||
csr = device->getDefaultEngine().commandStreamReceiver;
|
||||
@@ -224,7 +224,7 @@ HWTEST_P(MemObjAsyncDestructionTest, givenUsedMemObjWithAsyncDestructionsEnabled
|
||||
MemObjSizeArray region = {{1, 1, 1}};
|
||||
cl_map_flags mapFlags = CL_MAP_READ;
|
||||
memObj = new MemObj(context.get(), CL_MEM_OBJECT_BUFFER,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0, 0), CL_MEM_READ_WRITE, 0,
|
||||
MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0), CL_MEM_READ_WRITE, 0,
|
||||
size,
|
||||
storage, nullptr, allocation, true, false, false);
|
||||
memObj->addMappedPtr(storage, 1, mapFlags, region, origin, 0);
|
||||
|
||||
@@ -30,89 +30,89 @@ TEST(MemObjHelper, givenInvalidMemFlagsForSubBufferWhenFlagsAreCheckedThenTrueIs
|
||||
}
|
||||
|
||||
TEST(MemObjHelper, givenClMemForceLinearStorageFlagWhenCheckForLinearStorageForceThenReturnProperValue) {
|
||||
MemoryPropertiesFlags memoryProperties;
|
||||
MemoryProperties memoryProperties;
|
||||
cl_mem_flags flags = 0;
|
||||
cl_mem_flags_intel flagsIntel = 0;
|
||||
|
||||
flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
|
||||
flagsIntel = 0;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
EXPECT_TRUE(memoryProperties.flags.forceLinearStorage);
|
||||
|
||||
flags = 0;
|
||||
flagsIntel |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
EXPECT_TRUE(memoryProperties.flags.forceLinearStorage);
|
||||
|
||||
flags |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
|
||||
flagsIntel |= CL_MEM_FORCE_LINEAR_STORAGE_INTEL;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
EXPECT_TRUE(memoryProperties.flags.forceLinearStorage);
|
||||
|
||||
flags = 0;
|
||||
flagsIntel = 0;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
EXPECT_FALSE(memoryProperties.flags.forceLinearStorage);
|
||||
}
|
||||
|
||||
TEST(MemObjHelper, givenValidPropertiesWhenValidatingMemoryPropertiesThenTrueIsReturned) {
|
||||
cl_mem_flags flags = 0;
|
||||
cl_mem_flags_intel flagsIntel = 0;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
MockContext context;
|
||||
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context));
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context));
|
||||
|
||||
flags = CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL | CL_MEM_NO_ACCESS_INTEL;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
flags = CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL | CL_MEM_NO_ACCESS_INTEL;
|
||||
flagsIntel = 0;
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context));
|
||||
|
||||
flags = CL_MEM_NO_ACCESS_INTEL;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
flags = CL_MEM_NO_ACCESS_INTEL;
|
||||
flagsIntel = 0;
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context));
|
||||
|
||||
flags = CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR | CL_MEM_HOST_NO_ACCESS;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
flags = CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR | CL_MEM_HOST_NO_ACCESS;
|
||||
flagsIntel = 0;
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context));
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context));
|
||||
|
||||
flags = CL_MEM_WRITE_ONLY | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_WRITE_ONLY;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
flags = CL_MEM_WRITE_ONLY | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_WRITE_ONLY;
|
||||
flagsIntel = 0;
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context));
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context));
|
||||
|
||||
flags = CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_NO_ACCESS;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
flags = CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_NO_ACCESS;
|
||||
flagsIntel = 0;
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context));
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context));
|
||||
|
||||
flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
flags = 0;
|
||||
flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE;
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context));
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context));
|
||||
|
||||
flagsIntel = CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
flags = 0;
|
||||
flagsIntel = CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE;
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context));
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, nullptr, context));
|
||||
|
||||
flags = 0;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
flags = 0;
|
||||
flagsIntel = 0;
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, context));
|
||||
@@ -126,7 +126,7 @@ struct Image1dWithAccessFlagsUnrestricted : public Image1dDefaults {
|
||||
TEST(MemObjHelper, givenParentMemObjAndHostPtrFlagsWhenValidatingMemoryPropertiesForImageThenFalseIsReturned) {
|
||||
cl_mem_flags flags = 0;
|
||||
cl_mem_flags_intel flagsIntel = 0;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
|
||||
MockContext context;
|
||||
auto image = clUniquePtr(Image1dHelper<>::create(&context));
|
||||
@@ -136,15 +136,15 @@ TEST(MemObjHelper, givenParentMemObjAndHostPtrFlagsWhenValidatingMemoryPropertie
|
||||
|
||||
for (auto hostPtrFlag : hostPtrFlags) {
|
||||
flags = hostPtrFlag;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
flags = hostPtrFlag;
|
||||
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, image.get(), context));
|
||||
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, imageWithAccessFlagsUnrestricted.get(), context));
|
||||
|
||||
flags |= CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, 0);
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, flagsIntel, 0);
|
||||
flags |= CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL;
|
||||
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, image.get(), context));
|
||||
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, 0, imageWithAccessFlagsUnrestricted.get(), context));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,14 +65,14 @@ TEST(MemObj, GivenMemObjWhenInititalizedFromHostPtrThenInitializeFields) {
|
||||
char buffer[size];
|
||||
MockContext context;
|
||||
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(buffer, sizeof(buffer));
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||
sizeof(buffer), buffer, buffer, mockAllocation, true, false, false);
|
||||
|
||||
EXPECT_EQ(&buffer, memObj.getCpuAddress());
|
||||
EXPECT_EQ(&buffer, memObj.getHostPtr());
|
||||
EXPECT_EQ(size, memObj.getSize());
|
||||
EXPECT_EQ(static_cast<cl_mem_flags>(CL_MEM_USE_HOST_PTR), memObj.getMemoryPropertiesFlags());
|
||||
EXPECT_EQ(static_cast<cl_mem_flags>(CL_MEM_USE_HOST_PTR), memObj.getFlags());
|
||||
}
|
||||
|
||||
TEST(MemObj, givenMemObjectWhenAskedForTransferToHostPtrThenDoNothing) {
|
||||
@@ -81,7 +81,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, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||
size, hostPtr, hostPtr, mockAllocation, true, false, false);
|
||||
|
||||
@@ -101,7 +101,7 @@ TEST(MemObj, givenMemObjectWhenAskedForTransferFromHostPtrThenDoNothing) {
|
||||
uint8_t expectedBufferPtr[size] = {};
|
||||
MockContext context;
|
||||
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(hostPtr, sizeof(hostPtr));
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_PIPE, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||
size, hostPtr, hostPtr, mockAllocation, true, false, false);
|
||||
|
||||
@@ -118,7 +118,7 @@ TEST(MemObj, givenMemObjectWhenAskedForTransferFromHostPtrThenDoNothing) {
|
||||
TEST(MemObj, givenHostPtrAndUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnHostPtr) {
|
||||
uint8_t hostPtr = 0;
|
||||
MockContext context;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||
1, nullptr, &hostPtr, nullptr, true, false, false);
|
||||
|
||||
@@ -128,7 +128,7 @@ TEST(MemObj, givenHostPtrAndUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnHostP
|
||||
TEST(MemObj, givenHostPtrWithoutUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnAllocatedPtr) {
|
||||
uint8_t hostPtr = 0;
|
||||
MockContext context;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
1, nullptr, &hostPtr, nullptr, true, false, false);
|
||||
|
||||
@@ -140,7 +140,7 @@ TEST(MemObj, givenMemObjWhenReleaseAllocatedPtrIsCalledTwiceThenItDoesntCrash) {
|
||||
void *allocatedPtr = alignedMalloc(MemoryConstants::cacheLineSize, MemoryConstants::cacheLineSize);
|
||||
|
||||
MockContext context;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||
1, nullptr, nullptr, nullptr, true, false, false);
|
||||
|
||||
@@ -160,7 +160,7 @@ TEST(MemObj, givenNotReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThe
|
||||
auto defaultEngine = context.getDevice(0)->getDefaultEngine();
|
||||
allocation->updateTaskCount(2, defaultEngine.osContext->getContextId());
|
||||
*(defaultEngine.commandStreamReceiver->getTagAddress()) = 1;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
auto &allocationList = defaultEngine.commandStreamReceiver->getTemporaryAllocations();
|
||||
@@ -179,7 +179,7 @@ TEST(MemObj, givenReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThenAl
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
allocation->updateTaskCount(1, device->getDefaultEngine().osContext->getContextId());
|
||||
*device->getDefaultEngine().commandStreamReceiver->getTagAddress() = 1;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
|
||||
@@ -197,7 +197,7 @@ TEST(MemObj, givenNotUsedGraphicsAllocationWhenMemObjDestroysAllocationAsyncThen
|
||||
context.memoryManager = &memoryManager;
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
|
||||
@@ -215,7 +215,7 @@ TEST(MemObj, givenMemoryManagerWithoutDeviceWhenMemObjDestroysAllocationAsyncThe
|
||||
context.memoryManager = &memoryManager;
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
|
||||
@@ -231,7 +231,7 @@ TEST(MemObj, givenMemObjAndPointerToObjStorageWithProperCommandWhenCheckIfMemTra
|
||||
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
|
||||
|
||||
context.memoryManager = &memoryManager;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
void *ptr = memObj.getCpuAddressForMemoryTransfer();
|
||||
@@ -258,7 +258,7 @@ TEST(MemObj, givenMemObjAndPointerToObjStorageBadCommandWhenCheckIfMemTransferRe
|
||||
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
|
||||
|
||||
context.memoryManager = &memoryManager;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
void *ptr = memObj.getCpuAddressForMemoryTransfer();
|
||||
@@ -270,7 +270,7 @@ TEST(MemObj, givenMemObjAndPointerToDiffrentStorageAndProperCommandWhenCheckIfMe
|
||||
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
|
||||
|
||||
context.memoryManager = &memoryManager;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
void *ptr = (void *)0x1234;
|
||||
@@ -282,7 +282,7 @@ TEST(MemObj, givenSharingHandlerWhenAskedForCpuMappingThenReturnFalse) {
|
||||
MockContext context;
|
||||
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, allocation, true, false, false);
|
||||
memObj.setSharingHandler(new SharingHandler());
|
||||
@@ -294,7 +294,7 @@ TEST(MemObj, givenTiledObjectWhenAskedForCpuMappingThenReturnFalse) {
|
||||
using MemObj::MemObj;
|
||||
bool isTiledAllocation() const override { return true; }
|
||||
};
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MyMemObj memObj(nullptr, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
|
||||
@@ -309,7 +309,7 @@ TEST(MemObj, givenRenderCompressedGmmWhenAskingForMappingOnCpuThenDisallow) {
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, false));
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
|
||||
1, allocation->getUnderlyingBuffer(), nullptr, allocation, false, false, false);
|
||||
|
||||
@@ -326,7 +326,7 @@ TEST(MemObj, givenDefaultWhenAskedForCpuMappingThenReturnTrue) {
|
||||
context.memoryManager = &memoryManager;
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
64, allocation->getUnderlyingBuffer(), nullptr, allocation, true, false, false);
|
||||
|
||||
@@ -343,7 +343,7 @@ TEST(MemObj, givenNonCpuAccessibleMemoryWhenAskingForMappingOnCpuThenDisallow) {
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, false));
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
|
||||
1, allocation->getUnderlyingBuffer(), nullptr, allocation, false, false, false);
|
||||
|
||||
@@ -393,7 +393,7 @@ TEST(MemObj, givenSharedMemObjectWithNullGfxAllocationWhenSettingGfxAllocationTh
|
||||
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
|
||||
context.memoryManager = &memoryManager;
|
||||
MockGraphicsAllocation *gfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||
1, nullptr, nullptr, nullptr, true, false, false);
|
||||
memObj.setSharingHandler(new MySharingHandler(&memObj));
|
||||
@@ -410,7 +410,7 @@ TEST(MemObj, givenSharedMemObjectAndNullGfxAllocationProvidedWhenSettingGfxAlloc
|
||||
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
|
||||
context.memoryManager = &memoryManager;
|
||||
MockGraphicsAllocation *graphicsAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||
1, nullptr, nullptr, graphicsAllocation, true, false, false);
|
||||
memObj.setSharingHandler(new MySharingHandler(&memObj));
|
||||
@@ -427,7 +427,7 @@ TEST(MemObj, givenSharedMemObjectAndZeroReuseCountWhenChangingGfxAllocationThenO
|
||||
context.memoryManager = &memoryManager;
|
||||
MockGraphicsAllocation *oldGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||
MockGraphicsAllocation *newGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||
1, nullptr, nullptr, oldGfxAllocation, true, false, false);
|
||||
memObj.setSharingHandler(new MySharingHandler(&memObj));
|
||||
@@ -446,7 +446,7 @@ TEST(MemObj, givenSharedMemObjectAndNonZeroReuseCountWhenChangingGfxAllocationTh
|
||||
context.memoryManager = &memoryManager;
|
||||
MockGraphicsAllocation *oldGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||
MockGraphicsAllocation *newGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||
1, nullptr, nullptr, oldGfxAllocation, true, false, false);
|
||||
memObj.setSharingHandler(new MySharingHandler(&memObj));
|
||||
@@ -465,7 +465,7 @@ TEST(MemObj, givenNotSharedMemObjectWhenChangingGfxAllocationThenOldAllocationIs
|
||||
context.memoryManager = &memoryManager;
|
||||
MockGraphicsAllocation *oldGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||
MockGraphicsAllocation *newGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||
1, nullptr, nullptr, oldGfxAllocation, true, false, false);
|
||||
|
||||
@@ -483,7 +483,7 @@ TEST(MemObj, givenGraphicsAllocationWhenCallingIsAllocDumpableThenItReturnsTheCo
|
||||
|
||||
TEST(MemObj, givenMemObjNotUsingHostPtrWhenGettingBasePtrTwiceReturnSameMapPtr) {
|
||||
MockContext context;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
|
||||
1, nullptr, nullptr, nullptr, true, false, false);
|
||||
|
||||
@@ -498,7 +498,7 @@ TEST(MemObj, givenMemObjNotUsingHostPtrWhenGettingBasePtrTwiceReturnSameMapPtr)
|
||||
using MemObjMultiRootDeviceTests = MultiRootDeviceFixture;
|
||||
|
||||
TEST_F(MemObjMultiRootDeviceTests, memObjMapAllocationHasCorrectRootDeviceIndex) {
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0);
|
||||
MemObj memObj(context.get(), CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
|
||||
1, nullptr, nullptr, nullptr, true, false, false);
|
||||
|
||||
|
||||
@@ -74,12 +74,12 @@ class Nv12ImageTest : public testing::Test {
|
||||
|
||||
void validateImageWithFlags(cl_mem_flags flags) {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), surfaceFormat, &imageDesc, nullptr);
|
||||
retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, nullptr);
|
||||
}
|
||||
|
||||
Image *createImageWithFlags(cl_mem_flags flags) {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
return Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
return Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal);
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ TEST_F(Nv12ImageTest, given2DImageWhenPassedToValidateImageTraitsThenValidateRet
|
||||
imageDesc.mem_object = image;
|
||||
imageDesc.image_depth = 0;
|
||||
|
||||
retVal = Image::validateImageTraits(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0, 0), &imageFormat, &imageDesc, nullptr);
|
||||
retVal = Image::validateImageTraits(&context, MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0), &imageFormat, &imageDesc, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
delete image;
|
||||
@@ -210,7 +210,7 @@ TEST_F(Nv12ImageTest, given1DImageWhenPassedAsParentImageThenValidateImageTraits
|
||||
imageDesc.mem_object = image;
|
||||
imageDesc.image_depth = 0;
|
||||
|
||||
retVal = Image::validateImageTraits(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0, 0), &imageFormat, &imageDesc, nullptr);
|
||||
retVal = Image::validateImageTraits(&context, MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0), &imageFormat, &imageDesc, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
delete image;
|
||||
@@ -222,7 +222,7 @@ TEST_F(Nv12ImageTest, givenBufferWhenPassedAsNV12ParentImageThenValidateImageTra
|
||||
imageDesc.mem_object = &Buffer;
|
||||
imageDesc.image_depth = 0; // Plane of NV12 image
|
||||
|
||||
retVal = Image::validateImageTraits(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0, 0), &imageFormat, &imageDesc, nullptr);
|
||||
retVal = Image::validateImageTraits(&context, MemoryPropertiesParser::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0), &imageFormat, &imageDesc, nullptr);
|
||||
EXPECT_EQ(CL_INVALID_IMAGE_DESCRIPTOR, retVal);
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ HWTEST_F(Nv12ImageTest, checkIfPlanesAreWritten) {
|
||||
// Create Parent NV12 image
|
||||
cl_mem_flags flags = CL_MEM_READ_ONLY | CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL | CL_MEM_USE_HOST_PTR;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
auto imageNV12 = Image::create(contextWithMockCmdQ, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
auto imageNV12 = Image::create(contextWithMockCmdQ, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, hostPtr, retVal);
|
||||
|
||||
EXPECT_EQ(imageNV12->isTiledAllocation() ? 2u : 0u, cmdQ->EnqueueWriteImageCounter);
|
||||
@@ -575,7 +575,7 @@ TEST_F(Nv12ImageTest, invalidPlanarYUVImageHeight) {
|
||||
pDevice->getCap<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, 0, 0), &imageDesc, nullptr);
|
||||
retVal = Image::validatePlanarYUV(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), &imageDesc, nullptr);
|
||||
|
||||
EXPECT_EQ(CL_INVALID_IMAGE_SIZE, retVal);
|
||||
}
|
||||
@@ -592,17 +592,17 @@ TEST_F(Nv12ImageTest, invalidPlanarYUVImageWidth) {
|
||||
pDevice->getCap<CL_DEVICE_PLANAR_YUV_MAX_WIDTH_INTEL>(reinterpret_cast<const void *&>(maxWidth), srcSize, retSize);
|
||||
|
||||
imageDesc.image_width = *maxWidth + 12;
|
||||
retVal = Image::validatePlanarYUV(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), &imageDesc, nullptr);
|
||||
retVal = Image::validatePlanarYUV(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), &imageDesc, nullptr);
|
||||
|
||||
EXPECT_EQ(CL_INVALID_IMAGE_SIZE, retVal);
|
||||
}
|
||||
|
||||
TEST_F(Nv12ImageTest, validPlanarYUVImageHeight) {
|
||||
retVal = Image::validatePlanarYUV(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), &imageDesc, nullptr);
|
||||
retVal = Image::validatePlanarYUV(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), &imageDesc, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
TEST_F(Nv12ImageTest, validPlanarYUVImageWidth) {
|
||||
retVal = Image::validatePlanarYUV(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), &imageDesc, nullptr);
|
||||
retVal = Image::validatePlanarYUV(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), &imageDesc, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ class PackedYuvImageTest : public testing::Test,
|
||||
if (retVal != CL_SUCCESS)
|
||||
return;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
retVal = Image::validate(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), surfaceFormat, &imageDesc, nullptr);
|
||||
retVal = Image::validate(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0), surfaceFormat, &imageDesc, nullptr);
|
||||
}
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
@@ -73,7 +73,7 @@ TEST_P(PackedYuvImageTest, isPackedYuvImageReturnsTrue) {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
auto image = Image::create(
|
||||
&context,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
|
||||
@@ -50,37 +50,37 @@ TEST(MemoryManagerTest, givenAllowed32BitAndFroce32BitWhenGraphicsAllocationInDe
|
||||
|
||||
TEST(AllocationFlagsTest, givenAllocateMemoryFlagWhenGetAllocationFlagsIsCalledThenAllocateFlagIsCorrectlySet) {
|
||||
HardwareInfo hwInfo(*defaultHwInfo);
|
||||
auto allocationProperties = MemoryPropertiesParser::getAllocationProperties(0, {}, true, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {});
|
||||
auto allocationProperties = MemoryPropertiesParserHelper::getAllocationProperties(0, {}, true, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {});
|
||||
EXPECT_TRUE(allocationProperties.flags.allocateMemory);
|
||||
|
||||
auto allocationProperties2 = MemoryPropertiesParser::getAllocationProperties(0, {}, false, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {});
|
||||
auto allocationProperties2 = MemoryPropertiesParserHelper::getAllocationProperties(0, {}, false, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {});
|
||||
EXPECT_FALSE(allocationProperties2.flags.allocateMemory);
|
||||
}
|
||||
|
||||
TEST(UncacheableFlagsTest, givenUncachedResourceFlagWhenGetAllocationFlagsIsCalledThenUncacheableFlagIsCorrectlySet) {
|
||||
cl_mem_flags_intel flagsIntel = CL_MEM_LOCALLY_UNCACHED_RESOURCE;
|
||||
HardwareInfo hwInfo(*defaultHwInfo);
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, flagsIntel, 0);
|
||||
auto allocationFlags = MemoryPropertiesParser::getAllocationProperties(0, memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {});
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, flagsIntel, 0);
|
||||
auto allocationFlags = MemoryPropertiesParserHelper::getAllocationProperties(0, memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {});
|
||||
EXPECT_TRUE(allocationFlags.flags.uncacheable);
|
||||
|
||||
flagsIntel = 0;
|
||||
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(0, flagsIntel, 0);
|
||||
auto allocationFlags2 = MemoryPropertiesParser::getAllocationProperties(0, memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {});
|
||||
memoryProperties = MemoryPropertiesParser::createMemoryProperties(0, flagsIntel, 0);
|
||||
auto allocationFlags2 = MemoryPropertiesParserHelper::getAllocationProperties(0, memoryProperties, false, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {});
|
||||
EXPECT_FALSE(allocationFlags2.flags.uncacheable);
|
||||
}
|
||||
|
||||
TEST(AllocationFlagsTest, givenReadOnlyResourceFlagWhenGetAllocationFlagsIsCalledThenFlushL3FlagsAreCorrectlySet) {
|
||||
cl_mem_flags flags = CL_MEM_READ_ONLY;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesParser::createMemoryProperties(flags, 0, 0);
|
||||
HardwareInfo hwInfo(*defaultHwInfo);
|
||||
|
||||
auto allocationFlags =
|
||||
MemoryPropertiesParser::getAllocationProperties(0, memoryProperties, true, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {});
|
||||
MemoryPropertiesParserHelper::getAllocationProperties(0, memoryProperties, true, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {});
|
||||
EXPECT_FALSE(allocationFlags.flags.flushL3RequiredForRead);
|
||||
EXPECT_FALSE(allocationFlags.flags.flushL3RequiredForWrite);
|
||||
|
||||
auto allocationFlags2 = MemoryPropertiesParser::getAllocationProperties(0, {}, true, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {});
|
||||
auto allocationFlags2 = MemoryPropertiesParserHelper::getAllocationProperties(0, {}, true, 0, GraphicsAllocation::AllocationType::BUFFER, false, hwInfo, {});
|
||||
EXPECT_TRUE(allocationFlags2.flags.flushL3RequiredForRead);
|
||||
EXPECT_TRUE(allocationFlags2.flags.flushL3RequiredForWrite);
|
||||
}
|
||||
|
||||
@@ -36,10 +36,10 @@ class MockBuffer : public MockBufferStorage, public Buffer {
|
||||
using MockBufferStorage::device;
|
||||
|
||||
MockBuffer(GraphicsAllocation &alloc)
|
||||
: MockBufferStorage(), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, alloc.getUnderlyingBufferSize(), alloc.getUnderlyingBuffer(), alloc.getUnderlyingBuffer(), &alloc, true, false, false),
|
||||
: MockBufferStorage(), Buffer(nullptr, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, alloc.getUnderlyingBufferSize(), alloc.getUnderlyingBuffer(), alloc.getUnderlyingBuffer(), &alloc, true, false, false),
|
||||
externalAlloc(&alloc) {
|
||||
}
|
||||
MockBuffer() : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data, &mockGfxAllocation, true, false, false) {
|
||||
MockBuffer() : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data, &mockGfxAllocation, true, false, false) {
|
||||
}
|
||||
~MockBuffer() override {
|
||||
if (externalAlloc != nullptr) {
|
||||
@@ -57,9 +57,9 @@ class MockBuffer : public MockBufferStorage, public Buffer {
|
||||
class AlignedBuffer : public MockBufferStorage, public Buffer {
|
||||
public:
|
||||
using MockBufferStorage::device;
|
||||
AlignedBuffer() : MockBufferStorage(false), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64), &mockGfxAllocation, true, false, false) {
|
||||
AlignedBuffer() : MockBufferStorage(false), Buffer(nullptr, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64), &mockGfxAllocation, true, false, false) {
|
||||
}
|
||||
AlignedBuffer(GraphicsAllocation *gfxAllocation) : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64), gfxAllocation, true, false, false) {
|
||||
AlignedBuffer(GraphicsAllocation *gfxAllocation) : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64), gfxAllocation, true, false, false) {
|
||||
}
|
||||
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly) override {
|
||||
Buffer::setSurfaceState(device.get(), memory, getSize(), getCpuAddress(), 0, &mockGfxAllocation, 0, 0);
|
||||
@@ -69,9 +69,9 @@ class AlignedBuffer : public MockBufferStorage, public Buffer {
|
||||
class UnalignedBuffer : public MockBufferStorage, public Buffer {
|
||||
public:
|
||||
using MockBufferStorage::device;
|
||||
UnalignedBuffer() : MockBufferStorage(true), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4), &mockGfxAllocation, false, false, false) {
|
||||
UnalignedBuffer() : MockBufferStorage(true), Buffer(nullptr, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4), &mockGfxAllocation, false, false, false) {
|
||||
}
|
||||
UnalignedBuffer(GraphicsAllocation *gfxAllocation) : MockBufferStorage(true), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4), gfxAllocation, false, false, false) {
|
||||
UnalignedBuffer(GraphicsAllocation *gfxAllocation) : MockBufferStorage(true), Buffer(nullptr, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4), gfxAllocation, false, false, false) {
|
||||
}
|
||||
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly) override {
|
||||
Buffer::setSurfaceState(device.get(), memory, getSize(), getCpuAddress(), 0, &mockGfxAllocation, 0, 0);
|
||||
|
||||
@@ -19,7 +19,7 @@ struct MockImageBase : public Image {
|
||||
using Image::imageDesc;
|
||||
|
||||
MockImageBase() : Image(
|
||||
nullptr, MemoryPropertiesFlags(), cl_mem_flags{}, 0, 0, nullptr, cl_image_format{},
|
||||
nullptr, MemoryProperties(), cl_mem_flags{}, 0, 0, nullptr, cl_image_format{},
|
||||
cl_image_desc{}, false, new MockGraphicsAllocation(nullptr, 0), false,
|
||||
0, 0, ClSurfaceFormatInfo{}, nullptr) {
|
||||
}
|
||||
|
||||
@@ -1330,7 +1330,7 @@ class DrmMockBuffer : public Buffer {
|
||||
delete gfxAllocation;
|
||||
}
|
||||
|
||||
DrmMockBuffer(char *data, size_t size, DrmAllocation *alloc) : Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, size, data, data, alloc, true, false, false),
|
||||
DrmMockBuffer(char *data, size_t size, DrmAllocation *alloc) : Buffer(nullptr, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0, size, data, data, alloc, true, false, false),
|
||||
data(data),
|
||||
gfxAllocation(alloc) {
|
||||
}
|
||||
|
||||
@@ -1333,7 +1333,7 @@ HWTEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageWithMipCountZe
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, dstImage);
|
||||
@@ -1380,7 +1380,7 @@ HWTEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageWithMipCountNo
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, dstImage);
|
||||
@@ -1420,7 +1420,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageIsBeingCreatedAn
|
||||
InjectedFunction method = [&](size_t failureIndex) {
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
if (MemoryManagement::nonfailingAllocation == failureIndex) {
|
||||
EXPECT_NE(nullptr, dstImage.get());
|
||||
@@ -1481,7 +1481,7 @@ HWTEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageIsBeingCreated
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, data, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, dstImage);
|
||||
@@ -1526,7 +1526,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenMemoryAllocatedForImageThe
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, data, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, dstImage);
|
||||
@@ -1558,7 +1558,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenNonTiledImgWithMipCountZer
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, data, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, dstImage);
|
||||
@@ -1602,7 +1602,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenNonTiledImgWithMipCountNon
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, data, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, dstImage);
|
||||
@@ -1646,7 +1646,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhen1DarrayImageIsBeingCreated
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, data, retVal));
|
||||
auto imageGraphicsAllocation = dstImage->getGraphicsAllocation();
|
||||
ASSERT_NE(nullptr, imageGraphicsAllocation);
|
||||
|
||||
@@ -643,7 +643,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageWithMipCount
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, dstImage);
|
||||
@@ -672,7 +672,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageWithMipCountNo
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, dstImage);
|
||||
@@ -708,7 +708,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageIsBeingCreat
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, data, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, dstImage);
|
||||
@@ -737,7 +737,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenNonTiledImgWithMipCountZ
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, data, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, dstImage);
|
||||
@@ -765,7 +765,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenNonTiledImgWithMipCountN
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0),
|
||||
std::unique_ptr<Image> dstImage(Image::create(&context, MemoryPropertiesParser::createMemoryProperties(flags, 0, 0),
|
||||
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, dstImage);
|
||||
@@ -876,7 +876,6 @@ TEST_F(WddmMemoryManagerTest, getSystemSharedMemory) {
|
||||
|
||||
int64_t mem = memoryManager->getSystemSharedMemory(i);
|
||||
EXPECT_EQ(mem, 4249540608);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ TEST_F(glSharingTests, givenMockGlWhenGlBufferIsCreatedThenMemObjectHasGlHandler
|
||||
EXPECT_EQ(bufferId, mockGlSharing->dllParam->getBufferInfo().bufferName);
|
||||
EXPECT_EQ(4096u, glBuffer->getSize());
|
||||
size_t flagsExpected = CL_MEM_READ_WRITE;
|
||||
EXPECT_EQ(flagsExpected, glBuffer->getMemoryPropertiesFlags());
|
||||
EXPECT_EQ(flagsExpected, glBuffer->getFlags());
|
||||
|
||||
auto handler = glBuffer->peekSharingHandler();
|
||||
ASSERT_NE(nullptr, handler);
|
||||
|
||||
@@ -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, 0, 0), CL_MEM_USE_HOST_PTR, 0,
|
||||
std::unique_ptr<MemObj> memObj(new MemObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0,
|
||||
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, 0, 0), CL_MEM_USE_HOST_PTR, 0,
|
||||
std::unique_ptr<MemObj> memObj(new MemObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0,
|
||||
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, 0, 0), CL_MEM_USE_HOST_PTR, 0,
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesParser::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0,
|
||||
1, nullptr, nullptr, graphicsAllocation, true, false, false);
|
||||
|
||||
auto result = sharingHandler.acquire(&memObj);
|
||||
|
||||
@@ -400,7 +400,7 @@ TEST_F(VaSharingTests, givenSimpleParamsWhenCreateSurfaceIsCalledThenSetImgObjec
|
||||
EXPECT_NE(0u, sharedImg->getImageDesc().image_row_pitch);
|
||||
EXPECT_EQ(0u, sharedImg->getHostPtrSlicePitch());
|
||||
EXPECT_NE(0u, sharedImg->getHostPtrRowPitch());
|
||||
EXPECT_TRUE(sharedImg->getMemoryPropertiesFlags() == CL_MEM_READ_WRITE);
|
||||
EXPECT_TRUE(sharedImg->getFlags() == CL_MEM_READ_WRITE);
|
||||
EXPECT_TRUE(sharedImg->getCubeFaceIndex() == __GMM_NO_CUBE_MAP);
|
||||
|
||||
EXPECT_EQ(vaSharing->sharingHandle, sharedImg->getGraphicsAllocation()->peekSharedHandle());
|
||||
|
||||
@@ -205,7 +205,7 @@ void *SVMAllocsManager::createZeroCopySvmAllocation(uint32_t rootDeviceIndex, si
|
||||
GraphicsAllocation::AllocationType::SVM_ZERO_COPY,
|
||||
false, // isMultiStorageAllocation
|
||||
deviceBitfield};
|
||||
MemoryPropertiesParser::fillCachePolicyInProperties(properties, false, svmProperties.readOnly, false);
|
||||
MemoryPropertiesParserHelper::fillCachePolicyInProperties(properties, false, svmProperties.readOnly, false);
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
|
||||
if (!allocation) {
|
||||
return nullptr;
|
||||
@@ -229,7 +229,7 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(uint32_t rootDe
|
||||
false, // isMultiStorageAllocation
|
||||
unifiedMemoryProperties.subdeviceBitfield};
|
||||
cpuProperties.alignment = 2 * MemoryConstants::megaByte;
|
||||
MemoryPropertiesParser::fillCachePolicyInProperties(cpuProperties, false, svmProperties.readOnly, false);
|
||||
MemoryPropertiesParserHelper::fillCachePolicyInProperties(cpuProperties, false, svmProperties.readOnly, false);
|
||||
GraphicsAllocation *allocationCpu = memoryManager->allocateGraphicsMemoryWithProperties(cpuProperties);
|
||||
if (!allocationCpu) {
|
||||
return nullptr;
|
||||
@@ -247,7 +247,7 @@ void *SVMAllocsManager::createUnifiedAllocationWithDeviceStorage(uint32_t rootDe
|
||||
unifiedMemoryProperties.subdeviceBitfield};
|
||||
|
||||
gpuProperties.alignment = 2 * MemoryConstants::megaByte;
|
||||
MemoryPropertiesParser::fillCachePolicyInProperties(gpuProperties, false, svmProperties.readOnly, false);
|
||||
MemoryPropertiesParserHelper::fillCachePolicyInProperties(gpuProperties, false, svmProperties.readOnly, false);
|
||||
GraphicsAllocation *allocationGpu = memoryManager->allocateGraphicsMemoryWithProperties(gpuProperties, svmPtr);
|
||||
if (!allocationGpu) {
|
||||
memoryManager->freeGraphicsMemory(allocationCpu);
|
||||
|
||||
@@ -27,7 +27,7 @@ struct SvmAllocationData {
|
||||
GraphicsAllocation *gpuAllocation = nullptr;
|
||||
size_t size = 0;
|
||||
InternalMemoryType memoryType = InternalMemoryType::SVM;
|
||||
MemoryPropertiesFlags allocationFlagsProperty;
|
||||
MemoryProperties allocationFlagsProperty;
|
||||
void *device = nullptr;
|
||||
};
|
||||
|
||||
@@ -76,7 +76,7 @@ class SVMAllocsManager {
|
||||
UnifiedMemoryProperties() = default;
|
||||
UnifiedMemoryProperties(InternalMemoryType memoryType) : memoryType(memoryType){};
|
||||
InternalMemoryType memoryType = InternalMemoryType::NOT_SPECIFIED;
|
||||
MemoryPropertiesFlags allocationFlags;
|
||||
MemoryProperties allocationFlags;
|
||||
void *device = nullptr;
|
||||
DeviceBitfield subdeviceBitfield;
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
struct MemoryPropertiesFlags {
|
||||
struct MemoryProperties {
|
||||
union {
|
||||
MemoryFlags flags;
|
||||
uint32_t allFlags = 0;
|
||||
@@ -19,6 +19,6 @@ struct MemoryPropertiesFlags {
|
||||
MemoryAllocFlags allocFlags;
|
||||
uint32_t allAllocFlags = 0;
|
||||
};
|
||||
static_assert(sizeof(MemoryPropertiesFlags::flags) == sizeof(MemoryPropertiesFlags::allFlags) && sizeof(MemoryPropertiesFlags::allocFlags) == sizeof(MemoryPropertiesFlags::allAllocFlags), "");
|
||||
static_assert(sizeof(MemoryProperties::flags) == sizeof(MemoryProperties::allFlags) && sizeof(MemoryProperties::allocFlags) == sizeof(MemoryProperties::allAllocFlags), "");
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user