refactor: correct naming of unified memory enums

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski 2023-12-13 10:09:37 +00:00 committed by Compute-Runtime-Automation
parent 2eba5b35e4
commit 27fbdde4c5
55 changed files with 386 additions and 388 deletions

View File

@ -1882,8 +1882,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryFill(void *ptr,
NEO::SvmAllocationData *allocData = nullptr; NEO::SvmAllocationData *allocData = nullptr;
bool dstAllocFound = device->getDriverHandle()->findAllocationDataForRange(ptr, size, allocData); bool dstAllocFound = device->getDriverHandle()->findAllocationDataForRange(ptr, size, allocData);
if (dstAllocFound) { if (dstAllocFound) {
if (allocData->memoryType == InternalMemoryType::HOST_UNIFIED_MEMORY || if (allocData->memoryType == InternalMemoryType::hostUnifiedMemory ||
allocData->memoryType == InternalMemoryType::SHARED_UNIFIED_MEMORY) { allocData->memoryType == InternalMemoryType::sharedUnifiedMemory) {
hostPointerNeedsFlush = true; hostPointerNeedsFlush = true;
} }
} else { } else {
@ -2274,15 +2274,15 @@ inline AlignedAllocationData CommandListCoreFamily<gfxCoreFamily>::getAlignedAll
alloc = driverHandle->getPeerAllocation(device, allocData, reinterpret_cast<void *>(pbase), &alignedPtr, nullptr); alloc = driverHandle->getPeerAllocation(device, allocData, reinterpret_cast<void *>(pbase), &alignedPtr, nullptr);
alignedPtr += offset; alignedPtr += offset;
if (allocData->memoryType == InternalMemoryType::SHARED_UNIFIED_MEMORY) { if (allocData->memoryType == InternalMemoryType::sharedUnifiedMemory) {
commandContainer.addToResidencyContainer(allocData->gpuAllocations.getDefaultGraphicsAllocation()); commandContainer.addToResidencyContainer(allocData->gpuAllocations.getDefaultGraphicsAllocation());
} }
} else { } else {
alignedPtr = sourcePtr; alignedPtr = sourcePtr;
} }
if (allocData->memoryType == InternalMemoryType::HOST_UNIFIED_MEMORY || if (allocData->memoryType == InternalMemoryType::hostUnifiedMemory ||
allocData->memoryType == InternalMemoryType::SHARED_UNIFIED_MEMORY) { allocData->memoryType == InternalMemoryType::sharedUnifiedMemory) {
hostPointerNeedsFlush = true; hostPointerNeedsFlush = true;
} }
if (allocData->virtualReservationData) { if (allocData->virtualReservationData) {

View File

@ -974,8 +974,8 @@ bool CommandListCoreFamilyImmediate<gfxCoreFamily>::preferCopyThroughLockedPtr(C
bool cpuMemCopyEnabled = false; bool cpuMemCopyEnabled = false;
switch (transferType) { switch (transferType) {
case HOST_USM_TO_DEVICE_USM: case TransferType::hostUsmToDeviceUsm:
case DEVICE_USM_TO_HOST_USM: { case TransferType::deviceUsmToHostUsm: {
if (this->dependenciesPresent) { if (this->dependenciesPresent) {
cpuMemCopyEnabled = false; cpuMemCopyEnabled = false;
break; break;
@ -990,8 +990,8 @@ bool CommandListCoreFamilyImmediate<gfxCoreFamily>::preferCopyThroughLockedPtr(C
cpuMemCopyEnabled = allEventsCompleted; cpuMemCopyEnabled = allEventsCompleted;
break; break;
} }
case HOST_NON_USM_TO_DEVICE_USM: case TransferType::hostNonUsmToDeviceUsm:
case DEVICE_USM_TO_HOST_NON_USM: case TransferType::deviceUsmToHostNonUsm:
cpuMemCopyEnabled = true; cpuMemCopyEnabled = true;
break; break;
default: default:
@ -1004,19 +1004,19 @@ bool CommandListCoreFamilyImmediate<gfxCoreFamily>::preferCopyThroughLockedPtr(C
template <GFXCORE_FAMILY gfxCoreFamily> template <GFXCORE_FAMILY gfxCoreFamily>
bool CommandListCoreFamilyImmediate<gfxCoreFamily>::isSuitableUSMHostAlloc(NEO::SvmAllocationData *alloc) { bool CommandListCoreFamilyImmediate<gfxCoreFamily>::isSuitableUSMHostAlloc(NEO::SvmAllocationData *alloc) {
return alloc && (alloc->memoryType == InternalMemoryType::HOST_UNIFIED_MEMORY); return alloc && (alloc->memoryType == InternalMemoryType::hostUnifiedMemory);
} }
template <GFXCORE_FAMILY gfxCoreFamily> template <GFXCORE_FAMILY gfxCoreFamily>
bool CommandListCoreFamilyImmediate<gfxCoreFamily>::isSuitableUSMDeviceAlloc(NEO::SvmAllocationData *alloc) { bool CommandListCoreFamilyImmediate<gfxCoreFamily>::isSuitableUSMDeviceAlloc(NEO::SvmAllocationData *alloc) {
return alloc && (alloc->memoryType == InternalMemoryType::DEVICE_UNIFIED_MEMORY) && return alloc && (alloc->memoryType == InternalMemoryType::deviceUnifiedMemory) &&
alloc->gpuAllocations.getGraphicsAllocation(this->device->getRootDeviceIndex()) && alloc->gpuAllocations.getGraphicsAllocation(this->device->getRootDeviceIndex()) &&
alloc->gpuAllocations.getGraphicsAllocation(this->device->getRootDeviceIndex())->storageInfo.getNumBanks() == 1; alloc->gpuAllocations.getGraphicsAllocation(this->device->getRootDeviceIndex())->storageInfo.getNumBanks() == 1;
} }
template <GFXCORE_FAMILY gfxCoreFamily> template <GFXCORE_FAMILY gfxCoreFamily>
bool CommandListCoreFamilyImmediate<gfxCoreFamily>::isSuitableUSMSharedAlloc(NEO::SvmAllocationData *alloc) { bool CommandListCoreFamilyImmediate<gfxCoreFamily>::isSuitableUSMSharedAlloc(NEO::SvmAllocationData *alloc) {
return alloc && (alloc->memoryType == InternalMemoryType::SHARED_UNIFIED_MEMORY); return alloc && (alloc->memoryType == InternalMemoryType::sharedUnifiedMemory);
} }
template <GFXCORE_FAMILY gfxCoreFamily> template <GFXCORE_FAMILY gfxCoreFamily>
@ -1138,58 +1138,58 @@ TransferType CommandListCoreFamilyImmediate<gfxCoreFamily>::getTransferType(cons
const bool dstHostNonUSM = (cpuMemCopyInfo.dstAllocData == nullptr) && !cpuMemCopyInfo.dstIsImportedHostPtr; const bool dstHostNonUSM = (cpuMemCopyInfo.dstAllocData == nullptr) && !cpuMemCopyInfo.dstIsImportedHostPtr;
if (srcHostNonUSM && dstHostUSM) { if (srcHostNonUSM && dstHostUSM) {
return HOST_NON_USM_TO_HOST_USM; return TransferType::hostNonUsmToHostUsm;
} }
if (srcHostNonUSM && dstDeviceUSM) { if (srcHostNonUSM && dstDeviceUSM) {
return HOST_NON_USM_TO_DEVICE_USM; return TransferType::hostNonUsmToDeviceUsm;
} }
if (srcHostNonUSM && dstSharedUSM) { if (srcHostNonUSM && dstSharedUSM) {
return HOST_NON_USM_TO_SHARED_USM; return TransferType::hostNonUsmToSharedUsm;
} }
if (srcHostNonUSM && dstHostNonUSM) { if (srcHostNonUSM && dstHostNonUSM) {
return HOST_NON_USM_TO_HOST_NON_USM; return TransferType::hostNonUsmToHostNonUsm;
} }
if (srcHostUSM && dstHostUSM) { if (srcHostUSM && dstHostUSM) {
return HOST_USM_TO_HOST_USM; return TransferType::hostUsmToHostUsm;
} }
if (srcHostUSM && dstDeviceUSM) { if (srcHostUSM && dstDeviceUSM) {
return HOST_USM_TO_DEVICE_USM; return TransferType::hostUsmToDeviceUsm;
} }
if (srcHostUSM && dstSharedUSM) { if (srcHostUSM && dstSharedUSM) {
return HOST_USM_TO_SHARED_USM; return TransferType::hostUsmToSharedUsm;
} }
if (srcHostUSM && dstHostNonUSM) { if (srcHostUSM && dstHostNonUSM) {
return HOST_USM_TO_HOST_NON_USM; return TransferType::hostUsmToHostNonUsm;
} }
if (srcDeviceUSM && dstHostUSM) { if (srcDeviceUSM && dstHostUSM) {
return DEVICE_USM_TO_HOST_USM; return TransferType::deviceUsmToHostUsm;
} }
if (srcDeviceUSM && dstDeviceUSM) { if (srcDeviceUSM && dstDeviceUSM) {
return DEVICE_USM_TO_DEVICE_USM; return TransferType::deviceUsmToDeviceUsm;
} }
if (srcDeviceUSM && dstSharedUSM) { if (srcDeviceUSM && dstSharedUSM) {
return DEVICE_USM_TO_SHARED_USM; return TransferType::deviceUsmToSharedUsm;
} }
if (srcDeviceUSM && dstHostNonUSM) { if (srcDeviceUSM && dstHostNonUSM) {
return DEVICE_USM_TO_HOST_NON_USM; return TransferType::deviceUsmToHostNonUsm;
} }
if (srcSharedUSM && dstHostUSM) { if (srcSharedUSM && dstHostUSM) {
return SHARED_USM_TO_HOST_USM; return TransferType::sharedUsmToHostUsm;
} }
if (srcSharedUSM && dstDeviceUSM) { if (srcSharedUSM && dstDeviceUSM) {
return SHARED_USM_TO_DEVICE_USM; return TransferType::sharedUsmToDeviceUsm;
} }
if (srcSharedUSM && dstSharedUSM) { if (srcSharedUSM && dstSharedUSM) {
return SHARED_USM_TO_SHARED_USM; return TransferType::sharedUsmToSharedUsm;
} }
if (srcSharedUSM && dstHostNonUSM) { if (srcSharedUSM && dstHostNonUSM) {
return SHARED_USM_TO_HOST_NON_USM; return TransferType::sharedUsmToHostNonUsm;
} }
return TRANSFER_TYPE_UNKNOWN; return TransferType::unknown;
} }
template <GFXCORE_FAMILY gfxCoreFamily> template <GFXCORE_FAMILY gfxCoreFamily>
@ -1197,52 +1197,52 @@ size_t CommandListCoreFamilyImmediate<gfxCoreFamily>::getTransferThreshold(Trans
size_t retVal = 0u; size_t retVal = 0u;
switch (transferType) { switch (transferType) {
case HOST_NON_USM_TO_HOST_USM: case TransferType::hostNonUsmToHostUsm:
retVal = 1 * MemoryConstants::megaByte; retVal = 1 * MemoryConstants::megaByte;
break; break;
case HOST_NON_USM_TO_DEVICE_USM: case TransferType::hostNonUsmToDeviceUsm:
retVal = 4 * MemoryConstants::megaByte; retVal = 4 * MemoryConstants::megaByte;
if (NEO::debugManager.flags.ExperimentalH2DCpuCopyThreshold.get() != -1) { if (NEO::debugManager.flags.ExperimentalH2DCpuCopyThreshold.get() != -1) {
retVal = NEO::debugManager.flags.ExperimentalH2DCpuCopyThreshold.get(); retVal = NEO::debugManager.flags.ExperimentalH2DCpuCopyThreshold.get();
} }
break; break;
case HOST_NON_USM_TO_SHARED_USM: case TransferType::hostNonUsmToSharedUsm:
retVal = 0u; retVal = 0u;
break; break;
case HOST_NON_USM_TO_HOST_NON_USM: case TransferType::hostNonUsmToHostNonUsm:
retVal = 1 * MemoryConstants::megaByte; retVal = 1 * MemoryConstants::megaByte;
break; break;
case HOST_USM_TO_HOST_USM: case TransferType::hostUsmToHostUsm:
retVal = 200 * MemoryConstants::kiloByte; retVal = 200 * MemoryConstants::kiloByte;
break; break;
case HOST_USM_TO_DEVICE_USM: case TransferType::hostUsmToDeviceUsm:
retVal = 50 * MemoryConstants::kiloByte; retVal = 50 * MemoryConstants::kiloByte;
break; break;
case HOST_USM_TO_SHARED_USM: case TransferType::hostUsmToSharedUsm:
retVal = 0u; retVal = 0u;
break; break;
case HOST_USM_TO_HOST_NON_USM: case TransferType::hostUsmToHostNonUsm:
retVal = 500 * MemoryConstants::kiloByte; retVal = 500 * MemoryConstants::kiloByte;
break; break;
case DEVICE_USM_TO_DEVICE_USM: case TransferType::deviceUsmToDeviceUsm:
retVal = 0u; retVal = 0u;
break; break;
case DEVICE_USM_TO_SHARED_USM: case TransferType::deviceUsmToSharedUsm:
retVal = 0u; retVal = 0u;
break; break;
case DEVICE_USM_TO_HOST_USM: case TransferType::deviceUsmToHostUsm:
retVal = 128u; retVal = 128u;
break; break;
case DEVICE_USM_TO_HOST_NON_USM: case TransferType::deviceUsmToHostNonUsm:
retVal = 1 * MemoryConstants::kiloByte; retVal = 1 * MemoryConstants::kiloByte;
if (NEO::debugManager.flags.ExperimentalD2HCpuCopyThreshold.get() != -1) { if (NEO::debugManager.flags.ExperimentalD2HCpuCopyThreshold.get() != -1) {
retVal = NEO::debugManager.flags.ExperimentalD2HCpuCopyThreshold.get(); retVal = NEO::debugManager.flags.ExperimentalD2HCpuCopyThreshold.get();
} }
break; break;
case SHARED_USM_TO_HOST_USM: case TransferType::sharedUsmToHostUsm:
case SHARED_USM_TO_DEVICE_USM: case TransferType::sharedUsmToDeviceUsm:
case SHARED_USM_TO_SHARED_USM: case TransferType::sharedUsmToSharedUsm:
case SHARED_USM_TO_HOST_NON_USM: case TransferType::sharedUsmToHostNonUsm:
retVal = 0u; retVal = 0u;
break; break;
default: default:

View File

@ -28,11 +28,11 @@ struct Image;
struct Context : _ze_context_handle_t { struct Context : _ze_context_handle_t {
inline static ze_memory_type_t parseUSMType(InternalMemoryType memoryType) { inline static ze_memory_type_t parseUSMType(InternalMemoryType memoryType) {
switch (memoryType) { switch (memoryType) {
case InternalMemoryType::SHARED_UNIFIED_MEMORY: case InternalMemoryType::sharedUnifiedMemory:
return ZE_MEMORY_TYPE_SHARED; return ZE_MEMORY_TYPE_SHARED;
case InternalMemoryType::DEVICE_UNIFIED_MEMORY: case InternalMemoryType::deviceUnifiedMemory:
return ZE_MEMORY_TYPE_DEVICE; return ZE_MEMORY_TYPE_DEVICE;
case InternalMemoryType::HOST_UNIFIED_MEMORY: case InternalMemoryType::hostUnifiedMemory:
return ZE_MEMORY_TYPE_HOST; return ZE_MEMORY_TYPE_HOST;
default: default:
return ZE_MEMORY_TYPE_UNKNOWN; return ZE_MEMORY_TYPE_UNKNOWN;

View File

@ -119,7 +119,7 @@ ze_result_t ContextImp::allocHostMem(const ze_host_mem_alloc_desc_t *hostDesc,
return ZE_RESULT_SUCCESS; return ZE_RESULT_SUCCESS;
} }
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory,
alignment, alignment,
this->rootDeviceIndices, this->rootDeviceIndices,
this->deviceBitfields); this->deviceBitfields);
@ -246,7 +246,7 @@ ze_result_t ContextImp::allocDeviceMem(ze_device_handle_t hDevice,
} }
deviceBitfields[rootDeviceIndex] = neoDevice->getDeviceBitfield(); deviceBitfields[rootDeviceIndex] = neoDevice->getDeviceBitfield();
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, alignment, this->driverHandle->rootDeviceIndices, deviceBitfields); NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, alignment, this->driverHandle->rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.allocationFlags.flags.shareable = isShareableMemory(deviceDesc->pNext, static_cast<uint32_t>(lookupTable.exportMemory), neoDevice); unifiedMemoryProperties.allocationFlags.flags.shareable = isShareableMemory(deviceDesc->pNext, static_cast<uint32_t>(lookupTable.exportMemory), neoDevice);
unifiedMemoryProperties.device = neoDevice; unifiedMemoryProperties.device = neoDevice;
unifiedMemoryProperties.allocationFlags.flags.compressedHint = isAllocationSuitableForCompression(lookupTable, *device, size); unifiedMemoryProperties.allocationFlags.flags.compressedHint = isAllocationSuitableForCompression(lookupTable, *device, size);
@ -323,7 +323,7 @@ ze_result_t ContextImp::allocSharedMem(ze_device_handle_t hDevice,
deviceBitfields[rootDeviceIndex] = neoDevice->getDeviceBitfield(); deviceBitfields[rootDeviceIndex] = neoDevice->getDeviceBitfield();
} }
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory,
alignment, alignment,
this->rootDeviceIndices, this->rootDeviceIndices,
deviceBitfields); deviceBitfields);
@ -478,7 +478,7 @@ ze_result_t ContextImp::makeMemoryResident(ze_device_handle_t hDevice, void *ptr
if (ZE_RESULT_SUCCESS == res) { if (ZE_RESULT_SUCCESS == res) {
auto allocData = device->getDriverHandle()->getSvmAllocsManager()->getSVMAlloc(ptr); auto allocData = device->getDriverHandle()->getSvmAllocsManager()->getSVMAlloc(ptr);
if (allocData && allocData->memoryType == InternalMemoryType::SHARED_UNIFIED_MEMORY) { if (allocData && allocData->memoryType == InternalMemoryType::sharedUnifiedMemory) {
DriverHandleImp *driverHandleImp = static_cast<DriverHandleImp *>(device->getDriverHandle()); DriverHandleImp *driverHandleImp = static_cast<DriverHandleImp *>(device->getDriverHandle());
std::lock_guard<std::mutex> lock(driverHandleImp->sharedMakeResidentAllocationsLock); std::lock_guard<std::mutex> lock(driverHandleImp->sharedMakeResidentAllocationsLock);
driverHandleImp->sharedMakeResidentAllocations.insert({ptr, allocation}); driverHandleImp->sharedMakeResidentAllocations.insert({ptr, allocation});
@ -609,8 +609,8 @@ ze_result_t ContextImp::getIpcMemHandle(const void *ptr,
IpcMemoryData &ipcData = *reinterpret_cast<IpcMemoryData *>(pIpcHandle->data); IpcMemoryData &ipcData = *reinterpret_cast<IpcMemoryData *>(pIpcHandle->data);
auto type = allocData->memoryType; auto type = allocData->memoryType;
uint8_t ipcType = 0; uint8_t ipcType = 0;
if (type == HOST_UNIFIED_MEMORY) { if (type == InternalMemoryType::hostUnifiedMemory) {
ipcType = static_cast<uint8_t>(InternalIpcMemoryType::IPC_HOST_UNIFIED_MEMORY); ipcType = static_cast<uint8_t>(InternalIpcMemoryType::hostUnifiedMemory);
} }
setIPCHandleData(graphicsAllocation, handle, ipcData, reinterpret_cast<uint64_t>(ptr), ipcType); setIPCHandleData(graphicsAllocation, handle, ipcData, reinterpret_cast<uint64_t>(ptr), ipcType);
@ -663,9 +663,9 @@ ze_result_t ContextImp::getIpcMemHandles(const void *ptr,
} }
auto type = allocData->memoryType; auto type = allocData->memoryType;
auto ipcType = InternalIpcMemoryType::IPC_DEVICE_UNIFIED_MEMORY; auto ipcType = InternalIpcMemoryType::deviceUnifiedMemory;
if (type == HOST_UNIFIED_MEMORY) { if (type == InternalMemoryType::hostUnifiedMemory) {
ipcType = InternalIpcMemoryType::IPC_HOST_UNIFIED_MEMORY; ipcType = InternalIpcMemoryType::hostUnifiedMemory;
} }
for (uint32_t i = 0; i < *numIpcHandles; i++) { for (uint32_t i = 0; i < *numIpcHandles; i++) {
@ -694,9 +694,9 @@ ze_result_t ContextImp::openIpcMemHandle(ze_device_handle_t hDevice,
uint8_t type = ipcData.type; uint8_t type = ipcData.type;
NEO::AllocationType allocationType = NEO::AllocationType::unknown; NEO::AllocationType allocationType = NEO::AllocationType::unknown;
if (type == static_cast<uint8_t>(InternalIpcMemoryType::IPC_DEVICE_UNIFIED_MEMORY)) { if (type == static_cast<uint8_t>(InternalIpcMemoryType::deviceUnifiedMemory)) {
allocationType = NEO::AllocationType::buffer; allocationType = NEO::AllocationType::buffer;
} else if (type == static_cast<uint8_t>(InternalIpcMemoryType::IPC_HOST_UNIFIED_MEMORY)) { } else if (type == static_cast<uint8_t>(InternalIpcMemoryType::hostUnifiedMemory)) {
allocationType = NEO::AllocationType::bufferHostMemory; allocationType = NEO::AllocationType::bufferHostMemory;
} else { } else {
return ZE_RESULT_ERROR_INVALID_ARGUMENT; return ZE_RESULT_ERROR_INVALID_ARGUMENT;
@ -725,7 +725,7 @@ ze_result_t ContextImp::openIpcMemHandles(ze_device_handle_t hDevice,
const IpcMemoryData &ipcData = *reinterpret_cast<const IpcMemoryData *>(pIpcHandles[i].data); const IpcMemoryData &ipcData = *reinterpret_cast<const IpcMemoryData *>(pIpcHandles[i].data);
uint64_t handle = ipcData.handle; uint64_t handle = ipcData.handle;
if (ipcData.type != static_cast<uint8_t>(InternalIpcMemoryType::IPC_DEVICE_UNIFIED_MEMORY)) { if (ipcData.type != static_cast<uint8_t>(InternalIpcMemoryType::deviceUnifiedMemory)) {
return ZE_RESULT_ERROR_INVALID_ARGUMENT; return ZE_RESULT_ERROR_INVALID_ARGUMENT;
} }
@ -1178,7 +1178,7 @@ ze_result_t ContextImp::mapVirtualMem(const void *ptr,
allocData.size = size; allocData.size = size;
allocData.pageSizeForAlignment = MemoryConstants::pageSize64k; allocData.pageSizeForAlignment = MemoryConstants::pageSize64k;
allocData.setAllocId(this->driverHandle->svmAllocsManager->allocationsCounter++); allocData.setAllocId(this->driverHandle->svmAllocsManager->allocationsCounter++);
allocData.memoryType = InternalMemoryType::RESERVED_DEVICE_MEMORY; allocData.memoryType = InternalMemoryType::reservedDeviceMemory;
allocData.virtualReservationData = virtualMemoryReservation; allocData.virtualReservationData = virtualMemoryReservation;
NEO::MemoryMappedRange *mappedRange = new NEO::MemoryMappedRange; NEO::MemoryMappedRange *mappedRange = new NEO::MemoryMappedRange;
mappedRange->ptr = ptr; mappedRange->ptr = ptr;

View File

@ -1476,7 +1476,7 @@ NEO::GraphicsAllocation *DeviceImp::allocateManagedMemoryFromHostPtr(void *buffe
allocData.gpuAllocations.addAllocation(allocation); allocData.gpuAllocations.addAllocation(allocation);
allocData.cpuAllocation = nullptr; allocData.cpuAllocation = nullptr;
allocData.size = size; allocData.size = size;
allocData.memoryType = InternalMemoryType::NOT_SPECIFIED; allocData.memoryType = InternalMemoryType::notSpecified;
allocData.device = nullptr; allocData.device = nullptr;
driverHandle->getSvmAllocsManager()->insertSVMAlloc(allocData); driverHandle->getSvmAllocsManager()->insertSVMAlloc(allocData);

View File

@ -621,7 +621,7 @@ void *DriverHandleImp::importFdHandle(NEO::Device *neoDevice,
allocDataTmp->cpuAllocation = nullptr; allocDataTmp->cpuAllocation = nullptr;
allocDataTmp->size = alloc->getUnderlyingBufferSize(); allocDataTmp->size = alloc->getUnderlyingBufferSize();
allocDataTmp->memoryType = allocDataTmp->memoryType =
isHostIpcAllocation ? InternalMemoryType::HOST_UNIFIED_MEMORY : InternalMemoryType::DEVICE_UNIFIED_MEMORY; isHostIpcAllocation ? InternalMemoryType::hostUnifiedMemory : InternalMemoryType::deviceUnifiedMemory;
allocDataTmp->device = neoDevice; allocDataTmp->device = neoDevice;
allocDataTmp->isImportedAllocation = true; allocDataTmp->isImportedAllocation = true;
allocDataTmp->setAllocId(this->getSvmAllocsManager()->allocationsCounter++); allocDataTmp->setAllocId(this->getSvmAllocsManager()->allocationsCounter++);
@ -675,7 +675,7 @@ void *DriverHandleImp::importFdHandles(NEO::Device *neoDevice, ze_ipc_memory_fla
allocDataTmp->gpuAllocations.addAllocation(alloc); allocDataTmp->gpuAllocations.addAllocation(alloc);
allocDataTmp->cpuAllocation = nullptr; allocDataTmp->cpuAllocation = nullptr;
allocDataTmp->size = alloc->getUnderlyingBufferSize(); allocDataTmp->size = alloc->getUnderlyingBufferSize();
allocDataTmp->memoryType = InternalMemoryType::DEVICE_UNIFIED_MEMORY; allocDataTmp->memoryType = InternalMemoryType::deviceUnifiedMemory;
allocDataTmp->device = neoDevice; allocDataTmp->device = neoDevice;
allocDataTmp->isImportedAllocation = true; allocDataTmp->isImportedAllocation = true;
allocDataTmp->setAllocId(this->getSvmAllocsManager()->allocationsCounter++); allocDataTmp->setAllocId(this->getSvmAllocsManager()->allocationsCounter++);
@ -767,7 +767,7 @@ NEO::GraphicsAllocation *DriverHandleImp::getPeerAllocation(Device *device,
uint32_t numHandles = alloc->getNumHandles(); uint32_t numHandles = alloc->getNumHandles();
// Don't attempt to use the peerMapAddress for reserved memory due to the limitations in the address reserved. // Don't attempt to use the peerMapAddress for reserved memory due to the limitations in the address reserved.
if (allocData->memoryType == InternalMemoryType::RESERVED_DEVICE_MEMORY) { if (allocData->memoryType == InternalMemoryType::reservedDeviceMemory) {
peerMapAddress = nullptr; peerMapAddress = nullptr;
} }
@ -847,7 +847,7 @@ void *DriverHandleImp::importNTHandle(ze_device_handle_t hDevice, void *handle,
allocData.cpuAllocation = nullptr; allocData.cpuAllocation = nullptr;
allocData.size = alloc->getUnderlyingBufferSize(); allocData.size = alloc->getUnderlyingBufferSize();
allocData.memoryType = allocData.memoryType =
isHostIpcAllocation ? InternalMemoryType::HOST_UNIFIED_MEMORY : InternalMemoryType::DEVICE_UNIFIED_MEMORY; isHostIpcAllocation ? InternalMemoryType::hostUnifiedMemory : InternalMemoryType::deviceUnifiedMemory;
allocData.device = neoDevice; allocData.device = neoDevice;
allocData.isImportedAllocation = true; allocData.isImportedAllocation = true;
allocData.setAllocId(this->getSvmAllocsManager()->allocationsCounter++); allocData.setAllocId(this->getSvmAllocsManager()->allocationsCounter++);
@ -863,8 +863,8 @@ ze_result_t DriverHandleImp::checkMemoryAccessFromDevice(Device *device, const v
return ZE_RESULT_ERROR_INVALID_ARGUMENT; return ZE_RESULT_ERROR_INVALID_ARGUMENT;
} }
if (allocation->memoryType == InternalMemoryType::HOST_UNIFIED_MEMORY || if (allocation->memoryType == InternalMemoryType::hostUnifiedMemory ||
allocation->memoryType == InternalMemoryType::SHARED_UNIFIED_MEMORY) allocation->memoryType == InternalMemoryType::sharedUnifiedMemory)
return ZE_RESULT_SUCCESS; return ZE_RESULT_SUCCESS;
if (allocation->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex()) != nullptr) { if (allocation->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex()) != nullptr) {

View File

@ -23,7 +23,7 @@ TEST_F(AUBHelloWorldL0, whenAppendMemoryCopyIsCalledThenMemoryIsProperlyCopied)
uint8_t size = 8; uint8_t size = 8;
uint8_t val = 255; uint8_t val = 255;
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory,
1, 1,
context->rootDeviceIndices, context->rootDeviceIndices,
context->deviceBitfields); context->deviceBitfields);

View File

@ -69,7 +69,7 @@ HWTEST_F(L0BindlessAub, DISABLED_GivenBindlessKernelWhenExecutedThenOutputIsCorr
NEO::debugManager.flags.UpdateCrossThreadDataSize.set(true); NEO::debugManager.flags.UpdateCrossThreadDataSize.set(true);
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory,
1, 1,
context->rootDeviceIndices, context->rootDeviceIndices,
context->deviceBitfields); context->deviceBitfields);

View File

@ -56,7 +56,7 @@ TEST_F(AUBAppendKernelIndirectL0, whenAppendKernelIndirectThenGlobalWorkSizeIsPr
groupSize[2] * groupCount[2]}; groupSize[2] * groupCount[2]};
uint8_t size = 3 * sizeof(uint32_t); uint8_t size = 3 * sizeof(uint32_t);
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory,
1, 1,
context->rootDeviceIndices, context->rootDeviceIndices,
context->deviceBitfields); context->deviceBitfields);
@ -101,7 +101,7 @@ TEST_F(AUBAppendKernelIndirectL0, whenAppendKernelIndirectThenGroupCountIsProper
const uint32_t groupCount[] = {4, 3, 1}; const uint32_t groupCount[] = {4, 3, 1};
uint8_t size = 3 * sizeof(uint32_t); uint8_t size = 3 * sizeof(uint32_t);
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory,
1, 1,
context->rootDeviceIndices, context->rootDeviceIndices,
context->deviceBitfields); context->deviceBitfields);
@ -147,7 +147,7 @@ TEST_F(AUBAppendKernelIndirectL0, whenAppendMultipleKernelsIndirectThenGroupCoun
const uint32_t groupCount2[] = {7, 6, 4}; const uint32_t groupCount2[] = {7, 6, 4};
uint8_t size = 3 * sizeof(uint32_t); uint8_t size = 3 * sizeof(uint32_t);
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory,
1, 1,
context->rootDeviceIndices, context->rootDeviceIndices,
context->deviceBitfields); context->deviceBitfields);
@ -206,7 +206,7 @@ TEST_F(AUBAppendKernelIndirectL0, whenAppendMultipleKernelsIndirectThenGroupCoun
} }
TEST_F(AUBAppendKernelIndirectL0, whenAppendKernelIndirectThenWorkDimIsProperlyProgrammed) { TEST_F(AUBAppendKernelIndirectL0, whenAppendKernelIndirectThenWorkDimIsProperlyProgrammed) {
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory,
1, 1,
context->rootDeviceIndices, context->rootDeviceIndices,
context->deviceBitfields); context->deviceBitfields);

View File

@ -98,7 +98,7 @@ HWTEST2_F(DebuggerSingleAddressSpaceAub, GivenSingleAddressSpaceWhenCmdListIsExe
NEO::debugManager.flags.UpdateCrossThreadDataSize.set(true); NEO::debugManager.flags.UpdateCrossThreadDataSize.set(true);
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory,
1, 1,
context->rootDeviceIndices, context->rootDeviceIndices,
context->deviceBitfields); context->deviceBitfields);

View File

@ -302,7 +302,7 @@ ze_result_t ContextGetIpcHandleMock::getIpcMemHandle(const void *ptr, ze_ipc_mem
ipcData.handle = handle; ipcData.handle = handle;
auto type = Context::parseUSMType(allocData->memoryType); auto type = Context::parseUSMType(allocData->memoryType);
if (type == ZE_MEMORY_TYPE_HOST) { if (type == ZE_MEMORY_TYPE_HOST) {
ipcData.type = static_cast<uint8_t>(InternalIpcMemoryType::IPC_HOST_UNIFIED_MEMORY); ipcData.type = static_cast<uint8_t>(InternalIpcMemoryType::hostUnifiedMemory);
} }
return ZE_RESULT_SUCCESS; return ZE_RESULT_SUCCESS;
@ -393,7 +393,7 @@ ze_result_t ContextIpcMock::getIpcMemHandle(const void *ptr, ze_ipc_mem_handle_t
ipcData.handle = handle; ipcData.handle = handle;
auto type = Context::parseUSMType(allocData->memoryType); auto type = Context::parseUSMType(allocData->memoryType);
if (type == ZE_MEMORY_TYPE_HOST) { if (type == ZE_MEMORY_TYPE_HOST) {
ipcData.type = static_cast<uint8_t>(InternalIpcMemoryType::IPC_HOST_UNIFIED_MEMORY); ipcData.type = static_cast<uint8_t>(InternalIpcMemoryType::hostUnifiedMemory);
} }
return ZE_RESULT_SUCCESS; return ZE_RESULT_SUCCESS;

View File

@ -45,7 +45,7 @@ ze_result_t Mock<DriverHandle>::getDevice(uint32_t *pCount, ze_device_handle_t *
ze_result_t Mock<DriverHandle>::allocDeviceMem(ze_device_handle_t hDevice, const ze_device_mem_alloc_desc_t *deviceDesc, ze_result_t Mock<DriverHandle>::allocDeviceMem(ze_device_handle_t hDevice, const ze_device_mem_alloc_desc_t *deviceDesc,
size_t size, size_t alignment, void **ptr) { size_t size, size_t alignment, void **ptr) {
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, alignment, rootDeviceIndices, deviceBitfields); NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, alignment, rootDeviceIndices, deviceBitfields);
auto allocation = svmAllocsManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties); auto allocation = svmAllocsManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties);

View File

@ -470,146 +470,146 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListWhenGetTransferTy
const auto hostUSM2Found = device->getDriverHandle()->findAllocationDataForRange(hostPtr2, 1024, notSpecifiedAllocData); const auto hostUSM2Found = device->getDriverHandle()->findAllocationDataForRange(hostPtr2, 1024, notSpecifiedAllocData);
EXPECT_TRUE(hostUSM2Found); EXPECT_TRUE(hostUSM2Found);
notSpecifiedAllocData->memoryType = InternalMemoryType::NOT_SPECIFIED; notSpecifiedAllocData->memoryType = InternalMemoryType::notSpecified;
CpuMemCopyInfo copyInfoHostNonUsmToNotSpecified(hostPtr2, nonUsmHostPtr, 1024); CpuMemCopyInfo copyInfoHostNonUsmToNotSpecified(hostPtr2, nonUsmHostPtr, 1024);
copyInfoHostNonUsmToNotSpecified.dstAllocData = notSpecifiedAllocData; copyInfoHostNonUsmToNotSpecified.dstAllocData = notSpecifiedAllocData;
copyInfoHostNonUsmToNotSpecified.srcAllocData = hostNonUSMAllocData; copyInfoHostNonUsmToNotSpecified.srcAllocData = hostNonUSMAllocData;
EXPECT_EQ(TRANSFER_TYPE_UNKNOWN, cmdList.getTransferType(copyInfoHostNonUsmToNotSpecified)); EXPECT_EQ(TransferType::unknown, cmdList.getTransferType(copyInfoHostNonUsmToNotSpecified));
CpuMemCopyInfo copyInfoHostNonUsmToHostUsm(hostPtr, nonUsmHostPtr, 1024); CpuMemCopyInfo copyInfoHostNonUsmToHostUsm(hostPtr, nonUsmHostPtr, 1024);
copyInfoHostNonUsmToHostUsm.dstAllocData = hostUSMAllocData; copyInfoHostNonUsmToHostUsm.dstAllocData = hostUSMAllocData;
copyInfoHostNonUsmToHostUsm.srcAllocData = hostNonUSMAllocData; copyInfoHostNonUsmToHostUsm.srcAllocData = hostNonUSMAllocData;
EXPECT_EQ(HOST_NON_USM_TO_HOST_USM, cmdList.getTransferType(copyInfoHostNonUsmToHostUsm)); EXPECT_EQ(TransferType::hostNonUsmToHostUsm, cmdList.getTransferType(copyInfoHostNonUsmToHostUsm));
CpuMemCopyInfo copyInfoHostNonUsmToDeviceUsm(devicePtr, nonUsmHostPtr, 1024); CpuMemCopyInfo copyInfoHostNonUsmToDeviceUsm(devicePtr, nonUsmHostPtr, 1024);
copyInfoHostNonUsmToDeviceUsm.dstAllocData = deviceUSMAllocData; copyInfoHostNonUsmToDeviceUsm.dstAllocData = deviceUSMAllocData;
copyInfoHostNonUsmToDeviceUsm.srcAllocData = hostNonUSMAllocData; copyInfoHostNonUsmToDeviceUsm.srcAllocData = hostNonUSMAllocData;
EXPECT_EQ(HOST_NON_USM_TO_DEVICE_USM, cmdList.getTransferType(copyInfoHostNonUsmToDeviceUsm)); EXPECT_EQ(TransferType::hostNonUsmToDeviceUsm, cmdList.getTransferType(copyInfoHostNonUsmToDeviceUsm));
CpuMemCopyInfo copyInfoHostNonUsmToSharedUsm(sharedPtr, nonUsmHostPtr, 1024); CpuMemCopyInfo copyInfoHostNonUsmToSharedUsm(sharedPtr, nonUsmHostPtr, 1024);
copyInfoHostNonUsmToSharedUsm.dstAllocData = sharedUSMAllocData; copyInfoHostNonUsmToSharedUsm.dstAllocData = sharedUSMAllocData;
copyInfoHostNonUsmToSharedUsm.srcAllocData = hostNonUSMAllocData; copyInfoHostNonUsmToSharedUsm.srcAllocData = hostNonUSMAllocData;
EXPECT_EQ(HOST_NON_USM_TO_SHARED_USM, cmdList.getTransferType(copyInfoHostNonUsmToSharedUsm)); EXPECT_EQ(TransferType::hostNonUsmToSharedUsm, cmdList.getTransferType(copyInfoHostNonUsmToSharedUsm));
CpuMemCopyInfo copyInfoHostNonUsmToHostNonUsm(nonUsmHostPtr, nonUsmHostPtr, 1024); CpuMemCopyInfo copyInfoHostNonUsmToHostNonUsm(nonUsmHostPtr, nonUsmHostPtr, 1024);
copyInfoHostNonUsmToHostNonUsm.dstAllocData = hostNonUSMAllocData; copyInfoHostNonUsmToHostNonUsm.dstAllocData = hostNonUSMAllocData;
copyInfoHostNonUsmToHostNonUsm.srcAllocData = hostNonUSMAllocData; copyInfoHostNonUsmToHostNonUsm.srcAllocData = hostNonUSMAllocData;
EXPECT_EQ(HOST_NON_USM_TO_HOST_NON_USM, cmdList.getTransferType(copyInfoHostNonUsmToHostNonUsm)); EXPECT_EQ(TransferType::hostNonUsmToHostNonUsm, cmdList.getTransferType(copyInfoHostNonUsmToHostNonUsm));
CpuMemCopyInfo copyInfoHostNonUsmToHostImported(importedPtr, nonUsmHostPtr, 1024); CpuMemCopyInfo copyInfoHostNonUsmToHostImported(importedPtr, nonUsmHostPtr, 1024);
copyInfoHostNonUsmToHostImported.dstIsImportedHostPtr = true; copyInfoHostNonUsmToHostImported.dstIsImportedHostPtr = true;
copyInfoHostNonUsmToHostImported.dstAllocData = nullptr; copyInfoHostNonUsmToHostImported.dstAllocData = nullptr;
copyInfoHostNonUsmToHostImported.srcAllocData = hostNonUSMAllocData; copyInfoHostNonUsmToHostImported.srcAllocData = hostNonUSMAllocData;
EXPECT_EQ(HOST_NON_USM_TO_HOST_USM, cmdList.getTransferType(copyInfoHostNonUsmToHostImported)); EXPECT_EQ(TransferType::hostNonUsmToHostUsm, cmdList.getTransferType(copyInfoHostNonUsmToHostImported));
CpuMemCopyInfo copyInfoHostImportedToHostUsm(hostPtr, importedPtr, 1024); CpuMemCopyInfo copyInfoHostImportedToHostUsm(hostPtr, importedPtr, 1024);
copyInfoHostImportedToHostUsm.dstAllocData = hostUSMAllocData; copyInfoHostImportedToHostUsm.dstAllocData = hostUSMAllocData;
copyInfoHostImportedToHostUsm.srcIsImportedHostPtr = true; copyInfoHostImportedToHostUsm.srcIsImportedHostPtr = true;
copyInfoHostImportedToHostUsm.srcAllocData = nullptr; copyInfoHostImportedToHostUsm.srcAllocData = nullptr;
EXPECT_EQ(HOST_USM_TO_HOST_USM, cmdList.getTransferType(copyInfoHostImportedToHostUsm)); EXPECT_EQ(TransferType::hostUsmToHostUsm, cmdList.getTransferType(copyInfoHostImportedToHostUsm));
CpuMemCopyInfo copyInfoHostImportedToDeviceUsm(devicePtr, importedPtr, 1024); CpuMemCopyInfo copyInfoHostImportedToDeviceUsm(devicePtr, importedPtr, 1024);
copyInfoHostImportedToDeviceUsm.dstAllocData = deviceUSMAllocData; copyInfoHostImportedToDeviceUsm.dstAllocData = deviceUSMAllocData;
copyInfoHostImportedToDeviceUsm.srcIsImportedHostPtr = true; copyInfoHostImportedToDeviceUsm.srcIsImportedHostPtr = true;
copyInfoHostImportedToDeviceUsm.srcAllocData = nullptr; copyInfoHostImportedToDeviceUsm.srcAllocData = nullptr;
EXPECT_EQ(HOST_USM_TO_DEVICE_USM, cmdList.getTransferType(copyInfoHostImportedToDeviceUsm)); EXPECT_EQ(TransferType::hostUsmToDeviceUsm, cmdList.getTransferType(copyInfoHostImportedToDeviceUsm));
CpuMemCopyInfo copyInfoHostImportedToSharedUsm(sharedPtr, importedPtr, 1024); CpuMemCopyInfo copyInfoHostImportedToSharedUsm(sharedPtr, importedPtr, 1024);
copyInfoHostImportedToSharedUsm.dstAllocData = sharedUSMAllocData; copyInfoHostImportedToSharedUsm.dstAllocData = sharedUSMAllocData;
copyInfoHostImportedToSharedUsm.srcIsImportedHostPtr = true; copyInfoHostImportedToSharedUsm.srcIsImportedHostPtr = true;
copyInfoHostImportedToSharedUsm.srcAllocData = nullptr; copyInfoHostImportedToSharedUsm.srcAllocData = nullptr;
EXPECT_EQ(HOST_USM_TO_SHARED_USM, cmdList.getTransferType(copyInfoHostImportedToSharedUsm)); EXPECT_EQ(TransferType::hostUsmToSharedUsm, cmdList.getTransferType(copyInfoHostImportedToSharedUsm));
CpuMemCopyInfo copyInfoHostImportedToHostNonUsm(nonUsmHostPtr, importedPtr, 1024); CpuMemCopyInfo copyInfoHostImportedToHostNonUsm(nonUsmHostPtr, importedPtr, 1024);
copyInfoHostImportedToHostNonUsm.dstAllocData = hostNonUSMAllocData; copyInfoHostImportedToHostNonUsm.dstAllocData = hostNonUSMAllocData;
copyInfoHostImportedToHostNonUsm.srcIsImportedHostPtr = true; copyInfoHostImportedToHostNonUsm.srcIsImportedHostPtr = true;
copyInfoHostImportedToHostNonUsm.srcAllocData = nullptr; copyInfoHostImportedToHostNonUsm.srcAllocData = nullptr;
EXPECT_EQ(HOST_USM_TO_HOST_NON_USM, cmdList.getTransferType(copyInfoHostImportedToHostNonUsm)); EXPECT_EQ(TransferType::hostUsmToHostNonUsm, cmdList.getTransferType(copyInfoHostImportedToHostNonUsm));
CpuMemCopyInfo copyInfoHostImportedToHostImported(importedPtr, importedPtr, 1024); CpuMemCopyInfo copyInfoHostImportedToHostImported(importedPtr, importedPtr, 1024);
copyInfoHostImportedToHostImported.dstIsImportedHostPtr = true; copyInfoHostImportedToHostImported.dstIsImportedHostPtr = true;
copyInfoHostImportedToHostImported.dstAllocData = nullptr; copyInfoHostImportedToHostImported.dstAllocData = nullptr;
copyInfoHostImportedToHostImported.srcIsImportedHostPtr = true; copyInfoHostImportedToHostImported.srcIsImportedHostPtr = true;
copyInfoHostImportedToHostImported.srcAllocData = nullptr; copyInfoHostImportedToHostImported.srcAllocData = nullptr;
EXPECT_EQ(HOST_USM_TO_HOST_USM, cmdList.getTransferType(copyInfoHostImportedToHostImported)); EXPECT_EQ(TransferType::hostUsmToHostUsm, cmdList.getTransferType(copyInfoHostImportedToHostImported));
CpuMemCopyInfo copyInfoHostUsmToHostUsm(hostPtr, hostPtr, 1024); CpuMemCopyInfo copyInfoHostUsmToHostUsm(hostPtr, hostPtr, 1024);
copyInfoHostUsmToHostUsm.dstAllocData = hostUSMAllocData; copyInfoHostUsmToHostUsm.dstAllocData = hostUSMAllocData;
copyInfoHostUsmToHostUsm.srcAllocData = hostUSMAllocData; copyInfoHostUsmToHostUsm.srcAllocData = hostUSMAllocData;
EXPECT_EQ(HOST_USM_TO_HOST_USM, cmdList.getTransferType(copyInfoHostUsmToHostUsm)); EXPECT_EQ(TransferType::hostUsmToHostUsm, cmdList.getTransferType(copyInfoHostUsmToHostUsm));
CpuMemCopyInfo copyInfoHostUsmToDeviceUsm(devicePtr, hostPtr, 1024); CpuMemCopyInfo copyInfoHostUsmToDeviceUsm(devicePtr, hostPtr, 1024);
copyInfoHostUsmToDeviceUsm.dstAllocData = deviceUSMAllocData; copyInfoHostUsmToDeviceUsm.dstAllocData = deviceUSMAllocData;
copyInfoHostUsmToDeviceUsm.srcAllocData = hostUSMAllocData; copyInfoHostUsmToDeviceUsm.srcAllocData = hostUSMAllocData;
EXPECT_EQ(HOST_USM_TO_DEVICE_USM, cmdList.getTransferType(copyInfoHostUsmToDeviceUsm)); EXPECT_EQ(TransferType::hostUsmToDeviceUsm, cmdList.getTransferType(copyInfoHostUsmToDeviceUsm));
CpuMemCopyInfo copyInfoHostUsmToSharedUsm(sharedPtr, hostPtr, 1024); CpuMemCopyInfo copyInfoHostUsmToSharedUsm(sharedPtr, hostPtr, 1024);
copyInfoHostUsmToSharedUsm.dstAllocData = sharedUSMAllocData; copyInfoHostUsmToSharedUsm.dstAllocData = sharedUSMAllocData;
copyInfoHostUsmToSharedUsm.srcAllocData = hostUSMAllocData; copyInfoHostUsmToSharedUsm.srcAllocData = hostUSMAllocData;
EXPECT_EQ(HOST_USM_TO_SHARED_USM, cmdList.getTransferType(copyInfoHostUsmToSharedUsm)); EXPECT_EQ(TransferType::hostUsmToSharedUsm, cmdList.getTransferType(copyInfoHostUsmToSharedUsm));
CpuMemCopyInfo copyInfoHostUsmToHostNonUsm(nonUsmHostPtr, hostPtr, 1024); CpuMemCopyInfo copyInfoHostUsmToHostNonUsm(nonUsmHostPtr, hostPtr, 1024);
copyInfoHostUsmToHostNonUsm.dstAllocData = hostNonUSMAllocData; copyInfoHostUsmToHostNonUsm.dstAllocData = hostNonUSMAllocData;
copyInfoHostUsmToHostNonUsm.srcAllocData = hostUSMAllocData; copyInfoHostUsmToHostNonUsm.srcAllocData = hostUSMAllocData;
EXPECT_EQ(HOST_USM_TO_HOST_NON_USM, cmdList.getTransferType(copyInfoHostUsmToHostNonUsm)); EXPECT_EQ(TransferType::hostUsmToHostNonUsm, cmdList.getTransferType(copyInfoHostUsmToHostNonUsm));
CpuMemCopyInfo copyInfoHostUsmToHostImported(importedPtr, hostPtr, 1024); CpuMemCopyInfo copyInfoHostUsmToHostImported(importedPtr, hostPtr, 1024);
copyInfoHostUsmToHostImported.dstIsImportedHostPtr = true; copyInfoHostUsmToHostImported.dstIsImportedHostPtr = true;
copyInfoHostUsmToHostImported.dstAllocData = nullptr; copyInfoHostUsmToHostImported.dstAllocData = nullptr;
copyInfoHostUsmToHostImported.srcAllocData = hostUSMAllocData; copyInfoHostUsmToHostImported.srcAllocData = hostUSMAllocData;
EXPECT_EQ(HOST_USM_TO_HOST_USM, cmdList.getTransferType(copyInfoHostUsmToHostImported)); EXPECT_EQ(TransferType::hostUsmToHostUsm, cmdList.getTransferType(copyInfoHostUsmToHostImported));
CpuMemCopyInfo copyInfoDeviceUsmToHostUsm(hostPtr, devicePtr, 1024); CpuMemCopyInfo copyInfoDeviceUsmToHostUsm(hostPtr, devicePtr, 1024);
copyInfoDeviceUsmToHostUsm.dstAllocData = hostUSMAllocData; copyInfoDeviceUsmToHostUsm.dstAllocData = hostUSMAllocData;
copyInfoDeviceUsmToHostUsm.srcAllocData = deviceUSMAllocData; copyInfoDeviceUsmToHostUsm.srcAllocData = deviceUSMAllocData;
EXPECT_EQ(DEVICE_USM_TO_HOST_USM, cmdList.getTransferType(copyInfoDeviceUsmToHostUsm)); EXPECT_EQ(TransferType::deviceUsmToHostUsm, cmdList.getTransferType(copyInfoDeviceUsmToHostUsm));
CpuMemCopyInfo copyInfoDeviceUsmToDeviceUsm(devicePtr, devicePtr, 1024); CpuMemCopyInfo copyInfoDeviceUsmToDeviceUsm(devicePtr, devicePtr, 1024);
copyInfoDeviceUsmToDeviceUsm.dstAllocData = deviceUSMAllocData; copyInfoDeviceUsmToDeviceUsm.dstAllocData = deviceUSMAllocData;
copyInfoDeviceUsmToDeviceUsm.srcAllocData = deviceUSMAllocData; copyInfoDeviceUsmToDeviceUsm.srcAllocData = deviceUSMAllocData;
EXPECT_EQ(DEVICE_USM_TO_DEVICE_USM, cmdList.getTransferType(copyInfoDeviceUsmToDeviceUsm)); EXPECT_EQ(TransferType::deviceUsmToDeviceUsm, cmdList.getTransferType(copyInfoDeviceUsmToDeviceUsm));
CpuMemCopyInfo copyInfoDeviceUsmToSharedUsm(sharedPtr, devicePtr, 1024); CpuMemCopyInfo copyInfoDeviceUsmToSharedUsm(sharedPtr, devicePtr, 1024);
copyInfoDeviceUsmToSharedUsm.dstAllocData = sharedUSMAllocData; copyInfoDeviceUsmToSharedUsm.dstAllocData = sharedUSMAllocData;
copyInfoDeviceUsmToSharedUsm.srcAllocData = deviceUSMAllocData; copyInfoDeviceUsmToSharedUsm.srcAllocData = deviceUSMAllocData;
EXPECT_EQ(DEVICE_USM_TO_SHARED_USM, cmdList.getTransferType(copyInfoDeviceUsmToSharedUsm)); EXPECT_EQ(TransferType::deviceUsmToSharedUsm, cmdList.getTransferType(copyInfoDeviceUsmToSharedUsm));
CpuMemCopyInfo copyInfoDeviceUsmToHostNonUsm(nonUsmHostPtr, devicePtr, 1024); CpuMemCopyInfo copyInfoDeviceUsmToHostNonUsm(nonUsmHostPtr, devicePtr, 1024);
copyInfoDeviceUsmToHostNonUsm.dstAllocData = hostNonUSMAllocData; copyInfoDeviceUsmToHostNonUsm.dstAllocData = hostNonUSMAllocData;
copyInfoDeviceUsmToHostNonUsm.srcAllocData = deviceUSMAllocData; copyInfoDeviceUsmToHostNonUsm.srcAllocData = deviceUSMAllocData;
EXPECT_EQ(DEVICE_USM_TO_HOST_NON_USM, cmdList.getTransferType(copyInfoDeviceUsmToHostNonUsm)); EXPECT_EQ(TransferType::deviceUsmToHostNonUsm, cmdList.getTransferType(copyInfoDeviceUsmToHostNonUsm));
CpuMemCopyInfo copyInfoDeviceUsmToHostImported(importedPtr, devicePtr, 1024); CpuMemCopyInfo copyInfoDeviceUsmToHostImported(importedPtr, devicePtr, 1024);
copyInfoDeviceUsmToHostImported.dstIsImportedHostPtr = true; copyInfoDeviceUsmToHostImported.dstIsImportedHostPtr = true;
copyInfoDeviceUsmToHostImported.dstAllocData = nullptr; copyInfoDeviceUsmToHostImported.dstAllocData = nullptr;
copyInfoDeviceUsmToHostImported.srcAllocData = deviceUSMAllocData; copyInfoDeviceUsmToHostImported.srcAllocData = deviceUSMAllocData;
EXPECT_EQ(DEVICE_USM_TO_HOST_USM, cmdList.getTransferType(copyInfoDeviceUsmToHostImported)); EXPECT_EQ(TransferType::deviceUsmToHostUsm, cmdList.getTransferType(copyInfoDeviceUsmToHostImported));
CpuMemCopyInfo copyInfoSharedUsmToHostUsm(hostPtr, sharedPtr, 1024); CpuMemCopyInfo copyInfoSharedUsmToHostUsm(hostPtr, sharedPtr, 1024);
copyInfoSharedUsmToHostUsm.dstAllocData = hostUSMAllocData; copyInfoSharedUsmToHostUsm.dstAllocData = hostUSMAllocData;
copyInfoSharedUsmToHostUsm.srcAllocData = sharedUSMAllocData; copyInfoSharedUsmToHostUsm.srcAllocData = sharedUSMAllocData;
EXPECT_EQ(SHARED_USM_TO_HOST_USM, cmdList.getTransferType(copyInfoSharedUsmToHostUsm)); EXPECT_EQ(TransferType::sharedUsmToHostUsm, cmdList.getTransferType(copyInfoSharedUsmToHostUsm));
CpuMemCopyInfo copyInfoSharedUsmToDeviceUsm(devicePtr, sharedPtr, 1024); CpuMemCopyInfo copyInfoSharedUsmToDeviceUsm(devicePtr, sharedPtr, 1024);
copyInfoSharedUsmToDeviceUsm.dstAllocData = deviceUSMAllocData; copyInfoSharedUsmToDeviceUsm.dstAllocData = deviceUSMAllocData;
copyInfoSharedUsmToDeviceUsm.srcAllocData = sharedUSMAllocData; copyInfoSharedUsmToDeviceUsm.srcAllocData = sharedUSMAllocData;
EXPECT_EQ(SHARED_USM_TO_DEVICE_USM, cmdList.getTransferType(copyInfoSharedUsmToDeviceUsm)); EXPECT_EQ(TransferType::sharedUsmToDeviceUsm, cmdList.getTransferType(copyInfoSharedUsmToDeviceUsm));
CpuMemCopyInfo copyInfoSharedUsmToSharedUsm(sharedPtr, sharedPtr, 1024); CpuMemCopyInfo copyInfoSharedUsmToSharedUsm(sharedPtr, sharedPtr, 1024);
copyInfoSharedUsmToSharedUsm.dstAllocData = sharedUSMAllocData; copyInfoSharedUsmToSharedUsm.dstAllocData = sharedUSMAllocData;
copyInfoSharedUsmToSharedUsm.srcAllocData = sharedUSMAllocData; copyInfoSharedUsmToSharedUsm.srcAllocData = sharedUSMAllocData;
EXPECT_EQ(SHARED_USM_TO_SHARED_USM, cmdList.getTransferType(copyInfoSharedUsmToSharedUsm)); EXPECT_EQ(TransferType::sharedUsmToSharedUsm, cmdList.getTransferType(copyInfoSharedUsmToSharedUsm));
CpuMemCopyInfo copyInfoSharedUsmToHostNonUsm(nonUsmHostPtr, sharedPtr, 1024); CpuMemCopyInfo copyInfoSharedUsmToHostNonUsm(nonUsmHostPtr, sharedPtr, 1024);
copyInfoSharedUsmToHostNonUsm.dstAllocData = hostNonUSMAllocData; copyInfoSharedUsmToHostNonUsm.dstAllocData = hostNonUSMAllocData;
copyInfoSharedUsmToHostNonUsm.srcAllocData = sharedUSMAllocData; copyInfoSharedUsmToHostNonUsm.srcAllocData = sharedUSMAllocData;
EXPECT_EQ(SHARED_USM_TO_HOST_NON_USM, cmdList.getTransferType(copyInfoSharedUsmToHostNonUsm)); EXPECT_EQ(TransferType::sharedUsmToHostNonUsm, cmdList.getTransferType(copyInfoSharedUsmToHostNonUsm));
CpuMemCopyInfo copyInfoSharedUsmToHostImported(importedPtr, sharedPtr, 1024); CpuMemCopyInfo copyInfoSharedUsmToHostImported(importedPtr, sharedPtr, 1024);
copyInfoSharedUsmToHostImported.dstIsImportedHostPtr = true; copyInfoSharedUsmToHostImported.dstIsImportedHostPtr = true;
copyInfoSharedUsmToHostImported.dstAllocData = nullptr; copyInfoSharedUsmToHostImported.dstAllocData = nullptr;
copyInfoSharedUsmToHostImported.srcAllocData = sharedUSMAllocData; copyInfoSharedUsmToHostImported.srcAllocData = sharedUSMAllocData;
EXPECT_EQ(SHARED_USM_TO_HOST_USM, cmdList.getTransferType(copyInfoSharedUsmToHostImported)); EXPECT_EQ(TransferType::sharedUsmToHostUsm, cmdList.getTransferType(copyInfoSharedUsmToHostImported));
EXPECT_EQ(ZE_RESULT_SUCCESS, device->getDriverHandle()->releaseImportedPointer(importedPtr)); EXPECT_EQ(ZE_RESULT_SUCCESS, device->getDriverHandle()->releaseImportedPointer(importedPtr));
free(importedPtr); free(importedPtr);
@ -620,41 +620,41 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListWhenGetTransferTh
MockCommandListImmediateHw<gfxCoreFamily> cmdList; MockCommandListImmediateHw<gfxCoreFamily> cmdList;
cmdList.copyThroughLockedPtrEnabled = true; cmdList.copyThroughLockedPtrEnabled = true;
cmdList.initialize(device, NEO::EngineGroupType::renderCompute, 0u); cmdList.initialize(device, NEO::EngineGroupType::renderCompute, 0u);
EXPECT_EQ(0u, cmdList.getTransferThreshold(TRANSFER_TYPE_UNKNOWN)); EXPECT_EQ(0u, cmdList.getTransferThreshold(TransferType::unknown));
EXPECT_EQ(1 * MemoryConstants::megaByte, cmdList.getTransferThreshold(HOST_NON_USM_TO_HOST_USM)); EXPECT_EQ(1 * MemoryConstants::megaByte, cmdList.getTransferThreshold(TransferType::hostNonUsmToHostUsm));
EXPECT_EQ(4 * MemoryConstants::megaByte, cmdList.getTransferThreshold(HOST_NON_USM_TO_DEVICE_USM)); EXPECT_EQ(4 * MemoryConstants::megaByte, cmdList.getTransferThreshold(TransferType::hostNonUsmToDeviceUsm));
EXPECT_EQ(0u, cmdList.getTransferThreshold(HOST_NON_USM_TO_SHARED_USM)); EXPECT_EQ(0u, cmdList.getTransferThreshold(TransferType::hostNonUsmToSharedUsm));
EXPECT_EQ(1 * MemoryConstants::megaByte, cmdList.getTransferThreshold(HOST_NON_USM_TO_HOST_NON_USM)); EXPECT_EQ(1 * MemoryConstants::megaByte, cmdList.getTransferThreshold(TransferType::hostNonUsmToHostNonUsm));
EXPECT_EQ(200 * MemoryConstants::kiloByte, cmdList.getTransferThreshold(HOST_USM_TO_HOST_USM)); EXPECT_EQ(200 * MemoryConstants::kiloByte, cmdList.getTransferThreshold(TransferType::hostUsmToHostUsm));
EXPECT_EQ(50 * MemoryConstants::kiloByte, cmdList.getTransferThreshold(HOST_USM_TO_DEVICE_USM)); EXPECT_EQ(50 * MemoryConstants::kiloByte, cmdList.getTransferThreshold(TransferType::hostUsmToDeviceUsm));
EXPECT_EQ(0u, cmdList.getTransferThreshold(HOST_USM_TO_SHARED_USM)); EXPECT_EQ(0u, cmdList.getTransferThreshold(TransferType::hostUsmToSharedUsm));
EXPECT_EQ(500 * MemoryConstants::kiloByte, cmdList.getTransferThreshold(HOST_USM_TO_HOST_NON_USM)); EXPECT_EQ(500 * MemoryConstants::kiloByte, cmdList.getTransferThreshold(TransferType::hostUsmToHostNonUsm));
EXPECT_EQ(128u, cmdList.getTransferThreshold(DEVICE_USM_TO_HOST_USM)); EXPECT_EQ(128u, cmdList.getTransferThreshold(TransferType::deviceUsmToHostUsm));
EXPECT_EQ(0u, cmdList.getTransferThreshold(DEVICE_USM_TO_DEVICE_USM)); EXPECT_EQ(0u, cmdList.getTransferThreshold(TransferType::deviceUsmToDeviceUsm));
EXPECT_EQ(0u, cmdList.getTransferThreshold(DEVICE_USM_TO_SHARED_USM)); EXPECT_EQ(0u, cmdList.getTransferThreshold(TransferType::deviceUsmToSharedUsm));
EXPECT_EQ(1 * MemoryConstants::kiloByte, cmdList.getTransferThreshold(DEVICE_USM_TO_HOST_NON_USM)); EXPECT_EQ(1 * MemoryConstants::kiloByte, cmdList.getTransferThreshold(TransferType::deviceUsmToHostNonUsm));
EXPECT_EQ(0u, cmdList.getTransferThreshold(SHARED_USM_TO_HOST_USM)); EXPECT_EQ(0u, cmdList.getTransferThreshold(TransferType::sharedUsmToHostUsm));
EXPECT_EQ(0u, cmdList.getTransferThreshold(SHARED_USM_TO_DEVICE_USM)); EXPECT_EQ(0u, cmdList.getTransferThreshold(TransferType::sharedUsmToDeviceUsm));
EXPECT_EQ(0u, cmdList.getTransferThreshold(SHARED_USM_TO_SHARED_USM)); EXPECT_EQ(0u, cmdList.getTransferThreshold(TransferType::sharedUsmToSharedUsm));
EXPECT_EQ(0u, cmdList.getTransferThreshold(SHARED_USM_TO_HOST_NON_USM)); EXPECT_EQ(0u, cmdList.getTransferThreshold(TransferType::sharedUsmToHostNonUsm));
} }
HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndThresholdDebugFlagSetWhenGetTransferThresholdThenReturnCorrectValue, IsAtLeastSkl) { HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndThresholdDebugFlagSetWhenGetTransferThresholdThenReturnCorrectValue, IsAtLeastSkl) {
MockCommandListImmediateHw<gfxCoreFamily> cmdList; MockCommandListImmediateHw<gfxCoreFamily> cmdList;
cmdList.copyThroughLockedPtrEnabled = true; cmdList.copyThroughLockedPtrEnabled = true;
cmdList.initialize(device, NEO::EngineGroupType::renderCompute, 0u); cmdList.initialize(device, NEO::EngineGroupType::renderCompute, 0u);
EXPECT_EQ(4 * MemoryConstants::megaByte, cmdList.getTransferThreshold(HOST_NON_USM_TO_DEVICE_USM)); EXPECT_EQ(4 * MemoryConstants::megaByte, cmdList.getTransferThreshold(TransferType::hostNonUsmToDeviceUsm));
EXPECT_EQ(1 * MemoryConstants::kiloByte, cmdList.getTransferThreshold(DEVICE_USM_TO_HOST_NON_USM)); EXPECT_EQ(1 * MemoryConstants::kiloByte, cmdList.getTransferThreshold(TransferType::deviceUsmToHostNonUsm));
debugManager.flags.ExperimentalH2DCpuCopyThreshold.set(5 * MemoryConstants::megaByte); debugManager.flags.ExperimentalH2DCpuCopyThreshold.set(5 * MemoryConstants::megaByte);
EXPECT_EQ(5 * MemoryConstants::megaByte, cmdList.getTransferThreshold(HOST_NON_USM_TO_DEVICE_USM)); EXPECT_EQ(5 * MemoryConstants::megaByte, cmdList.getTransferThreshold(TransferType::hostNonUsmToDeviceUsm));
debugManager.flags.ExperimentalD2HCpuCopyThreshold.set(6 * MemoryConstants::megaByte); debugManager.flags.ExperimentalD2HCpuCopyThreshold.set(6 * MemoryConstants::megaByte);
EXPECT_EQ(6 * MemoryConstants::megaByte, cmdList.getTransferThreshold(DEVICE_USM_TO_HOST_NON_USM)); EXPECT_EQ(6 * MemoryConstants::megaByte, cmdList.getTransferThreshold(TransferType::deviceUsmToHostNonUsm));
} }
HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndNonUsmHostPtrWhenCopyH2DThenLockPtr, IsAtLeastSkl) { HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndNonUsmHostPtrWhenCopyH2DThenLockPtr, IsAtLeastSkl) {

View File

@ -963,7 +963,7 @@ HWTEST_F(ContextMakeMemoryResidentAndMigrationTests,
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, mockDeviceBitfield}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, mockDeviceBitfield}};
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto sharedPtr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, device); auto sharedPtr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, device);
EXPECT_NE(nullptr, sharedPtr); EXPECT_NE(nullptr, sharedPtr);

View File

@ -93,7 +93,7 @@ TEST_F(HostPointerManagerTest, givenPointerRegisteredWhenSvmAllocationExistsThen
allocData.gpuAllocations.addAllocation(usmAllocation); allocData.gpuAllocations.addAllocation(usmAllocation);
allocData.cpuAllocation = nullptr; allocData.cpuAllocation = nullptr;
allocData.size = usmSize; allocData.size = usmSize;
allocData.memoryType = InternalMemoryType::NOT_SPECIFIED; allocData.memoryType = InternalMemoryType::notSpecified;
allocData.device = nullptr; allocData.device = nullptr;
hostDriverHandle->getSvmAllocsManager()->insertSVMAlloc(allocData); hostDriverHandle->getSvmAllocsManager()->insertSVMAlloc(allocData);
@ -123,7 +123,7 @@ TEST_F(HostPointerManagerTest, givenSvmAllocationExistsWhenGettingExistingAlloca
allocData.gpuAllocations.addAllocation(usmAllocation); allocData.gpuAllocations.addAllocation(usmAllocation);
allocData.cpuAllocation = nullptr; allocData.cpuAllocation = nullptr;
allocData.size = usmSize; allocData.size = usmSize;
allocData.memoryType = InternalMemoryType::NOT_SPECIFIED; allocData.memoryType = InternalMemoryType::notSpecified;
allocData.device = nullptr; allocData.device = nullptr;
hostDriverHandle->getSvmAllocsManager()->insertSVMAlloc(allocData); hostDriverHandle->getSvmAllocsManager()->insertSVMAlloc(allocData);

View File

@ -231,7 +231,7 @@ HWTEST_F(ImportNTHandle, givenCallToImportNTHandleWithHostBufferMemoryAllocation
auto allocData = driverHandle->svmAllocsManager->getSVMAlloc(ptr); auto allocData = driverHandle->svmAllocsManager->getSVMAlloc(ptr);
EXPECT_NE(allocData, nullptr); EXPECT_NE(allocData, nullptr);
EXPECT_EQ(allocData->memoryType, InternalMemoryType::HOST_UNIFIED_MEMORY); EXPECT_EQ(allocData->memoryType, InternalMemoryType::hostUnifiedMemory);
ze_result_t result = context->freeMem(ptr); ze_result_t result = context->freeMem(ptr);
EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_EQ(result, ZE_RESULT_SUCCESS);
@ -250,7 +250,7 @@ HWTEST_F(ImportNTHandle, givenCallToImportNTHandleWithBufferMemoryAllocationType
auto allocData = driverHandle->svmAllocsManager->getSVMAlloc(ptr); auto allocData = driverHandle->svmAllocsManager->getSVMAlloc(ptr);
EXPECT_NE(allocData, nullptr); EXPECT_NE(allocData, nullptr);
EXPECT_EQ(allocData->memoryType, InternalMemoryType::DEVICE_UNIFIED_MEMORY); EXPECT_EQ(allocData->memoryType, InternalMemoryType::deviceUnifiedMemory);
ze_result_t result = context->freeMem(ptr); ze_result_t result = context->freeMem(ptr);
EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_EQ(result, ZE_RESULT_SUCCESS);

View File

@ -3083,7 +3083,7 @@ TEST_F(MemoryExportImportFailTest,
TEST_F(MemoryExportImportFailTest, TEST_F(MemoryExportImportFailTest,
whenParsingMemoryTypeWithNotSpecifidTypeThenUnknownTypeIsReturned) { whenParsingMemoryTypeWithNotSpecifidTypeThenUnknownTypeIsReturned) {
InternalMemoryType memoryType = InternalMemoryType::NOT_SPECIFIED; InternalMemoryType memoryType = InternalMemoryType::notSpecified;
ze_memory_type_t usmType = L0::Context::parseUSMType(memoryType); ze_memory_type_t usmType = L0::Context::parseUSMType(memoryType);
EXPECT_EQ(usmType, ZE_MEMORY_TYPE_UNKNOWN); EXPECT_EQ(usmType, ZE_MEMORY_TYPE_UNKNOWN);
} }
@ -4048,7 +4048,7 @@ HWTEST2_F(MultipleDevicePeerAllocationTest,
auto &residentAllocations = csr->getResidencyAllocations(); auto &residentAllocations = csr->getResidencyAllocations();
EXPECT_EQ(0u, residentAllocations.size()); EXPECT_EQ(0u, residentAllocations.size());
svmManager->makeInternalAllocationsResident(*csr, InternalMemoryType::DEVICE_UNIFIED_MEMORY); svmManager->makeInternalAllocationsResident(*csr, static_cast<uint32_t>(InternalMemoryType::deviceUnifiedMemory));
EXPECT_EQ(1u, residentAllocations.size()); EXPECT_EQ(1u, residentAllocations.size());
EXPECT_EQ(residentAllocations[0]->getGpuAddress(), reinterpret_cast<uint64_t>(ptr1)); EXPECT_EQ(residentAllocations[0]->getGpuAddress(), reinterpret_cast<uint64_t>(ptr1));
@ -5439,7 +5439,7 @@ TEST_F(ImportFdUncachedTests,
auto allocData = driverHandle->svmAllocsManager->getSVMAlloc(ptr); auto allocData = driverHandle->svmAllocsManager->getSVMAlloc(ptr);
EXPECT_NE(allocData, nullptr); EXPECT_NE(allocData, nullptr);
EXPECT_EQ(allocData->memoryType, InternalMemoryType::HOST_UNIFIED_MEMORY); EXPECT_EQ(allocData->memoryType, InternalMemoryType::hostUnifiedMemory);
context->freeMem(ptr); context->freeMem(ptr);
} }
@ -5454,7 +5454,7 @@ TEST_F(ImportFdUncachedTests,
auto allocData = driverHandle->svmAllocsManager->getSVMAlloc(ptr); auto allocData = driverHandle->svmAllocsManager->getSVMAlloc(ptr);
EXPECT_NE(allocData, nullptr); EXPECT_NE(allocData, nullptr);
EXPECT_EQ(allocData->memoryType, InternalMemoryType::DEVICE_UNIFIED_MEMORY); EXPECT_EQ(allocData->memoryType, InternalMemoryType::deviceUnifiedMemory);
context->freeMem(ptr); context->freeMem(ptr);
} }

View File

@ -3139,8 +3139,8 @@ kernels:
auto svmAllocsManager = device->getDriverHandle()->getSvmAllocsManager(); auto svmAllocsManager = device->getDriverHandle()->getSvmAllocsManager();
auto globalConstBufferAllocType = svmAllocsManager->getSVMAlloc(reinterpret_cast<void *>(moduleTu.globalConstBuffer->getGpuAddress()))->memoryType; auto globalConstBufferAllocType = svmAllocsManager->getSVMAlloc(reinterpret_cast<void *>(moduleTu.globalConstBuffer->getGpuAddress()))->memoryType;
auto globalVarBufferAllocType = svmAllocsManager->getSVMAlloc(reinterpret_cast<void *>(moduleTu.globalVarBuffer->getGpuAddress()))->memoryType; auto globalVarBufferAllocType = svmAllocsManager->getSVMAlloc(reinterpret_cast<void *>(moduleTu.globalVarBuffer->getGpuAddress()))->memoryType;
EXPECT_EQ(DEVICE_UNIFIED_MEMORY, globalConstBufferAllocType); EXPECT_EQ(InternalMemoryType::deviceUnifiedMemory, globalConstBufferAllocType);
EXPECT_EQ(DEVICE_UNIFIED_MEMORY, globalVarBufferAllocType); EXPECT_EQ(InternalMemoryType::deviceUnifiedMemory, globalVarBufferAllocType);
} }
HWTEST_F(ModuleTranslationUnitTest, WithNoCompilerWhenCallingBuildFromSpirvThenFailureReturned) { HWTEST_F(ModuleTranslationUnitTest, WithNoCompilerWhenCallingBuildFromSpirvThenFailureReturned) {

View File

@ -3885,7 +3885,7 @@ CL_API_ENTRY void *CL_API_CALL clHostMemAllocINTEL(
return nullptr; return nullptr;
} }
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, alignment, SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory, alignment,
neoContext->getRootDeviceIndices(), neoContext->getDeviceBitfields()); neoContext->getRootDeviceIndices(), neoContext->getDeviceBitfields());
cl_mem_flags flags = 0; cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0; cl_mem_flags_intel flagsIntel = 0;
@ -3930,7 +3930,7 @@ CL_API_ENTRY void *CL_API_CALL clDeviceMemAllocINTEL(
auto subDeviceBitfields = neoContext->getDeviceBitfields(); auto subDeviceBitfields = neoContext->getDeviceBitfields();
subDeviceBitfields[neoDevice->getRootDeviceIndex()] = neoDevice->getDeviceBitfield(); subDeviceBitfields[neoDevice->getRootDeviceIndex()] = neoDevice->getDeviceBitfield();
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, alignment, SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, alignment,
neoContext->getRootDeviceIndices(), subDeviceBitfields); neoContext->getRootDeviceIndices(), subDeviceBitfields);
cl_mem_flags flags = 0; cl_mem_flags flags = 0;
cl_mem_flags_intel flagsIntel = 0; cl_mem_flags_intel flagsIntel = 0;
@ -3990,7 +3990,7 @@ CL_API_ENTRY void *CL_API_CALL clSharedMemAllocINTEL(
} else { } else {
neoDevice = neoContext->getDevice(0); neoDevice = neoContext->getDevice(0);
} }
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, alignment, neoContext->getRootDeviceIndices(), subDeviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, alignment, neoContext->getRootDeviceIndices(), subDeviceBitfields);
unifiedMemoryProperties.device = unifiedMemoryPropertiesDevice; unifiedMemoryProperties.device = unifiedMemoryPropertiesDevice;
if (!ClMemoryPropertiesHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel, if (!ClMemoryPropertiesHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel,
allocflags, ClMemoryPropertiesHelper::ObjType::UNKNOWN, allocflags, ClMemoryPropertiesHelper::ObjType::UNKNOWN,
@ -4072,10 +4072,10 @@ CL_API_ENTRY cl_int CL_API_CALL clGetMemAllocInfoINTEL(
if (!unifiedMemoryAllocation) { if (!unifiedMemoryAllocation) {
retVal = changeGetInfoStatusToCLResultType(info.set<cl_int>(CL_MEM_TYPE_UNKNOWN_INTEL)); retVal = changeGetInfoStatusToCLResultType(info.set<cl_int>(CL_MEM_TYPE_UNKNOWN_INTEL));
return retVal; return retVal;
} else if (unifiedMemoryAllocation->memoryType == InternalMemoryType::HOST_UNIFIED_MEMORY) { } else if (unifiedMemoryAllocation->memoryType == InternalMemoryType::hostUnifiedMemory) {
retVal = changeGetInfoStatusToCLResultType(info.set<cl_int>(CL_MEM_TYPE_HOST_INTEL)); retVal = changeGetInfoStatusToCLResultType(info.set<cl_int>(CL_MEM_TYPE_HOST_INTEL));
return retVal; return retVal;
} else if (unifiedMemoryAllocation->memoryType == InternalMemoryType::DEVICE_UNIFIED_MEMORY) { } else if (unifiedMemoryAllocation->memoryType == InternalMemoryType::deviceUnifiedMemory) {
retVal = changeGetInfoStatusToCLResultType(info.set<cl_int>(CL_MEM_TYPE_DEVICE_INTEL)); retVal = changeGetInfoStatusToCLResultType(info.set<cl_int>(CL_MEM_TYPE_DEVICE_INTEL));
return retVal; return retVal;
} else { } else {

View File

@ -26,8 +26,6 @@
#include <cstdint> #include <cstdint>
#include <optional> #include <optional>
enum InternalMemoryType : uint32_t;
namespace NEO { namespace NEO {
class BarrierCommand; class BarrierCommand;
class Buffer; class Buffer;
@ -488,7 +486,7 @@ template <typename PtrType>
PtrType CommandQueue::convertAddressWithOffsetToGpuVa(PtrType ptr, InternalMemoryType memoryType, GraphicsAllocation &allocation) { PtrType CommandQueue::convertAddressWithOffsetToGpuVa(PtrType ptr, InternalMemoryType memoryType, GraphicsAllocation &allocation) {
// If this is device or shared USM pointer, it is already a gpuVA and we don't have to do anything. // If this is device or shared USM pointer, it is already a gpuVA and we don't have to do anything.
// Otherwise, we assume this is a cpuVA and we have to convert to gpuVA, while preserving offset from allocation start. // Otherwise, we assume this is a cpuVA and we have to convert to gpuVA, while preserving offset from allocation start.
const bool isCpuPtr = (memoryType != DEVICE_UNIFIED_MEMORY) && (memoryType != SHARED_UNIFIED_MEMORY); const bool isCpuPtr = (memoryType != InternalMemoryType::deviceUnifiedMemory) && (memoryType != InternalMemoryType::sharedUnifiedMemory);
if (isCpuPtr) { if (isCpuPtr) {
size_t dstOffset = ptrDiff(ptr, allocation.getUnderlyingBuffer()); size_t dstOffset = ptrDiff(ptr, allocation.getUnderlyingBuffer());
ptr = reinterpret_cast<PtrType>(allocation.getGpuAddress() + dstOffset); ptr = reinterpret_cast<PtrType>(allocation.getGpuAddress() + dstOffset);

View File

@ -48,7 +48,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadBuffer(
bool isMemTransferNeeded = buffer->isMemObjZeroCopy() ? buffer->checkIfMemoryTransferIsRequired(offset, 0, ptr, cmdType) : true; bool isMemTransferNeeded = buffer->isMemObjZeroCopy() ? buffer->checkIfMemoryTransferIsRequired(offset, 0, ptr, cmdType) : true;
bool isCpuCopyAllowed = bufferCpuCopyAllowed(buffer, cmdType, blockingRead, size, ptr, bool isCpuCopyAllowed = bufferCpuCopyAllowed(buffer, cmdType, blockingRead, size, ptr,
numEventsInWaitList, eventWaitList); numEventsInWaitList, eventWaitList);
InternalMemoryType memoryType = InternalMemoryType::NOT_SPECIFIED; InternalMemoryType memoryType = InternalMemoryType::notSpecified;
if (!mapAllocation) { if (!mapAllocation) {
cl_int retVal = getContext().tryGetExistingHostPtrAllocation(ptr, size, rootDeviceIndex, mapAllocation, memoryType, isCpuCopyAllowed); cl_int retVal = getContext().tryGetExistingHostPtrAllocation(ptr, size, rootDeviceIndex, mapAllocation, memoryType, isCpuCopyAllowed);

View File

@ -49,7 +49,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadBufferRect(
const size_t hostPtrSize = Buffer::calculateHostPtrSize(hostOrigin, region, hostRowPitch, hostSlicePitch); const size_t hostPtrSize = Buffer::calculateHostPtrSize(hostOrigin, region, hostRowPitch, hostSlicePitch);
const uint32_t rootDeviceIndex = getDevice().getRootDeviceIndex(); const uint32_t rootDeviceIndex = getDevice().getRootDeviceIndex();
InternalMemoryType memoryType = InternalMemoryType::NOT_SPECIFIED; InternalMemoryType memoryType = InternalMemoryType::notSpecified;
GraphicsAllocation *mapAllocation = nullptr; GraphicsAllocation *mapAllocation = nullptr;
bool isCpuCopyAllowed = false; bool isCpuCopyAllowed = false;
getContext().tryGetExistingHostPtrAllocation(ptr, hostPtrSize, rootDeviceIndex, mapAllocation, memoryType, isCpuCopyAllowed); getContext().tryGetExistingHostPtrAllocation(ptr, hostPtrSize, rootDeviceIndex, mapAllocation, memoryType, isCpuCopyAllowed);

View File

@ -303,7 +303,7 @@ inline std::tuple<SvmAllocationData *, GraphicsAllocation *, PtrType> getExistin
} else { } else {
context->tryGetExistingMapAllocation(ptr, size, allocation); context->tryGetExistingMapAllocation(ptr, size, allocation);
if (allocation) { if (allocation) {
ptr = CommandQueue::convertAddressWithOffsetToGpuVa(ptr, InternalMemoryType::NOT_SPECIFIED, *allocation); ptr = CommandQueue::convertAddressWithOffsetToGpuVa(ptr, InternalMemoryType::notSpecified, *allocation);
} }
} }
return std::make_tuple(svmData, allocation, ptr); return std::make_tuple(svmData, allocation, ptr);

View File

@ -36,7 +36,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueWriteBuffer(
auto isMemTransferNeeded = buffer->isMemObjZeroCopy() ? buffer->checkIfMemoryTransferIsRequired(offset, 0, ptr, cmdType) : true; auto isMemTransferNeeded = buffer->isMemObjZeroCopy() ? buffer->checkIfMemoryTransferIsRequired(offset, 0, ptr, cmdType) : true;
bool isCpuCopyAllowed = bufferCpuCopyAllowed(buffer, cmdType, blockingWrite, size, const_cast<void *>(ptr), bool isCpuCopyAllowed = bufferCpuCopyAllowed(buffer, cmdType, blockingWrite, size, const_cast<void *>(ptr),
numEventsInWaitList, eventWaitList); numEventsInWaitList, eventWaitList);
InternalMemoryType memoryType = InternalMemoryType::NOT_SPECIFIED; InternalMemoryType memoryType = InternalMemoryType::notSpecified;
if (!mapAllocation) { if (!mapAllocation) {
cl_int retVal = getContext().tryGetExistingHostPtrAllocation(ptr, size, rootDeviceIndex, mapAllocation, memoryType, isCpuCopyAllowed); cl_int retVal = getContext().tryGetExistingHostPtrAllocation(ptr, size, rootDeviceIndex, mapAllocation, memoryType, isCpuCopyAllowed);

View File

@ -53,7 +53,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueWriteBufferRect(
const size_t hostPtrSize = Buffer::calculateHostPtrSize(hostOrigin, region, hostRowPitch, hostSlicePitch); const size_t hostPtrSize = Buffer::calculateHostPtrSize(hostOrigin, region, hostRowPitch, hostSlicePitch);
const uint32_t rootDeviceIndex = getDevice().getRootDeviceIndex(); const uint32_t rootDeviceIndex = getDevice().getRootDeviceIndex();
InternalMemoryType memoryType = InternalMemoryType::NOT_SPECIFIED; InternalMemoryType memoryType = InternalMemoryType::notSpecified;
GraphicsAllocation *mapAllocation = nullptr; GraphicsAllocation *mapAllocation = nullptr;
bool isCpuCopyAllowed = false; bool isCpuCopyAllowed = false;
getContext().tryGetExistingHostPtrAllocation(ptr, hostPtrSize, rootDeviceIndex, mapAllocation, memoryType, isCpuCopyAllowed); getContext().tryGetExistingHostPtrAllocation(ptr, hostPtrSize, rootDeviceIndex, mapAllocation, memoryType, isCpuCopyAllowed);

View File

@ -121,7 +121,7 @@ cl_int Context::tryGetExistingSvmAllocation(const void *ptr,
} }
allocation = svmEntry->cpuAllocation ? svmEntry->cpuAllocation : svmEntry->gpuAllocations.getGraphicsAllocation(rootDeviceIndex); allocation = svmEntry->cpuAllocation ? svmEntry->cpuAllocation : svmEntry->gpuAllocations.getGraphicsAllocation(rootDeviceIndex);
if (isCpuCopyAllowed) { if (isCpuCopyAllowed) {
if (svmEntry->memoryType == DEVICE_UNIFIED_MEMORY) { if (svmEntry->memoryType == InternalMemoryType::deviceUnifiedMemory) {
isCpuCopyAllowed = false; isCpuCopyAllowed = false;
} }
} }

View File

@ -23,7 +23,7 @@
#include <map> #include <map>
enum InternalMemoryType : uint32_t; enum class InternalMemoryType : uint32_t;
namespace NEO { namespace NEO {
struct MemoryProperties; struct MemoryProperties;

View File

@ -380,7 +380,7 @@ Buffer *Buffer::create(Context *context,
if (svmManager) { if (svmManager) {
auto svmData = svmManager->getSVMAlloc(hostPtr); auto svmData = svmManager->getSVMAlloc(hostPtr);
if (svmData) { if (svmData) {
if ((svmData->memoryType == InternalMemoryType::HOST_UNIFIED_MEMORY) && memoryManager->isLocalMemorySupported(rootDeviceIndex)) { if ((svmData->memoryType == InternalMemoryType::hostUnifiedMemory) && memoryManager->isLocalMemorySupported(rootDeviceIndex)) {
allocationInfo.memory = nullptr; allocationInfo.memory = nullptr;
allocationInfo.allocationType = AllocationType::buffer; allocationInfo.allocationType = AllocationType::buffer;
allocationInfo.isHostPtrSVM = false; allocationInfo.isHostPtrSVM = false;

View File

@ -39,7 +39,7 @@ TEST(clUnifiedSharedMemoryTests, whenClHostMemAllocIntelIsCalledThenItAllocatesH
EXPECT_EQ(1u, allocationsManager->getNumAllocs()); EXPECT_EQ(1u, allocationsManager->getNumAllocs());
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryHostAllocation); auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryHostAllocation);
EXPECT_EQ(graphicsAllocation->size, 4u); EXPECT_EQ(graphicsAllocation->size, 4u);
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::HOST_UNIFIED_MEMORY); EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::hostUnifiedMemory);
EXPECT_EQ(graphicsAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex())->getGpuAddress(), EXPECT_EQ(graphicsAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex())->getGpuAddress(),
castToUint64(unifiedMemoryHostAllocation)); castToUint64(unifiedMemoryHostAllocation));
@ -139,7 +139,7 @@ TEST(clUnifiedSharedMemoryTests, whenClDeviceMemAllocIntelIsCalledThenItAllocate
EXPECT_EQ(1u, allocationsManager->getNumAllocs()); EXPECT_EQ(1u, allocationsManager->getNumAllocs());
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryDeviceAllocation); auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryDeviceAllocation);
EXPECT_EQ(graphicsAllocation->size, 4u); EXPECT_EQ(graphicsAllocation->size, 4u);
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::DEVICE_UNIFIED_MEMORY); EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::deviceUnifiedMemory);
EXPECT_EQ(graphicsAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex())->getGpuAddress(), EXPECT_EQ(graphicsAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex())->getGpuAddress(),
castToUint64(unifiedMemoryDeviceAllocation)); castToUint64(unifiedMemoryDeviceAllocation));
@ -206,7 +206,7 @@ TEST(clUnifiedSharedMemoryTests, whenClSharedMemAllocIntelIsCalledThenItAllocate
EXPECT_EQ(1u, allocationsManager->getNumAllocs()); EXPECT_EQ(1u, allocationsManager->getNumAllocs());
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemorySharedAllocation); auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemorySharedAllocation);
EXPECT_EQ(graphicsAllocation->size, 4u); EXPECT_EQ(graphicsAllocation->size, 4u);
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::SHARED_UNIFIED_MEMORY); EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::sharedUnifiedMemory);
EXPECT_EQ(graphicsAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex())->getGpuAddress(), EXPECT_EQ(graphicsAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex())->getGpuAddress(),
castToUint64(unifiedMemorySharedAllocation)); castToUint64(unifiedMemorySharedAllocation));
@ -356,7 +356,7 @@ TEST(clUnifiedSharedMemoryTests, whenClGetMemAllocInfoINTELisCalledWithValidUnif
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryHostAllocation); auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryHostAllocation);
retVal = clGetMemAllocInfoINTEL(&mockContext, unifiedMemoryHostAllocation, CL_MEM_ALLOC_TYPE_INTEL, paramValueSize, &paramValue, &paramValueSizeRet); retVal = clGetMemAllocInfoINTEL(&mockContext, unifiedMemoryHostAllocation, CL_MEM_ALLOC_TYPE_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::HOST_UNIFIED_MEMORY); EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::hostUnifiedMemory);
EXPECT_EQ(CL_MEM_TYPE_HOST_INTEL, paramValue); EXPECT_EQ(CL_MEM_TYPE_HOST_INTEL, paramValue);
EXPECT_EQ(sizeof(cl_int), paramValueSizeRet); EXPECT_EQ(sizeof(cl_int), paramValueSizeRet);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
@ -521,7 +521,7 @@ TEST(clUnifiedSharedMemoryTests, whenClGetMemAllocInfoINTELisCalledWithValidUnif
retVal = clGetMemAllocInfoINTEL(&mockContext, unifiedMemoryDeviceAllocation, CL_MEM_ALLOC_TYPE_INTEL, paramValueSize, &paramValue, &paramValueSizeRet); retVal = clGetMemAllocInfoINTEL(&mockContext, unifiedMemoryDeviceAllocation, CL_MEM_ALLOC_TYPE_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::DEVICE_UNIFIED_MEMORY); EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::deviceUnifiedMemory);
EXPECT_EQ(CL_MEM_TYPE_DEVICE_INTEL, paramValue); EXPECT_EQ(CL_MEM_TYPE_DEVICE_INTEL, paramValue);
EXPECT_EQ(sizeof(cl_int), paramValueSizeRet); EXPECT_EQ(sizeof(cl_int), paramValueSizeRet);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
@ -543,7 +543,7 @@ TEST(clUnifiedSharedMemoryTests, whenClGetMemAllocInfoINTELisCalledWithValidUnif
retVal = clGetMemAllocInfoINTEL(&mockContext, unifiedMemorySharedAllocation, CL_MEM_ALLOC_TYPE_INTEL, paramValueSize, &paramValue, &paramValueSizeRet); retVal = clGetMemAllocInfoINTEL(&mockContext, unifiedMemorySharedAllocation, CL_MEM_ALLOC_TYPE_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::SHARED_UNIFIED_MEMORY); EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::sharedUnifiedMemory);
EXPECT_EQ(CL_MEM_TYPE_SHARED_INTEL, paramValue); EXPECT_EQ(CL_MEM_TYPE_SHARED_INTEL, paramValue);
EXPECT_EQ(sizeof(cl_int), paramValueSizeRet); EXPECT_EQ(sizeof(cl_int), paramValueSizeRet);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
@ -644,7 +644,7 @@ TEST(clUnifiedSharedMemoryTests, whenClGetMemAllocInfoINTELisCalledWithAllocatio
retVal = clGetMemAllocInfoINTEL(&mockContext, unifiedMemorySharedAllocation, CL_MEM_ALLOC_BASE_PTR_INTEL, paramValueSize, &paramValue, &paramValueSizeRet); retVal = clGetMemAllocInfoINTEL(&mockContext, unifiedMemorySharedAllocation, CL_MEM_ALLOC_BASE_PTR_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::SHARED_UNIFIED_MEMORY); EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::sharedUnifiedMemory);
EXPECT_EQ(graphicsAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex())->getGpuAddress(), paramValue); EXPECT_EQ(graphicsAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex())->getGpuAddress(), paramValue);
EXPECT_EQ(sizeof(uint64_t), paramValueSizeRet); EXPECT_EQ(sizeof(uint64_t), paramValueSizeRet);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
@ -669,7 +669,7 @@ TEST(clUnifiedSharedMemoryTests, whenClGetMemAllocInfoINTELisCalledWithAllocatio
retVal = clGetMemAllocInfoINTEL(&mockContext, unifiedMemoryHostAllocation, CL_MEM_ALLOC_SIZE_INTEL, paramValueSize, &paramValue, &paramValueSizeRet); retVal = clGetMemAllocInfoINTEL(&mockContext, unifiedMemoryHostAllocation, CL_MEM_ALLOC_SIZE_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::HOST_UNIFIED_MEMORY); EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::hostUnifiedMemory);
EXPECT_EQ(graphicsAllocation->size, paramValue); EXPECT_EQ(graphicsAllocation->size, paramValue);
EXPECT_EQ(sizeof(size_t), paramValueSizeRet); EXPECT_EQ(sizeof(size_t), paramValueSizeRet);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
@ -1104,7 +1104,7 @@ TEST(clUnifiedSharedMemoryTests, givenDefaulMemPropertiesWhenClDeviceMemAllocInt
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryDeviceAllocation); auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryDeviceAllocation);
auto gpuAllocation = graphicsAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex()); auto gpuAllocation = graphicsAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex());
EXPECT_EQ(graphicsAllocation->size, allocationSize); EXPECT_EQ(graphicsAllocation->size, allocationSize);
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::DEVICE_UNIFIED_MEMORY); EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::deviceUnifiedMemory);
EXPECT_EQ(AllocationType::buffer, gpuAllocation->getAllocationType()); EXPECT_EQ(AllocationType::buffer, gpuAllocation->getAllocationType());
EXPECT_EQ(gpuAllocation->getGpuAddress(), castToUint64(unifiedMemoryDeviceAllocation)); EXPECT_EQ(gpuAllocation->getGpuAddress(), castToUint64(unifiedMemoryDeviceAllocation));
EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), gpuAllocation->getUnderlyingBufferSize()); EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), gpuAllocation->getUnderlyingBufferSize());
@ -1127,7 +1127,7 @@ TEST(clUnifiedSharedMemoryTests, givenValidMemPropertiesWhenClDeviceMemAllocInte
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryDeviceAllocation); auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryDeviceAllocation);
auto gpuAllocation = graphicsAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex()); auto gpuAllocation = graphicsAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex());
EXPECT_EQ(graphicsAllocation->size, allocationSize); EXPECT_EQ(graphicsAllocation->size, allocationSize);
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::DEVICE_UNIFIED_MEMORY); EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::deviceUnifiedMemory);
EXPECT_EQ(gpuAllocation->getAllocationType(), AllocationType::writeCombined); EXPECT_EQ(gpuAllocation->getAllocationType(), AllocationType::writeCombined);
EXPECT_EQ(gpuAllocation->getGpuAddress(), castToUint64(unifiedMemoryDeviceAllocation)); EXPECT_EQ(gpuAllocation->getGpuAddress(), castToUint64(unifiedMemoryDeviceAllocation));
EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), gpuAllocation->getUnderlyingBufferSize()); EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), gpuAllocation->getUnderlyingBufferSize());
@ -1286,7 +1286,7 @@ TEST_F(MultiRootDeviceClUnifiedSharedMemoryTests, WhenClHostMemAllocIntelIsCalle
auto graphicsAllocation2 = svmAllocation->gpuAllocations.getGraphicsAllocation(2u); auto graphicsAllocation2 = svmAllocation->gpuAllocations.getGraphicsAllocation(2u);
EXPECT_EQ(svmAllocation->size, 4u); EXPECT_EQ(svmAllocation->size, 4u);
EXPECT_EQ(svmAllocation->memoryType, InternalMemoryType::HOST_UNIFIED_MEMORY); EXPECT_EQ(svmAllocation->memoryType, InternalMemoryType::hostUnifiedMemory);
EXPECT_NE(graphicsAllocation1, nullptr); EXPECT_NE(graphicsAllocation1, nullptr);
EXPECT_NE(graphicsAllocation2, nullptr); EXPECT_NE(graphicsAllocation2, nullptr);
@ -1323,7 +1323,7 @@ TEST_F(MultiRootDeviceClUnifiedSharedMemoryTests, WhenClSharedMemAllocIntelIsCal
auto graphicsAllocation2 = svmAllocation->gpuAllocations.getGraphicsAllocation(2u); auto graphicsAllocation2 = svmAllocation->gpuAllocations.getGraphicsAllocation(2u);
EXPECT_EQ(svmAllocation->size, 4u); EXPECT_EQ(svmAllocation->size, 4u);
EXPECT_EQ(svmAllocation->memoryType, InternalMemoryType::SHARED_UNIFIED_MEMORY); EXPECT_EQ(svmAllocation->memoryType, InternalMemoryType::sharedUnifiedMemory);
EXPECT_NE(graphicsAllocation1, nullptr); EXPECT_NE(graphicsAllocation1, nullptr);
EXPECT_NE(graphicsAllocation2, nullptr); EXPECT_NE(graphicsAllocation2, nullptr);

View File

@ -29,13 +29,13 @@ void *UnifiedMemoryAubFixture::allocateUSM(InternalMemoryType type) {
void *ptr = nullptr; void *ptr = nullptr;
if (!this->skipped) { if (!this->skipped) {
switch (type) { switch (type) {
case DEVICE_UNIFIED_MEMORY: case InternalMemoryType::deviceUnifiedMemory:
ptr = clDeviceMemAllocINTEL(this->context, this->device.get(), nullptr, dataSize, 0, &retVal); ptr = clDeviceMemAllocINTEL(this->context, this->device.get(), nullptr, dataSize, 0, &retVal);
break; break;
case HOST_UNIFIED_MEMORY: case InternalMemoryType::hostUnifiedMemory:
ptr = clHostMemAllocINTEL(this->context, nullptr, dataSize, 0, &retVal); ptr = clHostMemAllocINTEL(this->context, nullptr, dataSize, 0, &retVal);
break; break;
case SHARED_UNIFIED_MEMORY: case InternalMemoryType::sharedUnifiedMemory:
ptr = clSharedMemAllocINTEL(this->context, this->device.get(), nullptr, dataSize, 0, &retVal); ptr = clSharedMemAllocINTEL(this->context, this->device.get(), nullptr, dataSize, 0, &retVal);
break; break;
default: default:
@ -51,9 +51,9 @@ void *UnifiedMemoryAubFixture::allocateUSM(InternalMemoryType type) {
void UnifiedMemoryAubFixture::freeUSM(void *ptr, InternalMemoryType type) { void UnifiedMemoryAubFixture::freeUSM(void *ptr, InternalMemoryType type) {
if (!this->skipped) { if (!this->skipped) {
switch (type) { switch (type) {
case DEVICE_UNIFIED_MEMORY: case InternalMemoryType::deviceUnifiedMemory:
case HOST_UNIFIED_MEMORY: case InternalMemoryType::hostUnifiedMemory:
case SHARED_UNIFIED_MEMORY: case InternalMemoryType::sharedUnifiedMemory:
retVal = clMemFreeINTEL(this->context, ptr); retVal = clMemFreeINTEL(this->context, ptr);
break; break;
default: default:
@ -67,7 +67,7 @@ void UnifiedMemoryAubFixture::freeUSM(void *ptr, InternalMemoryType type) {
void UnifiedMemoryAubFixture::writeToUsmMemory(std::vector<char> data, void *ptr, InternalMemoryType type) { void UnifiedMemoryAubFixture::writeToUsmMemory(std::vector<char> data, void *ptr, InternalMemoryType type) {
if (!this->skipped) { if (!this->skipped) {
switch (type) { switch (type) {
case DEVICE_UNIFIED_MEMORY: case InternalMemoryType::deviceUnifiedMemory:
retVal = clEnqueueMemcpyINTEL(this->pCmdQ, true, ptr, data.data(), dataSize, 0, nullptr, nullptr); retVal = clEnqueueMemcpyINTEL(this->pCmdQ, true, ptr, data.data(), dataSize, 0, nullptr, nullptr);
break; break;
default: default:
@ -78,4 +78,4 @@ void UnifiedMemoryAubFixture::writeToUsmMemory(std::vector<char> data, void *ptr
} }
} }
} // namespace NEO } // namespace NEO

View File

@ -36,7 +36,7 @@ class UnifiedMemoryAubTest : public UnifiedMemoryAubFixture,
}; };
HWTEST_F(UnifiedMemoryAubTest, givenDeviceMemoryAllocWhenWriteIntoItThenValuesMatch) { HWTEST_F(UnifiedMemoryAubTest, givenDeviceMemoryAllocWhenWriteIntoItThenValuesMatch) {
auto unifiedMemoryType = InternalMemoryType::DEVICE_UNIFIED_MEMORY; auto unifiedMemoryType = InternalMemoryType::deviceUnifiedMemory;
auto unifiedMemoryPtr = allocateUSM(unifiedMemoryType); auto unifiedMemoryPtr = allocateUSM(unifiedMemoryType);
writeToUsmMemory(values, unifiedMemoryPtr, unifiedMemoryType); writeToUsmMemory(values, unifiedMemoryPtr, unifiedMemoryType);
@ -46,7 +46,7 @@ HWTEST_F(UnifiedMemoryAubTest, givenDeviceMemoryAllocWhenWriteIntoItThenValuesMa
} }
HWTEST_F(UnifiedMemoryAubTest, givenSharedMemoryAllocWhenWriteIntoCPUPartThenValuesMatchAfterUsingAllocAsKernelParam) { HWTEST_F(UnifiedMemoryAubTest, givenSharedMemoryAllocWhenWriteIntoCPUPartThenValuesMatchAfterUsingAllocAsKernelParam) {
auto unifiedMemoryType = InternalMemoryType::SHARED_UNIFIED_MEMORY; auto unifiedMemoryType = InternalMemoryType::sharedUnifiedMemory;
auto unifiedMemoryPtr = allocateUSM(unifiedMemoryType); auto unifiedMemoryPtr = allocateUSM(unifiedMemoryType);
retVal = clEnqueueMemsetINTEL(this->pCmdQ, unifiedMemoryPtr, 0, dataSize, 0, nullptr, nullptr); retVal = clEnqueueMemsetINTEL(this->pCmdQ, unifiedMemoryPtr, 0, dataSize, 0, nullptr, nullptr);
EXPECT_EQ(retVal, CL_SUCCESS); EXPECT_EQ(retVal, CL_SUCCESS);
@ -65,7 +65,7 @@ HWTEST_F(UnifiedMemoryAubTest, givenSharedMemoryAllocWhenWriteIntoCPUPartThenVal
} }
HWTEST_F(UnifiedMemoryAubTest, givenSharedMemoryAllocWhenWriteIntoGPUPartThenValuesMatchAfterUsingAlloc) { HWTEST_F(UnifiedMemoryAubTest, givenSharedMemoryAllocWhenWriteIntoGPUPartThenValuesMatchAfterUsingAlloc) {
auto unifiedMemoryType = InternalMemoryType::SHARED_UNIFIED_MEMORY; auto unifiedMemoryType = InternalMemoryType::sharedUnifiedMemory;
auto unifiedMemoryPtr = allocateUSM(unifiedMemoryType); auto unifiedMemoryPtr = allocateUSM(unifiedMemoryType);
std::vector<char> input(dataSize, 11); std::vector<char> input(dataSize, 11);

View File

@ -48,10 +48,10 @@ HWTEST_P(UnifiedMemoryCopyAubTest, givenTwoUnifiedMemoryAllocsWhenCopyingOneToAn
expectMemory<FamilyType>(dstPtr, srcValues.data(), dataSize); expectMemory<FamilyType>(dstPtr, srcValues.data(), dataSize);
} }
InternalMemoryType memoryTypes[] = {InternalMemoryType::HOST_UNIFIED_MEMORY, InternalMemoryType memoryTypes[] = {InternalMemoryType::hostUnifiedMemory,
InternalMemoryType::DEVICE_UNIFIED_MEMORY, InternalMemoryType::deviceUnifiedMemory,
InternalMemoryType::SHARED_UNIFIED_MEMORY, InternalMemoryType::sharedUnifiedMemory,
InternalMemoryType::NOT_SPECIFIED}; InternalMemoryType::notSpecified};
INSTANTIATE_TEST_CASE_P(UnifiedMemoryCopyAubTest, INSTANTIATE_TEST_CASE_P(UnifiedMemoryCopyAubTest,
UnifiedMemoryCopyAubTest, UnifiedMemoryCopyAubTest,

View File

@ -1705,7 +1705,7 @@ HWTEST_F(EnqueueKernelTest, GivenForceMemoryPrefetchForKmdMigratedSharedAllocati
debugManager.flags.UseKmdMigration.set(true); debugManager.flags.UseKmdMigration.set(true);
debugManager.flags.ForceMemoryPrefetchForKmdMigratedSharedAllocations.set(true); debugManager.flags.ForceMemoryPrefetchForKmdMigratedSharedAllocations.set(true);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, context->getRootDeviceIndices(), context->getDeviceBitfields()); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, context->getRootDeviceIndices(), context->getDeviceBitfields());
auto ptr = context->getSVMAllocsManager()->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, pCmdQ); auto ptr = context->getSVMAllocsManager()->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, pCmdQ);
EXPECT_NE(nullptr, ptr); EXPECT_NE(nullptr, ptr);

View File

@ -1669,7 +1669,7 @@ struct FailCsr : public CommandStreamReceiverHw<GfxFamily> {
}; };
HWTEST_F(EnqueueSvmTest, whenInternalAllocationsAreMadeResidentThenOnlyNonSvmAllocationsAreAdded) { HWTEST_F(EnqueueSvmTest, whenInternalAllocationsAreMadeResidentThenOnlyNonSvmAllocationsAreAdded) {
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, context->getRootDeviceIndices(), context->getDeviceBitfields()); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, context->getRootDeviceIndices(), context->getDeviceBitfields());
unifiedMemoryProperties.device = pDevice; unifiedMemoryProperties.device = pDevice;
auto allocationSize = 4096u; auto allocationSize = 4096u;
auto svmManager = this->context->getSVMAllocsManager(); auto svmManager = this->context->getSVMAllocsManager();
@ -1683,7 +1683,7 @@ HWTEST_F(EnqueueSvmTest, whenInternalAllocationsAreMadeResidentThenOnlyNonSvmAll
auto &residentAllocations = commandStreamReceiver.getResidencyAllocations(); auto &residentAllocations = commandStreamReceiver.getResidencyAllocations();
EXPECT_EQ(0u, residentAllocations.size()); EXPECT_EQ(0u, residentAllocations.size());
svmManager->makeInternalAllocationsResident(commandStreamReceiver, InternalMemoryType::DEVICE_UNIFIED_MEMORY); svmManager->makeInternalAllocationsResident(commandStreamReceiver, static_cast<uint32_t>(InternalMemoryType::deviceUnifiedMemory));
// only unified memory allocation is made resident // only unified memory allocation is made resident
EXPECT_EQ(1u, residentAllocations.size()); EXPECT_EQ(1u, residentAllocations.size());
@ -1693,7 +1693,7 @@ HWTEST_F(EnqueueSvmTest, whenInternalAllocationsAreMadeResidentThenOnlyNonSvmAll
} }
HWTEST_F(EnqueueSvmTest, whenInternalAllocationsAreAddedToResidencyContainerThenOnlyExpectedAllocationsAreAdded) { HWTEST_F(EnqueueSvmTest, whenInternalAllocationsAreAddedToResidencyContainerThenOnlyExpectedAllocationsAreAdded) {
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, context->getRootDeviceIndices(), context->getDeviceBitfields()); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, context->getRootDeviceIndices(), context->getDeviceBitfields());
unifiedMemoryProperties.device = pDevice; unifiedMemoryProperties.device = pDevice;
auto allocationSize = 4096u; auto allocationSize = 4096u;
auto svmManager = this->context->getSVMAllocsManager(); auto svmManager = this->context->getSVMAllocsManager();
@ -1707,7 +1707,7 @@ HWTEST_F(EnqueueSvmTest, whenInternalAllocationsAreAddedToResidencyContainerThen
svmManager->addInternalAllocationsToResidencyContainer(pDevice->getRootDeviceIndex(), svmManager->addInternalAllocationsToResidencyContainer(pDevice->getRootDeviceIndex(),
residencyContainer, residencyContainer,
InternalMemoryType::DEVICE_UNIFIED_MEMORY); static_cast<uint32_t>(InternalMemoryType::deviceUnifiedMemory));
// only unified memory allocation is added to residency container // only unified memory allocation is added to residency container
EXPECT_EQ(1u, residencyContainer.size()); EXPECT_EQ(1u, residencyContainer.size());
@ -1717,7 +1717,7 @@ HWTEST_F(EnqueueSvmTest, whenInternalAllocationsAreAddedToResidencyContainerThen
} }
HWTEST_F(EnqueueSvmTest, whenInternalAllocationIsTriedToBeAddedTwiceToResidencyContainerThenItIsAdded) { HWTEST_F(EnqueueSvmTest, whenInternalAllocationIsTriedToBeAddedTwiceToResidencyContainerThenItIsAdded) {
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, context->getRootDeviceIndices(), context->getDeviceBitfields()); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, context->getRootDeviceIndices(), context->getDeviceBitfields());
unifiedMemoryProperties.device = pDevice; unifiedMemoryProperties.device = pDevice;
auto allocationSize = 4096u; auto allocationSize = 4096u;
auto svmManager = this->context->getSVMAllocsManager(); auto svmManager = this->context->getSVMAllocsManager();
@ -1731,7 +1731,7 @@ HWTEST_F(EnqueueSvmTest, whenInternalAllocationIsTriedToBeAddedTwiceToResidencyC
svmManager->addInternalAllocationsToResidencyContainer(pDevice->getRootDeviceIndex(), svmManager->addInternalAllocationsToResidencyContainer(pDevice->getRootDeviceIndex(),
residencyContainer, residencyContainer,
InternalMemoryType::DEVICE_UNIFIED_MEMORY); static_cast<uint32_t>(InternalMemoryType::deviceUnifiedMemory));
// only unified memory allocation is added to residency container // only unified memory allocation is added to residency container
EXPECT_EQ(1u, residencyContainer.size()); EXPECT_EQ(1u, residencyContainer.size());
@ -1739,7 +1739,7 @@ HWTEST_F(EnqueueSvmTest, whenInternalAllocationIsTriedToBeAddedTwiceToResidencyC
svmManager->addInternalAllocationsToResidencyContainer(pDevice->getRootDeviceIndex(), svmManager->addInternalAllocationsToResidencyContainer(pDevice->getRootDeviceIndex(),
residencyContainer, residencyContainer,
InternalMemoryType::DEVICE_UNIFIED_MEMORY); static_cast<uint32_t>(InternalMemoryType::deviceUnifiedMemory));
EXPECT_EQ(2u, residencyContainer.size()); EXPECT_EQ(2u, residencyContainer.size());
svmManager->freeSVMAlloc(unifiedMemoryPtr); svmManager->freeSVMAlloc(unifiedMemoryPtr);
@ -1766,7 +1766,7 @@ struct CreateHostUnifiedMemoryAllocationTest : public ::testing::Test {
HWTEST_F(CreateHostUnifiedMemoryAllocationTest, HWTEST_F(CreateHostUnifiedMemoryAllocationTest,
whenCreatingHostUnifiedMemoryAllocationThenOneAllocDataIsCreatedWithOneGraphicsAllocationPerDevice) { whenCreatingHostUnifiedMemoryAllocationThenOneAllocDataIsCreatedWithOneGraphicsAllocationPerDevice) {
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, 1, context.getRootDeviceIndices(), context.getDeviceBitfields()); NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory, 1, context.getRootDeviceIndices(), context.getDeviceBitfields());
EXPECT_EQ(0u, svmManager->getNumAllocs()); EXPECT_EQ(0u, svmManager->getNumAllocs());
auto unifiedMemoryPtr = svmManager->createHostUnifiedMemoryAllocation(allocationSize, auto unifiedMemoryPtr = svmManager->createHostUnifiedMemoryAllocation(allocationSize,
@ -1788,7 +1788,7 @@ HWTEST_F(CreateHostUnifiedMemoryAllocationTest,
HWTEST_F(CreateHostUnifiedMemoryAllocationTest, HWTEST_F(CreateHostUnifiedMemoryAllocationTest,
whenCreatingMultiGraphicsAllocationThenGraphicsAllocationPerDeviceIsCreated) { whenCreatingMultiGraphicsAllocationThenGraphicsAllocationPerDeviceIsCreated) {
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, 1, context.getRootDeviceIndices(), context.getDeviceBitfields()); NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory, 1, context.getRootDeviceIndices(), context.getDeviceBitfields());
auto alignedSize = alignUp<size_t>(allocationSize, MemoryConstants::pageSize64k); auto alignedSize = alignUp<size_t>(allocationSize, MemoryConstants::pageSize64k);
auto memoryManager = context.getMemoryManager(); auto memoryManager = context.getMemoryManager();
@ -1833,7 +1833,7 @@ HWTEST_F(CreateHostUnifiedMemoryAllocationTest,
HWTEST_F(CreateHostUnifiedMemoryAllocationTest, HWTEST_F(CreateHostUnifiedMemoryAllocationTest,
whenCreatingMultiGraphicsAllocationForSpecificRootDeviceIndicesThenOnlyGraphicsAllocationPerSpecificRootDeviceIndexIsCreated) { whenCreatingMultiGraphicsAllocationForSpecificRootDeviceIndicesThenOnlyGraphicsAllocationPerSpecificRootDeviceIndexIsCreated) {
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, 1, context.getRootDeviceIndices(), context.getDeviceBitfields()); NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory, 1, context.getRootDeviceIndices(), context.getDeviceBitfields());
auto alignedSize = alignUp<size_t>(allocationSize, MemoryConstants::pageSize64k); auto alignedSize = alignUp<size_t>(allocationSize, MemoryConstants::pageSize64k);
auto memoryManager = context.getMemoryManager(); auto memoryManager = context.getMemoryManager();
@ -1880,9 +1880,9 @@ HWTEST_F(CreateHostUnifiedMemoryAllocationTest,
} }
struct MemoryAllocationTypeArray { struct MemoryAllocationTypeArray {
const InternalMemoryType allocationType[3] = {InternalMemoryType::HOST_UNIFIED_MEMORY, const InternalMemoryType allocationType[3] = {InternalMemoryType::hostUnifiedMemory,
InternalMemoryType::DEVICE_UNIFIED_MEMORY, InternalMemoryType::deviceUnifiedMemory,
InternalMemoryType::SHARED_UNIFIED_MEMORY}; InternalMemoryType::sharedUnifiedMemory};
}; };
struct UpdateResidencyContainerMultipleDevicesTest : public ::testing::WithParamInterface<std::tuple<InternalMemoryType, InternalMemoryType>>, struct UpdateResidencyContainerMultipleDevicesTest : public ::testing::WithParamInterface<std::tuple<InternalMemoryType, InternalMemoryType>>,
@ -1917,7 +1917,7 @@ HWTEST_F(UpdateResidencyContainerMultipleDevicesTest,
EXPECT_EQ(0u, residencyContainer.size()); EXPECT_EQ(0u, residencyContainer.size());
svmManager->addInternalAllocationsToResidencyContainer(device->getDevice().getRootDeviceIndex(), svmManager->addInternalAllocationsToResidencyContainer(device->getDevice().getRootDeviceIndex(),
residencyContainer, residencyContainer,
InternalMemoryType::DEVICE_UNIFIED_MEMORY); static_cast<uint32_t>(InternalMemoryType::deviceUnifiedMemory));
EXPECT_EQ(0u, residencyContainer.size()); EXPECT_EQ(0u, residencyContainer.size());
} }
@ -1927,7 +1927,7 @@ HWTEST_P(UpdateResidencyContainerMultipleDevicesTest, givenAllocationThenItIsAdd
static_cast<void *>(pCmdBuffer), sizeof(pCmdBuffer)); static_cast<void *>(pCmdBuffer), sizeof(pCmdBuffer));
InternalMemoryType type = std::get<0>(GetParam()); InternalMemoryType type = std::get<0>(GetParam());
uint32_t mask = std::get<1>(GetParam()); uint32_t mask = static_cast<uint32_t>(std::get<1>(GetParam()));
SvmAllocationData allocData(maxRootDeviceIndex); SvmAllocationData allocData(maxRootDeviceIndex);
allocData.gpuAllocations.addAllocation(&gfxAllocation); allocData.gpuAllocations.addAllocation(&gfxAllocation);
@ -1959,7 +1959,7 @@ HWTEST_P(UpdateResidencyContainerMultipleDevicesTest,
static_cast<void *>(pCmdBuffer), sizeof(pCmdBuffer)); static_cast<void *>(pCmdBuffer), sizeof(pCmdBuffer));
SvmAllocationData allocData(maxRootDeviceIndex); SvmAllocationData allocData(maxRootDeviceIndex);
allocData.gpuAllocations.addAllocation(&gfxAllocation); allocData.gpuAllocations.addAllocation(&gfxAllocation);
allocData.memoryType = InternalMemoryType::DEVICE_UNIFIED_MEMORY; allocData.memoryType = InternalMemoryType::deviceUnifiedMemory;
allocData.device = &device->getDevice(); allocData.device = &device->getDevice();
uint32_t pCmdBufferPeer[1024]; uint32_t pCmdBufferPeer[1024];
@ -1967,7 +1967,7 @@ HWTEST_P(UpdateResidencyContainerMultipleDevicesTest,
(void *)pCmdBufferPeer, sizeof(pCmdBufferPeer)); (void *)pCmdBufferPeer, sizeof(pCmdBufferPeer));
SvmAllocationData allocDataPeer(maxRootDeviceIndex); SvmAllocationData allocDataPeer(maxRootDeviceIndex);
allocDataPeer.gpuAllocations.addAllocation(&gfxAllocationPeer); allocDataPeer.gpuAllocations.addAllocation(&gfxAllocationPeer);
allocDataPeer.memoryType = InternalMemoryType::DEVICE_UNIFIED_MEMORY; allocDataPeer.memoryType = InternalMemoryType::deviceUnifiedMemory;
allocDataPeer.device = &peerDevice->getDevice(); allocDataPeer.device = &peerDevice->getDevice();
svmManager->insertSVMAlloc(allocData); svmManager->insertSVMAlloc(allocData);
@ -1978,12 +1978,12 @@ HWTEST_P(UpdateResidencyContainerMultipleDevicesTest,
EXPECT_EQ(0u, residencyContainer.size()); EXPECT_EQ(0u, residencyContainer.size());
svmManager->addInternalAllocationsToResidencyContainer(numRootDevices + 1, svmManager->addInternalAllocationsToResidencyContainer(numRootDevices + 1,
residencyContainer, residencyContainer,
InternalMemoryType::DEVICE_UNIFIED_MEMORY); static_cast<uint32_t>(InternalMemoryType::deviceUnifiedMemory));
EXPECT_EQ(0u, residencyContainer.size()); EXPECT_EQ(0u, residencyContainer.size());
svmManager->addInternalAllocationsToResidencyContainer(device->getDevice().getRootDeviceIndex(), svmManager->addInternalAllocationsToResidencyContainer(device->getDevice().getRootDeviceIndex(),
residencyContainer, residencyContainer,
InternalMemoryType::DEVICE_UNIFIED_MEMORY); static_cast<uint32_t>(InternalMemoryType::deviceUnifiedMemory));
EXPECT_EQ(1u, residencyContainer.size()); EXPECT_EQ(1u, residencyContainer.size());
EXPECT_EQ(residencyContainer[0]->getGpuAddress(), gfxAllocation.getGpuAddress()); EXPECT_EQ(residencyContainer[0]->getGpuAddress(), gfxAllocation.getGpuAddress());
} }
@ -2003,7 +2003,7 @@ HWTEST_F(UpdateResidencyContainerMultipleDevicesTest,
static_cast<void *>(pCmdBuffer), sizeof(pCmdBuffer)); static_cast<void *>(pCmdBuffer), sizeof(pCmdBuffer));
SvmAllocationData allocData(maxRootDeviceIndex); SvmAllocationData allocData(maxRootDeviceIndex);
allocData.gpuAllocations.addAllocation(&gfxAllocation); allocData.gpuAllocations.addAllocation(&gfxAllocation);
allocData.memoryType = InternalMemoryType::DEVICE_UNIFIED_MEMORY; allocData.memoryType = InternalMemoryType::deviceUnifiedMemory;
allocData.device = &device->getDevice(); allocData.device = &device->getDevice();
uint32_t pCmdBufferPeer[1024]; uint32_t pCmdBufferPeer[1024];
@ -2011,7 +2011,7 @@ HWTEST_F(UpdateResidencyContainerMultipleDevicesTest,
(void *)pCmdBufferPeer, sizeof(pCmdBufferPeer)); (void *)pCmdBufferPeer, sizeof(pCmdBufferPeer));
SvmAllocationData allocDataPeer(maxRootDeviceIndex); SvmAllocationData allocDataPeer(maxRootDeviceIndex);
allocDataPeer.gpuAllocations.addAllocation(&gfxAllocationPeer); allocDataPeer.gpuAllocations.addAllocation(&gfxAllocationPeer);
allocDataPeer.memoryType = InternalMemoryType::DEVICE_UNIFIED_MEMORY; allocDataPeer.memoryType = InternalMemoryType::deviceUnifiedMemory;
allocDataPeer.device = &peerDevice->getDevice(); allocDataPeer.device = &peerDevice->getDevice();
svmManager->insertSVMAlloc(allocData); svmManager->insertSVMAlloc(allocData);
@ -2022,7 +2022,7 @@ HWTEST_F(UpdateResidencyContainerMultipleDevicesTest,
EXPECT_EQ(0u, residencyContainer.size()); EXPECT_EQ(0u, residencyContainer.size());
svmManager->addInternalAllocationsToResidencyContainer(device->getDevice().getRootDeviceIndex(), svmManager->addInternalAllocationsToResidencyContainer(device->getDevice().getRootDeviceIndex(),
residencyContainer, residencyContainer,
InternalMemoryType::DEVICE_UNIFIED_MEMORY); static_cast<uint32_t>(InternalMemoryType::deviceUnifiedMemory));
EXPECT_EQ(1u, residencyContainer.size()); EXPECT_EQ(1u, residencyContainer.size());
EXPECT_EQ(residencyContainer[0]->getGpuAddress(), gfxAllocation.getGpuAddress()); EXPECT_EQ(residencyContainer[0]->getGpuAddress(), gfxAllocation.getGpuAddress());
} }
@ -2034,7 +2034,7 @@ HWTEST_F(UpdateResidencyContainerMultipleDevicesTest,
MockGraphicsAllocation gfxAllocation(device->getDevice().getRootDeviceIndex(), static_cast<void *>(pCmdBuffer), sizeof(pCmdBuffer)); MockGraphicsAllocation gfxAllocation(device->getDevice().getRootDeviceIndex(), static_cast<void *>(pCmdBuffer), sizeof(pCmdBuffer));
SvmAllocationData allocData(maxRootDeviceIndex); SvmAllocationData allocData(maxRootDeviceIndex);
allocData.gpuAllocations.addAllocation(&gfxAllocation); allocData.gpuAllocations.addAllocation(&gfxAllocation);
allocData.memoryType = InternalMemoryType::SHARED_UNIFIED_MEMORY; allocData.memoryType = InternalMemoryType::sharedUnifiedMemory;
allocData.device = nullptr; allocData.device = nullptr;
svmManager->insertSVMAlloc(allocData); svmManager->insertSVMAlloc(allocData);
@ -2044,7 +2044,7 @@ HWTEST_F(UpdateResidencyContainerMultipleDevicesTest,
EXPECT_EQ(0u, residencyContainer.size()); EXPECT_EQ(0u, residencyContainer.size());
svmManager->addInternalAllocationsToResidencyContainer(device->getDevice().getRootDeviceIndex(), svmManager->addInternalAllocationsToResidencyContainer(device->getDevice().getRootDeviceIndex(),
residencyContainer, residencyContainer,
InternalMemoryType::SHARED_UNIFIED_MEMORY); static_cast<uint32_t>(InternalMemoryType::sharedUnifiedMemory));
EXPECT_EQ(1u, residencyContainer.size()); EXPECT_EQ(1u, residencyContainer.size());
EXPECT_EQ(residencyContainer[0]->getGpuAddress(), gfxAllocation.getGpuAddress()); EXPECT_EQ(residencyContainer[0]->getGpuAddress(), gfxAllocation.getGpuAddress());
} }
@ -2057,7 +2057,7 @@ HWTEST_F(UpdateResidencyContainerMultipleDevicesTest,
static_cast<void *>(pCmdBuffer), sizeof(pCmdBuffer)); static_cast<void *>(pCmdBuffer), sizeof(pCmdBuffer));
SvmAllocationData allocData(maxRootDeviceIndex); SvmAllocationData allocData(maxRootDeviceIndex);
allocData.gpuAllocations.addAllocation(&gfxAllocation); allocData.gpuAllocations.addAllocation(&gfxAllocation);
allocData.memoryType = InternalMemoryType::SHARED_UNIFIED_MEMORY; allocData.memoryType = InternalMemoryType::sharedUnifiedMemory;
allocData.device = &peerDevice->getDevice(); allocData.device = &peerDevice->getDevice();
svmManager->insertSVMAlloc(allocData); svmManager->insertSVMAlloc(allocData);
@ -2067,7 +2067,7 @@ HWTEST_F(UpdateResidencyContainerMultipleDevicesTest,
EXPECT_EQ(0u, residencyContainer.size()); EXPECT_EQ(0u, residencyContainer.size());
svmManager->addInternalAllocationsToResidencyContainer(device->getDevice().getRootDeviceIndex(), svmManager->addInternalAllocationsToResidencyContainer(device->getDevice().getRootDeviceIndex(),
residencyContainer, residencyContainer,
InternalMemoryType::SHARED_UNIFIED_MEMORY); static_cast<uint32_t>(InternalMemoryType::sharedUnifiedMemory));
EXPECT_EQ(0u, residencyContainer.size()); EXPECT_EQ(0u, residencyContainer.size());
} }
@ -2079,7 +2079,7 @@ HWTEST_F(UpdateResidencyContainerMultipleDevicesTest,
static_cast<void *>(pCmdBuffer), sizeof(pCmdBuffer)); static_cast<void *>(pCmdBuffer), sizeof(pCmdBuffer));
SvmAllocationData allocData0(maxRootDeviceIndex); SvmAllocationData allocData0(maxRootDeviceIndex);
allocData0.gpuAllocations.addAllocation(&gfxAllocation); allocData0.gpuAllocations.addAllocation(&gfxAllocation);
allocData0.memoryType = InternalMemoryType::DEVICE_UNIFIED_MEMORY; allocData0.memoryType = InternalMemoryType::deviceUnifiedMemory;
allocData0.device = &subDevice0->getDevice(); allocData0.device = &subDevice0->getDevice();
uint32_t pCmdBufferPeer[1024]; uint32_t pCmdBufferPeer[1024];
@ -2087,7 +2087,7 @@ HWTEST_F(UpdateResidencyContainerMultipleDevicesTest,
(void *)pCmdBufferPeer, sizeof(pCmdBufferPeer)); (void *)pCmdBufferPeer, sizeof(pCmdBufferPeer));
SvmAllocationData allocData1(maxRootDeviceIndex); SvmAllocationData allocData1(maxRootDeviceIndex);
allocData1.gpuAllocations.addAllocation(&gfxAllocationPeer); allocData1.gpuAllocations.addAllocation(&gfxAllocationPeer);
allocData1.memoryType = InternalMemoryType::DEVICE_UNIFIED_MEMORY; allocData1.memoryType = InternalMemoryType::deviceUnifiedMemory;
allocData1.device = &subDevice1->getDevice(); allocData1.device = &subDevice1->getDevice();
svmManager->insertSVMAlloc(allocData0); svmManager->insertSVMAlloc(allocData0);
@ -2098,7 +2098,7 @@ HWTEST_F(UpdateResidencyContainerMultipleDevicesTest,
EXPECT_EQ(0u, residencyContainer.size()); EXPECT_EQ(0u, residencyContainer.size());
svmManager->addInternalAllocationsToResidencyContainer(device->getDevice().getRootDeviceIndex(), svmManager->addInternalAllocationsToResidencyContainer(device->getDevice().getRootDeviceIndex(),
residencyContainer, residencyContainer,
InternalMemoryType::DEVICE_UNIFIED_MEMORY); static_cast<uint32_t>(InternalMemoryType::deviceUnifiedMemory));
EXPECT_EQ(2u, residencyContainer.size()); EXPECT_EQ(2u, residencyContainer.size());
} }
@ -2110,7 +2110,7 @@ HWTEST_F(UpdateResidencyContainerMultipleDevicesTest,
static_cast<void *>(pCmdBuffer), sizeof(pCmdBuffer)); static_cast<void *>(pCmdBuffer), sizeof(pCmdBuffer));
SvmAllocationData allocData0(maxRootDeviceIndex); SvmAllocationData allocData0(maxRootDeviceIndex);
allocData0.gpuAllocations.addAllocation(&gfxAllocation); allocData0.gpuAllocations.addAllocation(&gfxAllocation);
allocData0.memoryType = InternalMemoryType::DEVICE_UNIFIED_MEMORY; allocData0.memoryType = InternalMemoryType::deviceUnifiedMemory;
allocData0.device = &subDevice0->getDevice(); allocData0.device = &subDevice0->getDevice();
uint32_t pCmdBufferPeer[1024]; uint32_t pCmdBufferPeer[1024];
@ -2118,7 +2118,7 @@ HWTEST_F(UpdateResidencyContainerMultipleDevicesTest,
(void *)pCmdBufferPeer, sizeof(pCmdBufferPeer)); (void *)pCmdBufferPeer, sizeof(pCmdBufferPeer));
SvmAllocationData allocData1(maxRootDeviceIndex); SvmAllocationData allocData1(maxRootDeviceIndex);
allocData1.gpuAllocations.addAllocation(&gfxAllocationPeer); allocData1.gpuAllocations.addAllocation(&gfxAllocationPeer);
allocData1.memoryType = InternalMemoryType::DEVICE_UNIFIED_MEMORY; allocData1.memoryType = InternalMemoryType::deviceUnifiedMemory;
allocData1.device = &subDevice1->getDevice(); allocData1.device = &subDevice1->getDevice();
svmManager->insertSVMAlloc(allocData0); svmManager->insertSVMAlloc(allocData0);
@ -2129,7 +2129,7 @@ HWTEST_F(UpdateResidencyContainerMultipleDevicesTest,
EXPECT_EQ(0u, residencyContainer.size()); EXPECT_EQ(0u, residencyContainer.size());
svmManager->addInternalAllocationsToResidencyContainer(peerDevice->getDevice().getRootDeviceIndex(), svmManager->addInternalAllocationsToResidencyContainer(peerDevice->getDevice().getRootDeviceIndex(),
residencyContainer, residencyContainer,
InternalMemoryType::DEVICE_UNIFIED_MEMORY); static_cast<uint32_t>(InternalMemoryType::deviceUnifiedMemory));
EXPECT_EQ(0u, residencyContainer.size()); EXPECT_EQ(0u, residencyContainer.size());
} }

View File

@ -635,7 +635,7 @@ struct AllocationReuseContextTest : ContextTest {
svmEntry.memoryType = type; svmEntry.memoryType = type;
svmEntry.size = allocation.getUnderlyingBufferSize(); svmEntry.size = allocation.getUnderlyingBufferSize();
svmEntry.gpuAllocations.addAllocation(&allocation); svmEntry.gpuAllocations.addAllocation(&allocation);
if (type != InternalMemoryType::DEVICE_UNIFIED_MEMORY) { if (type != InternalMemoryType::deviceUnifiedMemory) {
svmEntry.cpuAllocation = &allocation; svmEntry.cpuAllocation = &allocation;
} }
context->getSVMAllocsManager()->insertSVMAlloc(svmEntry); context->getSVMAllocsManager()->insertSVMAlloc(svmEntry);
@ -648,7 +648,7 @@ TEST_F(AllocationReuseContextTest, givenSharedSvmAllocPresentWhenGettingExisting
uint64_t svmPtrGpu = 0x1234; uint64_t svmPtrGpu = 0x1234;
void *svmPtr = reinterpret_cast<void *>(svmPtrGpu); void *svmPtr = reinterpret_cast<void *>(svmPtrGpu);
MockGraphicsAllocation allocation{svmPtr, svmPtrGpu, 400}; MockGraphicsAllocation allocation{svmPtr, svmPtrGpu, 400};
addSvmPtr(InternalMemoryType::SHARED_UNIFIED_MEMORY, allocation); addSvmPtr(InternalMemoryType::sharedUnifiedMemory, allocation);
GraphicsAllocation *retrievedAllocation{}; GraphicsAllocation *retrievedAllocation{};
InternalMemoryType retrievedMemoryType{}; InternalMemoryType retrievedMemoryType{};
@ -657,7 +657,7 @@ TEST_F(AllocationReuseContextTest, givenSharedSvmAllocPresentWhenGettingExisting
retrievedAllocation, retrievedMemoryType, retrievedCpuCopyStatus); retrievedAllocation, retrievedMemoryType, retrievedCpuCopyStatus);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(&allocation, retrievedAllocation); EXPECT_EQ(&allocation, retrievedAllocation);
EXPECT_EQ(InternalMemoryType::SHARED_UNIFIED_MEMORY, retrievedMemoryType); EXPECT_EQ(InternalMemoryType::sharedUnifiedMemory, retrievedMemoryType);
EXPECT_TRUE(retrievedCpuCopyStatus); EXPECT_TRUE(retrievedCpuCopyStatus);
} }
@ -667,7 +667,7 @@ TEST_F(AllocationReuseContextTest, givenHostSvmAllocPresentWhenGettingExistingHo
uint64_t svmPtrGpu = 0x1234; uint64_t svmPtrGpu = 0x1234;
void *svmPtr = reinterpret_cast<void *>(svmPtrGpu); void *svmPtr = reinterpret_cast<void *>(svmPtrGpu);
MockGraphicsAllocation allocation{svmPtr, svmPtrGpu, 400}; MockGraphicsAllocation allocation{svmPtr, svmPtrGpu, 400};
addSvmPtr(InternalMemoryType::HOST_UNIFIED_MEMORY, allocation); addSvmPtr(InternalMemoryType::hostUnifiedMemory, allocation);
GraphicsAllocation *retrievedAllocation{}; GraphicsAllocation *retrievedAllocation{};
InternalMemoryType retrievedMemoryType{}; InternalMemoryType retrievedMemoryType{};
@ -676,7 +676,7 @@ TEST_F(AllocationReuseContextTest, givenHostSvmAllocPresentWhenGettingExistingHo
retrievedAllocation, retrievedMemoryType, retrievedCpuCopyStatus); retrievedAllocation, retrievedMemoryType, retrievedCpuCopyStatus);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(&allocation, retrievedAllocation); EXPECT_EQ(&allocation, retrievedAllocation);
EXPECT_EQ(InternalMemoryType::HOST_UNIFIED_MEMORY, retrievedMemoryType); EXPECT_EQ(InternalMemoryType::hostUnifiedMemory, retrievedMemoryType);
EXPECT_TRUE(retrievedCpuCopyStatus); EXPECT_TRUE(retrievedCpuCopyStatus);
} }
@ -686,7 +686,7 @@ TEST_F(AllocationReuseContextTest, givenDeviceSvmAllocPresentWhenGettingExisting
uint64_t svmPtrGpu = 0x1234; uint64_t svmPtrGpu = 0x1234;
void *svmPtr = reinterpret_cast<void *>(svmPtrGpu); void *svmPtr = reinterpret_cast<void *>(svmPtrGpu);
MockGraphicsAllocation allocation{svmPtr, svmPtrGpu, 400}; MockGraphicsAllocation allocation{svmPtr, svmPtrGpu, 400};
addSvmPtr(InternalMemoryType::DEVICE_UNIFIED_MEMORY, allocation); addSvmPtr(InternalMemoryType::deviceUnifiedMemory, allocation);
GraphicsAllocation *retrievedAllocation{}; GraphicsAllocation *retrievedAllocation{};
InternalMemoryType retrievedMemoryType{}; InternalMemoryType retrievedMemoryType{};
@ -695,7 +695,7 @@ TEST_F(AllocationReuseContextTest, givenDeviceSvmAllocPresentWhenGettingExisting
retrievedAllocation, retrievedMemoryType, retrievedCpuCopyStatus); retrievedAllocation, retrievedMemoryType, retrievedCpuCopyStatus);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(&allocation, retrievedAllocation); EXPECT_EQ(&allocation, retrievedAllocation);
EXPECT_EQ(InternalMemoryType::DEVICE_UNIFIED_MEMORY, retrievedMemoryType); EXPECT_EQ(InternalMemoryType::deviceUnifiedMemory, retrievedMemoryType);
EXPECT_FALSE(retrievedCpuCopyStatus); EXPECT_FALSE(retrievedCpuCopyStatus);
} }
@ -705,7 +705,7 @@ TEST_F(AllocationReuseContextTest, givenHostSvmAllocPresentButRequestingTooBigSi
uint64_t svmPtrGpu = 0x1234; uint64_t svmPtrGpu = 0x1234;
void *svmPtr = reinterpret_cast<void *>(svmPtrGpu); void *svmPtr = reinterpret_cast<void *>(svmPtrGpu);
MockGraphicsAllocation allocation{svmPtr, svmPtrGpu, 400}; MockGraphicsAllocation allocation{svmPtr, svmPtrGpu, 400};
addSvmPtr(InternalMemoryType::HOST_UNIFIED_MEMORY, allocation); addSvmPtr(InternalMemoryType::hostUnifiedMemory, allocation);
size_t ptrSizeToRetrieve = allocation.getUnderlyingBufferSize() + 1; size_t ptrSizeToRetrieve = allocation.getUnderlyingBufferSize() + 1;
GraphicsAllocation *retrievedAllocation{}; GraphicsAllocation *retrievedAllocation{};
@ -730,7 +730,7 @@ TEST_F(AllocationReuseContextTest, givenHostPtrStoredInMapOperationsStorageWhenG
retrievedAllocation, retrievedMemoryType, retrievedCpuCopyStatus); retrievedAllocation, retrievedMemoryType, retrievedCpuCopyStatus);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(&allocation, retrievedAllocation); EXPECT_EQ(&allocation, retrievedAllocation);
EXPECT_EQ(InternalMemoryType::NOT_SPECIFIED, retrievedMemoryType); EXPECT_EQ(InternalMemoryType::notSpecified, retrievedMemoryType);
EXPECT_TRUE(retrievedCpuCopyStatus); EXPECT_TRUE(retrievedCpuCopyStatus);
} }
@ -749,7 +749,7 @@ TEST_F(AllocationReuseContextTest, givenHostPtrNotStoredInMapOperationsStorageWh
retrievedAllocation, retrievedMemoryType, retrievedCpuCopyStatus); retrievedAllocation, retrievedMemoryType, retrievedCpuCopyStatus);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(nullptr, retrievedAllocation); EXPECT_EQ(nullptr, retrievedAllocation);
EXPECT_EQ(InternalMemoryType::NOT_SPECIFIED, retrievedMemoryType); EXPECT_EQ(InternalMemoryType::notSpecified, retrievedMemoryType);
EXPECT_TRUE(retrievedCpuCopyStatus); EXPECT_TRUE(retrievedCpuCopyStatus);
} }
@ -768,7 +768,7 @@ TEST_F(AllocationReuseContextTest, givenHostPtrStoredInMapOperationsStorageAndRe
retrievedAllocation, retrievedMemoryType, retrievedCpuCopyStatus); retrievedAllocation, retrievedMemoryType, retrievedCpuCopyStatus);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(nullptr, retrievedAllocation); EXPECT_EQ(nullptr, retrievedAllocation);
EXPECT_EQ(InternalMemoryType::NOT_SPECIFIED, retrievedMemoryType); EXPECT_EQ(InternalMemoryType::notSpecified, retrievedMemoryType);
EXPECT_TRUE(retrievedCpuCopyStatus); EXPECT_TRUE(retrievedCpuCopyStatus);
} }

