Connect UnifiedMemoryProperties with MemoryPropertiesFlags

-Add support to SvmAllocationData
-Refactor parseMemoryProperties
-Add allocation flags

Related-To: NEO-4011
Change-Id: I3728d2319aeef983dbcc3f8702da9a303a4e2b9c
Signed-off-by: Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Gibala
2019-12-05 10:32:42 +01:00
committed by sys_ocldev
parent ac0471adc5
commit 5ac1d1258c
59 changed files with 318 additions and 267 deletions

View File

@@ -12,7 +12,8 @@
namespace NEO {
bool NEO::MemoryPropertiesParser::parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryPropertiesFlags &memoryProperties, cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel, ObjType objectType) {
bool NEO::MemoryPropertiesParser::parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryPropertiesFlags &memoryProperties,
cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel, cl_mem_alloc_flags_intel &allocflags, ObjType objectType) {
if (properties == nullptr) {
return true;
}
@@ -25,12 +26,15 @@ bool NEO::MemoryPropertiesParser::parseMemoryProperties(const cl_mem_properties_
case CL_MEM_FLAGS_INTEL:
flagsIntel |= static_cast<cl_mem_flags_intel>(properties[i + 1]);
break;
case CL_MEM_ALLOC_FLAGS_INTEL:
allocflags |= static_cast<cl_mem_alloc_flags_intel>(properties[i + 1]);
break;
default:
return false;
}
}
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel);
memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, flagsIntel, allocflags);
switch (objectType) {
case MemoryPropertiesParser::ObjType::BUFFER:

View File

@@ -22,7 +22,8 @@ class MemoryPropertiesParser {
IMAGE,
};
static bool parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryPropertiesFlags &memoryProperties, cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel, ObjType objectType);
static bool parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryPropertiesFlags &memoryProperties,
cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel, cl_mem_alloc_flags_intel &allocflags, ObjType objectType);
static AllocationProperties getAllocationProperties(uint32_t rootDeviceIndex, MemoryPropertiesFlags memoryProperties, bool allocateMemory,
size_t size, GraphicsAllocation::AllocationType type, bool multiStorageResource) {

View File

@@ -16,6 +16,6 @@ class MemoryPropertiesFlagsParser {
public:
static void addExtraMemoryPropertiesFlags(MemoryPropertiesFlags &propertiesFlags, cl_mem_flags flags, cl_mem_flags_intel flagsIntel);
static MemoryPropertiesFlags createMemoryPropertiesFlags(cl_mem_flags flags, cl_mem_flags_intel flagsIntel);
static MemoryPropertiesFlags createMemoryPropertiesFlags(cl_mem_flags flags, cl_mem_flags_intel flagsIntel, cl_mem_alloc_flags_intel allocflags);
};
} // namespace NEO

View File

@@ -13,7 +13,7 @@
namespace NEO {
MemoryPropertiesFlags MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(cl_mem_flags flags, cl_mem_flags_intel flagsIntel) {
MemoryPropertiesFlags MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(cl_mem_flags flags, cl_mem_flags_intel flagsIntel, cl_mem_alloc_flags_intel allocflags) {
MemoryPropertiesFlags memoryPropertiesFlags;
if (isValueSet(flags, CL_MEM_READ_WRITE)) {
@@ -72,6 +72,14 @@ MemoryPropertiesFlags MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(c
memoryPropertiesFlags.flags.forceSharedPhysicalMemory = true;
}
if (isValueSet(allocflags, CL_MEM_ALLOC_WRITE_COMBINED_INTEL)) {
memoryPropertiesFlags.allocFlags.allocWriteCombined = true;
}
if (allocflags == CL_MEM_ALLOC_DEFAULT_INTEL) {
memoryPropertiesFlags.allocFlags.allocDefault = true;
}
addExtraMemoryPropertiesFlags(memoryPropertiesFlags, flags, flagsIntel);
return memoryPropertiesFlags;