mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Simplify Memory Manager API [3/4]
- remove method allocateGraphicsMemory(size_t size) - pass allocation type in allocation properties - set allocation type in allocateGraphicsMemoryInPreferredPool Change-Id: Ia9296d0ab2f711b7d78aff615cb56b3a246b60ec Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
686785ce5d
commit
8ec072d39c
@@ -192,9 +192,9 @@ Buffer *Buffer::create(Context *context,
|
||||
}
|
||||
|
||||
if (!memory) {
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(properties.flags_intel, allocateMemory, size);
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(properties.flags_intel, allocateMemory, size, allocationType);
|
||||
DevicesBitfield devices = MemObjHelper::getDevicesBitfield(properties);
|
||||
memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, devices, hostPtr, allocationType);
|
||||
memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, devices, hostPtr);
|
||||
}
|
||||
|
||||
if (allocateMemory && memory && MemoryPool::isSystemMemoryPool(memory->getMemoryPool())) {
|
||||
@@ -207,9 +207,9 @@ Buffer *Buffer::create(Context *context,
|
||||
allocationType = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
|
||||
zeroCopyAllowed = false;
|
||||
copyMemoryFromHostPtr = true;
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(properties.flags_intel, true, size);
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(properties.flags_intel, true, size, allocationType);
|
||||
DevicesBitfield devices = MemObjHelper::getDevicesBitfield(properties);
|
||||
memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, devices, nullptr, allocationType);
|
||||
memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, devices, nullptr);
|
||||
}
|
||||
|
||||
if (!memory) {
|
||||
|
||||
@@ -33,8 +33,8 @@ bool MemObjHelper::validateExtraMemoryProperties(const MemoryProperties &propert
|
||||
return true;
|
||||
}
|
||||
|
||||
AllocationProperties MemObjHelper::getAllocationProperties(cl_mem_flags_intel flags, bool allocateMemory, size_t size) {
|
||||
return AllocationProperties(allocateMemory, size);
|
||||
AllocationProperties MemObjHelper::getAllocationProperties(cl_mem_flags_intel flags, bool allocateMemory, size_t size, GraphicsAllocation::AllocationType type) {
|
||||
return AllocationProperties(allocateMemory, size, type);
|
||||
}
|
||||
|
||||
DevicesBitfield MemObjHelper::getDevicesBitfield(const MemoryProperties &properties) {
|
||||
|
||||
@@ -50,7 +50,7 @@ class MemObjHelper {
|
||||
|
||||
static bool validateExtraMemoryProperties(const MemoryProperties &properties);
|
||||
|
||||
static AllocationProperties getAllocationProperties(cl_mem_flags_intel flags, bool allocateMemory, size_t size);
|
||||
static AllocationProperties getAllocationProperties(cl_mem_flags_intel flags, bool allocateMemory, size_t size, GraphicsAllocation::AllocationType type);
|
||||
|
||||
static DevicesBitfield getDevicesBitfield(const MemoryProperties &properties);
|
||||
|
||||
|
||||
@@ -51,9 +51,9 @@ Pipe *Pipe::create(Context *context,
|
||||
memoryProperties.flags = flags;
|
||||
while (true) {
|
||||
auto size = static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace);
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(flags, true, size);
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(flags, true, size, GraphicsAllocation::AllocationType::PIPE);
|
||||
DevicesBitfield devices = MemObjHelper::getDevicesBitfield(memoryProperties);
|
||||
GraphicsAllocation *memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, devices, nullptr, GraphicsAllocation::AllocationType::PIPE);
|
||||
GraphicsAllocation *memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, devices, nullptr);
|
||||
if (!memory) {
|
||||
errcodeRet = CL_OUT_OF_HOST_MEMORY;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user