View File

@ -553,7 +553,7 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeEnabledWhenCallF
SvmAllocationData allocData(0); SvmAllocationData allocData(0);
allocData.gpuAllocations.addAllocation(&gfxAllocation); allocData.gpuAllocations.addAllocation(&gfxAllocation);
allocData.memoryType = InternalMemoryType::DEVICE_UNIFIED_MEMORY; allocData.memoryType = InternalMemoryType::deviceUnifiedMemory;
allocData.device = &pDevice->getDevice(); allocData.device = &pDevice->getDevice();
context->getSVMAllocsManager()->insertSVMAlloc(allocData); context->getSVMAllocsManager()->insertSVMAlloc(allocData);

View File

@ -358,12 +358,12 @@ TEST_F(KernelArgBufferTest, givenKernelExecInfoWithIndirectStatelessAccessWhenHa
mockKernel.unifiedMemoryControls.indirectHostAllocationsAllowed = true; mockKernel.unifiedMemoryControls.indirectHostAllocationsAllowed = true;
EXPECT_FALSE(mockKernel.hasIndirectStatelessAccessToHostMemory()); EXPECT_FALSE(mockKernel.hasIndirectStatelessAccessToHostMemory());
auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, mockKernel.getContext().getRootDeviceIndices(), mockKernel.getContext().getDeviceBitfields()); auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, mockKernel.getContext().getRootDeviceIndices(), mockKernel.getContext().getDeviceBitfields());
deviceProperties.device = &pClDevice->getDevice(); deviceProperties.device = &pClDevice->getDevice();
auto unifiedDeviceMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties); auto unifiedDeviceMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties);
EXPECT_FALSE(mockKernel.hasIndirectStatelessAccessToHostMemory()); EXPECT_FALSE(mockKernel.hasIndirectStatelessAccessToHostMemory());
auto hostProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, 1, mockKernel.getContext().getRootDeviceIndices(), mockKernel.getContext().getDeviceBitfields()); auto hostProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory, 1, mockKernel.getContext().getRootDeviceIndices(), mockKernel.getContext().getDeviceBitfields());
auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties); auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties);
EXPECT_TRUE(mockKernel.hasIndirectStatelessAccessToHostMemory()); EXPECT_TRUE(mockKernel.hasIndirectStatelessAccessToHostMemory());

