Extend UnifiedMemoryProperties constructor to take device bitfield

Related-To: NEO-4722

Change-Id: Ice185f1792635922e9bb89cd7329e6501bc585e0
Signed-off-by: Andrzej Swierczynski <andrzej.swierczynski@intel.com>
This commit is contained in:
Andrzej Swierczynski
2020-08-28 12:55:54 +02:00
committed by sys_ocldev
parent 820efffdd0
commit bdf8c5fc90
10 changed files with 68 additions and 113 deletions

View File

@@ -3522,7 +3522,8 @@ void *clHostMemAllocINTEL(
return nullptr;
}
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY,
neoContext->getDeviceBitfieldForAllocation(neoContext->getDevice(0)->getRootDeviceIndex()));
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
cl_mem_alloc_flags_intel allocflags = 0;
@@ -3561,11 +3562,11 @@ void *clDeviceMemAllocINTEL(
return nullptr;
}
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY,
neoDevice->getDeviceBitfield());
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
cl_mem_alloc_flags_intel allocflags = 0;
unifiedMemoryProperties.subdeviceBitfield = neoDevice->getDeviceBitfield();
if (!MemoryPropertiesHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel,
allocflags, MemoryPropertiesHelper::ObjType::UNKNOWN,
*neoContext)) {
@@ -3602,28 +3603,32 @@ void *clSharedMemAllocINTEL(
return nullptr;
}
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY);
cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0;
cl_mem_alloc_flags_intel allocflags = 0;
ClDevice *neoDevice = castToObject<ClDevice>(device);
void *unifiedMemoryPropertiesDevice = nullptr;
DeviceBitfield subdeviceBitfield;
if (neoDevice) {
if (!neoContext->isDeviceAssociated(*neoDevice)) {
err.set(CL_INVALID_DEVICE);
return nullptr;
}
unifiedMemoryPropertiesDevice = device;
subdeviceBitfield = neoDevice->getDeviceBitfield();
} else {
neoDevice = neoContext->getDevice(0);
subdeviceBitfield = neoContext->getDeviceBitfieldForAllocation(neoContext->getDevice(0)->getRootDeviceIndex());
}
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, subdeviceBitfield);
unifiedMemoryProperties.device = unifiedMemoryPropertiesDevice;
if (!MemoryPropertiesHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel,
allocflags, MemoryPropertiesHelper::ObjType::UNKNOWN,
*neoContext)) {
err.set(CL_INVALID_VALUE);
return nullptr;
}
ClDevice *neoDevice = castToObject<ClDevice>(device);
if (neoDevice) {
if (!neoContext->isDeviceAssociated(*neoDevice)) {
err.set(CL_INVALID_DEVICE);
return nullptr;
}
unifiedMemoryProperties.device = device;
unifiedMemoryProperties.subdeviceBitfield = neoDevice->getDeviceBitfield();
} else {
neoDevice = neoContext->getDevice(0);
unifiedMemoryProperties.subdeviceBitfield = neoContext->getDeviceBitfieldForAllocation(neoContext->getDevice(0)->getRootDeviceIndex());
}
if (size > neoDevice->getSharedDeviceInfo().maxMemAllocSize && !unifiedMemoryProperties.allocationFlags.flags.allowUnrestrictedSize) {
err.set(CL_INVALID_BUFFER_SIZE);
return nullptr;