Skip to content

Commit b182917

Browse files
refactor: correct naming of allocation types
Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent eac3d21 commit b182917

File tree

302 files changed

+2536
-2536
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

302 files changed

+2536
-2536
lines changed

level_zero/core/source/cmdlist/cmdlist.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ NEO::GraphicsAllocation *CommandList::getAllocationFromHostPtrMap(const void *bu
8080
}
8181
}
8282
if (this->storeExternalPtrAsTemporary()) {
83-
auto allocation = this->csr->getInternalAllocationStorage()->obtainTemporaryAllocationWithPtr(bufferSize, buffer, NEO::AllocationType::EXTERNAL_HOST_PTR);
83+
auto allocation = this->csr->getInternalAllocationStorage()->obtainTemporaryAllocationWithPtr(bufferSize, buffer, NEO::AllocationType::externalHostPtr);
8484
if (allocation != nullptr) {
8585
auto alloc = allocation.get();
8686
alloc->hostPtrTaskCountAssignment++;
@@ -111,7 +111,7 @@ NEO::GraphicsAllocation *CommandList::getHostPtrAlloc(const void *buffer, uint64
111111
if (this->storeExternalPtrAsTemporary()) {
112112
alloc->hostPtrTaskCountAssignment++;
113113
this->csr->getInternalAllocationStorage()->storeAllocationWithTaskCount(std::unique_ptr<NEO::GraphicsAllocation>(alloc), NEO::AllocationUsage::TEMPORARY_ALLOCATION, this->csr->peekTaskCount());
114-
} else if (alloc->getAllocationType() == NEO::AllocationType::EXTERNAL_HOST_PTR) {
114+
} else if (alloc->getAllocationType() == NEO::AllocationType::externalHostPtr) {
115115
hostPtrMap.insert(std::make_pair(buffer, alloc));
116116
} else {
117117
commandContainer.getDeallocationContainer().push_back(alloc);
@@ -130,8 +130,8 @@ void CommandList::removeDeallocationContainerData() {
130130
if (allocData) {
131131
device->getDriverHandle()->getSvmAllocsManager()->removeSVMAlloc(*allocData);
132132
}
133-
if (!((deallocation->getAllocationType() == NEO::AllocationType::INTERNAL_HEAP) ||
134-
(deallocation->getAllocationType() == NEO::AllocationType::LINEAR_STREAM))) {
133+
if (!((deallocation->getAllocationType() == NEO::AllocationType::internalHeap) ||
134+
(deallocation->getAllocationType() == NEO::AllocationType::linearStream))) {
135135
memoryManager->freeGraphicsMemory(deallocation);
136136
eraseDeallocationContainerEntry(deallocation);
137137
}

level_zero/core/source/cmdlist/cmdlist_hw.inl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -913,8 +913,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemory(void *
913913
CmdListKernelLaunchParams launchParams = {};
914914
launchParams.isBuiltInKernel = true;
915915
launchParams.isDestinationAllocationInSystemMemory =
916-
(dstAllocationType == NEO::AllocationType::BUFFER_HOST_MEMORY) ||
917-
(dstAllocationType == NEO::AllocationType::EXTERNAL_HOST_PTR);
916+
(dstAllocationType == NEO::AllocationType::bufferHostMemory) ||
917+
(dstAllocationType == NEO::AllocationType::externalHostPtr);
918918
ret = CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernel(builtinKernel->toHandle(), kernelArgs,
919919
event, numWaitEvents, phWaitEvents, launchParams, relaxedOrderingDispatch);
920920
addToMappedEventList(event);
@@ -1193,9 +1193,9 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernelWithGA(v
11931193
auto dstAllocationType = dstPtrAlloc->getAllocationType();
11941194
launchParams.isBuiltInKernel = true;
11951195
launchParams.isDestinationAllocationInSystemMemory =
1196-
(dstAllocationType == NEO::AllocationType::BUFFER_HOST_MEMORY) ||
1197-
(dstAllocationType == NEO::AllocationType::SVM_CPU) ||
1198-
(dstAllocationType == NEO::AllocationType::EXTERNAL_HOST_PTR);
1196+
(dstAllocationType == NEO::AllocationType::bufferHostMemory) ||
1197+
(dstAllocationType == NEO::AllocationType::svmCpu) ||
1198+
(dstAllocationType == NEO::AllocationType::externalHostPtr);
11991199

12001200
return CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelSplit(builtinKernel, dispatchKernelArgs, signalEvent, launchParams);
12011201
}
@@ -1720,8 +1720,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernel3d(Align
17201720
CmdListKernelLaunchParams launchParams = {};
17211721
launchParams.isBuiltInKernel = true;
17221722
launchParams.isDestinationAllocationInSystemMemory =
1723-
(dstAllocationType == NEO::AllocationType::BUFFER_HOST_MEMORY) ||
1724-
(dstAllocationType == NEO::AllocationType::EXTERNAL_HOST_PTR);
1723+
(dstAllocationType == NEO::AllocationType::bufferHostMemory) ||
1724+
(dstAllocationType == NEO::AllocationType::externalHostPtr);
17251725
return CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernel(builtinKernel->toHandle(), dispatchKernelArgs, signalEvent, numWaitEvents,
17261726
phWaitEvents, launchParams, relaxedOrderingDispatch);
17271727
}
@@ -1787,8 +1787,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernel2d(Align
17871787
CmdListKernelLaunchParams launchParams = {};
17881788
launchParams.isBuiltInKernel = true;
17891789
launchParams.isDestinationAllocationInSystemMemory =
1790-
(dstAllocationType == NEO::AllocationType::BUFFER_HOST_MEMORY) ||
1791-
(dstAllocationType == NEO::AllocationType::EXTERNAL_HOST_PTR);
1790+
(dstAllocationType == NEO::AllocationType::bufferHostMemory) ||
1791+
(dstAllocationType == NEO::AllocationType::externalHostPtr);
17921792
return CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernel(builtinKernel->toHandle(),
17931793
dispatchKernelArgs, signalEvent,
17941794
numWaitEvents,
@@ -1978,11 +1978,11 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryFill(void *ptr,
19781978
builtinKernel->setGroupSize(static_cast<uint32_t>(fillArguments.mainGroupSize), 1, 1);
19791979

19801980
size_t patternAllocationSize = alignUp(patternSize, MemoryConstants::cacheLineSize);
1981-
auto patternGfxAlloc = device->obtainReusableAllocation(patternAllocationSize, NEO::AllocationType::FILL_PATTERN);
1981+
auto patternGfxAlloc = device->obtainReusableAllocation(patternAllocationSize, NEO::AllocationType::fillPattern);
19821982
if (patternGfxAlloc == nullptr) {
19831983
NEO::AllocationProperties allocationProperties{device->getNEODevice()->getRootDeviceIndex(),
19841984
patternAllocationSize,
1985-
NEO::AllocationType::FILL_PATTERN,
1985+
NEO::AllocationType::fillPattern,
19861986
device->getNEODevice()->getDeviceBitfield()};
19871987
allocationProperties.alignment = MemoryConstants::pageSize;
19881988
patternGfxAlloc = device->getDriverHandle()->getMemoryManager()->allocateGraphicsMemoryWithProperties(allocationProperties);
@@ -2254,7 +2254,7 @@ inline AlignedAllocationData CommandListCoreFamily<gfxCoreFamily>::getAlignedAll
22542254
return {0u, 0, nullptr, false};
22552255
}
22562256
alignedPtr = static_cast<uintptr_t>(alignDown(alloc->getGpuAddress(), NEO::EncodeSurfaceState<GfxFamily>::getSurfaceBaseAddressAlignment()));
2257-
if (alloc->getAllocationType() == NEO::AllocationType::EXTERNAL_HOST_PTR) {
2257+
if (alloc->getAllocationType() == NEO::AllocationType::externalHostPtr) {
22582258
auto hostAllocCpuPtr = reinterpret_cast<uintptr_t>(alloc->getUnderlyingBuffer());
22592259
hostAllocCpuPtr = alignDown(hostAllocCpuPtr, NEO::EncodeSurfaceState<GfxFamily>::getSurfaceBaseAddressAlignment());
22602260
auto allignedPtrOffset = sourcePtr - hostAllocCpuPtr;
@@ -2301,7 +2301,7 @@ inline AlignedAllocationData CommandListCoreFamily<gfxCoreFamily>::getAlignedAll
23012301
template <GFXCORE_FAMILY gfxCoreFamily>
23022302
inline size_t CommandListCoreFamily<gfxCoreFamily>::getAllocationOffsetForAppendBlitFill(void *ptr, NEO::GraphicsAllocation &gpuAllocation) {
23032303
uint64_t offset;
2304-
if (gpuAllocation.getAllocationType() == NEO::AllocationType::EXTERNAL_HOST_PTR) {
2304+
if (gpuAllocation.getAllocationType() == NEO::AllocationType::externalHostPtr) {
23052305
offset = castToUint64(ptr) - castToUint64(gpuAllocation.getUnderlyingBuffer()) + gpuAllocation.getAllocationOffset();
23062306
} else {
23072307
offset = castToUint64(ptr) - gpuAllocation.getGpuAddress();
@@ -2771,7 +2771,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendQueryKernelTimestamps(
27712771
}
27722772

27732773
size_t alignedSize = alignUp<size_t>(sizeof(EventData) * numEvents, MemoryConstants::pageSize64k);
2774-
NEO::AllocationType allocationType = NEO::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER;
2774+
NEO::AllocationType allocationType = NEO::AllocationType::gpuTimestampDeviceBuffer;
27752775
auto devices = device->getNEODevice()->getDeviceBitfield();
27762776
NEO::AllocationProperties allocationProperties{device->getRootDeviceIndex(),
27772777
true,
@@ -2840,8 +2840,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendQueryKernelTimestamps(
28402840
CmdListKernelLaunchParams launchParams = {};
28412841
launchParams.isBuiltInKernel = true;
28422842
launchParams.isDestinationAllocationInSystemMemory =
2843-
(dstAllocationType == NEO::AllocationType::BUFFER_HOST_MEMORY) ||
2844-
(dstAllocationType == NEO::AllocationType::EXTERNAL_HOST_PTR);
2843+
(dstAllocationType == NEO::AllocationType::bufferHostMemory) ||
2844+
(dstAllocationType == NEO::AllocationType::externalHostPtr);
28452845
auto appendResult = appendLaunchKernel(builtinKernel->toHandle(), dispatchKernelArgs, hSignalEvent, numWaitEvents,
28462846
phWaitEvents, launchParams, false);
28472847
if (appendResult != ZE_RESULT_SUCCESS) {
@@ -3403,8 +3403,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendWaitOnMemory(void *desc,
34033403
const auto &rootDeviceEnvironment = this->device->getNEODevice()->getRootDeviceEnvironment();
34043404
auto allocType = srcAllocationStruct.alloc->getAllocationType();
34053405
bool isSystemMemoryUsed =
3406-
(allocType == NEO::AllocationType::BUFFER_HOST_MEMORY) ||
3407-
(allocType == NEO::AllocationType::EXTERNAL_HOST_PTR);
3406+
(allocType == NEO::AllocationType::bufferHostMemory) ||
3407+
(allocType == NEO::AllocationType::externalHostPtr);
34083408
if (isSystemMemoryUsed) {
34093409
NEO::MemorySynchronizationCommands<GfxFamily>::addAdditionalSynchronization(*commandContainer.getCommandStream(), gpuAddress, true, rootDeviceEnvironment);
34103410
}

level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
208208
if (allocation == nullptr) {
209209
continue;
210210
}
211-
if (allocation->getAllocationType() == NEO::AllocationType::BUFFER_HOST_MEMORY) {
211+
if (allocation->getAllocationType() == NEO::AllocationType::bufferHostMemory) {
212212
isKernelUsingSystemAllocation = true;
213213
}
214214
}

level_zero/core/source/cmdlist/cmdlist_imp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,14 @@ void CommandListImp::enableInOrderExecution() {
232232

233233
auto device = this->device->getNEODevice();
234234

235-
NEO::AllocationProperties allocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize64k, NEO::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER, device->getDeviceBitfield()};
235+
NEO::AllocationProperties allocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize64k, NEO::AllocationType::timestampPacketTagBuffer, device->getDeviceBitfield()};
236236

237237
auto inOrderDependencyCounterAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties(allocationProperties);
238238

239239
NEO::GraphicsAllocation *hostCounterAllocation = nullptr;
240240

241241
if (duplicatedInOrderCounterStorageEnabled()) {
242-
NEO::AllocationProperties hostAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize64k, NEO::AllocationType::BUFFER_HOST_MEMORY, device->getDeviceBitfield()};
242+
NEO::AllocationProperties hostAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize64k, NEO::AllocationType::bufferHostMemory, device->getDeviceBitfield()};
243243
hostCounterAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties(hostAllocationProperties);
244244

245245
UNRECOVERABLE_IF(!hostCounterAllocation);

level_zero/core/source/cmdqueue/cmdqueue.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,17 +268,17 @@ void CommandQueueImp::registerCsrClient() {
268268
ze_result_t CommandQueueImp::CommandBufferManager::initialize(Device *device, size_t sizeRequested) {
269269
size_t alignedSize = alignUp<size_t>(sizeRequested, MemoryConstants::pageSize64k);
270270
NEO::AllocationProperties properties{device->getRootDeviceIndex(), true, alignedSize,
271-
NEO::AllocationType::COMMAND_BUFFER,
271+
NEO::AllocationType::commandBuffer,
272272
(device->getNEODevice()->getNumGenericSubDevices() > 1u) /* multiOsContextCapable */,
273273
false,
274274
device->getNEODevice()->getDeviceBitfield()};
275275

276-
auto firstBuffer = device->obtainReusableAllocation(alignedSize, NEO::AllocationType::COMMAND_BUFFER);
276+
auto firstBuffer = device->obtainReusableAllocation(alignedSize, NEO::AllocationType::commandBuffer);
277277
if (!firstBuffer) {
278278
firstBuffer = device->getNEODevice()->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
279279
}
280280

281-
auto secondBuffer = device->obtainReusableAllocation(alignedSize, NEO::AllocationType::COMMAND_BUFFER);
281+
auto secondBuffer = device->obtainReusableAllocation(alignedSize, NEO::AllocationType::commandBuffer);
282282
if (!secondBuffer) {
283283
secondBuffer = device->getNEODevice()->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
284284
}
@@ -348,8 +348,8 @@ void CommandQueueImp::makeResidentAndMigrate(bool performMigration, const NEO::R
348348
alloc->prepareHostPtrForResidency(csr);
349349
csr->makeResident(*alloc);
350350
if (performMigration &&
351-
(alloc->getAllocationType() == NEO::AllocationType::SVM_GPU ||
352-
alloc->getAllocationType() == NEO::AllocationType::SVM_CPU)) {
351+
(alloc->getAllocationType() == NEO::AllocationType::svmGpu ||
352+
alloc->getAllocationType() == NEO::AllocationType::svmCpu)) {
353353
auto pageFaultManager = device->getDriverHandle()->getMemoryManager()->getPageFaultManager();
354354
pageFaultManager->moveAllocationToGpuDomain(reinterpret_cast<void *>(alloc->getGpuAddress()));
355355
}

level_zero/core/source/context/context_imp.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ ze_result_t ContextImp::allocHostMem(const ze_host_mem_alloc_desc_t *hostDesc,
102102
ze_ipc_memory_flags_t flags = {};
103103
*ptr = getMemHandlePtr(this->devices.begin()->second,
104104
lookupTable.sharedHandleType.fd,
105-
NEO::AllocationType::BUFFER_HOST_MEMORY,
105+
NEO::AllocationType::bufferHostMemory,
106106
flags);
107107
if (nullptr == *ptr) {
108108
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
@@ -111,7 +111,7 @@ ze_result_t ContextImp::allocHostMem(const ze_host_mem_alloc_desc_t *hostDesc,
111111
UNRECOVERABLE_IF(!lookupTable.sharedHandleType.isNTHandle);
112112
*ptr = this->driverHandle->importNTHandle(this->devices.begin()->second,
113113
lookupTable.sharedHandleType.ntHnadle,
114-
NEO::AllocationType::BUFFER_HOST_MEMORY);
114+
NEO::AllocationType::bufferHostMemory);
115115
if (*ptr == nullptr) {
116116
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
117117
}
@@ -223,7 +223,7 @@ ze_result_t ContextImp::allocDeviceMem(ze_device_handle_t hDevice,
223223
ze_ipc_memory_flags_t flags = {};
224224
*ptr = getMemHandlePtr(hDevice,
225225
lookupTable.sharedHandleType.fd,
226-
NEO::AllocationType::BUFFER,
226+
NEO::AllocationType::buffer,
227227
flags);
228228
if (nullptr == *ptr) {
229229
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
@@ -232,7 +232,7 @@ ze_result_t ContextImp::allocDeviceMem(ze_device_handle_t hDevice,
232232
UNRECOVERABLE_IF(!lookupTable.sharedHandleType.isNTHandle);
233233
*ptr = this->driverHandle->importNTHandle(hDevice,
234234
lookupTable.sharedHandleType.ntHnadle,
235-
NEO::AllocationType::BUFFER);
235+
NEO::AllocationType::buffer);
236236
if (*ptr == nullptr) {
237237
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
238238
}
@@ -693,11 +693,11 @@ ze_result_t ContextImp::openIpcMemHandle(ze_device_handle_t hDevice,
693693
uint64_t handle = ipcData.handle;
694694
uint8_t type = ipcData.type;
695695

696-
NEO::AllocationType allocationType = NEO::AllocationType::UNKNOWN;
696+
NEO::AllocationType allocationType = NEO::AllocationType::unknown;
697697
if (type == static_cast<uint8_t>(InternalIpcMemoryType::IPC_DEVICE_UNIFIED_MEMORY)) {
698-
allocationType = NEO::AllocationType::BUFFER;
698+
allocationType = NEO::AllocationType::buffer;
699699
} else if (type == static_cast<uint8_t>(InternalIpcMemoryType::IPC_HOST_UNIFIED_MEMORY)) {
700-
allocationType = NEO::AllocationType::BUFFER_HOST_MEMORY;
700+
allocationType = NEO::AllocationType::bufferHostMemory;
701701
} else {
702702
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
703703
}
@@ -1083,7 +1083,7 @@ ze_result_t ContextImp::createPhysicalMem(ze_device_handle_t hDevice,
10831083
NEO::AllocationProperties physicalDeviceMemoryProperties{neoDevice->getRootDeviceIndex(),
10841084
true,
10851085
desc->size,
1086-
NEO::AllocationType::BUFFER,
1086+
NEO::AllocationType::buffer,
10871087
false,
10881088
false,
10891089
device->getNEODevice()->getDeviceBitfield()};

level_zero/core/source/device/device_imp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, bool
12611261
debugSurface = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(
12621262
{device->getRootDeviceIndex(), true,
12631263
debugSurfaceSize,
1264-
NEO::AllocationType::DEBUG_CONTEXT_SAVE_AREA,
1264+
NEO::AllocationType::debugContextSaveArea,
12651265
false,
12661266
false,
12671267
device->getNEODevice()->getDeviceBitfield()});
@@ -1465,7 +1465,7 @@ NEO::GraphicsAllocation *DeviceImp::allocateManagedMemoryFromHostPtr(void *buffe
14651465
}
14661466

14671467
allocation = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(
1468-
{getRootDeviceIndex(), false, size, NEO::AllocationType::BUFFER_HOST_MEMORY, false, neoDevice->getDeviceBitfield()},
1468+
{getRootDeviceIndex(), false, size, NEO::AllocationType::bufferHostMemory, false, neoDevice->getDeviceBitfield()},
14691469
buffer);
14701470

14711471
if (allocation == nullptr) {
@@ -1485,7 +1485,7 @@ NEO::GraphicsAllocation *DeviceImp::allocateManagedMemoryFromHostPtr(void *buffe
14851485

14861486
NEO::GraphicsAllocation *DeviceImp::allocateMemoryFromHostPtr(const void *buffer, size_t size, bool hostCopyAllowed) {
14871487
NEO::AllocationProperties properties = {getRootDeviceIndex(), false, size,
1488-
NEO::AllocationType::EXTERNAL_HOST_PTR,
1488+
NEO::AllocationType::externalHostPtr,
14891489
false, neoDevice->getDeviceBitfield()};
14901490
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = true;
14911491
auto allocation = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties,

0 commit comments

Comments
 (0)