View File

@ -1195,7 +1195,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenItUsesIndirectUnifiedMemoryDeviceAl
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>(); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
auto properties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto properties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
properties.device = pDevice; properties.device = pDevice;
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, properties); auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, properties);
@ -1221,9 +1221,9 @@ HWTEST_F(KernelResidencyTest, givenKernelUsingIndirectHostMemoryWhenMakeResident
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>(); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
deviceProperties.device = pDevice; deviceProperties.device = pDevice;
auto hostProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto hostProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
auto unifiedDeviceMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties); auto unifiedDeviceMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties);
auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties); auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties);
@ -1244,8 +1244,8 @@ HWTEST_F(KernelResidencyTest, givenKernelUsingIndirectSharedMemoryWhenMakeReside
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>(); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
auto hostProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto hostProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
auto unifiedSharedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); auto unifiedSharedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties); auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties);
@ -1266,8 +1266,8 @@ HWTEST_F(KernelResidencyTest, givenKernelUsingIndirectSharedMemoryButNotHasIndir
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>(); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
auto hostProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto hostProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
auto unifiedSharedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); auto unifiedSharedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties); auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties);
mockKernel.mockKernel->kernelHasIndirectAccess = false; mockKernel.mockKernel->kernelHasIndirectAccess = false;
@ -1290,7 +1290,7 @@ HWTEST_F(KernelResidencyTest, givenDeviceUnifiedMemoryAndPageFaultManagerWhenMak
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>(); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
deviceProperties.device = pDevice; deviceProperties.device = pDevice;
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties); auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties);
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation); auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
@ -1318,7 +1318,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAndPageFaultManagerWhenMak
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>(); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation); auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {}); mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {});
@ -1352,7 +1352,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAndNotRequiredMemSyncWhenM
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>(); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation); auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {}); mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {});
@ -1390,7 +1390,7 @@ HWTEST_F(KernelResidencyTest, givenSvmArgWhenKernelDoesNotRequireUnifiedMemorySy
MockKernelWithInternals mockKernel(*this->pClDevice, nullptr, true); MockKernelWithInternals mockKernel(*this->pClDevice, nullptr, true);
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation); auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {}); mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {});
@ -1419,7 +1419,7 @@ HWTEST_F(KernelResidencyTest, givenSvmArgWhenKernelRequireUnifiedMemorySyncThenS
MockKernelWithInternals mockKernel(*this->pClDevice, nullptr, true); MockKernelWithInternals mockKernel(*this->pClDevice, nullptr, true);
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation); auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {}); mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {});
@ -1449,7 +1449,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryRequiredMemSyncWhenMakeRes
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>(); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation); auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {}); mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {});
@ -1483,7 +1483,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAllocPageFaultManagerAndIn
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>(); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {}); mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {});
@ -1511,7 +1511,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenSetKernelExecInfoWithUnifiedMemoryI
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>(); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
deviceProperties.device = pDevice; deviceProperties.device = pDevice;
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties); auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties);
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation); auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
@ -1537,7 +1537,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenclSetKernelExecInfoWithUnifiedMemor
MockKernelWithInternals mockKernel(*this->pClDevice); MockKernelWithInternals mockKernel(*this->pClDevice);
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto deviceProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
deviceProperties.device = pDevice; deviceProperties.device = pDevice;
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties); auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties);
@ -2063,7 +2063,7 @@ HWTEST_F(KernelResidencyTest, givenSimpleKernelWhenExecEnvDoesNotHavePageFaultMa
MockKernelWithInternals mockKernel(*this->pClDevice); MockKernelWithInternals mockKernel(*this->pClDevice);
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation); auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
mockPageFaultManager->insertAllocation(reinterpret_cast<void *>(unifiedMemoryGraphicsAllocation->gpuAllocations.getDefaultGraphicsAllocation()->getGpuAddress()), 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {}); mockPageFaultManager->insertAllocation(reinterpret_cast<void *>(unifiedMemoryGraphicsAllocation->gpuAllocations.getDefaultGraphicsAllocation()->getGpuAddress()), 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {});
@ -2089,7 +2089,7 @@ HWTEST_F(KernelResidencyTest, givenSimpleKernelWhenIsUnifiedMemorySyncRequiredIs
MockKernelWithInternals mockKernel(*this->pClDevice); MockKernelWithInternals mockKernel(*this->pClDevice);
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager(); auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields()); auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex())); auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation); auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
mockPageFaultManager->insertAllocation(reinterpret_cast<void *>(unifiedMemoryGraphicsAllocation->gpuAllocations.getDefaultGraphicsAllocation()->getGpuAddress()), 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {}); mockPageFaultManager->insertAllocation(reinterpret_cast<void *>(unifiedMemoryGraphicsAllocation->gpuAllocations.getDefaultGraphicsAllocation()->getGpuAddress()), 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {});

