Store GmmHelper in Gmm class

Store GmmHelper in Gmm class instead of GmmClientContext

Related-To: NEO-6523
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala
2022-04-27 10:20:10 +00:00
committed by Compute-Runtime-Automation
parent 7eb70775ea
commit 9b778863b4
75 changed files with 457 additions and 456 deletions

View File

@@ -163,9 +163,9 @@ struct BlitEnqueueTests : public ::testing::Test {
graphicsAllocation->setAllocationType(AllocationType::BUFFER);
if (compressed && !graphicsAllocation->getDefaultGmm()) {
auto clientContext = device->getRootDeviceEnvironment().getGmmClientContext();
auto gmmHelper = device->getRootDeviceEnvironment().getGmmHelper();
graphicsAllocation->setDefaultGmm(new Gmm(clientContext, nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
graphicsAllocation->setDefaultGmm(new Gmm(gmmHelper, nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
}
if (graphicsAllocation->getDefaultGmm()) {

View File

@@ -63,7 +63,7 @@ void CommandQueueHwFixture::forceMapBufferOnGpu(Buffer &buffer) {
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);
gfxAllocation->setGmm(new MockGmm(clDevice->getGmmHelper()), handleId);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -378,7 +378,7 @@ TEST_F(EnqueueMapBufferTest, givenNonReadOnlyBufferWhenMappedOnGpuThenSetValidEv
buffer->setSharingHandler(new SharingHandler());
auto gfxAllocation = buffer->getGraphicsAllocation(pDevice->getRootDeviceIndex());
for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) {
gfxAllocation->setGmm(new MockGmm(pDevice->getGmmClientContext()), handleId);
gfxAllocation->setGmm(new MockGmm(pDevice->getGmmHelper()), handleId);
}
buffer->forceDisallowCPUCopy = true;
@@ -426,7 +426,7 @@ TEST_F(EnqueueMapBufferTest, givenReadOnlyBufferWhenMappedOnGpuThenSetValidEvent
buffer->setSharingHandler(new SharingHandler());
auto gfxAllocation = buffer->getGraphicsAllocation(pDevice->getRootDeviceIndex());
for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) {
gfxAllocation->setGmm(new MockGmm(pDevice->getGmmClientContext()), handleId);
gfxAllocation->setGmm(new MockGmm(pDevice->getGmmHelper()), handleId);
}
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_NE(nullptr, buffer.get());

View File

@@ -615,7 +615,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenForcedCpuCopyWhenEnqueueReadCompressedB
static_cast<MemoryAllocation *>(graphicsAllocation)->overrideMemoryPool(MemoryPool::SystemCpuInaccessible);
void *ptr = nonZeroCopyBuffer->getCpuAddressForMemoryTransfer();
MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true);
MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true);
retVal = mockCmdQ->enqueueReadBuffer(buffer.get(),
CL_TRUE,
@@ -631,7 +631,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenForcedCpuCopyWhenEnqueueReadCompressedB
EXPECT_FALSE(graphicsAllocation->isLocked());
EXPECT_FALSE(mockCmdQ->cpuDataTransferHandlerCalled);
MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), false);
MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), false);
retVal = mockCmdQ->enqueueReadBuffer(buffer.get(),
CL_TRUE,

View File

@@ -444,7 +444,7 @@ HWTEST_F(EnqueueWriteBufferTypeTest, givenForcedCpuCopyWhenEnqueueWriteCompresse
allocation->overrideMemoryPool(MemoryPool::SystemCpuInaccessible);
void *ptr = srcBuffer->getCpuAddressForMemoryTransfer();
MockBuffer::setAllocationType(allocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true);
MockBuffer::setAllocationType(allocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true);
retVal = mockCmdQ->enqueueWriteBuffer(buffer.get(),
CL_FALSE,
@@ -460,7 +460,7 @@ HWTEST_F(EnqueueWriteBufferTypeTest, givenForcedCpuCopyWhenEnqueueWriteCompresse
EXPECT_FALSE(allocation->isLocked());
EXPECT_FALSE(mockCmdQ->cpuDataTransferHandlerCalled);
MockBuffer::setAllocationType(allocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), false);
MockBuffer::setAllocationType(allocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), false);
retVal = mockCmdQ->enqueueWriteBuffer(buffer.get(),
CL_FALSE,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -30,7 +30,7 @@ TEST_F(EnqueueKernelTest, givenKernelWithSharedObjArgsWhenEnqueueIsCalledThenRes
auto nonSharedBuffer = new MockBuffer;
MockGlSharing glSharing;
MockGmm mockGmm(pDevice->getGmmClientContext());
MockGmm mockGmm(pDevice->getGmmHelper());
glSharing.uploadDataToBufferInfo(1, 0, mockGmm.gmmResourceInfo->peekGmmResourceInfo());
pContext->setSharingFunctions(glSharing.sharingFunctions.release());
auto retVal = CL_SUCCESS;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -99,7 +99,7 @@ struct MultipleMapBufferTest : public ClDeviceFixture, public ::testing::Test {
buffer->setSharingHandler(new SharingHandler());
auto gfxAllocation = buffer->getGraphicsAllocation(pDevice->getRootDeviceIndex());
for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) {
gfxAllocation->setGmm(new MockGmm(pDevice->getGmmClientContext()), handleId);
gfxAllocation->setGmm(new MockGmm(pDevice->getGmmHelper()), handleId);
}
}
return std::unique_ptr<MockBuffer<FamilyType>>(buffer);

View File

@@ -24,7 +24,7 @@ HWTEST_F(ReadWriteBufferCpuCopyTest, givenCompressedGmmWhenAskingForCpuOperation
cl_int retVal;
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
std::unique_ptr<Buffer> buffer(Buffer::create(context, CL_MEM_READ_WRITE, 1, nullptr, retVal));
auto gmm = new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmm = new Gmm(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm->isCompressionEnabled = false;
auto allocation = buffer->getGraphicsAllocation(rootDeviceIndex);
allocation->setDefaultGmm(gmm);