Skip to content

Commit 4b0d986

Browse files
Move AllocationType enum out of GraphicsAllocation class
Signed-off-by: Bartosz Dunajski <[email protected]>
1 parent fd27098 commit 4b0d986

File tree

262 files changed

+2075
-2063
lines changed

Some content is hidden

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

262 files changed

+2075
-2063
lines changed

level_zero/core/source/cmdlist/cmdlist.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ NEO::GraphicsAllocation *CommandList::getAllocationFromHostPtrMap(const void *bu
6161
}
6262
}
6363
if (this->cmdListType == CommandListType::TYPE_IMMEDIATE && this->isFlushTaskSubmissionEnabled) {
64-
auto allocation = this->csr->getInternalAllocationStorage()->obtainTemporaryAllocationWithPtr(bufferSize, buffer, NEO::GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR);
64+
auto allocation = this->csr->getInternalAllocationStorage()->obtainTemporaryAllocationWithPtr(bufferSize, buffer, NEO::AllocationType::EXTERNAL_HOST_PTR);
6565
if (allocation != nullptr) {
6666
auto alloc = allocation.get();
6767
this->csr->getInternalAllocationStorage()->storeAllocation(std::move(allocation), NEO::AllocationUsage::TEMPORARY_ALLOCATION);
@@ -97,8 +97,8 @@ void CommandList::removeDeallocationContainerData() {
9797
if (allocData) {
9898
device->getDriverHandle()->getSvmAllocsManager()->removeSVMAlloc(*allocData);
9999
}
100-
if (!((deallocation->getAllocationType() == NEO::GraphicsAllocation::AllocationType::INTERNAL_HEAP) ||
101-
(deallocation->getAllocationType() == NEO::GraphicsAllocation::AllocationType::LINEAR_STREAM))) {
100+
if (!((deallocation->getAllocationType() == NEO::AllocationType::INTERNAL_HEAP) ||
101+
(deallocation->getAllocationType() == NEO::AllocationType::LINEAR_STREAM))) {
102102
memoryManager->freeGraphicsMemory(deallocation);
103103
eraseDeallocationContainerEntry(deallocation);
104104
}
@@ -141,8 +141,8 @@ void CommandList::makeResidentAndMigrate(bool performMigration) {
141141
csr->makeResident(*alloc);
142142

143143
if (performMigration &&
144-
(alloc->getAllocationType() == NEO::GraphicsAllocation::AllocationType::SVM_GPU ||
145-
alloc->getAllocationType() == NEO::GraphicsAllocation::AllocationType::SVM_CPU)) {
144+
(alloc->getAllocationType() == NEO::AllocationType::SVM_GPU ||
145+
alloc->getAllocationType() == NEO::AllocationType::SVM_CPU)) {
146146
auto pageFaultManager = device->getDriverHandle()->getMemoryManager()->getPageFaultManager();
147147
pageFaultManager->moveAllocationToGpuDomain(reinterpret_cast<void *>(alloc->getGpuAddress()));
148148
}

level_zero/core/source/cmdlist/cmdlist_hw.inl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,11 +1512,11 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryFill(void *ptr,
15121512
size_t patternAllocationSize = alignUp(patternSize, MemoryConstants::cacheLineSize);
15131513
uint32_t patternSizeInEls = static_cast<uint32_t>(patternAllocationSize / middleElSize);
15141514

1515-
auto patternGfxAlloc = device->obtainReusableAllocation(patternAllocationSize, NEO::GraphicsAllocation::AllocationType::FILL_PATTERN);
1515+
auto patternGfxAlloc = device->obtainReusableAllocation(patternAllocationSize, NEO::AllocationType::FILL_PATTERN);
15161516
if (patternGfxAlloc == nullptr) {
15171517
patternGfxAlloc = device->getDriverHandle()->getMemoryManager()->allocateGraphicsMemoryWithProperties({device->getNEODevice()->getRootDeviceIndex(),
15181518
patternAllocationSize,
1519-
NEO::GraphicsAllocation::AllocationType::FILL_PATTERN,
1519+
NEO::AllocationType::FILL_PATTERN,
15201520
device->getNEODevice()->getDeviceBitfield()});
15211521
}
15221522
void *patternGfxAllocPtr = patternGfxAlloc->getUnderlyingBuffer();
@@ -2106,7 +2106,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendQueryKernelTimestamps(
21062106
}
21072107

21082108
size_t alignedSize = alignUp<size_t>(sizeof(EventData) * numEvents, MemoryConstants::pageSize64k);
2109-
NEO::GraphicsAllocation::AllocationType allocationType = NEO::GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER;
2109+
NEO::AllocationType allocationType = NEO::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER;
21102110
auto devices = device->getNEODevice()->getDeviceBitfield();
21112111
NEO::AllocationProperties allocationProperties{device->getRootDeviceIndex(),
21122112
true,

level_zero/core/source/cmdqueue/cmdqueue.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,17 @@ ze_command_queue_mode_t CommandQueueImp::getSynchronousMode() const {
185185
ze_result_t CommandQueueImp::CommandBufferManager::initialize(Device *device, size_t sizeRequested) {
186186
size_t alignedSize = alignUp<size_t>(sizeRequested, MemoryConstants::pageSize64k);
187187
NEO::AllocationProperties properties{device->getRootDeviceIndex(), true, alignedSize,
188-
NEO::GraphicsAllocation::AllocationType::COMMAND_BUFFER,
188+
NEO::AllocationType::COMMAND_BUFFER,
189189
(device->getNEODevice()->getNumGenericSubDevices() > 1u) /* multiOsContextCapable */,
190190
false,
191191
device->getNEODevice()->getDeviceBitfield()};
192192

193-
auto firstBuffer = device->obtainReusableAllocation(alignedSize, NEO::GraphicsAllocation::AllocationType::COMMAND_BUFFER);
193+
auto firstBuffer = device->obtainReusableAllocation(alignedSize, NEO::AllocationType::COMMAND_BUFFER);
194194
if (!firstBuffer) {
195195
firstBuffer = device->getNEODevice()->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
196196
}
197197

198-
auto secondBuffer = device->obtainReusableAllocation(alignedSize, NEO::GraphicsAllocation::AllocationType::COMMAND_BUFFER);
198+
auto secondBuffer = device->obtainReusableAllocation(alignedSize, NEO::AllocationType::COMMAND_BUFFER);
199199
if (!secondBuffer) {
200200
secondBuffer = device->getNEODevice()->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
201201
}

level_zero/core/source/context/context_imp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ ze_result_t ContextImp::openEventPoolIpcHandle(ze_ipc_event_pool_handle_t hIpc,
485485
size_t alignedSize = alignUp<size_t>(numEvents * eventSize, MemoryConstants::pageSize64k);
486486
NEO::AllocationProperties unifiedMemoryProperties{rootDeviceIndex,
487487
alignedSize,
488-
NEO::GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY,
488+
NEO::AllocationType::BUFFER_HOST_MEMORY,
489489
systemMemoryBitfield};
490490

491491
unifiedMemoryProperties.subDevicesBitfield = neoDevice->getDeviceBitfield();

level_zero/core/source/debugger/debugger_l0.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void DebuggerL0::initialize() {
3333
sbaTrackingGpuVa = device->getMemoryManager()->reserveGpuAddress(MemoryConstants::pageSize, device->getRootDeviceIndex());
3434

3535
NEO::AllocationProperties properties{device->getRootDeviceIndex(), true, MemoryConstants::pageSize,
36-
NEO::GraphicsAllocation::AllocationType::DEBUG_SBA_TRACKING_BUFFER,
36+
NEO::AllocationType::DEBUG_SBA_TRACKING_BUFFER,
3737
false,
3838
device->getDeviceBitfield()};
3939

@@ -55,7 +55,7 @@ void DebuggerL0::initialize() {
5555
auto &hwInfo = device->getHardwareInfo();
5656
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
5757
NEO::AllocationProperties properties{device->getRootDeviceIndex(), true, MemoryConstants::pageSize64k,
58-
NEO::GraphicsAllocation::AllocationType::DEBUG_MODULE_AREA,
58+
NEO::AllocationType::DEBUG_MODULE_AREA,
5959
false,
6060
device->getDeviceBitfield()};
6161
moduleDebugArea = device->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);

level_zero/core/source/device/device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ struct Device : _ze_device_handle_t {
144144
virtual SysmanDevice *getSysmanHandle() = 0;
145145
virtual ze_result_t getCsrForOrdinalAndIndex(NEO::CommandStreamReceiver **csr, uint32_t ordinal, uint32_t index) = 0;
146146
virtual ze_result_t getCsrForLowPriority(NEO::CommandStreamReceiver **csr) = 0;
147-
virtual NEO::GraphicsAllocation *obtainReusableAllocation(size_t requiredSize, NEO::GraphicsAllocation::AllocationType type) = 0;
147+
virtual NEO::GraphicsAllocation *obtainReusableAllocation(size_t requiredSize, NEO::AllocationType type) = 0;
148148
virtual void storeReusableAllocation(NEO::GraphicsAllocation &alloc) = 0;
149149

150150
protected:

level_zero/core/source/device/device_imp.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, bool
845845
debugSurface = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(
846846
{device->getRootDeviceIndex(), true,
847847
debugSurfaceSize,
848-
NEO::GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA,
848+
NEO::AllocationType::DEBUG_CONTEXT_SAVE_AREA,
849849
false,
850850
false,
851851
device->getNEODevice()->getDeviceBitfield()});
@@ -1009,7 +1009,7 @@ NEO::GraphicsAllocation *DeviceImp::allocateManagedMemoryFromHostPtr(void *buffe
10091009
}
10101010

10111011
allocation = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(
1012-
{getRootDeviceIndex(), false, size, NEO::GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, false, neoDevice->getDeviceBitfield()},
1012+
{getRootDeviceIndex(), false, size, NEO::AllocationType::BUFFER_HOST_MEMORY, false, neoDevice->getDeviceBitfield()},
10131013
buffer);
10141014

10151015
if (allocation == nullptr) {
@@ -1029,7 +1029,7 @@ NEO::GraphicsAllocation *DeviceImp::allocateManagedMemoryFromHostPtr(void *buffe
10291029

10301030
NEO::GraphicsAllocation *DeviceImp::allocateMemoryFromHostPtr(const void *buffer, size_t size, bool hostCopyAllowed) {
10311031
NEO::AllocationProperties properties = {getRootDeviceIndex(), false, size,
1032-
NEO::GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR,
1032+
NEO::AllocationType::EXTERNAL_HOST_PTR,
10331033
false, neoDevice->getDeviceBitfield()};
10341034
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = true;
10351035
auto allocation = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties,
@@ -1044,7 +1044,7 @@ NEO::GraphicsAllocation *DeviceImp::allocateMemoryFromHostPtr(const void *buffer
10441044
return allocation;
10451045
}
10461046

1047-
NEO::GraphicsAllocation *DeviceImp::obtainReusableAllocation(size_t requiredSize, NEO::GraphicsAllocation::AllocationType type) {
1047+
NEO::GraphicsAllocation *DeviceImp::obtainReusableAllocation(size_t requiredSize, NEO::AllocationType type) {
10481048
auto alloc = allocationsForReuse->detachAllocation(requiredSize, nullptr, nullptr, type);
10491049
if (alloc == nullptr)
10501050
return nullptr;

level_zero/core/source/device/device_imp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ struct DeviceImp : public Device {
9494
SysmanDevice *getSysmanHandle() override;
9595
ze_result_t getCsrForOrdinalAndIndex(NEO::CommandStreamReceiver **csr, uint32_t ordinal, uint32_t index) override;
9696
ze_result_t getCsrForLowPriority(NEO::CommandStreamReceiver **csr) override;
97-
NEO::GraphicsAllocation *obtainReusableAllocation(size_t requiredSize, NEO::GraphicsAllocation::AllocationType type) override;
97+
NEO::GraphicsAllocation *obtainReusableAllocation(size_t requiredSize, NEO::AllocationType type) override;
9898
void storeReusableAllocation(NEO::GraphicsAllocation &alloc) override;
9999
NEO::Device *getActiveDevice() const;
100100

level_zero/core/source/driver/driver_handle_imp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ void *DriverHandleImp::importFdHandle(ze_device_handle_t hDevice, ze_ipc_memory_
421421
NEO::osHandle osHandle = static_cast<NEO::osHandle>(handle);
422422
NEO::AllocationProperties unifiedMemoryProperties{neoDevice->getRootDeviceIndex(),
423423
MemoryConstants::pageSize,
424-
NEO::GraphicsAllocation::AllocationType::BUFFER,
424+
NEO::AllocationType::BUFFER,
425425
neoDevice->getDeviceBitfield()};
426426
unifiedMemoryProperties.subDevicesBitfield = neoDevice->getDeviceBitfield();
427427
NEO::GraphicsAllocation *alloc =
@@ -499,7 +499,7 @@ NEO::GraphicsAllocation *DriverHandleImp::getPeerAllocation(Device *device,
499499
void *DriverHandleImp::importNTHandle(ze_device_handle_t hDevice, void *handle) {
500500
auto neoDevice = Device::fromHandle(hDevice)->getNEODevice();
501501

502-
auto alloc = this->getMemoryManager()->createGraphicsAllocationFromNTHandle(handle, neoDevice->getRootDeviceIndex(), NEO::GraphicsAllocation::AllocationType::SHARED_BUFFER);
502+
auto alloc = this->getMemoryManager()->createGraphicsAllocationFromNTHandle(handle, neoDevice->getRootDeviceIndex(), NEO::AllocationType::SHARED_BUFFER);
503503

504504
if (alloc == nullptr) {
505505
return nullptr;

level_zero/core/source/driver/host_pointer_manager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020-2021 Intel Corporation
2+
* Copyright (C) 2020-2022 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -110,7 +110,7 @@ NEO::GraphicsAllocation *HostPointerManager::createHostPointerAllocation(uint32_
110110
size_t size,
111111
const NEO::DeviceBitfield &deviceBitfield) {
112112
NEO::AllocationProperties properties = {rootDeviceIndex, false, size,
113-
NEO::GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR,
113+
NEO::AllocationType::EXTERNAL_HOST_PTR,
114114
false, deviceBitfield};
115115
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = true;
116116
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties,

0 commit comments

Comments
 (0)