View File

@ -1205,7 +1205,7 @@ TEST_P(ValidHostPtr, GivenUsmHostPtrWhenCreatingBufferThenBufferIsCreatedCorrect
auto memoryManager = static_cast<MockMemoryManager *>(context->getDevice(0)->getMemoryManager()); auto memoryManager = static_cast<MockMemoryManager *>(context->getDevice(0)->getMemoryManager());
memoryManager->localMemorySupported[pDevice->getRootDeviceIndex()] = true; memoryManager->localMemorySupported[pDevice->getRootDeviceIndex()] = true;
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, 1, context->getRootDeviceIndices(), context->getDeviceBitfields()); NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory, 1, context->getRootDeviceIndices(), context->getDeviceBitfields());
auto ptr = context->getSVMAllocsManager()->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties); auto ptr = context->getSVMAllocsManager()->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties);
auto buffer = Buffer::create(context.get(), CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, 64, ptr, retVal); auto buffer = Buffer::create(context.get(), CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, 64, ptr, retVal);

View File

@ -552,7 +552,7 @@ HWTEST_F(UsmDestructionTests, givenSharedUsmAllocationWhenBlockingFreeIsCalledTh
mockDevice.resetCommandStreamReceiver(mockCsr); mockDevice.resetCommandStreamReceiver(mockCsr);
*mockCsr->getTagAddress() = 5u; *mockCsr->getTagAddress() = 5u;
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields()); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields());
auto svmAllocationsManager = mockContext.getSVMAllocsManager(); auto svmAllocationsManager = mockContext.getSVMAllocsManager();
auto sharedMemory = svmAllocationsManager->createUnifiedAllocationWithDeviceStorage(4096u, {}, unifiedMemoryProperties); auto sharedMemory = svmAllocationsManager->createUnifiedAllocationWithDeviceStorage(4096u, {}, unifiedMemoryProperties);
@ -586,7 +586,7 @@ HWTEST_F(UsmDestructionTests, givenUsmAllocationWhenBlockingFreeIsCalledThenWait
mockDevice.resetCommandStreamReceiver(mockCsr); mockDevice.resetCommandStreamReceiver(mockCsr);
*mockCsr->getTagAddress() = 5u; *mockCsr->getTagAddress() = 5u;
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, 1, mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields()); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory, 1, mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields());
auto svmAllocationsManager = mockContext.getSVMAllocsManager(); auto svmAllocationsManager = mockContext.getSVMAllocsManager();
auto hostMemory = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); auto hostMemory = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);

