mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Connect mem_obj with MultiGraphicsAllocation
Related-To: NEO-4672 Change-Id: I188db44b4cb0ac6245bd7c864c69b8f1c0084dc4 Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
b457c50a56
commit
e9c42e54b2
@@ -56,8 +56,11 @@ cl_int CommandQueueHw<GfxFamily>::enqueueFillBuffer(
|
|||||||
BuiltInOwnershipWrapper builtInLock(builder, this->context);
|
BuiltInOwnershipWrapper builtInLock(builder, this->context);
|
||||||
|
|
||||||
BuiltinOpParams dc;
|
BuiltinOpParams dc;
|
||||||
|
auto multiGraphicsAllocation = MultiGraphicsAllocation(getDevice().getRootDeviceIndex());
|
||||||
|
multiGraphicsAllocation.addAllocation(patternAllocation);
|
||||||
|
|
||||||
MemObj patternMemObj(this->context, 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);
|
patternAllocation->getUnderlyingBuffer(), std::move(multiGraphicsAllocation), false, false, true);
|
||||||
dc.srcMemObj = &patternMemObj;
|
dc.srcMemObj = &patternMemObj;
|
||||||
dc.dstMemObj = buffer;
|
dc.dstMemObj = buffer;
|
||||||
dc.dstOffset = {offset, 0, 0};
|
dc.dstOffset = {offset, 0, 0};
|
||||||
|
|||||||
@@ -498,8 +498,11 @@ cl_int CommandQueueHw<GfxFamily>::enqueueSVMMemFill(void *svmPtr,
|
|||||||
BuiltInOwnershipWrapper builtInLock(builder, this->context);
|
BuiltInOwnershipWrapper builtInLock(builder, this->context);
|
||||||
|
|
||||||
BuiltinOpParams operationParams;
|
BuiltinOpParams operationParams;
|
||||||
|
auto multiGraphicsAllocation = MultiGraphicsAllocation(getDevice().getRootDeviceIndex());
|
||||||
|
multiGraphicsAllocation.addAllocation(patternAllocation);
|
||||||
|
|
||||||
MemObj patternMemObj(this->context, 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);
|
patternAllocation->getUnderlyingBuffer(), std::move(multiGraphicsAllocation), false, false, true);
|
||||||
|
|
||||||
void *alignedDstPtr = alignDown(svmPtr, 4);
|
void *alignedDstPtr = alignDown(svmPtr, 4);
|
||||||
size_t dstPtrOffset = ptrDiff(svmPtr, alignedDstPtr);
|
size_t dstPtrOffset = ptrDiff(svmPtr, alignedDstPtr);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ Buffer::Buffer(Context *context,
|
|||||||
size,
|
size,
|
||||||
memoryStorage,
|
memoryStorage,
|
||||||
hostPtr,
|
hostPtr,
|
||||||
multiGraphicsAllocation.getDefaultGraphicsAllocation(),
|
std::move(multiGraphicsAllocation),
|
||||||
zeroCopy,
|
zeroCopy,
|
||||||
isHostPtrSVM,
|
isHostPtrSVM,
|
||||||
isObjectRedescribed) {
|
isObjectRedescribed) {
|
||||||
@@ -68,7 +68,7 @@ Buffer::Buffer(Context *context,
|
|||||||
setHostPtrMinSize(size);
|
setHostPtrMinSize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer::Buffer() : MemObj(nullptr, CL_MEM_OBJECT_BUFFER, {}, 0, 0, 0, nullptr, nullptr, nullptr, false, false, false) {
|
Buffer::Buffer() : MemObj(nullptr, CL_MEM_OBJECT_BUFFER, {}, 0, 0, 0, nullptr, nullptr, 0, false, false, false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer::~Buffer() = default;
|
Buffer::~Buffer() = default;
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ Image::Image(Context *context,
|
|||||||
size,
|
size,
|
||||||
multiGraphicsAllocation.getDefaultGraphicsAllocation()->getUnderlyingBuffer(),
|
multiGraphicsAllocation.getDefaultGraphicsAllocation()->getUnderlyingBuffer(),
|
||||||
hostPtr,
|
hostPtr,
|
||||||
multiGraphicsAllocation.getDefaultGraphicsAllocation(),
|
multiGraphicsAllocation,
|
||||||
zeroCopy,
|
zeroCopy,
|
||||||
false,
|
false,
|
||||||
isObjectRedescribed),
|
isObjectRedescribed),
|
||||||
|
|||||||
@@ -35,14 +35,14 @@ MemObj::MemObj(Context *context,
|
|||||||
size_t size,
|
size_t size,
|
||||||
void *memoryStorage,
|
void *memoryStorage,
|
||||||
void *hostPtr,
|
void *hostPtr,
|
||||||
GraphicsAllocation *gfxAllocation,
|
MultiGraphicsAllocation multiGraphicsAllocation,
|
||||||
bool zeroCopy,
|
bool zeroCopy,
|
||||||
bool isHostPtrSVM,
|
bool isHostPtrSVM,
|
||||||
bool isObjectRedescribed)
|
bool isObjectRedescribed)
|
||||||
: context(context), memObjectType(memObjectType), memoryProperties(memoryProperties), flags(flags), flagsIntel(flagsIntel), size(size),
|
: context(context), memObjectType(memObjectType), memoryProperties(memoryProperties), flags(flags), flagsIntel(flagsIntel), size(size),
|
||||||
memoryStorage(memoryStorage), hostPtr(hostPtr),
|
memoryStorage(memoryStorage), hostPtr(hostPtr),
|
||||||
isZeroCopy(zeroCopy), isHostPtrSVM(isHostPtrSVM), isObjectRedescribed(isObjectRedescribed),
|
isZeroCopy(zeroCopy), isHostPtrSVM(isHostPtrSVM), isObjectRedescribed(isObjectRedescribed),
|
||||||
multiGraphicsAllocation(gfxAllocation ? gfxAllocation->getRootDeviceIndex() : 0) {
|
multiGraphicsAllocation(std::move(multiGraphicsAllocation)) {
|
||||||
|
|
||||||
if (context) {
|
if (context) {
|
||||||
context->incRefInternal();
|
context->incRefInternal();
|
||||||
@@ -50,9 +50,6 @@ MemObj::MemObj(Context *context,
|
|||||||
auto device = context->getDevice(0);
|
auto device = context->getDevice(0);
|
||||||
executionEnvironment = device->getExecutionEnvironment();
|
executionEnvironment = device->getExecutionEnvironment();
|
||||||
}
|
}
|
||||||
if (gfxAllocation) {
|
|
||||||
multiGraphicsAllocation.addAllocation(gfxAllocation);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MemObj::~MemObj() {
|
MemObj::~MemObj() {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class MemObj : public BaseObject<_cl_mem> {
|
|||||||
size_t size,
|
size_t size,
|
||||||
void *memoryStorage,
|
void *memoryStorage,
|
||||||
void *hostPtr,
|
void *hostPtr,
|
||||||
GraphicsAllocation *gfxAllocation,
|
MultiGraphicsAllocation multiGraphicsAllocation,
|
||||||
bool zeroCopy,
|
bool zeroCopy,
|
||||||
bool isHostPtrSVM,
|
bool isHostPtrSVM,
|
||||||
bool isObjectRedescrbied);
|
bool isObjectRedescrbied);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ Pipe::Pipe(Context *context,
|
|||||||
static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace),
|
static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace),
|
||||||
memoryStorage,
|
memoryStorage,
|
||||||
nullptr,
|
nullptr,
|
||||||
multiGraphicsAllocation.getDefaultGraphicsAllocation(),
|
std::move(multiGraphicsAllocation),
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false),
|
false),
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, WhenFillingBufferThenIndirectDataGetsAdded)
|
|||||||
|
|
||||||
BuiltinOpParams dc;
|
BuiltinOpParams dc;
|
||||||
MemObj patternMemObj(&this->context, 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);
|
patternAllocation->getUnderlyingBuffer(), GraphicsAllocationHelper::toMultiGraphicsAllocation(patternAllocation), false, false, true);
|
||||||
dc.srcMemObj = &patternMemObj;
|
dc.srcMemObj = &patternMemObj;
|
||||||
dc.dstMemObj = buffer;
|
dc.dstMemObj = buffer;
|
||||||
dc.dstOffset = {EnqueueFillBufferTraits::offset, 0, 0};
|
dc.dstOffset = {EnqueueFillBufferTraits::offset, 0, 0};
|
||||||
@@ -135,7 +135,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, FillBufferRightLeftover) {
|
|||||||
|
|
||||||
BuiltinOpParams dc;
|
BuiltinOpParams dc;
|
||||||
MemObj patternMemObj(&this->context, 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);
|
patternAllocation->getUnderlyingBuffer(), GraphicsAllocationHelper::toMultiGraphicsAllocation(patternAllocation), false, false, true);
|
||||||
dc.srcMemObj = &patternMemObj;
|
dc.srcMemObj = &patternMemObj;
|
||||||
dc.dstMemObj = buffer;
|
dc.dstMemObj = buffer;
|
||||||
dc.dstOffset = {0, 0, 0};
|
dc.dstOffset = {0, 0, 0};
|
||||||
@@ -161,7 +161,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, FillBufferMiddle) {
|
|||||||
|
|
||||||
BuiltinOpParams dc;
|
BuiltinOpParams dc;
|
||||||
MemObj patternMemObj(&this->context, 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);
|
patternAllocation->getUnderlyingBuffer(), GraphicsAllocationHelper::toMultiGraphicsAllocation(patternAllocation), false, false, true);
|
||||||
dc.srcMemObj = &patternMemObj;
|
dc.srcMemObj = &patternMemObj;
|
||||||
dc.dstMemObj = buffer;
|
dc.dstMemObj = buffer;
|
||||||
dc.dstOffset = {0, 0, 0};
|
dc.dstOffset = {0, 0, 0};
|
||||||
@@ -187,7 +187,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, FillBufferLeftLeftover) {
|
|||||||
|
|
||||||
BuiltinOpParams dc;
|
BuiltinOpParams dc;
|
||||||
MemObj patternMemObj(&this->context, 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);
|
patternAllocation->getUnderlyingBuffer(), GraphicsAllocationHelper::toMultiGraphicsAllocation(patternAllocation), false, false, true);
|
||||||
dc.srcMemObj = &patternMemObj;
|
dc.srcMemObj = &patternMemObj;
|
||||||
dc.dstMemObj = buffer;
|
dc.dstMemObj = buffer;
|
||||||
dc.dstOffset = {EnqueueFillBufferTraits::patternSize, 0, 0};
|
dc.dstOffset = {EnqueueFillBufferTraits::patternSize, 0, 0};
|
||||||
@@ -280,7 +280,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, WhenFillingBufferThenArgumentZeroShouldMatch
|
|||||||
|
|
||||||
BuiltinOpParams dc;
|
BuiltinOpParams dc;
|
||||||
MemObj patternMemObj(&this->context, 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);
|
patternAllocation->getUnderlyingBuffer(), GraphicsAllocationHelper::toMultiGraphicsAllocation(patternAllocation), false, false, true);
|
||||||
dc.srcMemObj = &patternMemObj;
|
dc.srcMemObj = &patternMemObj;
|
||||||
dc.dstMemObj = buffer;
|
dc.dstMemObj = buffer;
|
||||||
dc.dstOffset = {EnqueueFillBufferTraits::offset, 0, 0};
|
dc.dstOffset = {EnqueueFillBufferTraits::offset, 0, 0};
|
||||||
@@ -315,7 +315,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, DISABLED_WhenFillingBufferThenArgumentOneSho
|
|||||||
|
|
||||||
BuiltinOpParams dc;
|
BuiltinOpParams dc;
|
||||||
MemObj patternMemObj(&this->context, 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);
|
patternAllocation->getUnderlyingBuffer(), GraphicsAllocationHelper::toMultiGraphicsAllocation(patternAllocation), false, false, true);
|
||||||
dc.srcMemObj = &patternMemObj;
|
dc.srcMemObj = &patternMemObj;
|
||||||
dc.dstMemObj = buffer;
|
dc.dstMemObj = buffer;
|
||||||
dc.dstOffset = {EnqueueFillBufferTraits::offset, 0, 0};
|
dc.dstOffset = {EnqueueFillBufferTraits::offset, 0, 0};
|
||||||
@@ -347,7 +347,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, WhenFillingBufferThenArgumentTwoShouldMatchP
|
|||||||
|
|
||||||
BuiltinOpParams dc;
|
BuiltinOpParams dc;
|
||||||
MemObj patternMemObj(&this->context, 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);
|
patternAllocation->getUnderlyingBuffer(), GraphicsAllocationHelper::toMultiGraphicsAllocation(patternAllocation), false, false, true);
|
||||||
dc.srcMemObj = &patternMemObj;
|
dc.srcMemObj = &patternMemObj;
|
||||||
dc.dstMemObj = buffer;
|
dc.dstMemObj = buffer;
|
||||||
dc.dstOffset = {EnqueueFillBufferTraits::offset, 0, 0};
|
dc.dstOffset = {EnqueueFillBufferTraits::offset, 0, 0};
|
||||||
@@ -375,7 +375,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, WhenFillingBufferStatelessThenStatelessKerne
|
|||||||
|
|
||||||
BuiltinOpParams dc;
|
BuiltinOpParams dc;
|
||||||
MemObj patternMemObj(&this->context, 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);
|
patternAllocation->getUnderlyingBuffer(), GraphicsAllocationHelper::toMultiGraphicsAllocation(patternAllocation), false, false, true);
|
||||||
dc.srcMemObj = &patternMemObj;
|
dc.srcMemObj = &patternMemObj;
|
||||||
dc.dstMemObj = buffer;
|
dc.dstMemObj = buffer;
|
||||||
dc.dstOffset = {EnqueueFillBufferTraits::offset, 0, 0};
|
dc.dstOffset = {EnqueueFillBufferTraits::offset, 0, 0};
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ HWTEST_F(GetSizeRequiredBufferTest, WhenFillingBufferThenHeapsAndCommandBufferCo
|
|||||||
|
|
||||||
BuiltinOpParams dc;
|
BuiltinOpParams dc;
|
||||||
MemObj patternMemObj(this->context, 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);
|
patternAllocation->getUnderlyingBuffer(), GraphicsAllocationHelper::toMultiGraphicsAllocation(patternAllocation), false, false, true);
|
||||||
dc.srcMemObj = &patternMemObj;
|
dc.srcMemObj = &patternMemObj;
|
||||||
dc.dstMemObj = dstBuffer;
|
dc.dstMemObj = dstBuffer;
|
||||||
dc.dstOffset = {EnqueueFillBufferTraits::offset, 0, 0};
|
dc.dstOffset = {EnqueueFillBufferTraits::offset, 0, 0};
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ TYPED_TEST(BaseObjectTests, WhenObjectIsCreatedThenNumWaitersIsZero) {
|
|||||||
TYPED_TEST(BaseObjectTests, WhenConvertingToInternalObjectThnRefApiCountIsSetToZero) {
|
TYPED_TEST(BaseObjectTests, WhenConvertingToInternalObjectThnRefApiCountIsSetToZero) {
|
||||||
class ObjectForTest : public NEO::MemObj {
|
class ObjectForTest : public NEO::MemObj {
|
||||||
public:
|
public:
|
||||||
ObjectForTest() : MemObj(nullptr, 0, {}, 0, 0, 0u, nullptr, nullptr, nullptr, false, false, false) {
|
ObjectForTest() : MemObj(nullptr, 0, {}, 0, 0, 0u, nullptr, nullptr, 0, false, false, false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void convertToInternalObject(void) {
|
void convertToInternalObject(void) {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class MemObjDestructionTest : public ::testing::TestWithParam<bool> {
|
|||||||
memObj = new MemObj(context.get(), CL_MEM_OBJECT_BUFFER,
|
memObj = new MemObj(context.get(), CL_MEM_OBJECT_BUFFER,
|
||||||
MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &device->getDevice()),
|
MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &device->getDevice()),
|
||||||
CL_MEM_READ_WRITE, 0, size,
|
CL_MEM_READ_WRITE, 0, size,
|
||||||
nullptr, nullptr, allocation, true, false, false);
|
nullptr, nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(allocation), true, false, false);
|
||||||
csr = device->getDefaultEngine().commandStreamReceiver;
|
csr = device->getDefaultEngine().commandStreamReceiver;
|
||||||
*csr->getTagAddress() = 0;
|
*csr->getTagAddress() = 0;
|
||||||
contextId = device->getDefaultEngine().osContext->getContextId();
|
contextId = device->getDefaultEngine().osContext->getContextId();
|
||||||
@@ -228,7 +228,7 @@ HWTEST_P(MemObjAsyncDestructionTest, givenUsedMemObjWithAsyncDestructionsEnabled
|
|||||||
memObj = new MemObj(context.get(), CL_MEM_OBJECT_BUFFER,
|
memObj = new MemObj(context.get(), CL_MEM_OBJECT_BUFFER,
|
||||||
MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context->getDevice(0)->getDevice()),
|
MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context->getDevice(0)->getDevice()),
|
||||||
CL_MEM_READ_WRITE, 0, size,
|
CL_MEM_READ_WRITE, 0, size,
|
||||||
storage, nullptr, allocation, true, false, false);
|
storage, nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(allocation), true, false, false);
|
||||||
memObj->addMappedPtr(storage, 1, mapFlags, region, origin, 0);
|
memObj->addMappedPtr(storage, 1, mapFlags, region, origin, 0);
|
||||||
} else {
|
} else {
|
||||||
memObj->setAllocatedMapPtr(storage);
|
memObj->setAllocatedMapPtr(storage);
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ TEST(MemObj, GivenMemObjWhenInititalizedFromHostPtrThenInitializeFields) {
|
|||||||
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(buffer, sizeof(buffer));
|
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(buffer, sizeof(buffer));
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||||
sizeof(buffer), buffer, buffer, mockAllocation, true, false, false);
|
sizeof(buffer), buffer, buffer, GraphicsAllocationHelper::toMultiGraphicsAllocation(mockAllocation), true, false, false);
|
||||||
|
|
||||||
EXPECT_EQ(&buffer, memObj.getCpuAddress());
|
EXPECT_EQ(&buffer, memObj.getCpuAddress());
|
||||||
EXPECT_EQ(&buffer, memObj.getHostPtr());
|
EXPECT_EQ(&buffer, memObj.getHostPtr());
|
||||||
@@ -83,7 +83,7 @@ TEST(MemObj, givenMemObjectWhenAskedForTransferToHostPtrThenDoNothing) {
|
|||||||
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(hostPtr, sizeof(hostPtr));
|
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(hostPtr, sizeof(hostPtr));
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||||
size, hostPtr, hostPtr, mockAllocation, true, false, false);
|
size, hostPtr, hostPtr, GraphicsAllocationHelper::toMultiGraphicsAllocation(mockAllocation), true, false, false);
|
||||||
|
|
||||||
memset(memObj.getCpuAddress(), 123, size);
|
memset(memObj.getCpuAddress(), 123, size);
|
||||||
memset(hostPtr, 0, size);
|
memset(hostPtr, 0, size);
|
||||||
@@ -103,7 +103,7 @@ TEST(MemObj, givenMemObjectWhenAskedForTransferFromHostPtrThenDoNothing) {
|
|||||||
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(hostPtr, sizeof(hostPtr));
|
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(hostPtr, sizeof(hostPtr));
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_PIPE, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_PIPE, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||||
size, hostPtr, hostPtr, mockAllocation, true, false, false);
|
size, hostPtr, hostPtr, GraphicsAllocationHelper::toMultiGraphicsAllocation(mockAllocation), true, false, false);
|
||||||
|
|
||||||
memset(memObj.getCpuAddress(), 123, size);
|
memset(memObj.getCpuAddress(), 123, size);
|
||||||
memset(expectedBufferPtr, 123, size);
|
memset(expectedBufferPtr, 123, size);
|
||||||
@@ -120,7 +120,7 @@ TEST(MemObj, givenHostPtrAndUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnHostP
|
|||||||
MockContext context;
|
MockContext context;
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||||
1, nullptr, &hostPtr, nullptr, true, false, false);
|
1, nullptr, &hostPtr, 0, true, false, false);
|
||||||
|
|
||||||
EXPECT_EQ(&hostPtr, memObj.getBasePtrForMap(context.getDevice(0)->getRootDeviceIndex()));
|
EXPECT_EQ(&hostPtr, memObj.getBasePtrForMap(context.getDevice(0)->getRootDeviceIndex()));
|
||||||
}
|
}
|
||||||
@@ -130,7 +130,7 @@ TEST(MemObj, givenHostPtrWithoutUseHostPtrFlagWhenAskingForBaseMapPtrThenReturnA
|
|||||||
MockContext context;
|
MockContext context;
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||||
1, nullptr, &hostPtr, nullptr, true, false, false);
|
1, nullptr, &hostPtr, 0, true, false, false);
|
||||||
|
|
||||||
EXPECT_NE(&hostPtr, memObj.getBasePtrForMap(context.getDevice(0)->getRootDeviceIndex()));
|
EXPECT_NE(&hostPtr, memObj.getBasePtrForMap(context.getDevice(0)->getRootDeviceIndex()));
|
||||||
EXPECT_EQ(memObj.getAllocatedMapPtr(), memObj.getBasePtrForMap(context.getDevice(0)->getRootDeviceIndex()));
|
EXPECT_EQ(memObj.getAllocatedMapPtr(), memObj.getBasePtrForMap(context.getDevice(0)->getRootDeviceIndex()));
|
||||||
@@ -142,7 +142,7 @@ TEST(MemObj, givenMemObjWhenReleaseAllocatedPtrIsCalledTwiceThenItDoesntCrash) {
|
|||||||
MockContext context;
|
MockContext context;
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||||
1, nullptr, nullptr, nullptr, true, false, false);
|
1, nullptr, nullptr, 0, true, false, false);
|
||||||
|
|
||||||
memObj.setAllocatedMapPtr(allocatedPtr);
|
memObj.setAllocatedMapPtr(allocatedPtr);
|
||||||
memObj.releaseAllocatedMapPtr();
|
memObj.releaseAllocatedMapPtr();
|
||||||
@@ -162,7 +162,7 @@ TEST(MemObj, givenNotReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThe
|
|||||||
*(defaultEngine.commandStreamReceiver->getTagAddress()) = 1;
|
*(defaultEngine.commandStreamReceiver->getTagAddress()) = 1;
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
MemoryConstants::pageSize, nullptr, nullptr, 0, true, false, false);
|
||||||
auto &allocationList = defaultEngine.commandStreamReceiver->getTemporaryAllocations();
|
auto &allocationList = defaultEngine.commandStreamReceiver->getTemporaryAllocations();
|
||||||
EXPECT_TRUE(allocationList.peekIsEmpty());
|
EXPECT_TRUE(allocationList.peekIsEmpty());
|
||||||
memObj.destroyGraphicsAllocation(allocation, true);
|
memObj.destroyGraphicsAllocation(allocation, true);
|
||||||
@@ -181,7 +181,7 @@ TEST(MemObj, givenReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThenAl
|
|||||||
*device->getDefaultEngine().commandStreamReceiver->getTagAddress() = 1;
|
*device->getDefaultEngine().commandStreamReceiver->getTagAddress() = 1;
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
MemoryConstants::pageSize, nullptr, nullptr, 0, true, false, false);
|
||||||
|
|
||||||
auto &allocationList = device->getDefaultEngine().commandStreamReceiver->getTemporaryAllocations();
|
auto &allocationList = device->getDefaultEngine().commandStreamReceiver->getTemporaryAllocations();
|
||||||
EXPECT_TRUE(allocationList.peekIsEmpty());
|
EXPECT_TRUE(allocationList.peekIsEmpty());
|
||||||
@@ -199,7 +199,7 @@ TEST(MemObj, givenNotUsedGraphicsAllocationWhenMemObjDestroysAllocationAsyncThen
|
|||||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
|
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
MemoryConstants::pageSize, nullptr, nullptr, 0, true, false, false);
|
||||||
|
|
||||||
auto &allocationList = context.getDevice(0)->getDefaultEngine().commandStreamReceiver->getTemporaryAllocations();
|
auto &allocationList = context.getDevice(0)->getDefaultEngine().commandStreamReceiver->getTemporaryAllocations();
|
||||||
EXPECT_TRUE(allocationList.peekIsEmpty());
|
EXPECT_TRUE(allocationList.peekIsEmpty());
|
||||||
@@ -217,7 +217,7 @@ TEST(MemObj, givenMemoryManagerWithoutDeviceWhenMemObjDestroysAllocationAsyncThe
|
|||||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
|
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
MemoryConstants::pageSize, nullptr, nullptr, 0, true, false, false);
|
||||||
|
|
||||||
auto &allocationList = context.getDevice(0)->getDefaultEngine().commandStreamReceiver->getTemporaryAllocations();
|
auto &allocationList = context.getDevice(0)->getDefaultEngine().commandStreamReceiver->getTemporaryAllocations();
|
||||||
EXPECT_TRUE(allocationList.peekIsEmpty());
|
EXPECT_TRUE(allocationList.peekIsEmpty());
|
||||||
@@ -233,7 +233,7 @@ TEST(MemObj, givenMemObjAndPointerToObjStorageWithProperCommandWhenCheckIfMemTra
|
|||||||
context.memoryManager = &memoryManager;
|
context.memoryManager = &memoryManager;
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
MemoryConstants::pageSize, nullptr, nullptr, 0, true, false, false);
|
||||||
void *ptr = memObj.getCpuAddressForMemoryTransfer();
|
void *ptr = memObj.getCpuAddressForMemoryTransfer();
|
||||||
bool isMemTransferNeeded = memObj.checkIfMemoryTransferIsRequired(0, 0, ptr, CL_COMMAND_WRITE_BUFFER);
|
bool isMemTransferNeeded = memObj.checkIfMemoryTransferIsRequired(0, 0, ptr, CL_COMMAND_WRITE_BUFFER);
|
||||||
EXPECT_FALSE(isMemTransferNeeded);
|
EXPECT_FALSE(isMemTransferNeeded);
|
||||||
@@ -261,7 +261,7 @@ TEST(MemObj, givenMemObjAndPointerToObjStorageBadCommandWhenCheckIfMemTransferRe
|
|||||||
context.memoryManager = &memoryManager;
|
context.memoryManager = &memoryManager;
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
MemoryConstants::pageSize, nullptr, nullptr, 0, true, false, false);
|
||||||
void *ptr = memObj.getCpuAddressForMemoryTransfer();
|
void *ptr = memObj.getCpuAddressForMemoryTransfer();
|
||||||
bool isMemTransferNeeded = memObj.checkIfMemoryTransferIsRequired(0, 0, ptr, CL_COMMAND_FILL_BUFFER);
|
bool isMemTransferNeeded = memObj.checkIfMemoryTransferIsRequired(0, 0, ptr, CL_COMMAND_FILL_BUFFER);
|
||||||
EXPECT_TRUE(isMemTransferNeeded);
|
EXPECT_TRUE(isMemTransferNeeded);
|
||||||
@@ -274,7 +274,7 @@ TEST(MemObj, givenMemObjAndPointerToDiffrentStorageAndProperCommandWhenCheckIfMe
|
|||||||
context.memoryManager = &memoryManager;
|
context.memoryManager = &memoryManager;
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
MemoryConstants::pageSize, nullptr, nullptr, 0, true, false, false);
|
||||||
void *ptr = (void *)0x1234;
|
void *ptr = (void *)0x1234;
|
||||||
bool isMemTransferNeeded = memObj.checkIfMemoryTransferIsRequired(0, 0, ptr, CL_COMMAND_WRITE_BUFFER);
|
bool isMemTransferNeeded = memObj.checkIfMemoryTransferIsRequired(0, 0, ptr, CL_COMMAND_WRITE_BUFFER);
|
||||||
EXPECT_TRUE(isMemTransferNeeded);
|
EXPECT_TRUE(isMemTransferNeeded);
|
||||||
@@ -286,7 +286,7 @@ TEST(MemObj, givenSharingHandlerWhenAskedForCpuMappingThenReturnFalse) {
|
|||||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
|
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||||
MemoryConstants::pageSize, nullptr, nullptr, allocation, true, false, false);
|
MemoryConstants::pageSize, nullptr, nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(allocation), true, false, false);
|
||||||
memObj.setSharingHandler(new SharingHandler());
|
memObj.setSharingHandler(new SharingHandler());
|
||||||
EXPECT_FALSE(memObj.mappingOnCpuAllowed());
|
EXPECT_FALSE(memObj.mappingOnCpuAllowed());
|
||||||
}
|
}
|
||||||
@@ -299,7 +299,7 @@ TEST(MemObj, givenTiledObjectWhenAskedForCpuMappingThenReturnFalse) {
|
|||||||
MockContext context;
|
MockContext context;
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MyMemObj memObj(nullptr, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
MyMemObj memObj(nullptr, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
MemoryConstants::pageSize, nullptr, nullptr, 0, true, false, false);
|
||||||
|
|
||||||
EXPECT_FALSE(memObj.mappingOnCpuAllowed());
|
EXPECT_FALSE(memObj.mappingOnCpuAllowed());
|
||||||
}
|
}
|
||||||
@@ -314,7 +314,7 @@ TEST(MemObj, givenRenderCompressedGmmWhenAskingForMappingOnCpuThenDisallow) {
|
|||||||
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, false));
|
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, false));
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
|
||||||
1, allocation->getUnderlyingBuffer(), nullptr, allocation, false, false, false);
|
1, allocation->getUnderlyingBuffer(), nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(allocation), false, false, false);
|
||||||
|
|
||||||
allocation->getDefaultGmm()->isRenderCompressed = false;
|
allocation->getDefaultGmm()->isRenderCompressed = false;
|
||||||
EXPECT_TRUE(memObj.mappingOnCpuAllowed());
|
EXPECT_TRUE(memObj.mappingOnCpuAllowed());
|
||||||
@@ -331,7 +331,7 @@ TEST(MemObj, givenDefaultWhenAskedForCpuMappingThenReturnTrue) {
|
|||||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
|
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||||
64, allocation->getUnderlyingBuffer(), nullptr, allocation, true, false, false);
|
64, allocation->getUnderlyingBuffer(), nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(allocation), true, false, false);
|
||||||
|
|
||||||
EXPECT_FALSE(memObj.isTiledAllocation());
|
EXPECT_FALSE(memObj.isTiledAllocation());
|
||||||
EXPECT_FALSE(memObj.peekSharingHandler());
|
EXPECT_FALSE(memObj.peekSharingHandler());
|
||||||
@@ -348,7 +348,7 @@ TEST(MemObj, givenNonCpuAccessibleMemoryWhenAskingForMappingOnCpuThenDisallow) {
|
|||||||
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, false));
|
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, false));
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
|
||||||
1, allocation->getUnderlyingBuffer(), nullptr, allocation, false, false, false);
|
1, allocation->getUnderlyingBuffer(), nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(allocation), false, false, false);
|
||||||
|
|
||||||
EXPECT_TRUE(memObj.mappingOnCpuAllowed());
|
EXPECT_TRUE(memObj.mappingOnCpuAllowed());
|
||||||
reinterpret_cast<MemoryAllocation *>(allocation)->overrideMemoryPool(MemoryPool::SystemCpuInaccessible);
|
reinterpret_cast<MemoryAllocation *>(allocation)->overrideMemoryPool(MemoryPool::SystemCpuInaccessible);
|
||||||
@@ -362,13 +362,13 @@ TEST(MemObj, givenMultipleMemObjectsWithReusedGraphicsAllocationWhenDestroyedThe
|
|||||||
|
|
||||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
|
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||||
|
|
||||||
std::unique_ptr<MemObj> memObj1(new MemObj(&context, CL_MEM_OBJECT_BUFFER, {}, 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, GraphicsAllocationHelper::toMultiGraphicsAllocation(allocation), true, false, false));
|
||||||
memObj1->setSharingHandler(new MySharingHandler(allocation));
|
memObj1->setSharingHandler(new MySharingHandler(allocation));
|
||||||
|
|
||||||
std::unique_ptr<MemObj> memObj2(new MemObj(&context, CL_MEM_OBJECT_BUFFER, {}, 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, GraphicsAllocationHelper::toMultiGraphicsAllocation(allocation), true, false, false));
|
||||||
memObj2->setSharingHandler(new MySharingHandler(allocation));
|
memObj2->setSharingHandler(new MySharingHandler(allocation));
|
||||||
|
|
||||||
std::unique_ptr<MemObj> memObj3(new MemObj(&context, CL_MEM_OBJECT_BUFFER, {}, 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, GraphicsAllocationHelper::toMultiGraphicsAllocation(allocation), true, false, false));
|
||||||
memObj3->setSharingHandler(new MySharingHandler(allocation));
|
memObj3->setSharingHandler(new MySharingHandler(allocation));
|
||||||
|
|
||||||
EXPECT_EQ(3u, allocation->peekReuseCount());
|
EXPECT_EQ(3u, allocation->peekReuseCount());
|
||||||
@@ -385,7 +385,7 @@ TEST(MemObj, givenMemObjectWhenContextIsNotNullThenContextOutlivesMemobjects) {
|
|||||||
MockContext context;
|
MockContext context;
|
||||||
EXPECT_EQ(1, context.getRefInternalCount());
|
EXPECT_EQ(1, context.getRefInternalCount());
|
||||||
{
|
{
|
||||||
MemObj memObj(&context, 0, {}, 0, 0, 0, nullptr, nullptr, nullptr, false, false, false);
|
MemObj memObj(&context, 0, {}, 0, 0, 0, nullptr, nullptr, 0, false, false, false);
|
||||||
EXPECT_EQ(2, context.getRefInternalCount());
|
EXPECT_EQ(2, context.getRefInternalCount());
|
||||||
}
|
}
|
||||||
EXPECT_EQ(1, context.getRefInternalCount());
|
EXPECT_EQ(1, context.getRefInternalCount());
|
||||||
@@ -398,7 +398,7 @@ TEST(MemObj, givenSharedMemObjectWithNullGfxAllocationWhenSettingGfxAllocationTh
|
|||||||
MockGraphicsAllocation *gfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
MockGraphicsAllocation *gfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||||
1, nullptr, nullptr, nullptr, true, false, false);
|
1, nullptr, nullptr, 0, true, false, false);
|
||||||
memObj.setSharingHandler(new MySharingHandler(&memObj));
|
memObj.setSharingHandler(new MySharingHandler(&memObj));
|
||||||
|
|
||||||
memObj.resetGraphicsAllocation(gfxAllocation);
|
memObj.resetGraphicsAllocation(gfxAllocation);
|
||||||
@@ -415,7 +415,7 @@ TEST(MemObj, givenSharedMemObjectAndGfxAllocationWhenGraphicsAllocationIsRemoved
|
|||||||
MockGraphicsAllocation *graphicsAllocation = new MockGraphicsAllocation(nullptr, 0);
|
MockGraphicsAllocation *graphicsAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||||
1, nullptr, nullptr, graphicsAllocation, true, false, false);
|
1, nullptr, nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(graphicsAllocation), true, false, false);
|
||||||
memObj.setSharingHandler(new MySharingHandler(&memObj));
|
memObj.setSharingHandler(new MySharingHandler(&memObj));
|
||||||
|
|
||||||
graphicsAllocation->decReuseCount();
|
graphicsAllocation->decReuseCount();
|
||||||
@@ -432,7 +432,7 @@ TEST(MemObj, givenSharedMemObjectAndZeroReuseCountWhenChangingGfxAllocationThenO
|
|||||||
MockGraphicsAllocation *newGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
MockGraphicsAllocation *newGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||||
1, nullptr, nullptr, oldGfxAllocation, true, false, false);
|
1, nullptr, nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(oldGfxAllocation), true, false, false);
|
||||||
memObj.setSharingHandler(new MySharingHandler(&memObj));
|
memObj.setSharingHandler(new MySharingHandler(&memObj));
|
||||||
|
|
||||||
oldGfxAllocation->decReuseCount();
|
oldGfxAllocation->decReuseCount();
|
||||||
@@ -451,7 +451,7 @@ TEST(MemObj, givenSharedMemObjectAndNonZeroReuseCountWhenChangingGfxAllocationTh
|
|||||||
MockGraphicsAllocation *newGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
MockGraphicsAllocation *newGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||||
1, nullptr, nullptr, oldGfxAllocation, true, false, false);
|
1, nullptr, nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(oldGfxAllocation), true, false, false);
|
||||||
memObj.setSharingHandler(new MySharingHandler(&memObj));
|
memObj.setSharingHandler(new MySharingHandler(&memObj));
|
||||||
|
|
||||||
memObj.resetGraphicsAllocation(newGfxAllocation);
|
memObj.resetGraphicsAllocation(newGfxAllocation);
|
||||||
@@ -470,7 +470,7 @@ TEST(MemObj, givenNotSharedMemObjectWhenChangingGfxAllocationThenOldAllocationIs
|
|||||||
MockGraphicsAllocation *newGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
MockGraphicsAllocation *newGfxAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_USE_HOST_PTR, 0,
|
||||||
1, nullptr, nullptr, oldGfxAllocation, true, false, false);
|
1, nullptr, nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(oldGfxAllocation), true, false, false);
|
||||||
|
|
||||||
memObj.resetGraphicsAllocation(newGfxAllocation);
|
memObj.resetGraphicsAllocation(newGfxAllocation);
|
||||||
|
|
||||||
@@ -488,7 +488,7 @@ TEST(MemObj, givenMemObjNotUsingHostPtrWhenGettingBasePtrTwiceReturnSameMapPtr)
|
|||||||
MockContext context;
|
MockContext context;
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice());
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
|
||||||
1, nullptr, nullptr, nullptr, true, false, false);
|
1, nullptr, nullptr, 0, true, false, false);
|
||||||
|
|
||||||
void *mapPtr = memObj.getBasePtrForMap(context.getDevice(0)->getRootDeviceIndex());
|
void *mapPtr = memObj.getBasePtrForMap(context.getDevice(0)->getRootDeviceIndex());
|
||||||
EXPECT_NE(nullptr, mapPtr);
|
EXPECT_NE(nullptr, mapPtr);
|
||||||
@@ -503,7 +503,7 @@ using MemObjMultiRootDeviceTests = MultiRootDeviceFixture;
|
|||||||
TEST_F(MemObjMultiRootDeviceTests, WhenMemObjMapIsCreatedThenAllocationHasCorrectRootDeviceIndex) {
|
TEST_F(MemObjMultiRootDeviceTests, WhenMemObjMapIsCreatedThenAllocationHasCorrectRootDeviceIndex) {
|
||||||
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context->getDevice(0)->getDevice());
|
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context->getDevice(0)->getDevice());
|
||||||
MemObj memObj(context.get(), CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
|
MemObj memObj(context.get(), CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
|
||||||
1, nullptr, nullptr, nullptr, true, false, false);
|
1, nullptr, nullptr, 0, true, false, false);
|
||||||
|
|
||||||
void *mapPtr = memObj.getBasePtrForMap(device->getRootDeviceIndex());
|
void *mapPtr = memObj.getBasePtrForMap(device->getRootDeviceIndex());
|
||||||
EXPECT_NE(nullptr, mapPtr);
|
EXPECT_NE(nullptr, mapPtr);
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ TEST(sharingHandler, givenMemObjWhenAcquireIncrementCounterThenReleaseShouldDecr
|
|||||||
std::unique_ptr<MemObj> memObj(
|
std::unique_ptr<MemObj> memObj(
|
||||||
new MemObj(&context, CL_MEM_OBJECT_BUFFER,
|
new MemObj(&context, CL_MEM_OBJECT_BUFFER,
|
||||||
MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice()),
|
MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice()),
|
||||||
CL_MEM_USE_HOST_PTR, 0, sizeof(buffer), buffer, buffer, mockAllocation, true, false, false));
|
CL_MEM_USE_HOST_PTR, 0, sizeof(buffer), buffer, buffer, GraphicsAllocationHelper::toMultiGraphicsAllocation(mockAllocation), true, false, false));
|
||||||
|
|
||||||
struct MockSharingHandler : SharingHandler {
|
struct MockSharingHandler : SharingHandler {
|
||||||
using SharingHandler::acquireCount;
|
using SharingHandler::acquireCount;
|
||||||
@@ -66,7 +66,7 @@ TEST(sharingHandler, givenMemObjWhenAcquireTwoTimesThenReleaseShouldBeCalledTwoT
|
|||||||
std::unique_ptr<MemObj> memObj(
|
std::unique_ptr<MemObj> memObj(
|
||||||
new MemObj(&context, CL_MEM_OBJECT_BUFFER,
|
new MemObj(&context, CL_MEM_OBJECT_BUFFER,
|
||||||
MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice()),
|
MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice()),
|
||||||
CL_MEM_USE_HOST_PTR, 0, sizeof(buffer), buffer, buffer, mockAllocation, true, false, false));
|
CL_MEM_USE_HOST_PTR, 0, sizeof(buffer), buffer, buffer, GraphicsAllocationHelper::toMultiGraphicsAllocation(mockAllocation), true, false, false));
|
||||||
|
|
||||||
struct MockSharingHandler : SharingHandler {
|
struct MockSharingHandler : SharingHandler {
|
||||||
using SharingHandler::acquireCount;
|
using SharingHandler::acquireCount;
|
||||||
@@ -109,7 +109,7 @@ TEST(sharingHandler, givenSharingHandlerWhenAcquiringThenReturnErrorCode) {
|
|||||||
MockGraphicsAllocation *graphicsAllocation = new MockGraphicsAllocation(nullptr, 0);
|
MockGraphicsAllocation *graphicsAllocation = new MockGraphicsAllocation(nullptr, 0);
|
||||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER,
|
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER,
|
||||||
MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice()),
|
MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice()),
|
||||||
CL_MEM_USE_HOST_PTR, 0, 1, nullptr, nullptr, graphicsAllocation, true, false, false);
|
CL_MEM_USE_HOST_PTR, 0, 1, nullptr, nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(graphicsAllocation), true, false, false);
|
||||||
|
|
||||||
auto result = sharingHandler.acquire(&memObj, graphicsAllocation->getRootDeviceIndex());
|
auto result = sharingHandler.acquire(&memObj, graphicsAllocation->getRootDeviceIndex());
|
||||||
EXPECT_NE(CL_SUCCESS, result);
|
EXPECT_NE(CL_SUCCESS, result);
|
||||||
|
|||||||
Reference in New Issue
Block a user