Add hwInfo to args of fillPoliciesInProperties()

Related-To: NEO-4207

Change-Id: I74b672dd48d9797dfbc871a9e79b92fc2aae9639
Signed-off-by: Andrzej Swierczynski <andrzej.swierczynski@intel.com>
This commit is contained in:
Andrzej Swierczynski
2020-03-11 12:42:44 +01:00
committed by sys_ocldev
parent e9778d40c1
commit f8500ac3a8
12 changed files with 27 additions and 25 deletions

View File

@ -49,7 +49,7 @@ bool NEO::MemoryPropertiesParser::parseMemoryProperties(const cl_mem_properties_
return true;
}
void MemoryPropertiesParser::fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryPropertiesFlags &memoryProperties) {
void MemoryPropertiesParser::fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryPropertiesFlags &memoryProperties, const HardwareInfo &hwInfo) {
fillCachePolicyInProperties(allocationProperties,
memoryProperties.flags.locallyUncachedResource,
memoryProperties.flags.readOnly,

View File

@ -27,13 +27,13 @@ class MemoryPropertiesParser {
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) {
size_t size, GraphicsAllocation::AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo) {
AllocationProperties allocationProperties(rootDeviceIndex, allocateMemory, size, type, multiStorageResource);
fillPoliciesInProperties(allocationProperties, memoryProperties);
fillPoliciesInProperties(allocationProperties, memoryProperties, hwInfo);
return allocationProperties;
}
static void fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryPropertiesFlags &memoryProperties);
static void fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryPropertiesFlags &memoryProperties, const HardwareInfo &hwInfo);
static void fillCachePolicyInProperties(AllocationProperties &allocationProperties, bool uncached, bool readOnly,
bool deviceOnlyVisibilty) {

View File

@ -228,7 +228,7 @@ Buffer *Buffer::create(Context *context,
}
if (!memory) {
AllocationProperties allocProperties = MemoryPropertiesParser::getAllocationProperties(rootDeviceIndex, memoryProperties, allocateMemory, size, allocationType, context->areMultiStorageAllocationsPreferred());
AllocationProperties allocProperties = MemoryPropertiesParser::getAllocationProperties(rootDeviceIndex, memoryProperties, allocateMemory, size, allocationType, context->areMultiStorageAllocationsPreferred(), context->getDevice(0)->getHardwareInfo());
memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties, hostPtr);
}
@ -241,7 +241,7 @@ Buffer *Buffer::create(Context *context,
allocationType = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
zeroCopyAllowed = false;
copyMemoryFromHostPtr = true;
AllocationProperties allocProperties = MemoryPropertiesParser::getAllocationProperties(rootDeviceIndex, memoryProperties, true, size, allocationType, context->areMultiStorageAllocationsPreferred());
AllocationProperties allocProperties = MemoryPropertiesParser::getAllocationProperties(rootDeviceIndex, memoryProperties, true, size, allocationType, context->areMultiStorageAllocationsPreferred(), context->getDevice(0)->getHardwareInfo());
memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties);
}

View File

@ -268,7 +268,7 @@ Image *Image::create(Context *context,
if (memoryProperties.flags.useHostPtr) {
if (!context->isSharedContext) {
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(rootDeviceIndex, imgInfo, false, memoryProperties);
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(rootDeviceIndex, imgInfo, false, memoryProperties, context->getDevice(0)->getHardwareInfo());
memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties, hostPtr);
@ -292,7 +292,7 @@ Image *Image::create(Context *context,
mapAllocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, hostPtr);
}
} else {
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(rootDeviceIndex, imgInfo, true, memoryProperties);
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(rootDeviceIndex, imgInfo, true, memoryProperties, context->getDevice(0)->getHardwareInfo());
memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties);
if (memory && MemoryPool::isSystemMemoryPool(memory->getMemoryPool())) {

View File

@ -32,7 +32,7 @@ class MemObjHelper {
static bool validateMemoryPropertiesForBuffer(const MemoryPropertiesFlags &memoryProperties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel);
static bool validateMemoryPropertiesForImage(const MemoryPropertiesFlags &memoryProperties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel, cl_mem parent);
static AllocationProperties getAllocationPropertiesWithImageInfo(uint32_t rootDeviceIndex, ImageInfo &imgInfo, bool allocateMemory, const MemoryPropertiesFlags &memoryProperties);
static AllocationProperties getAllocationPropertiesWithImageInfo(uint32_t rootDeviceIndex, ImageInfo &imgInfo, bool allocateMemory, const MemoryPropertiesFlags &memoryProperties, const HardwareInfo &hwInfo);
static bool checkMemFlagsForSubBuffer(cl_mem_flags flags);
static SVMAllocsManager::SvmAllocationProperties getSvmAllocationProperties(cl_mem_flags flags);
static bool isSuitableForRenderCompression(bool renderCompressed, const MemoryPropertiesFlags &properties, Context &context, bool preferCompression);

View File

@ -67,9 +67,9 @@ bool MemObjHelper::validateMemoryPropertiesForImage(const MemoryPropertiesFlags
return validateExtraMemoryProperties(memoryProperties, flags, flagsIntel);
}
AllocationProperties MemObjHelper::getAllocationPropertiesWithImageInfo(uint32_t rootDeviceIndex, ImageInfo &imgInfo, bool allocateMemory, const MemoryPropertiesFlags &memoryProperties) {
AllocationProperties MemObjHelper::getAllocationPropertiesWithImageInfo(uint32_t rootDeviceIndex, ImageInfo &imgInfo, bool allocateMemory, const MemoryPropertiesFlags &memoryProperties, const HardwareInfo &hwInfo) {
AllocationProperties allocationProperties{rootDeviceIndex, allocateMemory, imgInfo, GraphicsAllocation::AllocationType::IMAGE};
MemoryPropertiesParser::fillPoliciesInProperties(allocationProperties, memoryProperties);
MemoryPropertiesParser::fillPoliciesInProperties(allocationProperties, memoryProperties, hwInfo);
return allocationProperties;
}

View File

@ -59,7 +59,7 @@ Pipe *Pipe::create(Context *context,
auto size = static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace);
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
AllocationProperties allocProperties =
MemoryPropertiesParser::getAllocationProperties(rootDeviceIndex, memoryPropertiesFlags, true, size, GraphicsAllocation::AllocationType::PIPE, false);
MemoryPropertiesParser::getAllocationProperties(rootDeviceIndex, memoryPropertiesFlags, true, size, GraphicsAllocation::AllocationType::PIPE, false, context->getDevice(0)->getHardwareInfo());
GraphicsAllocation *memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties);
if (!memory) {
errcodeRet = CL_OUT_OF_HOST_MEMORY;

View File

@ -95,7 +95,7 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo
imgInfo.imgDesc.imageHeight /= 2;
}
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0);
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(rootDeviceIndex, imgInfo, true, memoryProperties);
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(rootDeviceIndex, imgInfo, true, memoryProperties, context->getDevice(0)->getHardwareInfo());
allocProperties.allocationType = GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY;
alloc = context->getMemoryManager()->allocateGraphicsMemoryInPreferredPool(allocProperties, nullptr);