View File

@ -96,7 +96,7 @@ TEST_F(SVMMemoryAllocatorTest, givenSvmManagerWhenOperatedOnThenCorrectAllocatio
svmData.gpuAllocations.addAllocation(allocation); svmData.gpuAllocations.addAllocation(allocation);
svmData.cpuAllocation = nullptr; svmData.cpuAllocation = nullptr;
svmData.size = size; svmData.size = size;
svmData.memoryType = InternalMemoryType::SHARED_UNIFIED_MEMORY; svmData.memoryType = InternalMemoryType::sharedUnifiedMemory;
svmData.device = nullptr; svmData.device = nullptr;
auto ptr = reinterpret_cast<void *>(allocation->getGpuAddress()); auto ptr = reinterpret_cast<void *>(allocation->getGpuAddress());
@ -168,7 +168,7 @@ TEST_F(SVMMemoryAllocatorTest, whenCouldNotAllocateInMemoryManagerThenCreateUnif
MockContext mockContext; MockContext mockContext;
auto device = mockContext.getDevice(0u); auto device = mockContext.getDevice(0u);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = &device->getDevice(); unifiedMemoryProperties.device = &device->getDevice();
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
EXPECT_EQ(nullptr, ptr); EXPECT_EQ(nullptr, ptr);
@ -209,7 +209,7 @@ TEST_F(SVMMemoryAllocatorTest, whenCoherentFlagIsPassedThenAllocationIsCoherent)
} }
TEST_F(SVMLocalMemoryAllocatorTest, whenDeviceAllocationIsCreatedThenItIsStoredWithWriteCombinedTypeInAllocationMap) { TEST_F(SVMLocalMemoryAllocatorTest, whenDeviceAllocationIsCreatedThenItIsStoredWithWriteCombinedTypeInAllocationMap) {
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.allocationFlags.allocFlags.allocWriteCombined = true; unifiedMemoryProperties.allocationFlags.allocFlags.allocWriteCombined = true;
auto allocationSize = 4000u; auto allocationSize = 4000u;
auto ptr = svmManager->createUnifiedMemoryAllocation(4000u, unifiedMemoryProperties); auto ptr = svmManager->createUnifiedMemoryAllocation(4000u, unifiedMemoryProperties);
@ -218,7 +218,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenDeviceAllocationIsCreatedThenItIsStoredW
EXPECT_EQ(nullptr, allocation->cpuAllocation); EXPECT_EQ(nullptr, allocation->cpuAllocation);
auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(mockRootDeviceIndex); auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(mockRootDeviceIndex);
EXPECT_NE(nullptr, gpuAllocation); EXPECT_NE(nullptr, gpuAllocation);
EXPECT_EQ(InternalMemoryType::DEVICE_UNIFIED_MEMORY, allocation->memoryType); EXPECT_EQ(InternalMemoryType::deviceUnifiedMemory, allocation->memoryType);
EXPECT_EQ(allocationSize, allocation->size); EXPECT_EQ(allocationSize, allocation->size);
EXPECT_EQ(gpuAllocation->getMemoryPool(), MemoryPool::localMemory); EXPECT_EQ(gpuAllocation->getMemoryPool(), MemoryPool::localMemory);
@ -234,7 +234,7 @@ TEST_F(SVMMemoryAllocatorTest, givenNoWriteCombinedFlagwhenDeviceAllocationIsCre
} }
MockContext mockContext; MockContext mockContext;
auto device = mockContext.getDevice(0u); auto device = mockContext.getDevice(0u);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = &device->getDevice(); unifiedMemoryProperties.device = &device->getDevice();
unifiedMemoryProperties.allocationFlags.allocFlags.allocWriteCombined = false; unifiedMemoryProperties.allocationFlags.allocFlags.allocWriteCombined = false;
auto allocationSize = 4096u; auto allocationSize = 4096u;
@ -244,7 +244,7 @@ TEST_F(SVMMemoryAllocatorTest, givenNoWriteCombinedFlagwhenDeviceAllocationIsCre
EXPECT_EQ(nullptr, allocation->cpuAllocation); EXPECT_EQ(nullptr, allocation->cpuAllocation);
auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(mockRootDeviceIndex); auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(mockRootDeviceIndex);
EXPECT_NE(nullptr, gpuAllocation); EXPECT_NE(nullptr, gpuAllocation);
EXPECT_EQ(InternalMemoryType::DEVICE_UNIFIED_MEMORY, allocation->memoryType); EXPECT_EQ(InternalMemoryType::deviceUnifiedMemory, allocation->memoryType);
EXPECT_EQ(allocationSize, allocation->size); EXPECT_EQ(allocationSize, allocation->size);
EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), gpuAllocation->getUnderlyingBufferSize()); EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), gpuAllocation->getUnderlyingBufferSize());
@ -254,7 +254,7 @@ TEST_F(SVMMemoryAllocatorTest, givenNoWriteCombinedFlagwhenDeviceAllocationIsCre
} }
TEST_F(SVMMemoryAllocatorTest, whenHostAllocationIsCreatedThenItIsStoredWithProperTypeInAllocationMap) { TEST_F(SVMMemoryAllocatorTest, whenHostAllocationIsCreatedThenItIsStoredWithProperTypeInAllocationMap) {
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto allocationSize = 4096u; auto allocationSize = 4096u;
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
EXPECT_NE(nullptr, ptr); EXPECT_NE(nullptr, ptr);
@ -262,7 +262,7 @@ TEST_F(SVMMemoryAllocatorTest, whenHostAllocationIsCreatedThenItIsStoredWithProp
EXPECT_EQ(nullptr, allocation->cpuAllocation); EXPECT_EQ(nullptr, allocation->cpuAllocation);
auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(mockRootDeviceIndex); auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(mockRootDeviceIndex);
EXPECT_NE(nullptr, gpuAllocation); EXPECT_NE(nullptr, gpuAllocation);
EXPECT_EQ(InternalMemoryType::HOST_UNIFIED_MEMORY, allocation->memoryType); EXPECT_EQ(InternalMemoryType::hostUnifiedMemory, allocation->memoryType);
EXPECT_EQ(allocationSize, allocation->size); EXPECT_EQ(allocationSize, allocation->size);
EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), gpuAllocation->getUnderlyingBufferSize()); EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), gpuAllocation->getUnderlyingBufferSize());
@ -279,7 +279,7 @@ TEST_F(SVMMemoryAllocatorTest, whenCouldNotAllocateInMemoryManagerThenCreateShar
FailMemoryManager failMemoryManager(executionEnvironment); FailMemoryManager failMemoryManager(executionEnvironment);
svmManager->memoryManager = &failMemoryManager; svmManager->memoryManager = &failMemoryManager;
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
EXPECT_EQ(nullptr, ptr); EXPECT_EQ(nullptr, ptr);
EXPECT_EQ(0u, svmManager->svmAllocs.getNumAllocs()); EXPECT_EQ(0u, svmManager->svmAllocs.getNumAllocs());
@ -288,7 +288,7 @@ TEST_F(SVMMemoryAllocatorTest, whenCouldNotAllocateInMemoryManagerThenCreateShar
TEST_F(SVMMemoryAllocatorTest, whenSharedAllocationIsCreatedThenItIsStoredWithProperTypeInAllocationMap) { TEST_F(SVMMemoryAllocatorTest, whenSharedAllocationIsCreatedThenItIsStoredWithProperTypeInAllocationMap) {
MockCommandQueue cmdQ; MockCommandQueue cmdQ;
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto allocationSize = 4096u; auto allocationSize = 4096u;
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
@ -297,7 +297,7 @@ TEST_F(SVMMemoryAllocatorTest, whenSharedAllocationIsCreatedThenItIsStoredWithPr
EXPECT_EQ(nullptr, allocation->cpuAllocation); EXPECT_EQ(nullptr, allocation->cpuAllocation);
auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(mockRootDeviceIndex); auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(mockRootDeviceIndex);
EXPECT_NE(nullptr, gpuAllocation); EXPECT_NE(nullptr, gpuAllocation);
EXPECT_EQ(InternalMemoryType::SHARED_UNIFIED_MEMORY, allocation->memoryType); EXPECT_EQ(InternalMemoryType::sharedUnifiedMemory, allocation->memoryType);
EXPECT_EQ(allocationSize, allocation->size); EXPECT_EQ(allocationSize, allocation->size);
EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), gpuAllocation->getUnderlyingBufferSize()); EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), gpuAllocation->getUnderlyingBufferSize());
@ -314,7 +314,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenSharedAllocationIsCreatedWithDebugFlagSe
debugManager.flags.AllocateSharedAllocationsWithCpuAndGpuStorage.set(true); debugManager.flags.AllocateSharedAllocationsWithCpuAndGpuStorage.set(true);
auto device = mockContext.getDevice(0u); auto device = mockContext.getDevice(0u);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = &device->getDevice(); unifiedMemoryProperties.device = &device->getDevice();
auto allocationSize = 4096u; auto allocationSize = 4096u;
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
@ -324,7 +324,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenSharedAllocationIsCreatedWithDebugFlagSe
auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex()); auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex());
EXPECT_NE(nullptr, allocation->cpuAllocation); EXPECT_NE(nullptr, allocation->cpuAllocation);
EXPECT_NE(nullptr, gpuAllocation); EXPECT_NE(nullptr, gpuAllocation);
EXPECT_EQ(InternalMemoryType::SHARED_UNIFIED_MEMORY, allocation->memoryType); EXPECT_EQ(InternalMemoryType::sharedUnifiedMemory, allocation->memoryType);
EXPECT_EQ(allocationSize, allocation->size); EXPECT_EQ(allocationSize, allocation->size);
EXPECT_EQ(mockContext.getDevice(0u), allocation->device->getSpecializedDevice<ClDevice>()); EXPECT_EQ(mockContext.getDevice(0u), allocation->device->getSpecializedDevice<ClDevice>());
@ -346,7 +346,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenSharedAllocationIsCreatedWithLocalMemory
DebugManagerStateRestore restore; DebugManagerStateRestore restore;
debugManager.flags.EnableLocalMemory.set(1); debugManager.flags.EnableLocalMemory.set(1);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto allocationSize = 4096u; auto allocationSize = 4096u;
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
auto alignment = executionEnvironment.rootDeviceEnvironments[0]->getProductHelper().getSvmCpuAlignment(); auto alignment = executionEnvironment.rootDeviceEnvironments[0]->getProductHelper().getSvmCpuAlignment();
@ -355,7 +355,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenSharedAllocationIsCreatedWithLocalMemory
auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(mockRootDeviceIndex); auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(mockRootDeviceIndex);
EXPECT_NE(nullptr, allocation->cpuAllocation); EXPECT_NE(nullptr, allocation->cpuAllocation);
EXPECT_NE(nullptr, gpuAllocation); EXPECT_NE(nullptr, gpuAllocation);
EXPECT_EQ(InternalMemoryType::SHARED_UNIFIED_MEMORY, allocation->memoryType); EXPECT_EQ(InternalMemoryType::sharedUnifiedMemory, allocation->memoryType);
EXPECT_EQ(allocationSize, allocation->size); EXPECT_EQ(allocationSize, allocation->size);
EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), gpuAllocation->getUnderlyingBufferSize()); EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), gpuAllocation->getUnderlyingBufferSize());
@ -377,7 +377,7 @@ TEST_F(SVMMemoryAllocatorTest, givenSharedAllocationsDebugFlagWhenDeviceMemoryIs
MockContext mockContext; MockContext mockContext;
auto device = mockContext.getDevice(0u); auto device = mockContext.getDevice(0u);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = &device->getDevice(); unifiedMemoryProperties.device = &device->getDevice();
auto allocationSize = 4096u; auto allocationSize = 4096u;
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
@ -386,7 +386,7 @@ TEST_F(SVMMemoryAllocatorTest, givenSharedAllocationsDebugFlagWhenDeviceMemoryIs
EXPECT_EQ(nullptr, allocation->cpuAllocation); EXPECT_EQ(nullptr, allocation->cpuAllocation);
auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(mockRootDeviceIndex); auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(mockRootDeviceIndex);
EXPECT_NE(nullptr, gpuAllocation); EXPECT_NE(nullptr, gpuAllocation);
EXPECT_EQ(InternalMemoryType::DEVICE_UNIFIED_MEMORY, allocation->memoryType); EXPECT_EQ(InternalMemoryType::deviceUnifiedMemory, allocation->memoryType);
EXPECT_EQ(allocationSize, allocation->size); EXPECT_EQ(allocationSize, allocation->size);
EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), gpuAllocation->getUnderlyingBufferSize()); EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), gpuAllocation->getUnderlyingBufferSize());
@ -555,7 +555,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithMultipleBitsSetWhenSharedUnifiedM
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xf)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xf)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
svmManager->multiOsContextSupport = true; svmManager->multiOsContextSupport = true;
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
@ -570,7 +570,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithSingleBitSetWh
MockCommandQueue cmdQ; MockCommandQueue cmdQ;
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x8)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x8)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
@ -592,7 +592,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithMultipleBitsSetWhenMultiOsContext
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xf)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xf)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
svmManager->multiOsContextSupport = true; svmManager->multiOsContextSupport = true;
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
@ -616,7 +616,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithMultipleBitsSetWhenMultiOsContext
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xE)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xE)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
svmManager->multiOsContextSupport = false; svmManager->multiOsContextSupport = false;
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
@ -640,7 +640,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithMultipleBitsSetWhenMultiOsContext
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xf)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xf)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = &device->getDevice(); unifiedMemoryProperties.device = &device->getDevice();
svmManager->multiOsContextSupport = true; svmManager->multiOsContextSupport = true;
auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); auto ptr = svmManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
@ -659,7 +659,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithTwoBitsSetWhenMultiOsContextFlagT
auto memoryManager = std::make_unique<MemoryManagerPropertiesCheck>(false, true, executionEnvironment); auto memoryManager = std::make_unique<MemoryManagerPropertiesCheck>(false, true, executionEnvironment);
auto svmManager = std::make_unique<MockSVMAllocsManager>(memoryManager.get(), false); auto svmManager = std::make_unique<MockSVMAllocsManager>(memoryManager.get(), false);
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x6)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x6)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto device = mockContext.getDevice(0u); auto device = mockContext.getDevice(0u);
unifiedMemoryProperties.device = &device->getDevice(); unifiedMemoryProperties.device = &device->getDevice();
@ -686,7 +686,7 @@ TEST(UnifiedMemoryTest, givenDeviceBitfieldWithSingleBitsSetWhenMultiOsContextFl
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
svmManager->multiOsContextSupport = true; svmManager->multiOsContextSupport = true;
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
@ -707,7 +707,7 @@ TEST(UnifiedMemoryTest, givenInternalAllocationWhenItIsMadeResidentThenNewTracki
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
@ -741,7 +741,7 @@ TEST(UnifiedMemoryTest, givenInternalAllocationWhenItIsMadeResidentThenSubsequen
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
ASSERT_NE(nullptr, ptr); ASSERT_NE(nullptr, ptr);
@ -779,7 +779,7 @@ TEST(UnifiedMemoryTest, givenInternalAllocationWhenNewAllocationIsCreatedThenItI
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
ASSERT_NE(nullptr, ptr); ASSERT_NE(nullptr, ptr);
@ -819,7 +819,7 @@ TEST(UnifiedMemoryTest, givenInternalAllocationsWhenTheyArePreparedForFreeingThe
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); auto ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
ASSERT_NE(nullptr, ptr); ASSERT_NE(nullptr, ptr);
@ -844,7 +844,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithSingleBitSetWh
MockCommandQueue cmdQ; MockCommandQueue cmdQ;
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x8)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x8)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, &cmdQ);
@ -858,7 +858,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithSingleBitSetWh
TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithMultiDeviceBitSetWhenMultiOsContextFlagTrueThenProperPropertiesArePassedToMemoryManager) { TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithMultiDeviceBitSetWhenMultiOsContextFlagTrueThenProperPropertiesArePassedToMemoryManager) {
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xF)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xF)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
svmManager->multiOsContextSupport = true; svmManager->multiOsContextSupport = true;
auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties); auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties);
@ -876,7 +876,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithMultiDeviceBit
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xE)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xE)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
svmManager->multiOsContextSupport = false; svmManager->multiOsContextSupport = false;
auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties); auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties);
@ -895,7 +895,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithMultiDeviceBit
TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithSingleDeviceBitSetWhenMultiOsContextFlagTrueThenProperPropertiesArePassedToMemoryManager) { TEST_F(UnifiedMemoryManagerPropertiesTest, givenDeviceBitfieldWithSingleDeviceBitSetWhenMultiOsContextFlagTrueThenProperPropertiesArePassedToMemoryManager) {
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
svmManager->multiOsContextSupport = true; svmManager->multiOsContextSupport = true;
auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties); auto ptr = svmManager->createUnifiedAllocationWithDeviceStorage(10 * MemoryConstants::pageSize64k, {}, unifiedMemoryProperties);
@ -911,7 +911,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest,
givenSvmManagerMultiOsContextSupportFlagTrueWhenRootDeviceIsSingleThenMultiStorageFlagFalse) { givenSvmManagerMultiOsContextSupportFlagTrueWhenRootDeviceIsSingleThenMultiStorageFlagFalse) {
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
svmManager->multiOsContextSupport = true; svmManager->multiOsContextSupport = true;
auto ptr = svmManager->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties); auto ptr = svmManager->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties);
@ -927,7 +927,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest,
given1ByteAsAllocationSizeWhenHostMemAllocIsCreatedItIsAlignedTo4k) { given1ByteAsAllocationSizeWhenHostMemAllocIsCreatedItIsAlignedTo4k) {
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0x1)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
svmManager->multiOsContextSupport = true; svmManager->multiOsContextSupport = true;
auto ptr = svmManager->createHostUnifiedMemoryAllocation(1u, unifiedMemoryProperties); auto ptr = svmManager->createHostUnifiedMemoryAllocation(1u, unifiedMemoryProperties);
@ -942,7 +942,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest,
givenSvmManagerMultiOsContextSupportFlagFalseWhenRootDeviceIsMultiThenMultiStorageFlagFalse) { givenSvmManagerMultiOsContextSupportFlagFalseWhenRootDeviceIsMultiThenMultiStorageFlagFalse) {
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xF)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xF)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
svmManager->multiOsContextSupport = false; svmManager->multiOsContextSupport = false;
auto ptr = svmManager->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties); auto ptr = svmManager->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties);
@ -958,7 +958,7 @@ TEST_F(UnifiedMemoryManagerPropertiesTest,
givenSvmManagerMultiOsContextSupportFlagTrueWhenRootDeviceIsMultiThenMultiStorageFlagTrue) { givenSvmManagerMultiOsContextSupportFlagTrueWhenRootDeviceIsMultiThenMultiStorageFlagTrue) {
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xF)}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, DeviceBitfield(0xF)}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
svmManager->multiOsContextSupport = true; svmManager->multiOsContextSupport = true;
auto ptr = svmManager->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties); auto ptr = svmManager->createHostUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties);
@ -993,7 +993,7 @@ TEST_F(ShareableUnifiedMemoryManagerPropertiesTest, givenShareableUnifiedPropert
MockContext mockContext; MockContext mockContext;
auto device = mockContext.getDevice(0u); auto device = mockContext.getDevice(0u);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = &device->getDevice(); unifiedMemoryProperties.device = &device->getDevice();
unifiedMemoryProperties.allocationFlags.flags.shareable = 1; unifiedMemoryProperties.allocationFlags.flags.shareable = 1;
@ -1325,7 +1325,7 @@ class TestCommandQueueHw : public CommandQueueHw<GfxFamily> {
}; };
HWTEST_F(UnifiedSharedMemoryHWTest, givenDeviceUsmAllocationWhenWriteBufferThenCpuPtrIsNotUsed) { HWTEST_F(UnifiedSharedMemoryHWTest, givenDeviceUsmAllocationWhenWriteBufferThenCpuPtrIsNotUsed) {
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1,
mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields()); mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields());
unifiedMemoryProperties.device = &mockContext.getDevice(0)->getDevice(); unifiedMemoryProperties.device = &mockContext.getDevice(0)->getDevice();
auto deviceMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); auto deviceMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
@ -1353,7 +1353,7 @@ HWTEST_F(UnifiedSharedMemoryHWTest, givenDeviceUsmAllocationWhenWriteBufferThenC
} }
HWTEST_F(UnifiedSharedMemoryHWTest, givenDeviceUsmAllocationWhenReadBufferThenCpuPtrIsNotUsed) { HWTEST_F(UnifiedSharedMemoryHWTest, givenDeviceUsmAllocationWhenReadBufferThenCpuPtrIsNotUsed) {
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1,
mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields()); mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields());
unifiedMemoryProperties.device = &mockContext.getDevice(0)->getDevice(); unifiedMemoryProperties.device = &mockContext.getDevice(0)->getDevice();
auto deviceMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); auto deviceMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
@ -1381,7 +1381,7 @@ HWTEST_F(UnifiedSharedMemoryHWTest, givenDeviceUsmAllocationWhenReadBufferThenCp
} }
HWTEST_F(UnifiedSharedMemoryHWTest, givenSharedUsmAllocationWhenWriteBufferThenCpuPtrIsNotUsed) { HWTEST_F(UnifiedSharedMemoryHWTest, givenSharedUsmAllocationWhenWriteBufferThenCpuPtrIsNotUsed) {
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1,
mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields()); mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields());
auto sharedMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); auto sharedMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
auto svmAllocation = mockContext.getSVMAllocsManager()->getSVMAlloc(sharedMemory); auto svmAllocation = mockContext.getSVMAllocsManager()->getSVMAlloc(sharedMemory);
@ -1408,7 +1408,7 @@ HWTEST_F(UnifiedSharedMemoryHWTest, givenSharedUsmAllocationWhenWriteBufferThenC
} }
HWTEST_F(UnifiedSharedMemoryHWTest, givenSharedUsmAllocationWhenReadBufferThenCpuPtrIsNotUsed) { HWTEST_F(UnifiedSharedMemoryHWTest, givenSharedUsmAllocationWhenReadBufferThenCpuPtrIsNotUsed) {
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1,
mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields()); mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields());
auto sharedMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties); auto sharedMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
auto svmAllocation = mockContext.getSVMAllocsManager()->getSVMAlloc(sharedMemory); auto svmAllocation = mockContext.getSVMAllocsManager()->getSVMAlloc(sharedMemory);

