Use MemoryManager retrieved from ExecutionEnvironment in Kernel dtor

Change-Id: I5f3880e1a95b3cbd262847d97776b0b92a580181
This commit is contained in:
Zdanowicz, Zbigniew
2019-02-06 14:30:32 +01:00
committed by sys_ocldev
parent 62e56d2398
commit 44491a111c
2 changed files with 15 additions and 2 deletions

View File

@@ -2411,3 +2411,16 @@ TEST(KernelTest, whenAllocationReadOnlyNonFlushRequiredThenAssignNullPointerToCa
EXPECT_EQ(nullptr, kernel.mockKernel->kernelArgRequiresCacheFlush[0]);
}
TEST(KernelTest, givenKernelUsesPrivateMemoryWhenDeviceReleasedBeforeKernelThenKernelUsesMemoryManagerFromEnvironment) {
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
auto executionEnvironment = device->getExecutionEnvironment();
auto mockKernel = std::make_unique<MockKernelWithInternals>(*device);
GraphicsAllocation *privateSurface = device->getExecutionEnvironment()->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
mockKernel->mockKernel->setPrivateSurface(privateSurface, 10);
executionEnvironment->incRefInternal();
device.reset(nullptr);
mockKernel.reset(nullptr);
executionEnvironment->decRefInternal();
}