Remove limitation for write combined flag

Allow usage of WC in clHostMemAllocINTEL & clSharedMemAllocINTEL

Related-To: NEO-3374
Change-Id: I82f0be3f67b26bd19195d374b40f73e8f8a50b01
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala
2020-01-15 16:37:10 +01:00
committed by sys_ocldev
parent 9d79430878
commit e2d7634dd5
2 changed files with 13 additions and 17 deletions

View File

@@ -3464,11 +3464,6 @@ void *clHostMemAllocINTEL(
return nullptr;
}
if (isValueSet(unifiedMemoryProperties.allocationFlags.allAllocFlags, CL_MEM_ALLOC_WRITE_COMBINED_INTEL)) {
err.set(CL_INVALID_VALUE);
return nullptr;
}
return neoContext->getSVMAllocsManager()->createUnifiedMemoryAllocation(neoContext->getDevice(0)->getRootDeviceIndex(), size, unifiedMemoryProperties);
}
@@ -3544,11 +3539,6 @@ void *clSharedMemAllocINTEL(
return nullptr;
}
if (isValueSet(unifiedMemoryProperties.allocationFlags.allAllocFlags, CL_MEM_ALLOC_WRITE_COMBINED_INTEL)) {
err.set(CL_INVALID_VALUE);
return nullptr;
}
unifiedMemoryProperties.device = device;
unifiedMemoryProperties.subdeviceBitfield = neoDevice->getDefaultEngine().osContext->getDeviceBitfield();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 Intel Corporation
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -230,15 +230,18 @@ TEST(clUnifiedSharedMemoryTests, whenHostMemAllocWithInvalidPropertiesTokenThenE
EXPECT_EQ(CL_INVALID_VALUE, retVal);
}
TEST(clUnifiedSharedMemoryTests, whenHostMemAllocWithInvalidWriteCombinedTokenThenErrorIsReturned) {
TEST(clUnifiedSharedMemoryTests, whenHostMemAllocWithInvalidWriteCombinedTokenThenSuccessIsReturned) {
MockContext mockContext;
cl_int retVal = CL_SUCCESS;
cl_mem_properties_intel properties[] = {CL_MEM_ALLOC_FLAGS_INTEL, CL_MEM_ALLOC_WRITE_COMBINED_INTEL, 0};
auto unifiedMemoryHostAllocation = clHostMemAllocINTEL(&mockContext, properties, 4, 0, &retVal);
EXPECT_EQ(nullptr, unifiedMemoryHostAllocation);
EXPECT_EQ(CL_INVALID_VALUE, retVal);
EXPECT_NE(nullptr, unifiedMemoryHostAllocation);
EXPECT_EQ(CL_SUCCESS, retVal);
retVal = clMemFreeINTEL(&mockContext, unifiedMemoryHostAllocation);
EXPECT_EQ(CL_SUCCESS, retVal);
}
TEST(clUnifiedSharedMemoryTests, whenDeviceMemAllocWithInvalidPropertiesTokenThenErrorIsReturned) {
@@ -264,15 +267,18 @@ TEST(clUnifiedSharedMemoryTests, whenSharedMemAllocWithInvalidPropertiesTokenThe
EXPECT_EQ(CL_INVALID_VALUE, retVal);
}
TEST(clUnifiedSharedMemoryTests, whenSharedMemAllocWithInvalidWriteCombinedTokenThenErrorIsReturned) {
TEST(clUnifiedSharedMemoryTests, whenSharedMemAllocWithInvalidWriteCombinedTokenThenSuccessIsReturned) {
MockContext mockContext;
cl_int retVal = CL_SUCCESS;
cl_mem_properties_intel properties[] = {CL_MEM_ALLOC_FLAGS_INTEL, CL_MEM_ALLOC_WRITE_COMBINED_INTEL, 0};
auto unifiedMemorySharedAllocation = clSharedMemAllocINTEL(&mockContext, mockContext.getDevice(0u), properties, 4, 0, &retVal);
EXPECT_EQ(nullptr, unifiedMemorySharedAllocation);
EXPECT_EQ(CL_INVALID_VALUE, retVal);
EXPECT_NE(nullptr, unifiedMemorySharedAllocation);
EXPECT_EQ(CL_SUCCESS, retVal);
retVal = clMemFreeINTEL(&mockContext, unifiedMemorySharedAllocation);
EXPECT_EQ(CL_SUCCESS, retVal);
}
TEST(clUnifiedSharedMemoryTests, givenUnifiedMemoryAllocWithoutPropertiesWhenGetMemAllocFlagsThenDefaultValueIsReturned) {