View File

@ -18,7 +18,7 @@ std::unique_ptr<PrefetchManager> PrefetchManager::create() {
void PrefetchManager::insertAllocation(PrefetchContext &context, const void *usmPtr, SvmAllocationData &allocData) { void PrefetchManager::insertAllocation(PrefetchContext &context, const void *usmPtr, SvmAllocationData &allocData) {
std::unique_lock<SpinLock> lock{context.lock}; std::unique_lock<SpinLock> lock{context.lock};
if (allocData.memoryType == InternalMemoryType::SHARED_UNIFIED_MEMORY) { if (allocData.memoryType == InternalMemoryType::sharedUnifiedMemory) {
context.allocations.push_back(usmPtr); context.allocations.push_back(usmPtr);
} }
} }

View File

@ -141,7 +141,7 @@ void SVMAllocsManager::addInternalAllocationsToResidencyContainer(uint32_t rootD
continue; continue;
} }
if (!(allocation.second->memoryType & requestedTypesMask) || if (!(static_cast<uint32_t>(allocation.second->memoryType) & requestedTypesMask) ||
(nullptr == allocation.second->gpuAllocations.getGraphicsAllocation(rootDeviceIndex))) { (nullptr == allocation.second->gpuAllocations.getGraphicsAllocation(rootDeviceIndex))) {
continue; continue;
} }
@ -154,7 +154,7 @@ void SVMAllocsManager::addInternalAllocationsToResidencyContainer(uint32_t rootD
void SVMAllocsManager::makeInternalAllocationsResident(CommandStreamReceiver &commandStreamReceiver, uint32_t requestedTypesMask) { void SVMAllocsManager::makeInternalAllocationsResident(CommandStreamReceiver &commandStreamReceiver, uint32_t requestedTypesMask) {
std::shared_lock<std::shared_mutex> lock(mtx); std::shared_lock<std::shared_mutex> lock(mtx);
for (auto &allocation : this->svmAllocs.allocations) { for (auto &allocation : this->svmAllocs.allocations) {
if (allocation.second->memoryType & requestedTypesMask) { if (static_cast<uint32_t>(allocation.second->memoryType) & requestedTypesMask) {
auto gpuAllocation = allocation.second->gpuAllocations.getGraphicsAllocation(commandStreamReceiver.getRootDeviceIndex()); auto gpuAllocation = allocation.second->gpuAllocations.getGraphicsAllocation(commandStreamReceiver.getRootDeviceIndex());
if (gpuAllocation == nullptr) { if (gpuAllocation == nullptr) {
continue; continue;
@ -189,7 +189,7 @@ void *SVMAllocsManager::createSVMAlloc(size_t size, const SvmAllocationPropertie
if (!memoryManager->isLocalMemorySupported(*rootDeviceIndices.begin())) { if (!memoryManager->isLocalMemorySupported(*rootDeviceIndices.begin())) {
return createZeroCopySvmAllocation(size, svmProperties, rootDeviceIndices, subdeviceBitfields); return createZeroCopySvmAllocation(size, svmProperties, rootDeviceIndices, subdeviceBitfields);
} else { } else {
UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::NOT_SPECIFIED, 1, rootDeviceIndices, subdeviceBitfields); UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::notSpecified, 1, rootDeviceIndices, subdeviceBitfields);
return createUnifiedAllocationWithDeviceStorage(size, svmProperties, unifiedMemoryProperties); return createUnifiedAllocationWithDeviceStorage(size, svmProperties, unifiedMemoryProperties);
} }
} }
@ -283,7 +283,7 @@ void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size,
unifiedMemoryProperties.flags.preferCompressed = compressionEnabled || memoryProperties.allocationFlags.flags.compressedHint; unifiedMemoryProperties.flags.preferCompressed = compressionEnabled || memoryProperties.allocationFlags.flags.compressedHint;
unifiedMemoryProperties.flags.resource48Bit = memoryProperties.allocationFlags.flags.resource48Bit; unifiedMemoryProperties.flags.resource48Bit = memoryProperties.allocationFlags.flags.resource48Bit;
if (memoryProperties.memoryType == InternalMemoryType::DEVICE_UNIFIED_MEMORY) { if (memoryProperties.memoryType == InternalMemoryType::deviceUnifiedMemory) {
unifiedMemoryProperties.flags.isUSMDeviceAllocation = true; unifiedMemoryProperties.flags.isUSMDeviceAllocation = true;
if (this->usmDeviceAllocationsCacheEnabled) { if (this->usmDeviceAllocationsCacheEnabled) {
void *allocationFromCache = this->usmDeviceAllocationsCache.get(size, memoryProperties, this); void *allocationFromCache = this->usmDeviceAllocationsCache.get(size, memoryProperties, this);
@ -291,7 +291,7 @@ void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size,
return allocationFromCache; return allocationFromCache;
} }
} }
} else if (memoryProperties.memoryType == InternalMemoryType::HOST_UNIFIED_MEMORY) { } else if (memoryProperties.memoryType == InternalMemoryType::hostUnifiedMemory) {
unifiedMemoryProperties.flags.isUSMHostAllocation = true; unifiedMemoryProperties.flags.isUSMHostAllocation = true;
} else { } else {
unifiedMemoryProperties.flags.isUSMHostAllocation = useExternalHostPtrForCpu; unifiedMemoryProperties.flags.isUSMHostAllocation = useExternalHostPtrForCpu;
@ -299,7 +299,7 @@ void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size,
GraphicsAllocation *unifiedMemoryAllocation = memoryManager->allocateGraphicsMemoryWithProperties(unifiedMemoryProperties, externalPtr); GraphicsAllocation *unifiedMemoryAllocation = memoryManager->allocateGraphicsMemoryWithProperties(unifiedMemoryProperties, externalPtr);
if (!unifiedMemoryAllocation) { if (!unifiedMemoryAllocation) {
if (memoryProperties.memoryType == InternalMemoryType::DEVICE_UNIFIED_MEMORY && if (memoryProperties.memoryType == InternalMemoryType::deviceUnifiedMemory &&
this->usmDeviceAllocationsCacheEnabled) { this->usmDeviceAllocationsCacheEnabled) {
this->trimUSMDeviceAllocCache(); this->trimUSMDeviceAllocCache();
unifiedMemoryAllocation = memoryManager->allocateGraphicsMemoryWithProperties(unifiedMemoryProperties, externalPtr); unifiedMemoryAllocation = memoryManager->allocateGraphicsMemoryWithProperties(unifiedMemoryProperties, externalPtr);
@ -434,7 +434,7 @@ bool SVMAllocsManager::freeSVMAlloc(void *ptr, bool blocking) {
} }
SvmAllocationData *svmData = getSVMAlloc(ptr); SvmAllocationData *svmData = getSVMAlloc(ptr);
if (svmData) { if (svmData) {
if (InternalMemoryType::DEVICE_UNIFIED_MEMORY == svmData->memoryType && if (InternalMemoryType::deviceUnifiedMemory == svmData->memoryType &&
this->usmDeviceAllocationsCacheEnabled) { this->usmDeviceAllocationsCacheEnabled) {
this->usmDeviceAllocationsCache.insert(svmData->size, ptr); this->usmDeviceAllocationsCache.insert(svmData->size, ptr);
return true; return true;
@ -457,7 +457,7 @@ bool SVMAllocsManager::freeSVMAllocDefer(void *ptr) {
SvmAllocationData *svmData = getSVMAlloc(ptr); SvmAllocationData *svmData = getSVMAlloc(ptr);
if (svmData) { if (svmData) {
if (InternalMemoryType::DEVICE_UNIFIED_MEMORY == svmData->memoryType && if (InternalMemoryType::deviceUnifiedMemory == svmData->memoryType &&
this->usmDeviceAllocationsCacheEnabled) { this->usmDeviceAllocationsCacheEnabled) {
this->usmDeviceAllocationsCache.insert(svmData->size, ptr); this->usmDeviceAllocationsCache.insert(svmData->size, ptr);
return true; return true;
@ -666,7 +666,7 @@ void SVMAllocsManager::freeSvmAllocationWithDeviceStorage(SvmAllocationData *svm
bool SVMAllocsManager::hasHostAllocations() { bool SVMAllocsManager::hasHostAllocations() {
std::shared_lock<std::shared_mutex> lock(mtx); std::shared_lock<std::shared_mutex> lock(mtx);
for (auto &allocation : this->svmAllocs.allocations) { for (auto &allocation : this->svmAllocs.allocations) {
if (allocation.second->memoryType == InternalMemoryType::HOST_UNIFIED_MEMORY) { if (allocation.second->memoryType == InternalMemoryType::hostUnifiedMemory) {
return true; return true;
} }
} }
@ -751,7 +751,7 @@ AllocationType SVMAllocsManager::getGraphicsAllocationTypeAndCompressionPreferen
compressionEnabled = false; compressionEnabled = false;
AllocationType allocationType = AllocationType::bufferHostMemory; AllocationType allocationType = AllocationType::bufferHostMemory;
if (unifiedMemoryProperties.memoryType == InternalMemoryType::DEVICE_UNIFIED_MEMORY) { if (unifiedMemoryProperties.memoryType == InternalMemoryType::deviceUnifiedMemory) {
if (unifiedMemoryProperties.allocationFlags.allocFlags.allocWriteCombined) { if (unifiedMemoryProperties.allocationFlags.allocFlags.allocWriteCombined) {
allocationType = AllocationType::writeCombined; allocationType = AllocationType::writeCombined;
} else { } else {
@ -797,12 +797,12 @@ void SVMAllocsManager::prefetchMemory(Device &device, CommandStreamReceiver &com
bool isChunkingNeededForDeviceAllocations = false; bool isChunkingNeededForDeviceAllocations = false;
if (NEO::debugManager.flags.EnableBOChunkingDevMemPrefetch.get() && if (NEO::debugManager.flags.EnableBOChunkingDevMemPrefetch.get() &&
memoryManager->isKmdMigrationAvailable(device.getRootDeviceIndex()) && memoryManager->isKmdMigrationAvailable(device.getRootDeviceIndex()) &&
(svmData.memoryType == InternalMemoryType::DEVICE_UNIFIED_MEMORY)) { (svmData.memoryType == InternalMemoryType::deviceUnifiedMemory)) {
isChunkingNeededForDeviceAllocations = true; isChunkingNeededForDeviceAllocations = true;
} }
if ((memoryManager->isKmdMigrationAvailable(device.getRootDeviceIndex()) && if ((memoryManager->isKmdMigrationAvailable(device.getRootDeviceIndex()) &&
(svmData.memoryType == InternalMemoryType::SHARED_UNIFIED_MEMORY)) || (svmData.memoryType == InternalMemoryType::sharedUnifiedMemory)) ||
isChunkingNeededForDeviceAllocations) { isChunkingNeededForDeviceAllocations) {
auto gfxAllocation = svmData.gpuAllocations.getGraphicsAllocation(device.getRootDeviceIndex()); auto gfxAllocation = svmData.gpuAllocations.getGraphicsAllocation(device.getRootDeviceIndex());
auto subDeviceIds = commandStreamReceiver.getActivePartitions() > 1 ? getSubDeviceIds(commandStreamReceiver) : SubDeviceIdsVec{getSubDeviceId(device)}; auto subDeviceIds = commandStreamReceiver.getActivePartitions() > 1 ? getSubDeviceIds(commandStreamReceiver) : SubDeviceIdsVec{getSubDeviceId(device)};

View File

@ -55,7 +55,7 @@ struct SvmAllocationData {
VirtualMemoryReservation *virtualReservationData = nullptr; VirtualMemoryReservation *virtualReservationData = nullptr;
size_t size = 0; size_t size = 0;
size_t pageSizeForAlignment = 0; size_t pageSizeForAlignment = 0;
InternalMemoryType memoryType = InternalMemoryType::SVM; InternalMemoryType memoryType = InternalMemoryType::svm;
MemoryProperties allocationFlagsProperty; MemoryProperties allocationFlagsProperty;
Device *device = nullptr; Device *device = nullptr;
bool isImportedAllocation = false; bool isImportedAllocation = false;
@ -137,7 +137,7 @@ class SVMAllocsManager {
rootDeviceIndices(rootDeviceIndices), rootDeviceIndices(rootDeviceIndices),
subdeviceBitfields(subdeviceBitfields){}; subdeviceBitfields(subdeviceBitfields){};
uint32_t getRootDeviceIndex() const; uint32_t getRootDeviceIndex() const;
InternalMemoryType memoryType = InternalMemoryType::NOT_SPECIFIED; InternalMemoryType memoryType = InternalMemoryType::notSpecified;
MemoryProperties allocationFlags; MemoryProperties allocationFlags;
Device *device = nullptr; Device *device = nullptr;
size_t alignment; size_t alignment;

View File

@ -35,7 +35,7 @@ GraphicsAllocation *allocateGlobalsSurface(NEO::SVMAllocsManager *const svmAlloc
rootDeviceIndices.pushUnique(rootDeviceIndex); rootDeviceIndices.pushUnique(rootDeviceIndex);
std::map<uint32_t, DeviceBitfield> subDeviceBitfields; std::map<uint32_t, DeviceBitfield> subDeviceBitfields;
subDeviceBitfields.insert({rootDeviceIndex, deviceBitfield}); subDeviceBitfields.insert({rootDeviceIndex, deviceBitfield});
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, rootDeviceIndices, subDeviceBitfields); NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, rootDeviceIndices, subDeviceBitfields);
unifiedMemoryProperties.device = &device; unifiedMemoryProperties.device = &device;
unifiedMemoryProperties.requestedAllocationType = allocationType; unifiedMemoryProperties.requestedAllocationType = allocationType;
auto ptr = svmAllocManager->createUnifiedMemoryAllocation(totalSize, unifiedMemoryProperties); auto ptr = svmAllocManager->createUnifiedMemoryAllocation(totalSize, unifiedMemoryProperties);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019-2020 Intel Corporation * Copyright (C) 2019-2023 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@ -10,13 +10,13 @@
uint32_t UnifiedMemoryControls::generateMask() { uint32_t UnifiedMemoryControls::generateMask() {
uint32_t resourceMask = 0u; uint32_t resourceMask = 0u;
if (this->indirectHostAllocationsAllowed) { if (this->indirectHostAllocationsAllowed) {
resourceMask |= InternalMemoryType::HOST_UNIFIED_MEMORY; resourceMask |= static_cast<uint32_t>(InternalMemoryType::hostUnifiedMemory);
} }
if (this->indirectDeviceAllocationsAllowed) { if (this->indirectDeviceAllocationsAllowed) {
resourceMask |= InternalMemoryType::DEVICE_UNIFIED_MEMORY; resourceMask |= static_cast<uint32_t>(InternalMemoryType::deviceUnifiedMemory);
} }
if (this->indirectSharedAllocationsAllowed) { if (this->indirectSharedAllocationsAllowed) {
resourceMask |= InternalMemoryType::SHARED_UNIFIED_MEMORY; resourceMask |= static_cast<uint32_t>(InternalMemoryType::sharedUnifiedMemory);
} }
return resourceMask; return resourceMask;

View File

@ -9,43 +9,43 @@
#include <stdint.h> #include <stdint.h>
enum InternalMemoryType : uint32_t { enum class InternalMemoryType : uint32_t {
NOT_SPECIFIED = 0b0, notSpecified = 0b0,
SVM = 0b1, svm = 0b1,
DEVICE_UNIFIED_MEMORY = 0b10, deviceUnifiedMemory = 0b10,
HOST_UNIFIED_MEMORY = 0b100, hostUnifiedMemory = 0b100,
SHARED_UNIFIED_MEMORY = 0b1000, sharedUnifiedMemory = 0b1000,
RESERVED_DEVICE_MEMORY = 0b10000 reservedDeviceMemory = 0b10000
}; };
enum class InternalIpcMemoryType : uint32_t { enum class InternalIpcMemoryType : uint32_t {
IPC_DEVICE_UNIFIED_MEMORY = 0, deviceUnifiedMemory = 0,
IPC_HOST_UNIFIED_MEMORY = 1, hostUnifiedMemory = 1,
IPC_DEVICE_VIRTUAL_ADDRESS = 2 deviceVirtualAddress = 2
}; };
enum TransferType : uint32_t { enum class TransferType : uint32_t {
TRANSFER_TYPE_UNKNOWN = 0, unknown = 0,
HOST_NON_USM_TO_HOST_USM = 1, hostNonUsmToHostUsm = 1,
HOST_NON_USM_TO_DEVICE_USM = 2, hostNonUsmToDeviceUsm = 2,
HOST_NON_USM_TO_SHARED_USM = 3, hostNonUsmToSharedUsm = 3,
HOST_NON_USM_TO_HOST_NON_USM = 4, hostNonUsmToHostNonUsm = 4,
HOST_USM_TO_HOST_USM = 5, hostUsmToHostUsm = 5,
HOST_USM_TO_DEVICE_USM = 6, hostUsmToDeviceUsm = 6,
HOST_USM_TO_SHARED_USM = 7, hostUsmToSharedUsm = 7,
HOST_USM_TO_HOST_NON_USM = 8, hostUsmToHostNonUsm = 8,
DEVICE_USM_TO_HOST_USM = 9, deviceUsmToHostUsm = 9,
DEVICE_USM_TO_DEVICE_USM = 10, deviceUsmToDeviceUsm = 10,
DEVICE_USM_TO_SHARED_USM = 11, deviceUsmToSharedUsm = 11,
DEVICE_USM_TO_HOST_NON_USM = 12, deviceUsmToHostNonUsm = 12,
SHARED_USM_TO_HOST_USM = 13, sharedUsmToHostUsm = 13,
SHARED_USM_TO_DEVICE_USM = 14, sharedUsmToDeviceUsm = 14,
SHARED_USM_TO_SHARED_USM = 15, sharedUsmToSharedUsm = 15,
SHARED_USM_TO_HOST_NON_USM = 16 sharedUsmToHostNonUsm = 16
}; };
struct UnifiedMemoryControls { struct UnifiedMemoryControls {

View File

@ -577,7 +577,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenUsmAllocationWhenDumpAllocationIsCa
RootDeviceIndicesContainer rootDeviceIndices = {rootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {rootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{rootDeviceIndex, pDevice->getDeviceBitfield()}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{rootDeviceIndex, pDevice->getDeviceBitfield()}};
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = pDevice; unifiedMemoryProperties.device = pDevice;
auto ptr = svmManager->createUnifiedMemoryAllocation(4096, unifiedMemoryProperties); auto ptr = svmManager->createUnifiedMemoryAllocation(4096, unifiedMemoryProperties);
ASSERT_NE(nullptr, ptr); ASSERT_NE(nullptr, ptr);

View File

@ -27,7 +27,7 @@ TEST(PrefetchManagerTests, givenPrefetchManagerWhenCallingInterfaceFunctionsThen
auto prefetchManager = std::make_unique<MockPrefetchManager>(); auto prefetchManager = std::make_unique<MockPrefetchManager>();
PrefetchContext prefetchContext; PrefetchContext prefetchContext;
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr);
ASSERT_NE(nullptr, ptr); ASSERT_NE(nullptr, ptr);
@ -61,7 +61,7 @@ TEST(PrefetchManagerTests, givenPrefetchManagerWhenCallingMigrateAllocationsToGp
auto prefetchManager = std::make_unique<MockPrefetchManager>(); auto prefetchManager = std::make_unique<MockPrefetchManager>();
PrefetchContext prefetchContext; PrefetchContext prefetchContext;
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, nullptr);
ASSERT_NE(nullptr, ptr); ASSERT_NE(nullptr, ptr);

View File

@ -118,7 +118,7 @@ TEST(SvmDeviceAllocationCacheTest, givenAllocationCacheEnabledWhenFreeingDeviceA
{(allocationSizeBasis << 1), nullptr}, {(allocationSizeBasis << 1), nullptr},
{(allocationSizeBasis << 1) + 1, nullptr}}); {(allocationSizeBasis << 1) + 1, nullptr}});
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device; unifiedMemoryProperties.device = device;
for (auto &testData : testDataset) { for (auto &testData : testDataset) {
testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties); testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties);
@ -166,7 +166,7 @@ TEST(SvmDeviceAllocationCacheTest, givenAllocationsWithDifferentSizesWhenAllocat
{(allocationSizeBasis << 2) + 1, nullptr}, {(allocationSizeBasis << 2) + 1, nullptr},
}); });
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device; unifiedMemoryProperties.device = device;
for (auto &testData : testDataset) { for (auto &testData : testDataset) {
testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties); testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties);
@ -214,7 +214,7 @@ TEST(SvmDeviceAllocationCacheTest, givenMultipleAllocationsWhenAllocatingAfterFr
{(allocationSizeBasis << 2), nullptr}, {(allocationSizeBasis << 2), nullptr},
}); });
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device; unifiedMemoryProperties.device = device;
for (auto &testData : testDataset) { for (auto &testData : testDataset) {
testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties); testData.allocation = svmManager->createUnifiedMemoryAllocation(testData.allocationSize, unifiedMemoryProperties);
@ -260,7 +260,7 @@ struct SvmDeviceAllocationCacheTestDataType {
std::map<uint32_t, DeviceBitfield> &subdeviceBitFields, std::map<uint32_t, DeviceBitfield> &subdeviceBitFields,
Device *device, Device *device,
std::string name) : allocationSize(allocationSize), std::string name) : allocationSize(allocationSize),
unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory,
1, 1,
rootDeviceIndicesArg, rootDeviceIndicesArg,
subdeviceBitFields), subdeviceBitFields),
@ -357,7 +357,7 @@ TEST(SvmDeviceAllocationCacheTest, givenDeviceOutOfMemoryWhenAllocatingThenCache
memoryManager->capacity = MemoryConstants::pageSize64k * 3; memoryManager->capacity = MemoryConstants::pageSize64k * 3;
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device; unifiedMemoryProperties.device = device;
auto allocationInCache = svmManager->createUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties); auto allocationInCache = svmManager->createUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties);

View File

@ -45,7 +45,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenFreeSharedAllocWithOffsetPointerThenReso
auto mockPageFaultManager = new MockPageFaultManager(); auto mockPageFaultManager = new MockPageFaultManager();
memoryManager->pageFaultManager.reset(mockPageFaultManager); memoryManager->pageFaultManager.reset(mockPageFaultManager);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto allocationSize = 4096u; auto allocationSize = 4096u;
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties, &cmdQ); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties, &cmdQ);
EXPECT_NE(nullptr, ptr); EXPECT_NE(nullptr, ptr);
@ -73,7 +73,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenFreeSvmAllocationDeferThenAllocationsCou
csr->setupContext(*device->getDefaultEngine().osContext); csr->setupContext(*device->getDefaultEngine().osContext);
void *cmdQ = reinterpret_cast<void *>(0x12345); void *cmdQ = reinterpret_cast<void *>(0x12345);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device; unifiedMemoryProperties.device = device;
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096, unifiedMemoryProperties, &cmdQ); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096, unifiedMemoryProperties, &cmdQ);
@ -103,7 +103,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenFreeSVMAllocIsDeferredThenFreedSubsequen
csr->setupContext(*device->getDefaultEngine().osContext); csr->setupContext(*device->getDefaultEngine().osContext);
void *cmdQ = reinterpret_cast<void *>(0x12345); void *cmdQ = reinterpret_cast<void *>(0x12345);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device; unifiedMemoryProperties.device = device;
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096, unifiedMemoryProperties, &cmdQ); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096, unifiedMemoryProperties, &cmdQ);
@ -130,7 +130,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, GivenTwoRootDevicesWhenAllocatingSharedMemor
csr->setupContext(*device->getDefaultEngine().osContext); csr->setupContext(*device->getDefaultEngine().osContext);
void *cmdQ = reinterpret_cast<void *>(0x12345); void *cmdQ = reinterpret_cast<void *>(0x12345);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfieldsLocal); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfieldsLocal);
unifiedMemoryProperties.device = device; unifiedMemoryProperties.device = device;
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096, unifiedMemoryProperties, &cmdQ); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096, unifiedMemoryProperties, &cmdQ);
@ -155,7 +155,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenMultipleFreeSVMAllocDeferredThenFreedSub
auto csr = std::make_unique<MockCommandStreamReceiver>(*device->getExecutionEnvironment(), device->getRootDeviceIndex(), device->getDeviceBitfield()); auto csr = std::make_unique<MockCommandStreamReceiver>(*device->getExecutionEnvironment(), device->getRootDeviceIndex(), device->getDeviceBitfield());
csr->setupContext(*device->getDefaultEngine().osContext); csr->setupContext(*device->getDefaultEngine().osContext);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device; unifiedMemoryProperties.device = device;
auto ptr = svmManager->createUnifiedMemoryAllocation(4096, unifiedMemoryProperties); auto ptr = svmManager->createUnifiedMemoryAllocation(4096, unifiedMemoryProperties);
@ -187,7 +187,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenPointerWithOffsetPassedThenProperDataRet
auto device = deviceFactory->rootDevices[0]; auto device = deviceFactory->rootDevices[0];
auto svmManager = std::make_unique<MockSVMAllocsManager>(device->getMemoryManager(), false); auto svmManager = std::make_unique<MockSVMAllocsManager>(device->getMemoryManager(), false);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device; unifiedMemoryProperties.device = device;
auto ptr = svmManager->createUnifiedMemoryAllocation(4096, unifiedMemoryProperties); auto ptr = svmManager->createUnifiedMemoryAllocation(4096, unifiedMemoryProperties);
@ -208,7 +208,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenMultiplePointerWithOffsetPassedThenPrope
auto device = deviceFactory->rootDevices[0]; auto device = deviceFactory->rootDevices[0];
auto svmManager = std::make_unique<MockSVMAllocsManager>(device->getMemoryManager(), false); auto svmManager = std::make_unique<MockSVMAllocsManager>(device->getMemoryManager(), false);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device; unifiedMemoryProperties.device = device;
auto ptr = svmManager->createUnifiedMemoryAllocation(2048, unifiedMemoryProperties); auto ptr = svmManager->createUnifiedMemoryAllocation(2048, unifiedMemoryProperties);
@ -220,7 +220,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenMultiplePointerWithOffsetPassedThenPrope
MockGraphicsAllocation mockAllocation(unalignedPointer, 512u); MockGraphicsAllocation mockAllocation(unalignedPointer, 512u);
SvmAllocationData allocationData(1u); SvmAllocationData allocationData(1u);
allocationData.memoryType = InternalMemoryType::HOST_UNIFIED_MEMORY; allocationData.memoryType = InternalMemoryType::hostUnifiedMemory;
allocationData.size = mockAllocation.getUnderlyingBufferSize(); allocationData.size = mockAllocation.getUnderlyingBufferSize();
allocationData.gpuAllocations.addAllocation(&mockAllocation); allocationData.gpuAllocations.addAllocation(&mockAllocation);
svmManager->svmAllocs.insert(unalignedPointer, allocationData); svmManager->svmAllocs.insert(unalignedPointer, allocationData);
@ -250,7 +250,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, givenKmdMigratedSharedAllocationWhenPrefetch
csr->setupContext(*device->getDefaultEngine().osContext); csr->setupContext(*device->getDefaultEngine().osContext);
void *cmdQ = reinterpret_cast<void *>(0x12345); void *cmdQ = reinterpret_cast<void *>(0x12345);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096, unifiedMemoryProperties, &cmdQ); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096, unifiedMemoryProperties, &cmdQ);
EXPECT_NE(nullptr, ptr); EXPECT_NE(nullptr, ptr);
@ -282,7 +282,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, givenEnableBOChunkingPrefetchWhenPrefetchMem
auto csr = std::make_unique<MockCommandStreamReceiver>(*device->getExecutionEnvironment(), device->getRootDeviceIndex(), device->getDeviceBitfield()); auto csr = std::make_unique<MockCommandStreamReceiver>(*device->getExecutionEnvironment(), device->getRootDeviceIndex(), device->getDeviceBitfield());
csr->setupContext(*device->getDefaultEngine().osContext); csr->setupContext(*device->getDefaultEngine().osContext);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device; unifiedMemoryProperties.device = device;
auto ptr = svmManager->createUnifiedMemoryAllocation(4096, unifiedMemoryProperties); auto ptr = svmManager->createUnifiedMemoryAllocation(4096, unifiedMemoryProperties);
@ -311,7 +311,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, givenForceMemoryPrefetchForKmdMigratedShared
csr->setupContext(*device->getDefaultEngine().osContext); csr->setupContext(*device->getDefaultEngine().osContext);
void *cmdQ = reinterpret_cast<void *>(0x12345); void *cmdQ = reinterpret_cast<void *>(0x12345);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096, unifiedMemoryProperties, &cmdQ); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096, unifiedMemoryProperties, &cmdQ);
EXPECT_NE(nullptr, ptr); EXPECT_NE(nullptr, ptr);
@ -339,7 +339,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, givenAlignmentThenUnifiedMemoryAllocationsAr
memoryManager->validateAllocateProperties = [alignment](const AllocationProperties &properties) { memoryManager->validateAllocateProperties = [alignment](const AllocationProperties &properties) {
EXPECT_EQ(properties.alignment, alignUpNonZero<size_t>(alignment, MemoryConstants::pageSize64k)); EXPECT_EQ(properties.alignment, alignUpNonZero<size_t>(alignment, MemoryConstants::pageSize64k));
}; };
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, alignment, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, alignment, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device; unifiedMemoryProperties.device = device;
auto ptr = svmManager->createUnifiedMemoryAllocation(1, unifiedMemoryProperties); auto ptr = svmManager->createUnifiedMemoryAllocation(1, unifiedMemoryProperties);
EXPECT_NE(nullptr, ptr); EXPECT_NE(nullptr, ptr);
@ -364,7 +364,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, givenAlignmentThenHostUnifiedMemoryAllocatio
memoryManager->validateAllocateProperties = [alignment](const AllocationProperties &properties) { memoryManager->validateAllocateProperties = [alignment](const AllocationProperties &properties) {
EXPECT_EQ(properties.alignment, alignUpNonZero<size_t>(alignment, MemoryConstants::pageSize)); EXPECT_EQ(properties.alignment, alignUpNonZero<size_t>(alignment, MemoryConstants::pageSize));
}; };
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY, alignment, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory, alignment, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device; unifiedMemoryProperties.device = device;
auto ptr = svmManager->createHostUnifiedMemoryAllocation(1, unifiedMemoryProperties); auto ptr = svmManager->createHostUnifiedMemoryAllocation(1, unifiedMemoryProperties);
EXPECT_NE(nullptr, ptr); EXPECT_NE(nullptr, ptr);
@ -393,7 +393,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, givenAlignmentThenSharedUnifiedMemoryAllocat
memoryManager->validateAllocateProperties = [alignment](const AllocationProperties &properties) { memoryManager->validateAllocateProperties = [alignment](const AllocationProperties &properties) {
EXPECT_EQ(properties.alignment, alignUpNonZero<size_t>(alignment, MemoryConstants::pageSize64k)); EXPECT_EQ(properties.alignment, alignUpNonZero<size_t>(alignment, MemoryConstants::pageSize64k));
}; };
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, alignment, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, alignment, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device; unifiedMemoryProperties.device = device;
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(1, unifiedMemoryProperties, cmdQ); auto ptr = svmManager->createSharedUnifiedMemoryAllocation(1, unifiedMemoryProperties, cmdQ);
EXPECT_NE(nullptr, ptr); EXPECT_NE(nullptr, ptr);

View File

@ -684,7 +684,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateS
SVMAllocsManager unifiedMemoryManager(memoryManager, false); SVMAllocsManager unifiedMemoryManager(memoryManager, false);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
EXPECT_NE(ptr, nullptr); EXPECT_NE(ptr, nullptr);
@ -732,7 +732,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, MmapFailWhenCreateSharedUnifiedMem
SVMAllocsManager unifiedMemoryManager(memoryManager, false); SVMAllocsManager unifiedMemoryManager(memoryManager, false);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
EXPECT_EQ(ptr, nullptr); EXPECT_EQ(ptr, nullptr);
@ -755,7 +755,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateS
SVMAllocsManager unifiedMemoryManager(memoryManager, false); SVMAllocsManager unifiedMemoryManager(memoryManager, false);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device.get(); unifiedMemoryProperties.device = device.get();
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
@ -800,7 +800,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenSetVmAdviseAtomicAttributeWhe
SVMAllocsManager unifiedMemoryManager(memoryManager, false); SVMAllocsManager unifiedMemoryManager(memoryManager, false);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device.get(); unifiedMemoryProperties.device = device.get();
for (auto atomicAdvise : {-1, 0, 1, 2}) { for (auto atomicAdvise : {-1, 0, 1, 2}) {
@ -846,7 +846,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenSetVmAdviseDevicePreferredLoc
SVMAllocsManager unifiedMemoryManager(memoryManager, false); SVMAllocsManager unifiedMemoryManager(memoryManager, false);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device.get(); unifiedMemoryProperties.device = device.get();
for (auto preferredLocation : {-1, 0, 1, 2}) { for (auto preferredLocation : {-1, 0, 1, 2}) {
@ -903,7 +903,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenKmdMigratedSharedAllocationWh
SVMAllocsManager unifiedMemoryManager(memoryManager, false); SVMAllocsManager unifiedMemoryManager(memoryManager, false);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device.get(); unifiedMemoryProperties.device = device.get();
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
@ -952,7 +952,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenCreateContextWithAccessCounte
SVMAllocsManager unifiedMemoryManager(memoryManager, false); SVMAllocsManager unifiedMemoryManager(memoryManager, false);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device.get(); unifiedMemoryProperties.device = device.get();
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
@ -994,7 +994,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenCreateContextWithAccessCounte
SVMAllocsManager unifiedMemoryManager(memoryManager, false); SVMAllocsManager unifiedMemoryManager(memoryManager, false);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device.get(); unifiedMemoryProperties.device = device.get();
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
@ -1050,7 +1050,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationAndUsmInitialP
SVMAllocsManager unifiedMemoryManager(memoryManager, false); SVMAllocsManager unifiedMemoryManager(memoryManager, false);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device.get(); unifiedMemoryProperties.device = device.get();
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
@ -1093,7 +1093,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenKMDSupportForCrossTileMigrati
SVMAllocsManager unifiedMemoryManager(memoryManager, false); SVMAllocsManager unifiedMemoryManager(memoryManager, false);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
unifiedMemoryProperties.device = device.get(); unifiedMemoryProperties.device = device.get();
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
@ -1233,7 +1233,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, whenVmAdviseIoctlFailsThenCreateSh
SVMAllocsManager unifiedMemoryManager(memoryManager, false); SVMAllocsManager unifiedMemoryManager(memoryManager, false);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
@ -1257,7 +1257,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateS
SVMAllocsManager unifiedMemoryManager(memoryManager, false); SVMAllocsManager unifiedMemoryManager(memoryManager, false);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
EXPECT_EQ(ptr, nullptr); EXPECT_EQ(ptr, nullptr);
@ -1284,7 +1284,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateS
SVMAllocsManager unifiedMemoryManager(memoryManager, false); SVMAllocsManager unifiedMemoryManager(memoryManager, false);
auto size = 2 * MemoryConstants::megaByte; auto size = 2 * MemoryConstants::megaByte;
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr); auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr);
EXPECT_NE(ptr, nullptr); EXPECT_NE(ptr, nullptr);
@ -1331,7 +1331,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenCreateKmdMigratedSharedAlloca
SVMAllocsManager unifiedMemoryManager(memoryManager, false); SVMAllocsManager unifiedMemoryManager(memoryManager, false);
auto size = 2 * MemoryConstants::megaByte; auto size = 2 * MemoryConstants::megaByte;
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr); auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr);
EXPECT_NE(ptr, nullptr); EXPECT_NE(ptr, nullptr);
@ -2009,7 +2009,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenPrintBOCreateDestroyResultFla
SVMAllocsManager unifiedMemoryManager(memoryManager, false); SVMAllocsManager unifiedMemoryManager(memoryManager, false);
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
testing::internal::CaptureStdout(); testing::internal::CaptureStdout();
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr); auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);

View File

@ -662,7 +662,7 @@ TEST_F(PageFaultManagerTest, givenUnifiedMemoryAllocWhenSetAubWritableIsCalledTh
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, mockDeviceBitfield}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, mockDeviceBitfield}};
auto properties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); auto properties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
void *cmdQ = reinterpret_cast<void *>(0xFFFF); void *cmdQ = reinterpret_cast<void *>(0xFFFF);
void *alloc1 = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(10, properties, cmdQ); void *alloc1 = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(10, properties, cmdQ);
@ -723,7 +723,7 @@ TEST_F(PageFaultManagerTest, givenPageFaultMAnagerWhenSetCpuAllocEvictableIsCall
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, mockDeviceBitfield}}; std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, mockDeviceBitfield}};
auto properties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, rootDeviceIndices, deviceBitfields); auto properties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1, rootDeviceIndices, deviceBitfields);
void *cmdQ = reinterpret_cast<void *>(0xFFFF); void *cmdQ = reinterpret_cast<void *>(0xFFFF);
void *ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(10, properties, cmdQ); void *ptr = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(10, properties, cmdQ);

