Reuse graphics allocation from mapped buffers in OpenCL

Related-To: NEO-6352
Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
Maciej Dziuban
2021-10-18 15:07:01 +00:00
committed by Compute-Runtime-Automation
parent f164acad0b
commit f1b6b733f0
21 changed files with 376 additions and 54 deletions

View File

@@ -9,6 +9,7 @@
#include "shared/source/device/device.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_gmm.h"
#include "opencl/source/command_queue/command_queue_hw.h"
#include "opencl/source/context/context.h"
@@ -57,6 +58,15 @@ CommandQueue *CommandQueueHwFixture::createCommandQueue(
return funcCreate(pContext, pDevice, properties, false);
}
void CommandQueueHwFixture::forceMapBufferOnGpu(Buffer &buffer) {
ClDevice *clDevice = buffer.getContext()->getDevice(0);
buffer.setSharingHandler(new SharingHandler());
auto gfxAllocation = buffer.getGraphicsAllocation(clDevice->getRootDeviceIndex());
for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) {
gfxAllocation->setGmm(new MockGmm(clDevice->getGmmClientContext()), handleId);
}
}
void CommandQueueHwFixture::SetUp() {
ASSERT_NE(nullptr, pCmdQ);
context = new MockContext();