Update CL_MEM_FORCE_HOST_MEMORY_INTEL flag

Rename CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL to
CL_MEM_FORCE_HOST_MEMORY_INTEL.
Rename MemoryFlags::forceSharedPhysicalMemory to MemoryFlags::forceHostMemory.

Change-Id: I48c0ae958ff55f2aef71cf99ed274d021a3c1f19
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2020-10-05 16:17:51 +02:00
committed by sys_ocldev
parent 909107cab6
commit 89be51cd94
13 changed files with 20 additions and 20 deletions

View File

@ -72,7 +72,7 @@ using cl_unified_shared_memory_capabilities_intel = cl_bitfield;
#define CL_MEM_COMPARE_NOT_EQUAL 1u
#define CL_MEM_FORCE_LINEAR_STORAGE_INTEL (1 << 19)
#define CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL (1 << 20)
#define CL_MEM_FORCE_HOST_MEMORY_INTEL (1 << 20)
#define CL_MEM_ALLOCATION_HANDLE_INTEL 0x10050
#define CL_MEM_USES_COMPRESSION_INTEL 0x10051

View File

@ -31,7 +31,7 @@ GTPIN_DI_STATUS GTPIN_DRIVER_CALLCONV gtpinCreateBuffer(context_handle_t context
if (hostPtr == nullptr) {
return GTPIN_DI_ERROR_ALLOCATION_FAILED;
}
cl_mem buffer = Buffer::create(pContext, CL_MEM_USE_HOST_PTR | CL_MEM_READ_WRITE | CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL, size, hostPtr, diag);
cl_mem buffer = Buffer::create(pContext, CL_MEM_USE_HOST_PTR | CL_MEM_READ_WRITE | CL_MEM_FORCE_HOST_MEMORY_INTEL, size, hostPtr, diag);
*pResource = (resource_handle_t)buffer;
return GTPIN_DI_SUCCESS;
}

View File