View File

@ -87,7 +87,7 @@ TEST(AllocateGlobalSurfaceTest, GivenSvmAllocsManagerWhenGlobalsAreExportedThenM
EXPECT_EQ(0, memcmp(alloc->getUnderlyingBuffer(), initData.data(), initData.size())); EXPECT_EQ(0, memcmp(alloc->getUnderlyingBuffer(), initData.data(), initData.size()));
ASSERT_NE(nullptr, svmAllocsManager.getSVMAlloc(reinterpret_cast<void *>(static_cast<uintptr_t>(alloc->getGpuAddress())))); ASSERT_NE(nullptr, svmAllocsManager.getSVMAlloc(reinterpret_cast<void *>(static_cast<uintptr_t>(alloc->getGpuAddress()))));
EXPECT_TRUE(alloc->isMemObjectsAllocationWithWritableFlags()); EXPECT_TRUE(alloc->isMemObjectsAllocationWithWritableFlags());
EXPECT_EQ(DEVICE_UNIFIED_MEMORY, svmAllocsManager.getSVMAlloc(reinterpret_cast<void *>(alloc->getGpuAddress()))->memoryType); EXPECT_EQ(InternalMemoryType::deviceUnifiedMemory, svmAllocsManager.getSVMAlloc(reinterpret_cast<void *>(alloc->getGpuAddress()))->memoryType);
EXPECT_EQ(AllocationType::constantSurface, alloc->getAllocationType()); EXPECT_EQ(AllocationType::constantSurface, alloc->getAllocationType());
EXPECT_FALSE(alloc->getDefaultGmm()->resourceParams.Flags.Info.NotLockable); EXPECT_FALSE(alloc->getDefaultGmm()->resourceParams.Flags.Info.NotLockable);
svmAllocsManager.freeSVMAlloc(reinterpret_cast<void *>(static_cast<uintptr_t>(alloc->getGpuAddress()))); svmAllocsManager.freeSVMAlloc(reinterpret_cast<void *>(static_cast<uintptr_t>(alloc->getGpuAddress())));
@ -114,7 +114,7 @@ TEST(AllocateGlobalSurfaceTest, GivenSvmAllocsManagerWhenGlobalsAreExportedThenM
EXPECT_EQ(0, memcmp(alloc->getUnderlyingBuffer(), initData.data(), initData.size())); EXPECT_EQ(0, memcmp(alloc->getUnderlyingBuffer(), initData.data(), initData.size()));
EXPECT_NE(nullptr, svmAllocsManager.getSVMAlloc(reinterpret_cast<void *>(static_cast<uintptr_t>(alloc->getGpuAddress())))); EXPECT_NE(nullptr, svmAllocsManager.getSVMAlloc(reinterpret_cast<void *>(static_cast<uintptr_t>(alloc->getGpuAddress()))));
EXPECT_TRUE(alloc->isMemObjectsAllocationWithWritableFlags()); EXPECT_TRUE(alloc->isMemObjectsAllocationWithWritableFlags());
EXPECT_EQ(DEVICE_UNIFIED_MEMORY, svmAllocsManager.getSVMAlloc(reinterpret_cast<void *>(alloc->getGpuAddress()))->memoryType); EXPECT_EQ(InternalMemoryType::deviceUnifiedMemory, svmAllocsManager.getSVMAlloc(reinterpret_cast<void *>(alloc->getGpuAddress()))->memoryType);
EXPECT_EQ(AllocationType::globalSurface, alloc->getAllocationType()); EXPECT_EQ(AllocationType::globalSurface, alloc->getAllocationType());
EXPECT_FALSE(alloc->getDefaultGmm()->resourceParams.Flags.Info.NotLockable); EXPECT_FALSE(alloc->getDefaultGmm()->resourceParams.Flags.Info.NotLockable);
svmAllocsManager.freeSVMAlloc(reinterpret_cast<void *>(static_cast<uintptr_t>(alloc->getGpuAddress()))); svmAllocsManager.freeSVMAlloc(reinterpret_cast<void *>(static_cast<uintptr_t>(alloc->getGpuAddress())));
@ -275,4 +275,4 @@ TEST(AllocateGlobalSurfaceTest, whenAllocatingGlobalSurfaceWithZeroInitSizeGreat
EXPECT_EQ(0u, static_cast<MockMemoryManager *>(device.getMemoryManager())->copyMemoryToAllocationBanksCalled); EXPECT_EQ(0u, static_cast<MockMemoryManager *>(device.getMemoryManager())->copyMemoryToAllocationBanksCalled);
device.getMemoryManager()->freeGraphicsMemory(alloc); device.getMemoryManager()->freeGraphicsMemory(alloc);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019-2022 Intel Corporation * Copyright (C) 2019-2023 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@ -12,26 +12,26 @@
#include <bitset> #include <bitset>
TEST(UnifiedMemoryTests, givenInternalMemoryTypesThenAllHaveOnlyOneBitSet) { TEST(UnifiedMemoryTests, givenInternalMemoryTypesThenAllHaveOnlyOneBitSet) {
EXPECT_EQ(1u, std::bitset<4>(InternalMemoryType::DEVICE_UNIFIED_MEMORY).count()); EXPECT_EQ(1u, std::bitset<4>(static_cast<uint32_t>(InternalMemoryType::deviceUnifiedMemory)).count());
EXPECT_EQ(1u, std::bitset<4>(InternalMemoryType::HOST_UNIFIED_MEMORY).count()); EXPECT_EQ(1u, std::bitset<4>(static_cast<uint32_t>(InternalMemoryType::hostUnifiedMemory)).count());
EXPECT_EQ(1u, std::bitset<4>(InternalMemoryType::SHARED_UNIFIED_MEMORY).count()); EXPECT_EQ(1u, std::bitset<4>(static_cast<uint32_t>(InternalMemoryType::sharedUnifiedMemory)).count());
EXPECT_EQ(1u, std::bitset<4>(InternalMemoryType::SVM).count()); EXPECT_EQ(1u, std::bitset<4>(static_cast<uint32_t>(InternalMemoryType::svm)).count());
} }
TEST(UnifiedMemoryTests, givenUnifiedMemoryControlsWhenDedicatedFieldsAreSetThenMaskIsProperlyGenerated) { TEST(UnifiedMemoryTests, givenUnifiedMemoryControlsWhenDedicatedFieldsAreSetThenMaskIsProperlyGenerated) {
UnifiedMemoryControls controls; UnifiedMemoryControls controls;
EXPECT_EQ(0u, controls.generateMask()); EXPECT_EQ(0u, controls.generateMask());
controls.indirectDeviceAllocationsAllowed = true; controls.indirectDeviceAllocationsAllowed = true;
EXPECT_EQ(InternalMemoryType::DEVICE_UNIFIED_MEMORY, controls.generateMask()); EXPECT_EQ(static_cast<uint32_t>(InternalMemoryType::deviceUnifiedMemory), controls.generateMask());
controls.indirectHostAllocationsAllowed = true; controls.indirectHostAllocationsAllowed = true;
EXPECT_EQ(InternalMemoryType::HOST_UNIFIED_MEMORY | InternalMemoryType::DEVICE_UNIFIED_MEMORY, controls.generateMask()); EXPECT_EQ(static_cast<uint32_t>(InternalMemoryType::hostUnifiedMemory) | static_cast<uint32_t>(InternalMemoryType::deviceUnifiedMemory), controls.generateMask());
controls.indirectDeviceAllocationsAllowed = false; controls.indirectDeviceAllocationsAllowed = false;
EXPECT_EQ(InternalMemoryType::HOST_UNIFIED_MEMORY, controls.generateMask()); EXPECT_EQ(static_cast<uint32_t>(InternalMemoryType::hostUnifiedMemory), controls.generateMask());
controls.indirectHostAllocationsAllowed = false; controls.indirectHostAllocationsAllowed = false;
controls.indirectSharedAllocationsAllowed = true; controls.indirectSharedAllocationsAllowed = true;
EXPECT_EQ(InternalMemoryType::SHARED_UNIFIED_MEMORY, controls.generateMask()); EXPECT_EQ(static_cast<uint32_t>(InternalMemoryType::sharedUnifiedMemory), controls.generateMask());
} }