mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-23 11:03:02 +08:00
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:
committed by
sys_ocldev
parent
9d79430878
commit
e2d7634dd5
@@ -3464,11 +3464,6 @@ void *clHostMemAllocINTEL(
|
|||||||
return nullptr;
|
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);
|
return neoContext->getSVMAllocsManager()->createUnifiedMemoryAllocation(neoContext->getDevice(0)->getRootDeviceIndex(), size, unifiedMemoryProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3544,11 +3539,6 @@ void *clSharedMemAllocINTEL(
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isValueSet(unifiedMemoryProperties.allocationFlags.allAllocFlags, CL_MEM_ALLOC_WRITE_COMBINED_INTEL)) {
|
|
||||||
err.set(CL_INVALID_VALUE);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
unifiedMemoryProperties.device = device;
|
unifiedMemoryProperties.device = device;
|
||||||
unifiedMemoryProperties.subdeviceBitfield = neoDevice->getDefaultEngine().osContext->getDeviceBitfield();
|
unifiedMemoryProperties.subdeviceBitfield = neoDevice->getDefaultEngine().osContext->getDeviceBitfield();
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 Intel Corporation
|
* Copyright (C) 2019-2020 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -230,15 +230,18 @@ TEST(clUnifiedSharedMemoryTests, whenHostMemAllocWithInvalidPropertiesTokenThenE
|
|||||||
EXPECT_EQ(CL_INVALID_VALUE, retVal);
|
EXPECT_EQ(CL_INVALID_VALUE, retVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(clUnifiedSharedMemoryTests, whenHostMemAllocWithInvalidWriteCombinedTokenThenErrorIsReturned) {
|
TEST(clUnifiedSharedMemoryTests, whenHostMemAllocWithInvalidWriteCombinedTokenThenSuccessIsReturned) {
|
||||||
MockContext mockContext;
|
MockContext mockContext;
|
||||||
cl_int retVal = CL_SUCCESS;
|
cl_int retVal = CL_SUCCESS;
|
||||||
cl_mem_properties_intel properties[] = {CL_MEM_ALLOC_FLAGS_INTEL, CL_MEM_ALLOC_WRITE_COMBINED_INTEL, 0};
|
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);
|
auto unifiedMemoryHostAllocation = clHostMemAllocINTEL(&mockContext, properties, 4, 0, &retVal);
|
||||||
|
|
||||||
EXPECT_EQ(nullptr, unifiedMemoryHostAllocation);
|
EXPECT_NE(nullptr, unifiedMemoryHostAllocation);
|
||||||
EXPECT_EQ(CL_INVALID_VALUE, retVal);
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||||
|
|
||||||
|
retVal = clMemFreeINTEL(&mockContext, unifiedMemoryHostAllocation);
|
||||||
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(clUnifiedSharedMemoryTests, whenDeviceMemAllocWithInvalidPropertiesTokenThenErrorIsReturned) {
|
TEST(clUnifiedSharedMemoryTests, whenDeviceMemAllocWithInvalidPropertiesTokenThenErrorIsReturned) {
|
||||||
@@ -264,15 +267,18 @@ TEST(clUnifiedSharedMemoryTests, whenSharedMemAllocWithInvalidPropertiesTokenThe
|
|||||||
EXPECT_EQ(CL_INVALID_VALUE, retVal);
|
EXPECT_EQ(CL_INVALID_VALUE, retVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(clUnifiedSharedMemoryTests, whenSharedMemAllocWithInvalidWriteCombinedTokenThenErrorIsReturned) {
|
TEST(clUnifiedSharedMemoryTests, whenSharedMemAllocWithInvalidWriteCombinedTokenThenSuccessIsReturned) {
|
||||||
MockContext mockContext;
|
MockContext mockContext;
|
||||||
cl_int retVal = CL_SUCCESS;
|
cl_int retVal = CL_SUCCESS;
|
||||||
cl_mem_properties_intel properties[] = {CL_MEM_ALLOC_FLAGS_INTEL, CL_MEM_ALLOC_WRITE_COMBINED_INTEL, 0};
|
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);
|
auto unifiedMemorySharedAllocation = clSharedMemAllocINTEL(&mockContext, mockContext.getDevice(0u), properties, 4, 0, &retVal);
|
||||||
|
|
||||||
EXPECT_EQ(nullptr, unifiedMemorySharedAllocation);
|
EXPECT_NE(nullptr, unifiedMemorySharedAllocation);
|
||||||
EXPECT_EQ(CL_INVALID_VALUE, retVal);
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||||
|
|
||||||
|
retVal = clMemFreeINTEL(&mockContext, unifiedMemorySharedAllocation);
|
||||||
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(clUnifiedSharedMemoryTests, givenUnifiedMemoryAllocWithoutPropertiesWhenGetMemAllocFlagsThenDefaultValueIsReturned) {
|
TEST(clUnifiedSharedMemoryTests, givenUnifiedMemoryAllocWithoutPropertiesWhenGetMemAllocFlagsThenDefaultValueIsReturned) {
|
||||||
|
|||||||
Reference in New Issue
Block a user