@ -70,8 +70,8 @@ MemoryProperties MemoryPropertiesHelper::createMemoryProperties(cl_mem_flags fla
memoryProperties.flags.locallyUncachedInSurfaceState = true;
}
if (isValueSet(flags, CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL)) {
memoryProperties.flags.forceSharedPhysicalMemory = true;
if (isValueSet(flags, CL_MEM_FORCE_HOST_MEMORY_INTEL)) {
memoryProperties.flags.forceHostMemory = true;
}
if (isValueSet(allocflags, CL_MEM_ALLOC_WRITE_COMBINED_INTEL)) {

View File

@ -442,7 +442,7 @@ void Buffer::checkMemory(MemoryProperties memoryProperties,
GraphicsAllocation::AllocationType Buffer::getGraphicsAllocationType(const MemoryProperties &properties, Context &context,
bool renderCompressedBuffers, bool isLocalMemoryEnabled,
bool preferCompression) {
if (context.isSharedContext || properties.flags.forceSharedPhysicalMemory) {
if (context.isSharedContext || properties.flags.forceHostMemory) {
return GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
}

View File

@ -100,7 +100,7 @@ const uint64_t MemObjHelper::commonFlags = extraFlags | CL_MEM_READ_WRITE | CL_M
const uint64_t MemObjHelper::commonFlagsIntel = extraFlagsIntel | CL_MEM_LOCALLY_UNCACHED_RESOURCE |
CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE | CL_MEM_48BIT_RESOURCE_INTEL;
const uint64_t MemObjHelper::validFlagsForBuffer = commonFlags | CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL | CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL;
const uint64_t MemObjHelper::validFlagsForBuffer = commonFlags | CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL | CL_MEM_FORCE_HOST_MEMORY_INTEL;
const uint64_t MemObjHelper::validFlagsForBufferIntel = commonFlagsIntel | CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL;

View File

@ -65,7 +65,7 @@ static cl_mem_flags validFlags[] = {
CL_MEM_HOST_READ_ONLY,
CL_MEM_HOST_WRITE_ONLY,
CL_MEM_HOST_NO_ACCESS,
CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL};
CL_MEM_FORCE_HOST_MEMORY_INTEL};
INSTANTIATE_TEST_CASE_P(
CreateBufferCheckFlags,

View File

@ -88,7 +88,7 @@ TEST_P(PerformanceHintBufferTest, GivenHostPtrAndSizeAlignmentsWhenBufferIsCreat
auto flags = CL_MEM_USE_HOST_PTR;
if (alignedAddress && alignedSize) {
flags |= CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL;
flags |= CL_MEM_FORCE_HOST_MEMORY_INTEL;
}
buffer = Buffer::create(
@ -509,7 +509,7 @@ TEST_F(PerformanceHintTest, givenUncompressedBufferWhenItsCreatedThenProperPerfo
HwHelper::get(hwInfo.platform.eRenderCoreFamily).obtainRenderBufferCompressionPreference(hwInfo, size)) &&
!is32bit && !context->isSharedContext &&
(!memoryProperties.flags.useHostPtr || context->getMemoryManager()->isLocalMemorySupported(device->getRootDeviceIndex())) &&
!memoryProperties.flags.forceSharedPhysicalMemory;
!memoryProperties.flags.forceHostMemory;
buffer = std::unique_ptr<Buffer>(Buffer::create(context.get(), memoryProperties, CL_MEM_READ_WRITE, 0, size, static_cast<void *>(NULL), retVal));
}

View File

@ -65,8 +65,8 @@ TEST(MemoryProperties, givenValidPropertiesWhenCreateMemoryPropertiesThenTrueIsR
properties = MemoryPropertiesHelper::createMemoryProperties(0, CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE, 0, pDevice);
EXPECT_TRUE(properties.flags.locallyUncachedInSurfaceState);
properties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL, 0, 0, pDevice);
EXPECT_TRUE(properties.flags.forceSharedPhysicalMemory);
properties = MemoryPropertiesHelper::createMemoryProperties(CL_MEM_FORCE_HOST_MEMORY_INTEL, 0, 0, pDevice);
EXPECT_TRUE(properties.flags.forceHostMemory);
properties = MemoryPropertiesHelper::createMemoryProperties(0, 0, CL_MEM_ALLOC_WRITE_COMBINED_INTEL, pDevice);
EXPECT_TRUE(properties.allocFlags.allocWriteCombined);

View File

@ -87,7 +87,7 @@ TEST(BufferTests, GivenHostPtrWhenBufferIsCreatedThenPinIsSet) {
auto buffer = Buffer::create(
&context,
CL_MEM_USE_HOST_PTR | CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL,
CL_MEM_USE_HOST_PTR | CL_MEM_FORCE_HOST_MEMORY_INTEL,
size,
bff,
retVal);

View File

@ -402,7 +402,7 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledAndRenderCompressedBuffersE
}
TEST(Buffer, givenUseHostPointerFlagAndForceSharedPhysicalStorageWhenLocalMemoryIsEnabledThenBufferHostMemoryTypeIsReturned) {
cl_mem_flags flags = CL_MEM_USE_HOST_PTR | CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL;
cl_mem_flags flags = CL_MEM_USE_HOST_PTR | CL_MEM_FORCE_HOST_MEMORY_INTEL;
MockContext context;
MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context.getDevice(0)->getDevice());
context.contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
@ -482,7 +482,7 @@ TEST_F(RenderCompressedBuffersTests, givenBufferCompressedAllocationAndZeroCopyH
void *cacheAlignedHostPtr = alignedMalloc(MemoryConstants::cacheLineSize, MemoryConstants::cacheLineSize);
buffer.reset(Buffer::create(context.get(), CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL | CL_MEM_USE_HOST_PTR, MemoryConstants::cacheLineSize, cacheAlignedHostPtr, retVal));
buffer.reset(Buffer::create(context.get(), CL_MEM_FORCE_HOST_MEMORY_INTEL | CL_MEM_USE_HOST_PTR, MemoryConstants::cacheLineSize, cacheAlignedHostPtr, retVal));
auto allocation = buffer->getGraphicsAllocation(device->getRootDeviceIndex());
EXPECT_EQ(cacheAlignedHostPtr, allocation->getUnderlyingBuffer());
EXPECT_TRUE(buffer->isMemObjZeroCopy());
@ -501,7 +501,7 @@ TEST_F(RenderCompressedBuffersTests, givenBufferCompressedAllocationAndZeroCopyH
}
hwInfo->capabilityTable.ftrRenderCompressedBuffers = true;
buffer.reset(Buffer::create(context.get(), CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL | CL_MEM_USE_HOST_PTR, MemoryConstants::cacheLineSize, cacheAlignedHostPtr, retVal));
buffer.reset(Buffer::create(context.get(), CL_MEM_FORCE_HOST_MEMORY_INTEL | CL_MEM_USE_HOST_PTR, MemoryConstants::cacheLineSize, cacheAlignedHostPtr, retVal));
allocation = buffer->getGraphicsAllocation(device->getRootDeviceIndex());
EXPECT_EQ(cacheAlignedHostPtr, allocation->getUnderlyingBuffer());
EXPECT_TRUE(buffer->isMemObjZeroCopy());
@ -513,7 +513,7 @@ TEST_F(RenderCompressedBuffersTests, givenBufferCompressedAllocationAndZeroCopyH
}
TEST_F(RenderCompressedBuffersTests, givenAllocationCreatedWithForceSharedPhysicalMemoryWhenItIsCreatedItIsZeroCopy) {
buffer.reset(Buffer::create(context.get(), CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL, 1u, nullptr, retVal));
buffer.reset(Buffer::create(context.get(), CL_MEM_FORCE_HOST_MEMORY_INTEL, 1u, nullptr, retVal));
EXPECT_EQ(buffer->getGraphicsAllocation(device->getRootDeviceIndex())->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
EXPECT_TRUE(buffer->isMemObjZeroCopy());
EXPECT_EQ(1u, buffer->getSize());
@ -521,7 +521,7 @@ TEST_F(RenderCompressedBuffersTests, givenAllocationCreatedWithForceSharedPhysic
TEST_F(RenderCompressedBuffersTests, givenRenderCompressedBuffersAndAllocationCreatedWithForceSharedPhysicalMemoryWhenItIsCreatedItIsZeroCopy) {
hwInfo->capabilityTable.ftrRenderCompressedBuffers = true;
buffer.reset(Buffer::create(context.get(), CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL, 1u, nullptr, retVal));
buffer.reset(Buffer::create(context.get(), CL_MEM_FORCE_HOST_MEMORY_INTEL, 1u, nullptr, retVal));
EXPECT_EQ(buffer->getGraphicsAllocation(device->getRootDeviceIndex())->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
EXPECT_TRUE(buffer->isMemObjZeroCopy());
EXPECT_EQ(1u, buffer->getSize());

View File

@ -120,7 +120,7 @@ TEST_F(SubBufferTest, GivenBufferWithAlignedHostPtrAndSameMemoryStorageWhenSubBu
cl_int retVal = 0;
void *alignedPointer = alignedMalloc(MemoryConstants::pageSize, MemoryConstants::preferredAlignment);
Buffer *buffer = Buffer::create(&context, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR | CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL,
Buffer *buffer = Buffer::create(&context, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR | CL_MEM_FORCE_HOST_MEMORY_INTEL,
MemoryConstants::pageSize, alignedPointer, retVal);
ASSERT_NE(nullptr, buffer);

View File

@ -1167,7 +1167,7 @@ TEST_F(WddmMemoryManagerTest, givenPtrAndSizePassedToCreateInternalAllocationWhe
}
TEST_F(BufferWithWddmMemory, WhenCreatingBufferThenBufferIsCreatedCorrectly) {
flags = CL_MEM_USE_HOST_PTR | CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL;
flags = CL_MEM_USE_HOST_PTR | CL_MEM_FORCE_HOST_MEMORY_INTEL;
auto ptr = alignedMalloc(MemoryConstants::preferredAlignment, MemoryConstants::preferredAlignment);

View File

@ -25,7 +25,7 @@ struct MemoryFlags {
uint32_t locallyUncachedResource : 1;
uint32_t locallyUncachedInSurfaceState : 1;
uint32_t allowUnrestrictedSize : 1;
uint32_t forceSharedPhysicalMemory : 1;
uint32_t forceHostMemory : 1;
uint32_t shareable : 1;
uint32_t resource48Bit : 1;
uint32_t usmInitialPlacementCpu : 1;