Use correct heap when opening device memory IPC handle

This change extends the logic of opening IPC
memory handles and fills the gap between this
logic and allocation of USM device buffers.

When HEAP_EXTENDED is available, then it is
preferred.

Signed-off-by: Wrobel, Patryk <patryk.wrobel@intel.com>
This commit is contained in:
Wrobel, Patryk
2022-11-07 18:39:23 +00:00
committed by Compute-Runtime-Automation
parent eafea5e2fe
commit 4c05a54c2b
3 changed files with 41 additions and 10 deletions

View File

@@ -730,7 +730,9 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromMultipleShared
sizes.push_back(bo->peekSize());
}
auto heapIndex = HeapIndex::HEAP_STANDARD2MB;
auto gfxPartition = getGfxPartition(properties.rootDeviceIndex);
auto prefer57bitAddressing = (gfxPartition->getHeapLimit(HeapIndex::HEAP_EXTENDED) > 0);
auto heapIndex = prefer57bitAddressing ? HeapIndex::HEAP_EXTENDED : HeapIndex::HEAP_STANDARD2MB;
auto gpuRange = acquireGpuRange(totalSize, properties.rootDeviceIndex, heapIndex);
lock.unlock();
@@ -812,10 +814,25 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o
return nullptr;
}
auto heapIndex = isLocalMemorySupported(properties.rootDeviceIndex) ? HeapIndex::HEAP_STANDARD2MB : HeapIndex::HEAP_STANDARD;
if (requireSpecificBitness && this->force32bitAllocations) {
heapIndex = HeapIndex::HEAP_EXTERNAL;
}
auto getHeapIndex = [&] {
if (requireSpecificBitness && this->force32bitAllocations) {
return HeapIndex::HEAP_EXTERNAL;
}
auto gfxPartition = getGfxPartition(properties.rootDeviceIndex);
auto prefer57bitAddressing = (gfxPartition->getHeapLimit(HeapIndex::HEAP_EXTENDED) > 0);
if (prefer57bitAddressing) {
return HeapIndex::HEAP_EXTENDED;
}
if (isLocalMemorySupported(properties.rootDeviceIndex)) {
return HeapIndex::HEAP_STANDARD2MB;
}
return HeapIndex::HEAP_STANDARD;
};
auto heapIndex = getHeapIndex();
auto gpuRange = acquireGpuRange(size, properties.rootDeviceIndex, heapIndex);
bo->setAddress(gpuRange);