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

View File

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

View File

@ -28,11 +28,11 @@ struct Image;
struct Context : _ze_context_handle_t {
inline static ze_memory_type_t parseUSMType(InternalMemoryType memoryType) {
switch (memoryType) {
case InternalMemoryType::SHARED_UNIFIED_MEMORY:
case InternalMemoryType::sharedUnifiedMemory:
return ZE_MEMORY_TYPE_SHARED;
case InternalMemoryType::DEVICE_UNIFIED_MEMORY:
case InternalMemoryType::deviceUnifiedMemory:
return ZE_MEMORY_TYPE_DEVICE;
case InternalMemoryType::HOST_UNIFIED_MEMORY:
case InternalMemoryType::hostUnifiedMemory:
return ZE_MEMORY_TYPE_HOST;
default:
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;
}
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY,
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory,
alignment,
this->rootDeviceIndices,
this->deviceBitfields);
@ -246,7 +246,7 @@ ze_result_t ContextImp::allocDeviceMem(ze_device_handle_t hDevice,
}
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.device = neoDevice;
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();
}
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY,
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory,
alignment,
this->rootDeviceIndices,
deviceBitfields);
@ -478,7 +478,7 @@ ze_result_t ContextImp::makeMemoryResident(ze_device_handle_t hDevice, void *ptr
if (ZE_RESULT_SUCCESS == res) {
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());
std::lock_guard<std::mutex> lock(driverHandleImp->sharedMakeResidentAllocationsLock);
driverHandleImp->sharedMakeResidentAllocations.insert({ptr, allocation});
@ -609,8 +609,8 @@ ze_result_t ContextImp::getIpcMemHandle(const void *ptr,
IpcMemoryData &ipcData = *reinterpret_cast<IpcMemoryData *>(pIpcHandle->data);
auto type = allocData->memoryType;
uint8_t ipcType = 0;
if (type == HOST_UNIFIED_MEMORY) {
ipcType = static_cast<uint8_t>(InternalIpcMemoryType::IPC_HOST_UNIFIED_MEMORY);
if (type == InternalMemoryType::hostUnifiedMemory) {
ipcType = static_cast<uint8_t>(InternalIpcMemoryType::hostUnifiedMemory);
}
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 ipcType = InternalIpcMemoryType::IPC_DEVICE_UNIFIED_MEMORY;
if (type == HOST_UNIFIED_MEMORY) {
ipcType = InternalIpcMemoryType::IPC_HOST_UNIFIED_MEMORY;
auto ipcType = InternalIpcMemoryType::deviceUnifiedMemory;
if (type == InternalMemoryType::hostUnifiedMemory) {
ipcType = InternalIpcMemoryType::hostUnifiedMemory;
}
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;
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;
} 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;
} else {
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);
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;
}
@ -1178,7 +1178,7 @@ ze_result_t ContextImp::mapVirtualMem(const void *ptr,
allocData.size = size;
allocData.pageSizeForAlignment = MemoryConstants::pageSize64k;
allocData.setAllocId(this->driverHandle->svmAllocsManager->allocationsCounter++);
allocData.memoryType = InternalMemoryType::RESERVED_DEVICE_MEMORY;
allocData.memoryType = InternalMemoryType::reservedDeviceMemory;
allocData.virtualReservationData = virtualMemoryReservation;
NEO::MemoryMappedRange *mappedRange = new NEO::MemoryMappedRange;
mappedRange->ptr = ptr;

View File

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

View File

@ -621,7 +621,7 @@ void *DriverHandleImp::importFdHandle(NEO::Device *neoDevice,
allocDataTmp->cpuAllocation = nullptr;
allocDataTmp->size = alloc->getUnderlyingBufferSize();
allocDataTmp->memoryType =
isHostIpcAllocation ? InternalMemoryType::HOST_UNIFIED_MEMORY : InternalMemoryType::DEVICE_UNIFIED_MEMORY;
isHostIpcAllocation ? InternalMemoryType::hostUnifiedMemory : InternalMemoryType::deviceUnifiedMemory;
allocDataTmp->device = neoDevice;
allocDataTmp->isImportedAllocation = true;
allocDataTmp->setAllocId(this->getSvmAllocsManager()->allocationsCounter++);
@ -675,7 +675,7 @@ void *DriverHandleImp::importFdHandles(NEO::Device *neoDevice, ze_ipc_memory_fla
allocDataTmp->gpuAllocations.addAllocation(alloc);
allocDataTmp->cpuAllocation = nullptr;
allocDataTmp->size = alloc->getUnderlyingBufferSize();
allocDataTmp->memoryType = InternalMemoryType::DEVICE_UNIFIED_MEMORY;
allocDataTmp->memoryType = InternalMemoryType::deviceUnifiedMemory;
allocDataTmp->device = neoDevice;
allocDataTmp->isImportedAllocation = true;
allocDataTmp->setAllocId(this->getSvmAllocsManager()->allocationsCounter++);
@ -767,7 +767,7 @@ NEO::GraphicsAllocation *DriverHandleImp::getPeerAllocation(Device *device,
uint32_t numHandles = alloc->getNumHandles();
// 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;
}
@ -847,7 +847,7 @@ void *DriverHandleImp::importNTHandle(ze_device_handle_t hDevice, void *handle,
allocData.cpuAllocation = nullptr;
allocData.size = alloc->getUnderlyingBufferSize();
allocData.memoryType =
isHostIpcAllocation ? InternalMemoryType::HOST_UNIFIED_MEMORY : InternalMemoryType::DEVICE_UNIFIED_MEMORY;
isHostIpcAllocation ? InternalMemoryType::hostUnifiedMemory : InternalMemoryType::deviceUnifiedMemory;
allocData.device = neoDevice;
allocData.isImportedAllocation = true;
allocData.setAllocId(this->getSvmAllocsManager()->allocationsCounter++);
@ -863,8 +863,8 @@ ze_result_t DriverHandleImp::checkMemoryAccessFromDevice(Device *device, const v
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
}
if (allocation->memoryType == InternalMemoryType::HOST_UNIFIED_MEMORY ||
allocation->memoryType == InternalMemoryType::SHARED_UNIFIED_MEMORY)
if (allocation->memoryType == InternalMemoryType::hostUnifiedMemory ||
allocation->memoryType == InternalMemoryType::sharedUnifiedMemory)
return ZE_RESULT_SUCCESS;
if (allocation->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex()) != nullptr) {

View File

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

View File

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

View File

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

View File

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

View File

@ -302,7 +302,7 @@ ze_result_t ContextGetIpcHandleMock::getIpcMemHandle(const void *ptr, ze_ipc_mem
ipcData.handle = handle;
auto type = Context::parseUSMType(allocData->memoryType);
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;
@ -393,7 +393,7 @@ ze_result_t ContextIpcMock::getIpcMemHandle(const void *ptr, ze_ipc_mem_handle_t
ipcData.handle = handle;
auto type = Context::parseUSMType(allocData->memoryType);
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;

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,
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);

View File

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

View File

@ -963,7 +963,7 @@ HWTEST_F(ContextMakeMemoryResidentAndMigrationTests,
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
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);
EXPECT_NE(nullptr, sharedPtr);

View File

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

View File

@ -231,7 +231,7 @@ HWTEST_F(ImportNTHandle, givenCallToImportNTHandleWithHostBufferMemoryAllocation
auto allocData = driverHandle->svmAllocsManager->getSVMAlloc(ptr);
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);
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
@ -250,7 +250,7 @@ HWTEST_F(ImportNTHandle, givenCallToImportNTHandleWithBufferMemoryAllocationType
auto allocData = driverHandle->svmAllocsManager->getSVMAlloc(ptr);
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);
EXPECT_EQ(result, ZE_RESULT_SUCCESS);

View File

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

View File

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

View File

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

View File

@ -26,8 +26,6 @@
#include <cstdint>
#include <optional>
enum InternalMemoryType : uint32_t;
namespace NEO {
class BarrierCommand;
class Buffer;
@ -488,7 +486,7 @@ template <typename PtrType>
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.
// 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) {
size_t dstOffset = ptrDiff(ptr, allocation.getUnderlyingBuffer());
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 isCpuCopyAllowed = bufferCpuCopyAllowed(buffer, cmdType, blockingRead, size, ptr,
numEventsInWaitList, eventWaitList);
InternalMemoryType memoryType = InternalMemoryType::NOT_SPECIFIED;
InternalMemoryType memoryType = InternalMemoryType::notSpecified;
if (!mapAllocation) {
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 uint32_t rootDeviceIndex = getDevice().getRootDeviceIndex();
InternalMemoryType memoryType = InternalMemoryType::NOT_SPECIFIED;
InternalMemoryType memoryType = InternalMemoryType::notSpecified;
GraphicsAllocation *mapAllocation = nullptr;
bool isCpuCopyAllowed = false;
getContext().tryGetExistingHostPtrAllocation(ptr, hostPtrSize, rootDeviceIndex, mapAllocation, memoryType, isCpuCopyAllowed);

View File

@ -303,7 +303,7 @@ inline std::tuple<SvmAllocationData *, GraphicsAllocation *, PtrType> getExistin
} else {
context->tryGetExistingMapAllocation(ptr, size, 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);

View File

@ -36,7 +36,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueWriteBuffer(
auto isMemTransferNeeded = buffer->isMemObjZeroCopy() ? buffer->checkIfMemoryTransferIsRequired(offset, 0, ptr, cmdType) : true;
bool isCpuCopyAllowed = bufferCpuCopyAllowed(buffer, cmdType, blockingWrite, size, const_cast<void *>(ptr),
numEventsInWaitList, eventWaitList);
InternalMemoryType memoryType = InternalMemoryType::NOT_SPECIFIED;
InternalMemoryType memoryType = InternalMemoryType::notSpecified;
if (!mapAllocation) {
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 uint32_t rootDeviceIndex = getDevice().getRootDeviceIndex();
InternalMemoryType memoryType = InternalMemoryType::NOT_SPECIFIED;
InternalMemoryType memoryType = InternalMemoryType::notSpecified;
GraphicsAllocation *mapAllocation = nullptr;
bool isCpuCopyAllowed = false;
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);
if (isCpuCopyAllowed) {
if (svmEntry->memoryType == DEVICE_UNIFIED_MEMORY) {
if (svmEntry->memoryType == InternalMemoryType::deviceUnifiedMemory) {
isCpuCopyAllowed = false;
}
}

View File

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

View File

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

View File

@ -39,7 +39,7 @@ TEST(clUnifiedSharedMemoryTests, whenClHostMemAllocIntelIsCalledThenItAllocatesH
EXPECT_EQ(1u, allocationsManager->getNumAllocs());
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryHostAllocation);
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(),
castToUint64(unifiedMemoryHostAllocation));
@ -139,7 +139,7 @@ TEST(clUnifiedSharedMemoryTests, whenClDeviceMemAllocIntelIsCalledThenItAllocate
EXPECT_EQ(1u, allocationsManager->getNumAllocs());
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryDeviceAllocation);
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(),
castToUint64(unifiedMemoryDeviceAllocation));
@ -206,7 +206,7 @@ TEST(clUnifiedSharedMemoryTests, whenClSharedMemAllocIntelIsCalledThenItAllocate
EXPECT_EQ(1u, allocationsManager->getNumAllocs());
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemorySharedAllocation);
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(),
castToUint64(unifiedMemorySharedAllocation));
@ -356,7 +356,7 @@ TEST(clUnifiedSharedMemoryTests, whenClGetMemAllocInfoINTELisCalledWithValidUnif
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryHostAllocation);
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(sizeof(cl_int), paramValueSizeRet);
EXPECT_EQ(CL_SUCCESS, retVal);
@ -521,7 +521,7 @@ TEST(clUnifiedSharedMemoryTests, whenClGetMemAllocInfoINTELisCalledWithValidUnif
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(sizeof(cl_int), paramValueSizeRet);
EXPECT_EQ(CL_SUCCESS, retVal);
@ -543,7 +543,7 @@ TEST(clUnifiedSharedMemoryTests, whenClGetMemAllocInfoINTELisCalledWithValidUnif
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(sizeof(cl_int), paramValueSizeRet);
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);
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(sizeof(uint64_t), paramValueSizeRet);
EXPECT_EQ(CL_SUCCESS, retVal);
@ -669,7 +669,7 @@ TEST(clUnifiedSharedMemoryTests, whenClGetMemAllocInfoINTELisCalledWithAllocatio
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(sizeof(size_t), paramValueSizeRet);
EXPECT_EQ(CL_SUCCESS, retVal);
@ -1104,7 +1104,7 @@ TEST(clUnifiedSharedMemoryTests, givenDefaulMemPropertiesWhenClDeviceMemAllocInt
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryDeviceAllocation);
auto gpuAllocation = graphicsAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex());
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(gpuAllocation->getGpuAddress(), castToUint64(unifiedMemoryDeviceAllocation));
EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), gpuAllocation->getUnderlyingBufferSize());
@ -1127,7 +1127,7 @@ TEST(clUnifiedSharedMemoryTests, givenValidMemPropertiesWhenClDeviceMemAllocInte
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryDeviceAllocation);
auto gpuAllocation = graphicsAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex());
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->getGpuAddress(), castToUint64(unifiedMemoryDeviceAllocation));
EXPECT_EQ(alignUp(allocationSize, MemoryConstants::pageSize64k), gpuAllocation->getUnderlyingBufferSize());
@ -1286,7 +1286,7 @@ TEST_F(MultiRootDeviceClUnifiedSharedMemoryTests, WhenClHostMemAllocIntelIsCalle
auto graphicsAllocation2 = svmAllocation->gpuAllocations.getGraphicsAllocation(2u);
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(graphicsAllocation2, nullptr);
@ -1323,7 +1323,7 @@ TEST_F(MultiRootDeviceClUnifiedSharedMemoryTests, WhenClSharedMemAllocIntelIsCal
auto graphicsAllocation2 = svmAllocation->gpuAllocations.getGraphicsAllocation(2u);
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(graphicsAllocation2, nullptr);

View File

@ -29,13 +29,13 @@ void *UnifiedMemoryAubFixture::allocateUSM(InternalMemoryType type) {
void *ptr = nullptr;
if (!this->skipped) {
switch (type) {
case DEVICE_UNIFIED_MEMORY:
case InternalMemoryType::deviceUnifiedMemory:
ptr = clDeviceMemAllocINTEL(this->context, this->device.get(), nullptr, dataSize, 0, &retVal);
break;
case HOST_UNIFIED_MEMORY:
case InternalMemoryType::hostUnifiedMemory:
ptr = clHostMemAllocINTEL(this->context, nullptr, dataSize, 0, &retVal);
break;
case SHARED_UNIFIED_MEMORY:
case InternalMemoryType::sharedUnifiedMemory:
ptr = clSharedMemAllocINTEL(this->context, this->device.get(), nullptr, dataSize, 0, &retVal);
break;
default:
@ -51,9 +51,9 @@ void *UnifiedMemoryAubFixture::allocateUSM(InternalMemoryType type) {
void UnifiedMemoryAubFixture::freeUSM(void *ptr, InternalMemoryType type) {
if (!this->skipped) {
switch (type) {
case DEVICE_UNIFIED_MEMORY:
case HOST_UNIFIED_MEMORY:
case SHARED_UNIFIED_MEMORY:
case InternalMemoryType::deviceUnifiedMemory:
case InternalMemoryType::hostUnifiedMemory:
case InternalMemoryType::sharedUnifiedMemory:
retVal = clMemFreeINTEL(this->context, ptr);
break;
default:
@ -67,7 +67,7 @@ void UnifiedMemoryAubFixture::freeUSM(void *ptr, InternalMemoryType type) {
void UnifiedMemoryAubFixture::writeToUsmMemory(std::vector<char> data, void *ptr, InternalMemoryType type) {
if (!this->skipped) {
switch (type) {
case DEVICE_UNIFIED_MEMORY:
case InternalMemoryType::deviceUnifiedMemory:
retVal = clEnqueueMemcpyINTEL(this->pCmdQ, true, ptr, data.data(), dataSize, 0, nullptr, nullptr);
break;
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) {
auto unifiedMemoryType = InternalMemoryType::DEVICE_UNIFIED_MEMORY;
auto unifiedMemoryType = InternalMemoryType::deviceUnifiedMemory;
auto unifiedMemoryPtr = allocateUSM(unifiedMemoryType);
writeToUsmMemory(values, unifiedMemoryPtr, unifiedMemoryType);
@ -46,7 +46,7 @@ HWTEST_F(UnifiedMemoryAubTest, givenDeviceMemoryAllocWhenWriteIntoItThenValuesMa
}
HWTEST_F(UnifiedMemoryAubTest, givenSharedMemoryAllocWhenWriteIntoCPUPartThenValuesMatchAfterUsingAllocAsKernelParam) {
auto unifiedMemoryType = InternalMemoryType::SHARED_UNIFIED_MEMORY;
auto unifiedMemoryType = InternalMemoryType::sharedUnifiedMemory;
auto unifiedMemoryPtr = allocateUSM(unifiedMemoryType);
retVal = clEnqueueMemsetINTEL(this->pCmdQ, unifiedMemoryPtr, 0, dataSize, 0, nullptr, nullptr);
EXPECT_EQ(retVal, CL_SUCCESS);
@ -65,7 +65,7 @@ HWTEST_F(UnifiedMemoryAubTest, givenSharedMemoryAllocWhenWriteIntoCPUPartThenVal
}
HWTEST_F(UnifiedMemoryAubTest, givenSharedMemoryAllocWhenWriteIntoGPUPartThenValuesMatchAfterUsingAlloc) {
auto unifiedMemoryType = InternalMemoryType::SHARED_UNIFIED_MEMORY;
auto unifiedMemoryType = InternalMemoryType::sharedUnifiedMemory;
auto unifiedMemoryPtr = allocateUSM(unifiedMemoryType);
std::vector<char> input(dataSize, 11);

View File

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

View File

@ -1705,7 +1705,7 @@ HWTEST_F(EnqueueKernelTest, GivenForceMemoryPrefetchForKmdMigratedSharedAllocati
debugManager.flags.UseKmdMigration.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);
EXPECT_NE(nullptr, ptr);

View File

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

View File

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

View File

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

View File

@ -358,12 +358,12 @@ TEST_F(KernelArgBufferTest, givenKernelExecInfoWithIndirectStatelessAccessWhenHa
mockKernel.unifiedMemoryControls.indirectHostAllocationsAllowed = true;
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();
auto unifiedDeviceMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties);
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);
EXPECT_TRUE(mockKernel.hasIndirectStatelessAccessToHostMemory());

View File

@ -1195,7 +1195,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenItUsesIndirectUnifiedMemoryDeviceAl
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
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;
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, properties);
@ -1221,9 +1221,9 @@ HWTEST_F(KernelResidencyTest, givenKernelUsingIndirectHostMemoryWhenMakeResident
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
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;
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 unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties);
@ -1244,8 +1244,8 @@ HWTEST_F(KernelResidencyTest, givenKernelUsingIndirectSharedMemoryWhenMakeReside
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
auto hostProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::HOST_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::hostUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
auto unifiedSharedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties);
@ -1266,8 +1266,8 @@ HWTEST_F(KernelResidencyTest, givenKernelUsingIndirectSharedMemoryButNotHasIndir
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
auto svmAllocationsManager = mockKernel.mockContext->getSVMAllocsManager();
auto sharedProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
auto hostProperties = SVMAllocsManager::UnifiedMemoryProperties(InternalMemoryType::HOST_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::hostUnifiedMemory, 1, mockKernel.mockContext->getRootDeviceIndices(), mockKernel.mockContext->getDeviceBitfields());
auto unifiedSharedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()));
auto unifiedHostMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, hostProperties);
mockKernel.mockKernel->kernelHasIndirectAccess = false;
@ -1290,7 +1290,7 @@ HWTEST_F(KernelResidencyTest, givenDeviceUnifiedMemoryAndPageFaultManagerWhenMak
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
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;
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties);
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
@ -1318,7 +1318,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAndPageFaultManagerWhenMak
auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
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 unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
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 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 unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {});
@ -1390,7 +1390,7 @@ HWTEST_F(KernelResidencyTest, givenSvmArgWhenKernelDoesNotRequireUnifiedMemorySy
MockKernelWithInternals mockKernel(*this->pClDevice, nullptr, true);
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 unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue(pDevice->getRootDeviceIndex()), {});
@ -1419,7 +1419,7 @@ HWTEST_F(KernelResidencyTest, givenSvmArgWhenKernelRequireUnifiedMemorySyncThenS
MockKernelWithInternals mockKernel(*this->pClDevice, nullptr, true);
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 unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
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 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 unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
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 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()));
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 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;
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties);
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
@ -1537,7 +1537,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenclSetKernelExecInfoWithUnifiedMemor
MockKernelWithInternals mockKernel(*this->pClDevice);
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;
auto unifiedMemoryAllocation = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, deviceProperties);
@ -2063,7 +2063,7 @@ HWTEST_F(KernelResidencyTest, givenSimpleKernelWhenExecEnvDoesNotHavePageFaultMa
MockKernelWithInternals mockKernel(*this->pClDevice);
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 unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
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);
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 unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
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());
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 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);
*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 sharedMemory = svmAllocationsManager->createUnifiedAllocationWithDeviceStorage(4096u, {}, unifiedMemoryProperties);
@ -586,7 +586,7 @@ HWTEST_F(UsmDestructionTests, givenUsmAllocationWhenBlockingFreeIsCalledThenWait
mockDevice.resetCommandStreamReceiver(mockCsr);
*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 hostMemory = svmAllocationsManager->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);

View File

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

View File

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

View File

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

View File

@ -35,7 +35,7 @@ GraphicsAllocation *allocateGlobalsSurface(NEO::SVMAllocsManager *const svmAlloc
rootDeviceIndices.pushUnique(rootDeviceIndex);
std::map<uint32_t, DeviceBitfield> subDeviceBitfields;
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.requestedAllocationType = allocationType;
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
*
@ -10,13 +10,13 @@
uint32_t UnifiedMemoryControls::generateMask() {
uint32_t resourceMask = 0u;
if (this->indirectHostAllocationsAllowed) {
resourceMask |= InternalMemoryType::HOST_UNIFIED_MEMORY;
resourceMask |= static_cast<uint32_t>(InternalMemoryType::hostUnifiedMemory);
}
if (this->indirectDeviceAllocationsAllowed) {
resourceMask |= InternalMemoryType::DEVICE_UNIFIED_MEMORY;
resourceMask |= static_cast<uint32_t>(InternalMemoryType::deviceUnifiedMemory);
}
if (this->indirectSharedAllocationsAllowed) {
resourceMask |= InternalMemoryType::SHARED_UNIFIED_MEMORY;
resourceMask |= static_cast<uint32_t>(InternalMemoryType::sharedUnifiedMemory);
}
return resourceMask;

View File

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

View File

@ -577,7 +577,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenUsmAllocationWhenDumpAllocationIsCa
RootDeviceIndicesContainer rootDeviceIndices = {rootDeviceIndex};
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;
auto ptr = svmManager->createUnifiedMemoryAllocation(4096, unifiedMemoryProperties);
ASSERT_NE(nullptr, ptr);

View File

@ -27,7 +27,7 @@ TEST(PrefetchManagerTests, givenPrefetchManagerWhenCallingInterfaceFunctionsThen
auto prefetchManager = std::make_unique<MockPrefetchManager>();
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);
ASSERT_NE(nullptr, ptr);
@ -61,7 +61,7 @@ TEST(PrefetchManagerTests, givenPrefetchManagerWhenCallingMigrateAllocationsToGp
auto prefetchManager = std::make_unique<MockPrefetchManager>();
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);
ASSERT_NE(nullptr, ptr);

View File

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

View File

@ -45,7 +45,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenFreeSharedAllocWithOffsetPointerThenReso
auto mockPageFaultManager = new 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 ptr = svmManager->createSharedUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties, &cmdQ);
EXPECT_NE(nullptr, ptr);
@ -73,7 +73,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenFreeSvmAllocationDeferThenAllocationsCou
csr->setupContext(*device->getDefaultEngine().osContext);
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;
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096, unifiedMemoryProperties, &cmdQ);
@ -103,7 +103,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenFreeSVMAllocIsDeferredThenFreedSubsequen
csr->setupContext(*device->getDefaultEngine().osContext);
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;
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(4096, unifiedMemoryProperties, &cmdQ);
@ -130,7 +130,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, GivenTwoRootDevicesWhenAllocatingSharedMemor
csr->setupContext(*device->getDefaultEngine().osContext);
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;
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());
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;
auto ptr = svmManager->createUnifiedMemoryAllocation(4096, unifiedMemoryProperties);
@ -187,7 +187,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenPointerWithOffsetPassedThenProperDataRet
auto device = deviceFactory->rootDevices[0];
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;
auto ptr = svmManager->createUnifiedMemoryAllocation(4096, unifiedMemoryProperties);
@ -208,7 +208,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenMultiplePointerWithOffsetPassedThenPrope
auto device = deviceFactory->rootDevices[0];
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;
auto ptr = svmManager->createUnifiedMemoryAllocation(2048, unifiedMemoryProperties);
@ -220,7 +220,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, whenMultiplePointerWithOffsetPassedThenPrope
MockGraphicsAllocation mockAllocation(unalignedPointer, 512u);
SvmAllocationData allocationData(1u);
allocationData.memoryType = InternalMemoryType::HOST_UNIFIED_MEMORY;
allocationData.memoryType = InternalMemoryType::hostUnifiedMemory;
allocationData.size = mockAllocation.getUnderlyingBufferSize();
allocationData.gpuAllocations.addAllocation(&mockAllocation);
svmManager->svmAllocs.insert(unalignedPointer, allocationData);
@ -250,7 +250,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, givenKmdMigratedSharedAllocationWhenPrefetch
csr->setupContext(*device->getDefaultEngine().osContext);
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);
EXPECT_NE(nullptr, ptr);
@ -282,7 +282,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, givenEnableBOChunkingPrefetchWhenPrefetchMem
auto csr = std::make_unique<MockCommandStreamReceiver>(*device->getExecutionEnvironment(), device->getRootDeviceIndex(), device->getDeviceBitfield());
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;
auto ptr = svmManager->createUnifiedMemoryAllocation(4096, unifiedMemoryProperties);
@ -311,7 +311,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, givenForceMemoryPrefetchForKmdMigratedShared
csr->setupContext(*device->getDefaultEngine().osContext);
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);
EXPECT_NE(nullptr, ptr);
@ -339,7 +339,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, givenAlignmentThenUnifiedMemoryAllocationsAr
memoryManager->validateAllocateProperties = [alignment](const AllocationProperties &properties) {
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;
auto ptr = svmManager->createUnifiedMemoryAllocation(1, unifiedMemoryProperties);
EXPECT_NE(nullptr, ptr);
@ -364,7 +364,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, givenAlignmentThenHostUnifiedMemoryAllocatio
memoryManager->validateAllocateProperties = [alignment](const AllocationProperties &properties) {
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;
auto ptr = svmManager->createHostUnifiedMemoryAllocation(1, unifiedMemoryProperties);
EXPECT_NE(nullptr, ptr);
@ -393,7 +393,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, givenAlignmentThenSharedUnifiedMemoryAllocat
memoryManager->validateAllocateProperties = [alignment](const AllocationProperties &properties) {
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;
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(1, unifiedMemoryProperties, cmdQ);
EXPECT_NE(nullptr, ptr);

View File

@ -684,7 +684,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateS
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);
EXPECT_NE(ptr, nullptr);
@ -732,7 +732,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, MmapFailWhenCreateSharedUnifiedMem
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);
EXPECT_EQ(ptr, nullptr);
@ -755,7 +755,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateS
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();
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
@ -800,7 +800,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenSetVmAdviseAtomicAttributeWhe
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();
for (auto atomicAdvise : {-1, 0, 1, 2}) {
@ -846,7 +846,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenSetVmAdviseDevicePreferredLoc
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();
for (auto preferredLocation : {-1, 0, 1, 2}) {
@ -903,7 +903,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenKmdMigratedSharedAllocationWh
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();
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
@ -952,7 +952,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenCreateContextWithAccessCounte
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();
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
@ -994,7 +994,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenCreateContextWithAccessCounte
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();
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
@ -1050,7 +1050,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationAndUsmInitialP
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();
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
@ -1093,7 +1093,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenKMDSupportForCrossTileMigrati
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();
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);
@ -1233,7 +1233,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, whenVmAdviseIoctlFailsThenCreateSh
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);
@ -1257,7 +1257,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateS
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);
EXPECT_EQ(ptr, nullptr);
@ -1284,7 +1284,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenUseKmdMigrationSetWhenCreateS
SVMAllocsManager unifiedMemoryManager(memoryManager, false);
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);
EXPECT_NE(ptr, nullptr);
@ -1331,7 +1331,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenCreateKmdMigratedSharedAlloca
SVMAllocsManager unifiedMemoryManager(memoryManager, false);
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);
EXPECT_NE(ptr, nullptr);
@ -2009,7 +2009,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenPrintBOCreateDestroyResultFla
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();
auto ptr = unifiedMemoryManager.createSharedUnifiedMemoryAllocation(MemoryConstants::pageSize64k, unifiedMemoryProperties, nullptr);

View File

@ -662,7 +662,7 @@ TEST_F(PageFaultManagerTest, givenUnifiedMemoryAllocWhenSetAubWritableIsCalledTh
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
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 *alloc1 = unifiedMemoryManager->createSharedUnifiedMemoryAllocation(10, properties, cmdQ);
@ -723,7 +723,7 @@ TEST_F(PageFaultManagerTest, givenPageFaultMAnagerWhenSetCpuAllocEvictableIsCall
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
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 *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()));
ASSERT_NE(nullptr, svmAllocsManager.getSVMAlloc(reinterpret_cast<void *>(static_cast<uintptr_t>(alloc->getGpuAddress()))));
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_FALSE(alloc->getDefaultGmm()->resourceParams.Flags.Info.NotLockable);
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_NE(nullptr, svmAllocsManager.getSVMAlloc(reinterpret_cast<void *>(static_cast<uintptr_t>(alloc->getGpuAddress()))));
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_FALSE(alloc->getDefaultGmm()->resourceParams.Flags.Info.NotLockable);
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);
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
*
@ -12,26 +12,26 @@
#include <bitset>
TEST(UnifiedMemoryTests, givenInternalMemoryTypesThenAllHaveOnlyOneBitSet) {
EXPECT_EQ(1u, std::bitset<4>(InternalMemoryType::DEVICE_UNIFIED_MEMORY).count());
EXPECT_EQ(1u, std::bitset<4>(InternalMemoryType::HOST_UNIFIED_MEMORY).count());
EXPECT_EQ(1u, std::bitset<4>(InternalMemoryType::SHARED_UNIFIED_MEMORY).count());
EXPECT_EQ(1u, std::bitset<4>(InternalMemoryType::SVM).count());
EXPECT_EQ(1u, std::bitset<4>(static_cast<uint32_t>(InternalMemoryType::deviceUnifiedMemory)).count());
EXPECT_EQ(1u, std::bitset<4>(static_cast<uint32_t>(InternalMemoryType::hostUnifiedMemory)).count());
EXPECT_EQ(1u, std::bitset<4>(static_cast<uint32_t>(InternalMemoryType::sharedUnifiedMemory)).count());
EXPECT_EQ(1u, std::bitset<4>(static_cast<uint32_t>(InternalMemoryType::svm)).count());
}
TEST(UnifiedMemoryTests, givenUnifiedMemoryControlsWhenDedicatedFieldsAreSetThenMaskIsProperlyGenerated) {
UnifiedMemoryControls controls;
EXPECT_EQ(0u, controls.generateMask());
controls.indirectDeviceAllocationsAllowed = true;
EXPECT_EQ(InternalMemoryType::DEVICE_UNIFIED_MEMORY, controls.generateMask());
EXPECT_EQ(static_cast<uint32_t>(InternalMemoryType::deviceUnifiedMemory), controls.generateMask());
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;
EXPECT_EQ(InternalMemoryType::HOST_UNIFIED_MEMORY, controls.generateMask());
EXPECT_EQ(static_cast<uint32_t>(InternalMemoryType::hostUnifiedMemory), controls.generateMask());
controls.indirectHostAllocationsAllowed = false;
controls.indirectSharedAllocationsAllowed = true;
EXPECT_EQ(InternalMemoryType::SHARED_UNIFIED_MEMORY, controls.generateMask());
EXPECT_EQ(static_cast<uint32_t>(InternalMemoryType::sharedUnifiedMemory), controls.generateMask());
}