mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 00:24:58 +08:00
Pass MultiGraphicsAllocation in Buffer 1/n
Pass MultiGraphicsAllocation in Buffer instead of GraphicsAllocation Related-To: NEO-4672 Change-Id: I7fb05ab53f54875f41d90f480e7f930b3b9f2fda Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
8a9ac830cf
commit
6be8d332f4
@@ -48,7 +48,7 @@ Buffer::Buffer(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)
|
||||||
@@ -60,7 +60,7 @@ Buffer::Buffer(Context *context,
|
|||||||
size,
|
size,
|
||||||
memoryStorage,
|
memoryStorage,
|
||||||
hostPtr,
|
hostPtr,
|
||||||
gfxAllocation,
|
multiGraphicsAllocation.getDefaultGraphicsAllocation(),
|
||||||
zeroCopy,
|
zeroCopy,
|
||||||
isHostPtrSVM,
|
isHostPtrSVM,
|
||||||
isObjectRedescribed) {
|
isObjectRedescribed) {
|
||||||
@@ -295,6 +295,9 @@ Buffer *Buffer::create(Context *context,
|
|||||||
memory->setAllocationType(allocationType);
|
memory->setAllocationType(allocationType);
|
||||||
memory->setMemObjectsAllocationWithWritableFlags(!(memoryProperties.flags.readOnly || memoryProperties.flags.hostReadOnly || memoryProperties.flags.hostNoAccess));
|
memory->setMemObjectsAllocationWithWritableFlags(!(memoryProperties.flags.readOnly || memoryProperties.flags.hostReadOnly || memoryProperties.flags.hostNoAccess));
|
||||||
|
|
||||||
|
auto multiGraphicsAllocation = MultiGraphicsAllocation(rootDeviceIndex);
|
||||||
|
multiGraphicsAllocation.addAllocation(memory);
|
||||||
|
|
||||||
pBuffer = createBufferHw(context,
|
pBuffer = createBufferHw(context,
|
||||||
memoryProperties,
|
memoryProperties,
|
||||||
flags,
|
flags,
|
||||||
@@ -302,7 +305,7 @@ Buffer *Buffer::create(Context *context,
|
|||||||
size,
|
size,
|
||||||
memory->getUnderlyingBuffer(),
|
memory->getUnderlyingBuffer(),
|
||||||
(memoryProperties.flags.useHostPtr) ? hostPtr : nullptr,
|
(memoryProperties.flags.useHostPtr) ? hostPtr : nullptr,
|
||||||
memory,
|
multiGraphicsAllocation,
|
||||||
zeroCopyAllowed,
|
zeroCopyAllowed,
|
||||||
isHostPtrSVM,
|
isHostPtrSVM,
|
||||||
false);
|
false);
|
||||||
@@ -372,9 +375,13 @@ Buffer *Buffer::create(Context *context,
|
|||||||
|
|
||||||
Buffer *Buffer::createSharedBuffer(Context *context, cl_mem_flags flags, SharingHandler *sharingHandler,
|
Buffer *Buffer::createSharedBuffer(Context *context, cl_mem_flags flags, SharingHandler *sharingHandler,
|
||||||
GraphicsAllocation *graphicsAllocation) {
|
GraphicsAllocation *graphicsAllocation) {
|
||||||
|
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
|
||||||
|
auto multiGraphicsAllocation = MultiGraphicsAllocation(rootDeviceIndex);
|
||||||
|
multiGraphicsAllocation.addAllocation(graphicsAllocation);
|
||||||
|
|
||||||
auto sharedBuffer = createBufferHw(
|
auto sharedBuffer = createBufferHw(
|
||||||
context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice()),
|
context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice()),
|
||||||
flags, 0, graphicsAllocation->getUnderlyingBufferSize(), nullptr, nullptr, graphicsAllocation,
|
flags, 0, graphicsAllocation->getUnderlyingBufferSize(), nullptr, nullptr, multiGraphicsAllocation,
|
||||||
false, false, false);
|
false, false, false);
|
||||||
|
|
||||||
sharedBuffer->setSharingHandler(sharingHandler);
|
sharedBuffer->setSharingHandler(sharingHandler);
|
||||||
@@ -466,7 +473,7 @@ Buffer *Buffer::createSubBuffer(cl_mem_flags flags,
|
|||||||
auto buffer = createFunction(this->context, memoryProperties, flags, 0, region->size,
|
auto buffer = createFunction(this->context, memoryProperties, flags, 0, region->size,
|
||||||
ptrOffset(this->memoryStorage, region->origin),
|
ptrOffset(this->memoryStorage, region->origin),
|
||||||
this->hostPtr ? ptrOffset(this->hostPtr, region->origin) : nullptr,
|
this->hostPtr ? ptrOffset(this->hostPtr, region->origin) : nullptr,
|
||||||
this->multiGraphicsAllocation.getDefaultGraphicsAllocation(),
|
this->multiGraphicsAllocation,
|
||||||
this->isZeroCopy, this->isHostPtrSVM, false);
|
this->isZeroCopy, this->isHostPtrSVM, false);
|
||||||
|
|
||||||
if (this->context->isProvidingPerformanceHints()) {
|
if (this->context->isProvidingPerformanceHints()) {
|
||||||
@@ -593,7 +600,7 @@ Buffer *Buffer::createBufferHw(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 isImageRedescribed) {
|
bool isImageRedescribed) {
|
||||||
@@ -602,7 +609,7 @@ Buffer *Buffer::createBufferHw(Context *context,
|
|||||||
|
|
||||||
auto funcCreate = bufferFactory[hwInfo.platform.eRenderCoreFamily].createBufferFunction;
|
auto funcCreate = bufferFactory[hwInfo.platform.eRenderCoreFamily].createBufferFunction;
|
||||||
DEBUG_BREAK_IF(nullptr == funcCreate);
|
DEBUG_BREAK_IF(nullptr == funcCreate);
|
||||||
auto pBuffer = funcCreate(context, memoryProperties, flags, flagsIntel, size, memoryStorage, hostPtr, gfxAllocation,
|
auto pBuffer = funcCreate(context, memoryProperties, flags, flagsIntel, size, memoryStorage, hostPtr, multiGraphicsAllocation,
|
||||||
zeroCopy, isHostPtrSVM, isImageRedescribed);
|
zeroCopy, isHostPtrSVM, isImageRedescribed);
|
||||||
DEBUG_BREAK_IF(nullptr == pBuffer);
|
DEBUG_BREAK_IF(nullptr == pBuffer);
|
||||||
if (pBuffer) {
|
if (pBuffer) {
|
||||||
@@ -627,8 +634,14 @@ Buffer *Buffer::createBufferHwFromDevice(const Device *device,
|
|||||||
|
|
||||||
auto funcCreate = bufferFactory[hwInfo.platform.eRenderCoreFamily].createBufferFunction;
|
auto funcCreate = bufferFactory[hwInfo.platform.eRenderCoreFamily].createBufferFunction;
|
||||||
DEBUG_BREAK_IF(nullptr == funcCreate);
|
DEBUG_BREAK_IF(nullptr == funcCreate);
|
||||||
|
|
||||||
|
auto multiGraphicsAllocation = MultiGraphicsAllocation(device->getRootDeviceIndex());
|
||||||
|
if (gfxAllocation) {
|
||||||
|
multiGraphicsAllocation.addAllocation(gfxAllocation);
|
||||||
|
}
|
||||||
|
|
||||||
MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0, device);
|
MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0, device);
|
||||||
auto pBuffer = funcCreate(nullptr, memoryProperties, flags, flagsIntel, size, memoryStorage, hostPtr, gfxAllocation,
|
auto pBuffer = funcCreate(nullptr, memoryProperties, flags, flagsIntel, size, memoryStorage, hostPtr, multiGraphicsAllocation,
|
||||||
zeroCopy, isHostPtrSVM, isImageRedescribed);
|
zeroCopy, isHostPtrSVM, isImageRedescribed);
|
||||||
|
|
||||||
if (!gfxAllocation) {
|
if (!gfxAllocation) {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ using BufferCreatFunc = Buffer *(*)(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 isImageRedescribed);
|
bool isImageRedescribed);
|
||||||
@@ -96,7 +96,7 @@ class Buffer : public MemObj {
|
|||||||
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 isImageRedescribed);
|
bool isImageRedescribed);
|
||||||
@@ -165,7 +165,7 @@ class Buffer : public MemObj {
|
|||||||
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);
|
||||||
@@ -198,11 +198,11 @@ class BufferHw : public Buffer {
|
|||||||
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)
|
||||||
: Buffer(context, memoryProperties, flags, flagsIntel, size, memoryStorage, hostPtr, gfxAllocation,
|
: Buffer(context, memoryProperties, flags, flagsIntel, size, memoryStorage, hostPtr, multiGraphicsAllocation,
|
||||||
zeroCopy, isHostPtrSVM, isObjectRedescribed) {}
|
zeroCopy, isHostPtrSVM, isObjectRedescribed) {}
|
||||||
|
|
||||||
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnlyArgument, const Device &device) override;
|
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnlyArgument, const Device &device) override;
|
||||||
@@ -216,7 +216,7 @@ class BufferHw : public Buffer {
|
|||||||
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) {
|
||||||
@@ -227,7 +227,7 @@ class BufferHw : public Buffer {
|
|||||||
size,
|
size,
|
||||||
memoryStorage,
|
memoryStorage,
|
||||||
hostPtr,
|
hostPtr,
|
||||||
gfxAllocation,
|
multiGraphicsAllocation,
|
||||||
zeroCopy,
|
zeroCopy,
|
||||||
isHostPtrSVM,
|
isHostPtrSVM,
|
||||||
isObjectRedescribed);
|
isObjectRedescribed);
|
||||||
|
|||||||
@@ -122,6 +122,8 @@ HWTEST_F(AUBReadBuffer, reserveCanonicalGpuAddress) {
|
|||||||
0xFFFF800400001000,
|
0xFFFF800400001000,
|
||||||
sizeof(srcMemory),
|
sizeof(srcMemory),
|
||||||
MemoryPool::MemoryNull);
|
MemoryPool::MemoryNull);
|
||||||
|
auto multiGraphicsAllocation = MultiGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex());
|
||||||
|
multiGraphicsAllocation.addAllocation(srcAllocation);
|
||||||
|
|
||||||
std::unique_ptr<Buffer> srcBuffer(Buffer::createBufferHw(
|
std::unique_ptr<Buffer> srcBuffer(Buffer::createBufferHw(
|
||||||
&context,
|
&context,
|
||||||
@@ -131,7 +133,7 @@ HWTEST_F(AUBReadBuffer, reserveCanonicalGpuAddress) {
|
|||||||
sizeof(srcMemory),
|
sizeof(srcMemory),
|
||||||
srcAllocation->getUnderlyingBuffer(),
|
srcAllocation->getUnderlyingBuffer(),
|
||||||
srcMemory,
|
srcMemory,
|
||||||
srcAllocation,
|
multiGraphicsAllocation,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false));
|
false));
|
||||||
|
|||||||
@@ -92,8 +92,11 @@ struct MultipleMapBufferTest : public ClDeviceFixture, public ::testing::Test {
|
|||||||
std::unique_ptr<MockBuffer<FamilyType>> createMockBuffer(bool mapOnGpu) {
|
std::unique_ptr<MockBuffer<FamilyType>> createMockBuffer(bool mapOnGpu) {
|
||||||
MemoryProperties memoryProperties;
|
MemoryProperties memoryProperties;
|
||||||
auto mockAlloc = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
|
auto mockAlloc = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||||
|
auto multiGraphicsAllocation = MultiGraphicsAllocation(context->getDevice(0)->getRootDeviceIndex());
|
||||||
|
multiGraphicsAllocation.addAllocation(mockAlloc);
|
||||||
|
|
||||||
auto buffer = new MockBuffer<FamilyType>(context, memoryProperties, 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);
|
multiGraphicsAllocation, false, false, false);
|
||||||
if (mapOnGpu) {
|
if (mapOnGpu) {
|
||||||
buffer->setSharingHandler(new SharingHandler());
|
buffer->setSharingHandler(new SharingHandler());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ class MockBuffer : public MockBufferStorage, public Buffer {
|
|||||||
public:
|
public:
|
||||||
MockBuffer() : MockBufferStorage(),
|
MockBuffer() : MockBufferStorage(),
|
||||||
Buffer(nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, nullptr),
|
Buffer(nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, nullptr),
|
||||||
CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data, &mockGfxAllocation, true, false, false) {
|
CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data, GraphicsAllocationHelper::toMultiGraphicsAllocation(&mockGfxAllocation), true, false, false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly, const Device &device) override {
|
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly, const Device &device) override {
|
||||||
|
|||||||
@@ -2024,7 +2024,7 @@ TEST_P(NoHostPtr, GivenNoHostPtrWhenHwBufferCreationFailsThenReturnNullptr) {
|
|||||||
size_t,
|
size_t,
|
||||||
void *,
|
void *,
|
||||||
void *,
|
void *,
|
||||||
GraphicsAllocation *,
|
MultiGraphicsAllocation,
|
||||||
bool,
|
bool,
|
||||||
bool,
|
bool,
|
||||||
bool)
|
bool)
|
||||||
|
|||||||
@@ -18,13 +18,16 @@ using namespace NEO;
|
|||||||
|
|
||||||
class MockBufferStorage {
|
class MockBufferStorage {
|
||||||
public:
|
public:
|
||||||
MockBufferStorage() : mockGfxAllocation(data, sizeof(data) / 2) {
|
MockBufferStorage() : mockGfxAllocation(data, sizeof(data) / 2),
|
||||||
|
multiGfxAllocation(GraphicsAllocationHelper::toMultiGraphicsAllocation(&mockGfxAllocation)) {
|
||||||
}
|
}
|
||||||
MockBufferStorage(bool unaligned) : mockGfxAllocation(unaligned ? alignUp(&data, 4) : alignUp(&data, 64), sizeof(data) / 2) {
|
MockBufferStorage(bool unaligned) : mockGfxAllocation(unaligned ? alignUp(&data, 4) : alignUp(&data, 64), sizeof(data) / 2),
|
||||||
|
multiGfxAllocation(GraphicsAllocationHelper::toMultiGraphicsAllocation(&mockGfxAllocation)) {
|
||||||
}
|
}
|
||||||
char data[128];
|
char data[128];
|
||||||
MockGraphicsAllocation mockGfxAllocation;
|
MockGraphicsAllocation mockGfxAllocation;
|
||||||
std::unique_ptr<MockDevice> device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
std::unique_ptr<MockDevice> device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||||
|
MultiGraphicsAllocation multiGfxAllocation;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MockBuffer : public MockBufferStorage, public Buffer {
|
class MockBuffer : public MockBufferStorage, public Buffer {
|
||||||
@@ -34,12 +37,16 @@ class MockBuffer : public MockBufferStorage, public Buffer {
|
|||||||
using Buffer::size;
|
using Buffer::size;
|
||||||
using MemObj::isZeroCopy;
|
using MemObj::isZeroCopy;
|
||||||
using MockBufferStorage::device;
|
using MockBufferStorage::device;
|
||||||
|
|
||||||
MockBuffer(GraphicsAllocation &alloc)
|
MockBuffer(GraphicsAllocation &alloc)
|
||||||
: MockBufferStorage(), Buffer(nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, nullptr), CL_MEM_USE_HOST_PTR, 0, alloc.getUnderlyingBufferSize(), alloc.getUnderlyingBuffer(), alloc.getUnderlyingBuffer(), &alloc, true, false, false),
|
: MockBufferStorage(), Buffer(
|
||||||
|
nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, nullptr), CL_MEM_USE_HOST_PTR, 0, alloc.getUnderlyingBufferSize(), alloc.getUnderlyingBuffer(), alloc.getUnderlyingBuffer(),
|
||||||
|
GraphicsAllocationHelper::toMultiGraphicsAllocation(&alloc), true, false, false),
|
||||||
externalAlloc(&alloc) {
|
externalAlloc(&alloc) {
|
||||||
}
|
}
|
||||||
MockBuffer() : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, nullptr), CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data, &mockGfxAllocation, true, false, false) {
|
MockBuffer()
|
||||||
|
: MockBufferStorage(), Buffer(
|
||||||
|
nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, nullptr), CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data,
|
||||||
|
GraphicsAllocationHelper::toMultiGraphicsAllocation(&mockGfxAllocation), true, false, false) {
|
||||||
}
|
}
|
||||||
~MockBuffer() override {
|
~MockBuffer() override {
|
||||||
if (externalAlloc != nullptr) {
|
if (externalAlloc != nullptr) {
|
||||||
@@ -57,9 +64,14 @@ class MockBuffer : public MockBufferStorage, public Buffer {
|
|||||||
class AlignedBuffer : public MockBufferStorage, public Buffer {
|
class AlignedBuffer : public MockBufferStorage, public Buffer {
|
||||||
public:
|
public:
|
||||||
using MockBufferStorage::device;
|
using MockBufferStorage::device;
|
||||||
AlignedBuffer() : MockBufferStorage(false), Buffer(nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, nullptr), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64), &mockGfxAllocation, true, false, false) {
|
|
||||||
|
AlignedBuffer() : MockBufferStorage(false), Buffer(
|
||||||
|
nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, nullptr), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64),
|
||||||
|
GraphicsAllocationHelper::toMultiGraphicsAllocation(&mockGfxAllocation), true, false, false) {
|
||||||
}
|
}
|
||||||
AlignedBuffer(GraphicsAllocation *gfxAllocation) : MockBufferStorage(), Buffer(nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, nullptr), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64), gfxAllocation, true, false, false) {
|
AlignedBuffer(GraphicsAllocation *gfxAllocation) : MockBufferStorage(), Buffer(
|
||||||
|
nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, nullptr), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64),
|
||||||
|
GraphicsAllocationHelper::toMultiGraphicsAllocation(gfxAllocation), true, false, false) {
|
||||||
}
|
}
|
||||||
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly, const Device &device) override {
|
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly, const Device &device) override {
|
||||||
Buffer::setSurfaceState(this->device.get(), memory, getSize(), getCpuAddress(), 0, &mockGfxAllocation, 0, 0);
|
Buffer::setSurfaceState(this->device.get(), memory, getSize(), getCpuAddress(), 0, &mockGfxAllocation, 0, 0);
|
||||||
@@ -69,9 +81,14 @@ class AlignedBuffer : public MockBufferStorage, public Buffer {
|
|||||||
class UnalignedBuffer : public MockBufferStorage, public Buffer {
|
class UnalignedBuffer : public MockBufferStorage, public Buffer {
|
||||||
public:
|
public:
|
||||||
using MockBufferStorage::device;
|
using MockBufferStorage::device;
|
||||||
UnalignedBuffer() : MockBufferStorage(true), Buffer(nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, nullptr), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4), &mockGfxAllocation, false, false, false) {
|
|
||||||
|
UnalignedBuffer() : MockBufferStorage(true), Buffer(
|
||||||
|
nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, nullptr), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4),
|
||||||
|
GraphicsAllocationHelper::toMultiGraphicsAllocation(&mockGfxAllocation), false, false, false) {
|
||||||
}
|
}
|
||||||
UnalignedBuffer(GraphicsAllocation *gfxAllocation) : MockBufferStorage(true), Buffer(nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, nullptr), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4), gfxAllocation, false, false, false) {
|
UnalignedBuffer(GraphicsAllocation *gfxAllocation) : MockBufferStorage(true), Buffer(
|
||||||
|
nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, nullptr), CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4),
|
||||||
|
GraphicsAllocationHelper::toMultiGraphicsAllocation(gfxAllocation), false, false, false) {
|
||||||
}
|
}
|
||||||
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly, const Device &device) override {
|
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly, const Device &device) override {
|
||||||
Buffer::setSurfaceState(this->device.get(), memory, getSize(), getCpuAddress(), 0, &mockGfxAllocation, 0, 0);
|
Buffer::setSurfaceState(this->device.get(), memory, getSize(), getCpuAddress(), 0, &mockGfxAllocation, 0, 0);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||||
|
#include "shared/source/memory_manager/multi_graphics_allocation.h"
|
||||||
|
|
||||||
#include "opencl/source/memory_manager/os_agnostic_memory_manager.h"
|
#include "opencl/source/memory_manager/os_agnostic_memory_manager.h"
|
||||||
|
|
||||||
@@ -42,4 +43,15 @@ class MockGraphicsAllocation : public MemoryAllocation {
|
|||||||
this->memoryPool = pool;
|
this->memoryPool = pool;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace GraphicsAllocationHelper {
|
||||||
|
|
||||||
|
static inline MultiGraphicsAllocation toMultiGraphicsAllocation(GraphicsAllocation *graphicsAllocation) {
|
||||||
|
MultiGraphicsAllocation multiGraphicsAllocation(graphicsAllocation->getRootDeviceIndex());
|
||||||
|
multiGraphicsAllocation.addAllocation(graphicsAllocation);
|
||||||
|
return multiGraphicsAllocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace GraphicsAllocationHelper
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -1376,7 +1376,10 @@ class DrmMockBuffer : public Buffer {
|
|||||||
delete gfxAllocation;
|
delete gfxAllocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrmMockBuffer(char *data, size_t size, DrmAllocation *alloc) : Buffer(nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, nullptr), CL_MEM_USE_HOST_PTR, 0, size, data, data, alloc, true, false, false),
|
DrmMockBuffer(char *data, size_t size, DrmAllocation *alloc)
|
||||||
|
: Buffer(
|
||||||
|
nullptr, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, nullptr), CL_MEM_USE_HOST_PTR, 0, size, data, data,
|
||||||
|
GraphicsAllocationHelper::toMultiGraphicsAllocation(alloc), true, false, false),
|
||||||
data(data),
|
data(data),
|
||||||
gfxAllocation(alloc) {
|
gfxAllocation(alloc) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
|
||||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
class MultiGraphicsAllocation : NonCopyableClass {
|
class MultiGraphicsAllocation {
|
||||||
public:
|
public:
|
||||||
MultiGraphicsAllocation(uint32_t maxRootDeviceIndex);
|
MultiGraphicsAllocation(uint32_t maxRootDeviceIndex);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user