Remove mapping on free.

Change-Id: I0ec5783362c9091edf98f893b062faaaad125522
Signed-off-by: Mrozek, Michal <michal.mrozek@intel.com>
This commit is contained in:
Mrozek, Michal
2019-09-06 13:22:50 +02:00
committed by sys_ocldev
parent 3e4dd67f09
commit dface02b19
2 changed files with 20 additions and 0 deletions

View File

@ -38,6 +38,22 @@ TEST(clUnifiedSharedMemoryTests, whenClHostMemAllocIntelIsCalledThenItAllocatesH
EXPECT_EQ(CL_SUCCESS, retVal);
}
TEST(clUnifiedSharedMemoryTests, givenMappedAllocationWhenClMemFreeIntelIscalledThenMappingIsRemoved) {
MockContext mockContext;
cl_int retVal = CL_SUCCESS;
auto unifiedMemorySharedAllocation = clSharedMemAllocINTEL(&mockContext, mockContext.getDevice(0u), nullptr, 4, 0, &retVal);
EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, unifiedMemorySharedAllocation);
auto allocationsManager = mockContext.getSVMAllocsManager();
allocationsManager->insertSvmMapOperation(unifiedMemorySharedAllocation, 4u, unifiedMemorySharedAllocation, 0u, false);
retVal = clMemFreeINTEL(&mockContext, unifiedMemorySharedAllocation);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(nullptr, allocationsManager->getSvmMapOperation(unifiedMemorySharedAllocation));
}
TEST(clUnifiedSharedMemoryTests, whenClDeviceMemAllocINTELisCalledWithWrongContextThenInvalidContextErrorIsReturned) {
cl_int retVal = CL_SUCCESS;
auto ptr = clDeviceMemAllocINTEL(0, 0, nullptr, 0, 0, &retVal);