mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-22 10:17:01 +08:00
Remove OCL object from MemoryProperties 11/n
Remove MemoryProperties from MemObj class and replaced it with MemoryPropertiesFlags Related-To: NEO-3132 Change-Id: Iff8633c49225b6a1f18103281825b36bf179701f Signed-off-by: Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
@@ -54,7 +54,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueFillBuffer(
|
||||
BuiltInOwnershipWrapper builtInLock(builder, this->context);
|
||||
|
||||
BuiltinOpParams dc;
|
||||
MemObj patternMemObj(this->context, 0, 0, 0, 0, alignUp(patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
MemObj patternMemObj(this->context, 0, {}, 0, 0, alignUp(patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
patternAllocation->getUnderlyingBuffer(), patternAllocation, false, false, true);
|
||||
dc.srcMemObj = &patternMemObj;
|
||||
dc.dstMemObj = buffer;
|
||||
|
||||
@@ -469,7 +469,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueSVMMemFill(void *svmPtr,
|
||||
BuiltInOwnershipWrapper builtInLock(builder, this->context);
|
||||
|
||||
BuiltinOpParams operationParams;
|
||||
MemObj patternMemObj(this->context, 0, 0, 0, 0, alignUp(patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
MemObj patternMemObj(this->context, 0, {}, 0, 0, alignUp(patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
patternAllocation->getUnderlyingBuffer(), patternAllocation, false, false, true);
|
||||
|
||||
void *alignedDstPtr = alignDown(svmPtr, 4);
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace NEO {
|
||||
BufferFuncs bufferFactory[IGFX_MAX_CORE] = {};
|
||||
|
||||
Buffer::Buffer(Context *context,
|
||||
MemoryProperties properties,
|
||||
MemoryPropertiesFlags memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -44,7 +44,7 @@ Buffer::Buffer(Context *context,
|
||||
bool isObjectRedescribed)
|
||||
: MemObj(context,
|
||||
CL_MEM_OBJECT_BUFFER,
|
||||
properties,
|
||||
memoryProperties,
|
||||
flags,
|
||||
flagsIntel,
|
||||
size,
|
||||
@@ -58,7 +58,7 @@ Buffer::Buffer(Context *context,
|
||||
setHostPtrMinSize(size);
|
||||
}
|
||||
|
||||
Buffer::Buffer() : MemObj(nullptr, CL_MEM_OBJECT_BUFFER, 0, 0, 0, 0, nullptr, nullptr, nullptr, false, false, false) {
|
||||
Buffer::Buffer() : MemObj(nullptr, CL_MEM_OBJECT_BUFFER, {}, 0, 0, 0, nullptr, nullptr, nullptr, false, false, false) {
|
||||
}
|
||||
|
||||
Buffer::~Buffer() = default;
|
||||
@@ -405,7 +405,8 @@ Buffer *Buffer::createSubBuffer(cl_mem_flags flags,
|
||||
const cl_buffer_region *region,
|
||||
cl_int &errcodeRet) {
|
||||
DEBUG_BREAK_IF(nullptr == createFunction);
|
||||
auto buffer = createFunction(this->context, flags, flags, 0, region->size,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags});
|
||||
auto buffer = createFunction(this->context, memoryProperties, flags, 0, region->size,
|
||||
ptrOffset(this->memoryStorage, region->origin),
|
||||
this->hostPtr ? ptrOffset(this->hostPtr, region->origin) : nullptr,
|
||||
this->graphicsAllocation,
|
||||
@@ -510,7 +511,8 @@ Buffer *Buffer::createBufferHw(Context *context,
|
||||
|
||||
auto funcCreate = bufferFactory[hwInfo.platform.eRenderCoreFamily].createBufferFunction;
|
||||
DEBUG_BREAK_IF(nullptr == funcCreate);
|
||||
auto pBuffer = funcCreate(context, properties, properties.flags, properties.flagsIntel, size, memoryStorage, hostPtr, gfxAllocation,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
|
||||
auto pBuffer = funcCreate(context, memoryProperties, properties.flags, properties.flagsIntel, size, memoryStorage, hostPtr, gfxAllocation,
|
||||
zeroCopy, isHostPtrSVM, isImageRedescribed);
|
||||
DEBUG_BREAK_IF(nullptr == pBuffer);
|
||||
if (pBuffer) {
|
||||
@@ -534,7 +536,8 @@ Buffer *Buffer::createBufferHwFromDevice(const Device *device,
|
||||
|
||||
auto funcCreate = bufferFactory[hwInfo.platform.eRenderCoreFamily].createBufferFunction;
|
||||
DEBUG_BREAK_IF(nullptr == funcCreate);
|
||||
auto pBuffer = funcCreate(nullptr, flags, flags, flagsIntel, size, memoryStorage, hostPtr, gfxAllocation,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags});
|
||||
auto pBuffer = funcCreate(nullptr, memoryProperties, flags, flagsIntel, size, memoryStorage, hostPtr, gfxAllocation,
|
||||
zeroCopy, isHostPtrSVM, isImageRedescribed);
|
||||
pBuffer->executionEnvironment = device->getExecutionEnvironment();
|
||||
return pBuffer;
|
||||
|
||||
@@ -22,7 +22,7 @@ class MemoryManager;
|
||||
struct MemoryProperties;
|
||||
|
||||
typedef Buffer *(*BufferCreatFunc)(Context *context,
|
||||
MemoryProperties properties,
|
||||
MemoryPropertiesFlags memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -135,7 +135,7 @@ class Buffer : public MemObj {
|
||||
|
||||
protected:
|
||||
Buffer(Context *context,
|
||||
MemoryProperties properties,
|
||||
MemoryPropertiesFlags memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -167,7 +167,7 @@ template <typename GfxFamily>
|
||||
class BufferHw : public Buffer {
|
||||
public:
|
||||
BufferHw(Context *context,
|
||||
MemoryProperties properties,
|
||||
MemoryPropertiesFlags memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -177,7 +177,7 @@ class BufferHw : public Buffer {
|
||||
bool zeroCopy,
|
||||
bool isHostPtrSVM,
|
||||
bool isObjectRedescribed)
|
||||
: Buffer(context, properties, flags, flagsIntel, size, memoryStorage, hostPtr, gfxAllocation,
|
||||
: Buffer(context, memoryProperties, flags, flagsIntel, size, memoryStorage, hostPtr, gfxAllocation,
|
||||
zeroCopy, isHostPtrSVM, isObjectRedescribed) {}
|
||||
|
||||
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnlyArgument) override;
|
||||
@@ -185,7 +185,7 @@ class BufferHw : public Buffer {
|
||||
void appendSurfaceStateExt(void *memory);
|
||||
|
||||
static Buffer *create(Context *context,
|
||||
MemoryProperties properties,
|
||||
MemoryPropertiesFlags memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -196,7 +196,7 @@ class BufferHw : public Buffer {
|
||||
bool isHostPtrSVM,
|
||||
bool isObjectRedescribed) {
|
||||
auto buffer = new BufferHw<GfxFamily>(context,
|
||||
properties,
|
||||
memoryProperties,
|
||||
flags,
|
||||
flagsIntel,
|
||||
size,
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace NEO {
|
||||
ImageFuncs imageFactory[IGFX_MAX_CORE] = {};
|
||||
|
||||
Image::Image(Context *context,
|
||||
const MemoryProperties &properties,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -54,7 +54,7 @@ Image::Image(Context *context,
|
||||
const SurfaceOffsets *surfaceOffsets)
|
||||
: MemObj(context,
|
||||
imageDesc.image_type,
|
||||
properties,
|
||||
memoryProperties,
|
||||
flags,
|
||||
flagsIntel,
|
||||
size,
|
||||
@@ -412,7 +412,8 @@ Image *Image::createImageHw(Context *context, const MemoryProperties &properties
|
||||
|
||||
auto funcCreate = imageFactory[hwInfo.platform.eRenderCoreFamily].createImageFunction;
|
||||
DEBUG_BREAK_IF(nullptr == funcCreate);
|
||||
auto image = funcCreate(context, properties, properties.flags, properties.flagsIntel, size, hostPtr, imageFormat, imageDesc,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
|
||||
auto image = funcCreate(context, memoryProperties, properties.flags, properties.flagsIntel, size, hostPtr, imageFormat, imageDesc,
|
||||
zeroCopy, graphicsAllocation, isObjectRedescribed, baseMipLevel, mipCount, surfaceFormatInfo, nullptr);
|
||||
DEBUG_BREAK_IF(nullptr == image);
|
||||
image->createFunction = funcCreate;
|
||||
@@ -860,10 +861,11 @@ 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});
|
||||
auto image = createFunction(context,
|
||||
properties.flags | CL_MEM_USE_HOST_PTR,
|
||||
properties.flags | CL_MEM_USE_HOST_PTR,
|
||||
properties.flagsIntel,
|
||||
memoryProperties,
|
||||
flags | CL_MEM_USE_HOST_PTR,
|
||||
flagsIntel,
|
||||
this->getSize(),
|
||||
this->getCpuAddress(),
|
||||
imageFormatNew,
|
||||
@@ -909,10 +911,11 @@ 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});
|
||||
auto image = createFunction(context,
|
||||
properties.flags | CL_MEM_USE_HOST_PTR,
|
||||
properties.flags | CL_MEM_USE_HOST_PTR,
|
||||
properties.flagsIntel,
|
||||
memoryProperties,
|
||||
flags | CL_MEM_USE_HOST_PTR,
|
||||
flagsIntel,
|
||||
this->getSize(),
|
||||
this->getCpuAddress(),
|
||||
imageFormatNew,
|
||||
|
||||
@@ -25,7 +25,7 @@ struct SurfaceOffsets {
|
||||
};
|
||||
|
||||
typedef Image *(*ImageCreatFunc)(Context *context,
|
||||
const MemoryProperties &properties,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
uint64_t flags,
|
||||
uint64_t flagsIntel,
|
||||
size_t size,
|
||||
@@ -183,7 +183,7 @@ class Image : public MemObj {
|
||||
|
||||
protected:
|
||||
Image(Context *context,
|
||||
const MemoryProperties &properties,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -239,7 +239,7 @@ class ImageHw : public Image {
|
||||
|
||||
public:
|
||||
ImageHw(Context *context,
|
||||
const MemoryProperties &properties,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -253,7 +253,7 @@ class ImageHw : public Image {
|
||||
uint32_t mipCount,
|
||||
const SurfaceFormatInfo &surfaceFormatInfo,
|
||||
const SurfaceOffsets *surfaceOffsets = nullptr)
|
||||
: Image(context, properties, flags, flagsIntel, size, hostPtr, imageFormat, imageDesc,
|
||||
: Image(context, memoryProperties, flags, flagsIntel, size, hostPtr, imageFormat, imageDesc,
|
||||
zeroCopy, graphicsAllocation, isObjectRedescribed, baseMipLevel, mipCount, surfaceFormatInfo, surfaceOffsets) {
|
||||
if (getImageDesc().image_type == CL_MEM_OBJECT_IMAGE1D ||
|
||||
getImageDesc().image_type == CL_MEM_OBJECT_IMAGE1D_BUFFER ||
|
||||
@@ -295,7 +295,7 @@ class ImageHw : public Image {
|
||||
void transformImage2dArrayTo3d(void *memory) override;
|
||||
void transformImage3dTo2dArray(void *memory) override;
|
||||
static Image *create(Context *context,
|
||||
const MemoryProperties &properties,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -311,7 +311,7 @@ class ImageHw : public Image {
|
||||
const SurfaceOffsets *surfaceOffsets) {
|
||||
UNRECOVERABLE_IF(surfaceFormatInfo == nullptr);
|
||||
return new ImageHw<GfxFamily>(context,
|
||||
properties,
|
||||
memoryProperties,
|
||||
flags,
|
||||
flagsIntel,
|
||||
size,
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace NEO {
|
||||
|
||||
MemObj::MemObj(Context *context,
|
||||
cl_mem_object_type memObjectType,
|
||||
const MemoryProperties &properties,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -37,7 +37,7 @@ MemObj::MemObj(Context *context,
|
||||
bool zeroCopy,
|
||||
bool isHostPtrSVM,
|
||||
bool isObjectRedescribed)
|
||||
: context(context), memObjectType(memObjectType), properties(properties), flags(flags), flagsIntel(flagsIntel), size(size),
|
||||
: context(context), memObjectType(memObjectType), memoryProperties(memoryProperties), flags(flags), flagsIntel(flagsIntel), size(size),
|
||||
memoryStorage(memoryStorage), hostPtr(hostPtr),
|
||||
isZeroCopy(zeroCopy), isHostPtrSVM(isHostPtrSVM), isObjectRedescribed(isObjectRedescribed),
|
||||
graphicsAllocation(gfxAllocation) {
|
||||
@@ -130,8 +130,8 @@ cl_int MemObj::getMemObjectInfo(cl_mem_info paramName,
|
||||
break;
|
||||
|
||||
case CL_MEM_FLAGS:
|
||||
srcParamSize = sizeof(properties.flags);
|
||||
srcParam = &properties.flags;
|
||||
srcParamSize = sizeof(flags);
|
||||
srcParam = &flags;
|
||||
break;
|
||||
|
||||
case CL_MEM_SIZE:
|
||||
@@ -151,7 +151,7 @@ cl_int MemObj::getMemObjectInfo(cl_mem_info paramName,
|
||||
break;
|
||||
|
||||
case CL_MEM_USES_SVM_POINTER:
|
||||
usesSVMPointer = isHostPtrSVM && isValueSet(properties.flags, CL_MEM_USE_HOST_PTR);
|
||||
usesSVMPointer = isHostPtrSVM && isValueSet(flags, CL_MEM_USE_HOST_PTR);
|
||||
srcParamSize = sizeof(cl_bool);
|
||||
srcParam = &usesSVMPointer;
|
||||
break;
|
||||
@@ -231,11 +231,11 @@ bool MemObj::isMemObjWithHostPtrSVM() const {
|
||||
}
|
||||
|
||||
bool MemObj::isMemObjUncacheable() const {
|
||||
return isValueSet(properties.flagsIntel, CL_MEM_LOCALLY_UNCACHED_RESOURCE);
|
||||
return isValueSet(flagsIntel, CL_MEM_LOCALLY_UNCACHED_RESOURCE);
|
||||
}
|
||||
|
||||
bool MemObj::isMemObjUncacheableForSurfaceState() const {
|
||||
return isAnyBitSet(properties.flagsIntel, CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE | CL_MEM_LOCALLY_UNCACHED_RESOURCE);
|
||||
return isAnyBitSet(flagsIntel, CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE | CL_MEM_LOCALLY_UNCACHED_RESOURCE);
|
||||
}
|
||||
|
||||
GraphicsAllocation *MemObj::getGraphicsAllocation() const {
|
||||
@@ -253,11 +253,11 @@ void MemObj::resetGraphicsAllocation(GraphicsAllocation *newGraphicsAllocation)
|
||||
}
|
||||
|
||||
bool MemObj::readMemObjFlagsInvalid() {
|
||||
return isValueSet(properties.flags, CL_MEM_HOST_WRITE_ONLY) || isValueSet(properties.flags, CL_MEM_HOST_NO_ACCESS);
|
||||
return isValueSet(flags, CL_MEM_HOST_WRITE_ONLY) || isValueSet(flags, CL_MEM_HOST_NO_ACCESS);
|
||||
}
|
||||
|
||||
bool MemObj::writeMemObjFlagsInvalid() {
|
||||
return isValueSet(properties.flags, CL_MEM_HOST_READ_ONLY) || isValueSet(properties.flags, CL_MEM_HOST_NO_ACCESS);
|
||||
return isValueSet(flags, CL_MEM_HOST_READ_ONLY) || isValueSet(flags, CL_MEM_HOST_NO_ACCESS);
|
||||
}
|
||||
|
||||
bool MemObj::mapMemObjFlagsInvalid(cl_map_flags mapFlags) {
|
||||
@@ -271,7 +271,7 @@ void MemObj::setHostPtrMinSize(size_t size) {
|
||||
|
||||
void *MemObj::getCpuAddressForMapping() {
|
||||
void *ptrToReturn = nullptr;
|
||||
if (isValueSet(properties.flags, CL_MEM_USE_HOST_PTR)) {
|
||||
if (isValueSet(flags, CL_MEM_USE_HOST_PTR)) {
|
||||
ptrToReturn = this->hostPtr;
|
||||
} else {
|
||||
ptrToReturn = this->memoryStorage;
|
||||
@@ -280,7 +280,7 @@ void *MemObj::getCpuAddressForMapping() {
|
||||
}
|
||||
void *MemObj::getCpuAddressForMemoryTransfer() {
|
||||
void *ptrToReturn = nullptr;
|
||||
if (isValueSet(properties.flags, CL_MEM_USE_HOST_PTR) && this->isMemObjZeroCopy()) {
|
||||
if (isValueSet(flags, CL_MEM_USE_HOST_PTR) && this->isMemObjZeroCopy()) {
|
||||
ptrToReturn = this->hostPtr;
|
||||
} else {
|
||||
ptrToReturn = this->memoryStorage;
|
||||
@@ -289,7 +289,7 @@ void *MemObj::getCpuAddressForMemoryTransfer() {
|
||||
}
|
||||
void MemObj::releaseAllocatedMapPtr() {
|
||||
if (allocatedMapPtr) {
|
||||
DEBUG_BREAK_IF(isValueSet(properties.flags, CL_MEM_USE_HOST_PTR));
|
||||
DEBUG_BREAK_IF(isValueSet(flags, CL_MEM_USE_HOST_PTR));
|
||||
memoryManager->freeSystemMemory(allocatedMapPtr);
|
||||
}
|
||||
allocatedMapPtr = nullptr;
|
||||
|
||||
@@ -39,7 +39,7 @@ class MemObj : public BaseObject<_cl_mem> {
|
||||
|
||||
MemObj(Context *context,
|
||||
cl_mem_object_type memObjectType,
|
||||
const MemoryProperties &properties,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
@@ -130,7 +130,6 @@ class MemObj : public BaseObject<_cl_mem> {
|
||||
|
||||
Context *context;
|
||||
cl_mem_object_type memObjectType;
|
||||
MemoryProperties properties;
|
||||
MemoryPropertiesFlags memoryProperties;
|
||||
cl_mem_flags flags = 0;
|
||||
cl_mem_flags_intel flagsIntel = 0;
|
||||
|
||||
@@ -24,7 +24,7 @@ Pipe::Pipe(Context *context,
|
||||
GraphicsAllocation *gfxAllocation)
|
||||
: MemObj(context,
|
||||
CL_MEM_OBJECT_PIPE,
|
||||
flags,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}),
|
||||
flags,
|
||||
0,
|
||||
static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace),
|
||||
|
||||
@@ -100,7 +100,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, WhenFillingBufferThenIndirectDataGetsAdded)
|
||||
ASSERT_NE(nullptr, &builder);
|
||||
|
||||
BuiltinOpParams dc;
|
||||
MemObj patternMemObj(&this->context, 0, 0, 0, 0, alignUp(EnqueueFillBufferTraits::patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
MemObj patternMemObj(&this->context, 0, {}, 0, 0, alignUp(EnqueueFillBufferTraits::patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
patternAllocation->getUnderlyingBuffer(), patternAllocation, false, false, true);
|
||||
dc.srcMemObj = &patternMemObj;
|
||||
dc.dstMemObj = buffer;
|
||||
@@ -132,7 +132,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, FillBufferRightLeftover) {
|
||||
ASSERT_NE(nullptr, &builder);
|
||||
|
||||
BuiltinOpParams dc;
|
||||
MemObj patternMemObj(&this->context, 0, 0, 0, 0, alignUp(EnqueueFillBufferTraits::patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
MemObj patternMemObj(&this->context, 0, {}, 0, 0, alignUp(EnqueueFillBufferTraits::patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
patternAllocation->getUnderlyingBuffer(), patternAllocation, false, false, true);
|
||||
dc.srcMemObj = &patternMemObj;
|
||||
dc.dstMemObj = buffer;
|
||||
@@ -159,7 +159,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, FillBufferMiddle) {
|
||||
ASSERT_NE(nullptr, &builder);
|
||||
|
||||
BuiltinOpParams dc;
|
||||
MemObj patternMemObj(&this->context, 0, 0, 0, 0, alignUp(EnqueueFillBufferTraits::patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
MemObj patternMemObj(&this->context, 0, {}, 0, 0, alignUp(EnqueueFillBufferTraits::patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
patternAllocation->getUnderlyingBuffer(), patternAllocation, false, false, true);
|
||||
dc.srcMemObj = &patternMemObj;
|
||||
dc.dstMemObj = buffer;
|
||||
@@ -186,7 +186,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, FillBufferLeftLeftover) {
|
||||
ASSERT_NE(nullptr, &builder);
|
||||
|
||||
BuiltinOpParams dc;
|
||||
MemObj patternMemObj(&this->context, 0, 0, 0, 0, alignUp(EnqueueFillBufferTraits::patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
MemObj patternMemObj(&this->context, 0, {}, 0, 0, alignUp(EnqueueFillBufferTraits::patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
patternAllocation->getUnderlyingBuffer(), patternAllocation, false, false, true);
|
||||
dc.srcMemObj = &patternMemObj;
|
||||
dc.dstMemObj = buffer;
|
||||
@@ -279,7 +279,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, WhenFillingBufferThenArgumentZeroShouldMatch
|
||||
ASSERT_NE(nullptr, &builder);
|
||||
|
||||
BuiltinOpParams dc;
|
||||
MemObj patternMemObj(&this->context, 0, 0, 0, 0, alignUp(EnqueueFillBufferTraits::patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
MemObj patternMemObj(&this->context, 0, {}, 0, 0, alignUp(EnqueueFillBufferTraits::patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
patternAllocation->getUnderlyingBuffer(), patternAllocation, false, false, true);
|
||||
dc.srcMemObj = &patternMemObj;
|
||||
dc.dstMemObj = buffer;
|
||||
@@ -315,7 +315,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, DISABLED_WhenFillingBufferThenArgumentOneSho
|
||||
ASSERT_NE(nullptr, &builder);
|
||||
|
||||
BuiltinOpParams dc;
|
||||
MemObj patternMemObj(&this->context, 0, 0, 0, 0, alignUp(EnqueueFillBufferTraits::patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
MemObj patternMemObj(&this->context, 0, {}, 0, 0, alignUp(EnqueueFillBufferTraits::patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
patternAllocation->getUnderlyingBuffer(), patternAllocation, false, false, true);
|
||||
dc.srcMemObj = &patternMemObj;
|
||||
dc.dstMemObj = buffer;
|
||||
@@ -348,7 +348,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, WhenFillingBufferThenArgumentTwoShouldMatchP
|
||||
ASSERT_NE(nullptr, &builder);
|
||||
|
||||
BuiltinOpParams dc;
|
||||
MemObj patternMemObj(&this->context, 0, 0, 0, 0, alignUp(EnqueueFillBufferTraits::patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
MemObj patternMemObj(&this->context, 0, {}, 0, 0, alignUp(EnqueueFillBufferTraits::patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
patternAllocation->getUnderlyingBuffer(), patternAllocation, false, false, true);
|
||||
dc.srcMemObj = &patternMemObj;
|
||||
dc.dstMemObj = buffer;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/event/user_event.h"
|
||||
#include "runtime/helpers/memory_properties_flags_helpers.h"
|
||||
#include "runtime/os_interface/os_context.h"
|
||||
#include "test.h"
|
||||
#include "unit_tests/command_queue/command_enqueue_fixture.h"
|
||||
@@ -194,7 +195,7 @@ HWTEST_F(EnqueueMapImageTest, givenTiledImageWhenMapImageIsCalledThenStorageIsSe
|
||||
auto surfaceFormatInfo = image->getSurfaceFormatInfo();
|
||||
|
||||
mockedImage<FamilyType> mockImage(context,
|
||||
0,
|
||||
{},
|
||||
0,
|
||||
0,
|
||||
4096u,
|
||||
@@ -918,7 +919,7 @@ TEST_F(EnqueueMapImageTest, givenImage1DArrayWhenEnqueueMapImageIsCalledThenRetu
|
||||
class MockImage : public Image {
|
||||
public:
|
||||
MockImage(Context *context, cl_mem_flags flags, GraphicsAllocation *allocation, const SurfaceFormatInfo &surfaceFormat,
|
||||
const cl_image_format &imageFormat, const cl_image_desc &imageDesc) : Image(context, flags, flags, 0,
|
||||
const cl_image_format &imageFormat, const cl_image_desc &imageDesc) : Image(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({flags}), flags, 0,
|
||||
0, nullptr,
|
||||
imageFormat, imageDesc,
|
||||
true,
|
||||
|
||||
@@ -81,7 +81,7 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueFillBuffer) {
|
||||
ASSERT_NE(nullptr, &builder);
|
||||
|
||||
BuiltinOpParams dc;
|
||||
MemObj patternMemObj(this->context, 0, 0, 0, 0, alignUp(EnqueueFillBufferTraits::patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
MemObj patternMemObj(this->context, 0, {}, 0, 0, alignUp(EnqueueFillBufferTraits::patternSize, 4), patternAllocation->getUnderlyingBuffer(),
|
||||
patternAllocation->getUnderlyingBuffer(), patternAllocation, false, false, true);
|
||||
dc.srcMemObj = &patternMemObj;
|
||||
dc.dstMemObj = dstBuffer;
|
||||
|
||||
@@ -89,8 +89,9 @@ struct MultipleMapBufferTest : public DeviceFixture, public ::testing::Test {
|
||||
|
||||
template <typename FamilyType>
|
||||
std::unique_ptr<MockBuffer<FamilyType>> createMockBuffer(bool mapOnGpu) {
|
||||
MemoryPropertiesFlags memoryProperties;
|
||||
auto mockAlloc = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto buffer = new MockBuffer<FamilyType>(context, 0, 0, 0, 1024, mockAlloc->getUnderlyingBuffer(), mockAlloc->getUnderlyingBuffer(),
|
||||
auto buffer = new MockBuffer<FamilyType>(context, memoryProperties, 0, 0, 1024, mockAlloc->getUnderlyingBuffer(), mockAlloc->getUnderlyingBuffer(),
|
||||
mockAlloc, false, false, false);
|
||||
if (mapOnGpu) {
|
||||
buffer->setSharingHandler(new SharingHandler());
|
||||
|
||||
@@ -26,7 +26,7 @@ struct MultipleMapImageTest : public DeviceFixture, public ::testing::Test {
|
||||
using ImageHw<T>::ImageHw;
|
||||
|
||||
static Image *createMockImage(Context *context,
|
||||
const MemoryProperties &properties,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
uint64_t flags,
|
||||
uint64_t flagsIntel,
|
||||
size_t size,
|
||||
@@ -40,7 +40,7 @@ struct MultipleMapImageTest : public DeviceFixture, public ::testing::Test {
|
||||
uint32_t mipCount,
|
||||
const SurfaceFormatInfo *surfaceFormatInfo,
|
||||
const SurfaceOffsets *surfaceOffsets) {
|
||||
return new MockImage<T>(context, properties, flags, flagsIntel, size, hostPtr, imageFormat, imageDesc, zeroCopy, graphicsAllocation,
|
||||
return new MockImage<T>(context, memoryProperties, flags, flagsIntel, size, hostPtr, imageFormat, imageDesc, zeroCopy, graphicsAllocation,
|
||||
isObjectRedescribed, baseMipLevel, mipCount, *surfaceFormatInfo, surfaceOffsets);
|
||||
};
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@ TEST(CastToImage, fromMemObj) {
|
||||
extern std::thread::id tempThreadID;
|
||||
class MockBuffer : public MockBufferStorage, public Buffer {
|
||||
public:
|
||||
MockBuffer() : MockBufferStorage(), Buffer(nullptr, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data, &mockGfxAllocation, true, false, false) {
|
||||
MockBuffer() : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), 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 {
|
||||
@@ -306,7 +306,7 @@ TYPED_TEST(BaseObjectTests, getCond) {
|
||||
TYPED_TEST(BaseObjectTests, convertToInternalObject) {
|
||||
class ObjectForTest : public NEO::MemObj {
|
||||
public:
|
||||
ObjectForTest() : MemObj(nullptr, 0, 0, 0, 0, 0u, nullptr, nullptr, nullptr, false, false, false) {
|
||||
ObjectForTest() : MemObj(nullptr, 0, {}, 0, 0, 0u, nullptr, nullptr, nullptr, false, false, false) {
|
||||
}
|
||||
|
||||
void convertToInternalObject(void) {
|
||||
|
||||
@@ -1237,7 +1237,7 @@ TEST_P(NoHostPtr, GivenNoHostPtrWhenHwBufferCreationFailsThenReturnNullptr) {
|
||||
BufferFuncsBackup[i] = bufferFactory[i];
|
||||
bufferFactory[i].createBufferFunction =
|
||||
[](Context *,
|
||||
MemoryProperties,
|
||||
MemoryPropertiesFlags,
|
||||
cl_mem_flags,
|
||||
cl_mem_flags_intel,
|
||||
size_t,
|
||||
|
||||
@@ -1463,7 +1463,7 @@ HWTEST_F(ImageTransformTest, givenSurfaceBaseAddressAndUnifiedSurfaceWhenSetUnif
|
||||
template <typename FamilyName>
|
||||
class MockImageHw : public ImageHw<FamilyName> {
|
||||
public:
|
||||
MockImageHw(Context *context, const cl_image_format &format, const cl_image_desc &desc, SurfaceFormatInfo &surfaceFormatInfo, GraphicsAllocation *graphicsAllocation) : ImageHw<FamilyName>(context, 0, 0, 0, 0, nullptr, format, desc, false, graphicsAllocation, false, 0, 0, surfaceFormatInfo) {
|
||||
MockImageHw(Context *context, const cl_image_format &format, const cl_image_desc &desc, SurfaceFormatInfo &surfaceFormatInfo, GraphicsAllocation *graphicsAllocation) : ImageHw<FamilyName>(context, {}, 0, 0, 0, nullptr, format, desc, false, graphicsAllocation, false, 0, 0, surfaceFormatInfo) {
|
||||
}
|
||||
|
||||
void setClearColorParams(typename FamilyName::RENDER_SURFACE_STATE *surfaceState, const Gmm *gmm) override;
|
||||
|
||||
@@ -760,7 +760,7 @@ struct NullImage : public Image {
|
||||
using Image::imageDesc;
|
||||
using Image::imageFormat;
|
||||
|
||||
NullImage() : Image(nullptr, cl_mem_flags{}, cl_mem_flags{}, 0, 0, nullptr, cl_image_format{},
|
||||
NullImage() : Image(nullptr, MemoryPropertiesFlags(), cl_mem_flags{}, 0, 0, nullptr, cl_image_format{},
|
||||
cl_image_desc{}, false, new MockGraphicsAllocation(nullptr, 0), false,
|
||||
0, 0, SurfaceFormatInfo{}, nullptr) {
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "runtime/helpers/memory_properties_flags_helpers.h"
|
||||
#include "runtime/mem_obj/mem_obj.h"
|
||||
#include "runtime/memory_manager/allocations_list.h"
|
||||
#include "runtime/os_interface/os_context.h"
|
||||
@@ -38,7 +39,7 @@ class MemObjDestructionTest : public ::testing::TestWithParam<bool> {
|
||||
|
||||
allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{size});
|
||||
memObj = new MemObj(context.get(), CL_MEM_OBJECT_BUFFER,
|
||||
CL_MEM_READ_WRITE, CL_MEM_READ_WRITE, 0,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_READ_WRITE}), CL_MEM_READ_WRITE, 0,
|
||||
size,
|
||||
nullptr, nullptr, allocation, true, false, false);
|
||||
*device->getDefaultEngine().commandStreamReceiver->getTagAddress() = 0;
|
||||
@@ -215,7 +216,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,
|
||||
CL_MEM_READ_WRITE, CL_MEM_READ_WRITE, 0,
|
||||
MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_READ_WRITE}), CL_MEM_READ_WRITE, 0,
|
||||
size,
|
||||
storage, nullptr, allocation, true, false, false);
|
||||
memObj->addMappedPtr(storage, 1, mapFlags, region, origin, 0);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/gmm_helper/gmm.h"
|
||||
#include "runtime/helpers/memory_properties_flags_helpers.h"
|
||||
#include "runtime/helpers/properties_helper.h"
|
||||
#include "runtime/mem_obj/mem_obj.h"
|
||||
#include "runtime/memory_manager/allocations_list.h"
|
||||
@@ -60,8 +61,8 @@ TEST(MemObj, GivenMemObjWhenInititalizedFromHostPtrThenInitializeFields) {
|
||||
char buffer[size];
|
||||
MockContext context;
|
||||
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(buffer, sizeof(buffer));
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
|
||||
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());
|
||||
@@ -76,7 +77,8 @@ TEST(MemObj, givenMemObjectWhenAskedForTransferToHostPtrThenDoNothing) {
|
||||
uint8_t expectedHostPtr[size] = {};
|
||||
MockContext context;
|
||||
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(hostPtr, sizeof(hostPtr));
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||
size, hostPtr, hostPtr, mockAllocation, true, false, false);
|
||||
|
||||
memset(memObj.getCpuAddress(), 123, size);
|
||||
@@ -95,7 +97,8 @@ TEST(MemObj, givenMemObjectWhenAskedForTransferFromHostPtrThenDoNothing) {
|
||||
uint8_t expectedBufferPtr[size] = {};
|
||||
MockContext context;
|
||||
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(hostPtr, sizeof(hostPtr));
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_PIPE, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_PIPE, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||
size, hostPtr, hostPtr, mockAllocation, true, false, false);
|
||||
|
||||
memset(memObj.getCpuAddress(), 123, size);
|
||||
@@ -111,8 +114,8 @@ TEST(MemObj, givenMemObjectWhenAskedForTransferFromHostPtrThenDoNothing) {
|
||||
TEST(MemObj, givenHostPtrAndUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnHostPtr) {
|
||||
uint8_t hostPtr = 0;
|
||||
MockContext context;
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||
1, nullptr, &hostPtr, nullptr, true, false, false);
|
||||
|
||||
EXPECT_EQ(&hostPtr, memObj.getBasePtrForMap());
|
||||
@@ -121,8 +124,8 @@ TEST(MemObj, givenHostPtrAndUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnHostP
|
||||
TEST(MemObj, givenHostPtrWithoutUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnAllocatedPtr) {
|
||||
uint8_t hostPtr = 0;
|
||||
MockContext context;
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
1, nullptr, &hostPtr, nullptr, true, false, false);
|
||||
|
||||
EXPECT_NE(&hostPtr, memObj.getBasePtrForMap());
|
||||
@@ -133,8 +136,8 @@ TEST(MemObj, givenMemObjWhenReleaseAllocatedPtrIsCalledTwiceThenItDoesntCrash) {
|
||||
void *allocatedPtr = alignedMalloc(MemoryConstants::cacheLineSize, MemoryConstants::cacheLineSize);
|
||||
|
||||
MockContext context;
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||
1, nullptr, nullptr, nullptr, true, false, false);
|
||||
|
||||
memObj.setAllocatedMapPtr(allocatedPtr);
|
||||
@@ -152,7 +155,8 @@ TEST(MemObj, givenNotReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThe
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
allocation->updateTaskCount(2, context.getDevice(0)->getDefaultEngine().osContext->getContextId());
|
||||
*(memoryManager->getDefaultCommandStreamReceiver(0)->getTagAddress()) = 1;
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
auto &allocationList = memoryManager->getDefaultCommandStreamReceiver(0)->getTemporaryAllocations();
|
||||
EXPECT_TRUE(allocationList.peekIsEmpty());
|
||||
@@ -170,7 +174,8 @@ TEST(MemObj, givenReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThenAl
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
allocation->updateTaskCount(1, device->getDefaultEngine().osContext->getContextId());
|
||||
*device->getDefaultEngine().commandStreamReceiver->getTagAddress() = 1;
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
|
||||
auto &allocationList = device->getDefaultEngine().commandStreamReceiver->getTemporaryAllocations();
|
||||
@@ -187,7 +192,8 @@ TEST(MemObj, givenNotUsedGraphicsAllocationWhenMemObjDestroysAllocationAsyncThen
|
||||
context.memoryManager = &memoryManager;
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
|
||||
auto &allocationList = memoryManager.getDefaultCommandStreamReceiver(0)->getTemporaryAllocations();
|
||||
@@ -204,8 +210,8 @@ TEST(MemObj, givenMemoryManagerWithoutDeviceWhenMemObjDestroysAllocationAsyncThe
|
||||
context.memoryManager = &memoryManager;
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
|
||||
auto &allocationList = memoryManager.getDefaultCommandStreamReceiver(0)->getTemporaryAllocations();
|
||||
@@ -220,8 +226,8 @@ TEST(MemObj, givenMemObjAndPointerToObjStorageWithProperCommandWhenCheckIfMemTra
|
||||
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
|
||||
|
||||
context.memoryManager = &memoryManager;
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
|
||||
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();
|
||||
bool isMemTransferNeeded = memObj.checkIfMemoryTransferIsRequired(0, 0, ptr, CL_COMMAND_WRITE_BUFFER);
|
||||
@@ -247,8 +253,8 @@ TEST(MemObj, givenMemObjAndPointerToObjStorageBadCommandWhenCheckIfMemTransferRe
|
||||
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
|
||||
|
||||
context.memoryManager = &memoryManager;
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
|
||||
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();
|
||||
bool isMemTransferNeeded = memObj.checkIfMemoryTransferIsRequired(0, 0, ptr, CL_COMMAND_FILL_BUFFER);
|
||||
@@ -259,8 +265,8 @@ TEST(MemObj, givenMemObjAndPointerToDiffrentStorageAndProperCommandWhenCheckIfMe
|
||||
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
|
||||
|
||||
context.memoryManager = &memoryManager;
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
|
||||
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;
|
||||
bool isMemTransferNeeded = memObj.checkIfMemoryTransferIsRequired(0, 0, ptr, CL_COMMAND_WRITE_BUFFER);
|
||||
@@ -271,8 +277,8 @@ TEST(MemObj, givenSharingHandlerWhenAskedForCpuMappingThenReturnFalse) {
|
||||
MockContext context;
|
||||
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
|
||||
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());
|
||||
EXPECT_FALSE(memObj.mappingOnCpuAllowed());
|
||||
@@ -283,7 +289,8 @@ TEST(MemObj, givenTiledObjectWhenAskedForCpuMappingThenReturnFalse) {
|
||||
using MemObj::MemObj;
|
||||
bool isTiledAllocation() const override { return true; }
|
||||
};
|
||||
MyMemObj memObj(nullptr, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
|
||||
MyMemObj memObj(nullptr, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
|
||||
EXPECT_FALSE(memObj.mappingOnCpuAllowed());
|
||||
@@ -297,8 +304,8 @@ TEST(MemObj, givenRenderCompressedGmmWhenAskingForMappingOnCpuThenDisallow) {
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
allocation->setDefaultGmm(new Gmm(nullptr, 1, false));
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_READ_WRITE, CL_MEM_READ_WRITE, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_READ_WRITE});
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
|
||||
1, allocation->getUnderlyingBuffer(), nullptr, allocation, false, false, false);
|
||||
|
||||
allocation->getDefaultGmm()->isRenderCompressed = false;
|
||||
@@ -314,8 +321,8 @@ TEST(MemObj, givenDefaultWhenAskedForCpuMappingThenReturnTrue) {
|
||||
context.memoryManager = &memoryManager;
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_COPY_HOST_PTR});
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
64, allocation->getUnderlyingBuffer(), nullptr, allocation, true, false, false);
|
||||
|
||||
EXPECT_FALSE(memObj.isTiledAllocation());
|
||||
@@ -331,8 +338,8 @@ TEST(MemObj, givenNonCpuAccessibleMemoryWhenAskingForMappingOnCpuThenDisallow) {
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
allocation->setDefaultGmm(new Gmm(nullptr, 1, false));
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_READ_WRITE, CL_MEM_READ_WRITE, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_READ_WRITE});
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
|
||||
1, allocation->getUnderlyingBuffer(), nullptr, allocation, false, false, false);
|
||||
|
||||
EXPECT_TRUE(memObj.mappingOnCpuAllowed());
|
||||
@@ -347,13 +354,13 @@ TEST(MemObj, givenMultipleMemObjectsWithReusedGraphicsAllocationWhenDestroyedThe
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
std::unique_ptr<MemObj> memObj1(new MemObj(&context, CL_MEM_OBJECT_BUFFER, 0, 0, 0, 1, nullptr, nullptr, allocation, true, false, false));
|
||||
std::unique_ptr<MemObj> memObj1(new MemObj(&context, CL_MEM_OBJECT_BUFFER, {}, 0, 0, 1, nullptr, nullptr, allocation, true, false, false));
|
||||
memObj1->setSharingHandler(new MySharingHandler(allocation));
|
||||
|
||||
std::unique_ptr<MemObj> memObj2(new MemObj(&context, CL_MEM_OBJECT_BUFFER, 0, 0, 0, 1, nullptr, nullptr, allocation, true, false, false));
|
||||
std::unique_ptr<MemObj> memObj2(new MemObj(&context, CL_MEM_OBJECT_BUFFER, {}, 0, 0, 1, nullptr, nullptr, allocation, true, false, false));
|
||||
memObj2->setSharingHandler(new MySharingHandler(allocation));
|
||||
|
||||
std::unique_ptr<MemObj> memObj3(new MemObj(&context, CL_MEM_OBJECT_BUFFER, 0, 0, 0, 1, nullptr, nullptr, allocation, true, false, false));
|
||||
std::unique_ptr<MemObj> memObj3(new MemObj(&context, CL_MEM_OBJECT_BUFFER, {}, 0, 0, 1, nullptr, nullptr, allocation, true, false, false));
|
||||
memObj3->setSharingHandler(new MySharingHandler(allocation));
|
||||
|
||||
EXPECT_EQ(3u, allocation->peekReuseCount());
|
||||
@@ -370,7 +377,7 @@ TEST(MemObj, givenMemObjectWhenContextIsNotNullThenContextOutlivesMemobjects) {
|
||||
MockContext context;
|
||||
EXPECT_EQ(1, context.getRefInternalCount());
|
||||
{
|
||||
MemObj memObj(&context, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr, false, false, false);
|
||||
MemObj memObj(&context, 0, {}, 0, 0, 0, nullptr, nullptr, nullptr, false, false, false);
|
||||
EXPECT_EQ(2, context.getRefInternalCount());
|
||||
}
|
||||
EXPECT_EQ(1, context.getRefInternalCount());
|
||||
@@ -381,8 +388,8 @@ TEST(MemObj, givenSharedMemObjectWithNullGfxAllocationWhenSettingGfxAllocationTh
|
||||
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
|
||||
context.memoryManager = &memoryManager;
|
||||
MockGraphicsAllocation *gfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
|
||||
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));
|
||||
|
||||
@@ -398,8 +405,8 @@ TEST(MemObj, givenSharedMemObjectAndNullGfxAllocationProvidedWhenSettingGfxAlloc
|
||||
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
|
||||
context.memoryManager = &memoryManager;
|
||||
MockGraphicsAllocation *graphicsAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
|
||||
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));
|
||||
|
||||
@@ -415,8 +422,8 @@ TEST(MemObj, givenSharedMemObjectAndZeroReuseCountWhenChangingGfxAllocationThenO
|
||||
context.memoryManager = &memoryManager;
|
||||
MockGraphicsAllocation *oldGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||
MockGraphicsAllocation *newGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
|
||||
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));
|
||||
|
||||
@@ -434,8 +441,8 @@ TEST(MemObj, givenSharedMemObjectAndNonZeroReuseCountWhenChangingGfxAllocationTh
|
||||
context.memoryManager = &memoryManager;
|
||||
MockGraphicsAllocation *oldGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||
MockGraphicsAllocation *newGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
|
||||
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));
|
||||
|
||||
@@ -453,8 +460,8 @@ TEST(MemObj, givenNotSharedMemObjectWhenChangingGfxAllocationThenOldAllocationIs
|
||||
context.memoryManager = &memoryManager;
|
||||
MockGraphicsAllocation *oldGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||
MockGraphicsAllocation *newGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR});
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||
1, nullptr, nullptr, oldGfxAllocation, true, false, false);
|
||||
|
||||
memObj.resetGraphicsAllocation(newGfxAllocation);
|
||||
@@ -471,8 +478,8 @@ TEST(MemObj, givenGraphicsAllocationWhenCallingIsAllocDumpableThenItReturnsTheCo
|
||||
|
||||
TEST(MemObj, givenMemObjNotUsingHostPtrWhenGettingBasePtrTwiceReturnSameMapPtr) {
|
||||
MockContext context;
|
||||
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_READ_WRITE, CL_MEM_READ_WRITE, 0,
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_READ_WRITE});
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
|
||||
1, nullptr, nullptr, nullptr, true, false, false);
|
||||
|
||||
void *mapPtr = memObj.getBasePtrForMap();
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "core/helpers/aligned_memory.h"
|
||||
#include "runtime/helpers/memory_properties_flags_helpers.h"
|
||||
#include "runtime/mem_obj/buffer.h"
|
||||
#include "unit_tests/mocks/mock_context.h"
|
||||
#include "unit_tests/mocks/mock_device.h"
|
||||
@@ -33,10 +34,10 @@ class MockBuffer : public MockBufferStorage, public Buffer {
|
||||
using MockBufferStorage::device;
|
||||
|
||||
MockBuffer(GraphicsAllocation &alloc)
|
||||
: MockBufferStorage(), Buffer(nullptr, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0, alloc.getUnderlyingBufferSize(), alloc.getUnderlyingBuffer(), alloc.getUnderlyingBuffer(), &alloc, true, false, false),
|
||||
: MockBufferStorage(), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), CL_MEM_USE_HOST_PTR, 0, alloc.getUnderlyingBufferSize(), alloc.getUnderlyingBuffer(), alloc.getUnderlyingBuffer(), &alloc, true, false, false),
|
||||
externalAlloc(&alloc) {
|
||||
}
|
||||
MockBuffer() : MockBufferStorage(), Buffer(nullptr, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data, &mockGfxAllocation, true, false, false) {
|
||||
MockBuffer() : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data, &mockGfxAllocation, true, false, false) {
|
||||
}
|
||||
~MockBuffer() override {
|
||||
if (externalAlloc != nullptr) {
|
||||
@@ -54,9 +55,9 @@ class MockBuffer : public MockBufferStorage, public Buffer {
|
||||
class AlignedBuffer : public MockBufferStorage, public Buffer {
|
||||
public:
|
||||
using MockBufferStorage::device;
|
||||
AlignedBuffer() : MockBufferStorage(false), Buffer(nullptr, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64), &mockGfxAllocation, true, false, false) {
|
||||
AlignedBuffer() : MockBufferStorage(false), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), 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, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64), gfxAllocation, true, false, false) {
|
||||
AlignedBuffer(GraphicsAllocation *gfxAllocation) : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64), gfxAllocation, true, false, false) {
|
||||
}
|
||||
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly) override {
|
||||
Buffer::setSurfaceState(device.get(), memory, getSize(), getCpuAddress(), &mockGfxAllocation);
|
||||
@@ -66,9 +67,9 @@ class AlignedBuffer : public MockBufferStorage, public Buffer {
|
||||
class UnalignedBuffer : public MockBufferStorage, public Buffer {
|
||||
public:
|
||||
using MockBufferStorage::device;
|
||||
UnalignedBuffer() : MockBufferStorage(true), Buffer(nullptr, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4), &mockGfxAllocation, false, false, false) {
|
||||
UnalignedBuffer() : MockBufferStorage(true), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), 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, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4), gfxAllocation, false, false, false) {
|
||||
UnalignedBuffer(GraphicsAllocation *gfxAllocation) : MockBufferStorage(true), Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4), gfxAllocation, false, false, false) {
|
||||
}
|
||||
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly) override {
|
||||
Buffer::setSurfaceState(device.get(), memory, getSize(), getCpuAddress(), &mockGfxAllocation);
|
||||
|
||||
@@ -15,7 +15,7 @@ struct MockImageBase : public NEO::Image {
|
||||
using Image::imageDesc;
|
||||
|
||||
MockImageBase() : Image(
|
||||
nullptr, cl_mem_flags{}, cl_mem_flags{}, 0, 0, nullptr, cl_image_format{},
|
||||
nullptr, MemoryPropertiesFlags(), cl_mem_flags{}, 0, 0, nullptr, cl_image_format{},
|
||||
cl_image_desc{}, false, new NEO::MockGraphicsAllocation(nullptr, 0), false,
|
||||
0, 0, NEO::SurfaceFormatInfo{}, nullptr) {
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "runtime/command_stream/preemption.h"
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
#include "runtime/helpers/flush_stamp.h"
|
||||
#include "runtime/helpers/memory_properties_flags_helpers.h"
|
||||
#include "runtime/mem_obj/buffer.h"
|
||||
#include "runtime/memory_manager/internal_allocation_storage.h"
|
||||
#include "runtime/os_interface/linux/drm_buffer_object.h"
|
||||
@@ -1330,7 +1331,7 @@ class DrmMockBuffer : public Buffer {
|
||||
delete gfxAllocation;
|
||||
}
|
||||
|
||||
DrmMockBuffer(char *data, size_t size, DrmAllocation *alloc) : Buffer(nullptr, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0, size, data, data, alloc, true, false, false),
|
||||
DrmMockBuffer(char *data, size_t size, DrmAllocation *alloc) : Buffer(nullptr, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), CL_MEM_USE_HOST_PTR, 0, size, data, data, alloc, true, false, false),
|
||||
data(data),
|
||||
gfxAllocation(alloc) {
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "runtime/helpers/memory_properties_flags_helpers.h"
|
||||
#include "runtime/mem_obj/mem_obj.h"
|
||||
#include "runtime/sharings/sharing.h"
|
||||
#include "unit_tests/mocks/mock_context.h"
|
||||
@@ -36,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, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0,
|
||||
std::unique_ptr<MemObj> memObj(new MemObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), CL_MEM_USE_HOST_PTR, 0,
|
||||
sizeof(buffer), buffer, buffer, mockAllocation, true, false, false));
|
||||
|
||||
struct MockSharingHandler : SharingHandler {
|
||||
@@ -61,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, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0,
|
||||
std::unique_ptr<MemObj> memObj(new MemObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), CL_MEM_USE_HOST_PTR, 0,
|
||||
sizeof(buffer), buffer, buffer, mockAllocation, true, false, false));
|
||||
|
||||
struct MockSharingHandler : SharingHandler {
|
||||
@@ -106,7 +107,7 @@ TEST(sharingHandler, givenSharingHandlerWhenAcquiringThenReturnErrorCode) {
|
||||
SharingHandler sharingHandler;
|
||||
MockContext context;
|
||||
MockGraphicsAllocation *graphicsAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_USE_HOST_PTR, CL_MEM_USE_HOST_PTR, 0,
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({CL_MEM_USE_HOST_PTR}), CL_MEM_USE_HOST_PTR, 0,
|
||||
1, nullptr, nullptr, graphicsAllocation, true, false, false);
|
||||
|
||||
auto result = sharingHandler.acquire(&memObj);
|
||||
|
||||
Reference in New Issue
Block a user