Use device index from os context when allocating heaps and command buffers

Related-To: NEO-3691

Change-Id: I64015d606bba289d250920899ad620171e8303b7
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2019-09-23 11:10:48 +02:00
committed by sys_ocldev
parent 1448f6a312
commit 7cb6d665a5
4 changed files with 31 additions and 2 deletions

View File

@@ -126,7 +126,7 @@ void CommandStreamReceiver::ensureCommandBufferAllocation(LinearStream &commandS
auto allocation = this->getInternalAllocationStorage()->obtainReusableAllocation(allocationSize, allocationType).release();
if (allocation == nullptr) {
const AllocationProperties commandStreamAllocationProperties{true, allocationSize, allocationType,
isMultiOsContextCapable(), deviceIndex};
isMultiOsContextCapable(), getDeviceIndexForAllocation()};
allocation = this->getMemoryManager()->allocateGraphicsMemoryWithProperties(commandStreamAllocationProperties);
}
DEBUG_BREAK_IF(allocation == nullptr);
@@ -297,6 +297,10 @@ IndirectHeap &CommandStreamReceiver::getIndirectHeap(IndirectHeap::Type heapType
return *heap;
}
uint32_t CommandStreamReceiver::getDeviceIndexForAllocation() const {
return osContext->getDeviceBitfield().any() ? static_cast<uint32_t>(Math::log2(static_cast<uint32_t>(osContext->getDeviceBitfield().to_ulong()))) : 0u;
}
void CommandStreamReceiver::allocateHeapMemory(IndirectHeap::Type heapType,
size_t minRequiredSize, IndirectHeap *&indirectHeap) {
size_t reservedSize = 0;
@@ -321,7 +325,7 @@ void CommandStreamReceiver::allocateHeapMemory(IndirectHeap::Type heapType,
if (!heapMemory) {
heapMemory = getMemoryManager()->allocateGraphicsMemoryWithProperties({true, finalHeapSize, allocationType,
isMultiOsContextCapable(), deviceIndex});
isMultiOsContextCapable(), getDeviceIndexForAllocation()});
} else {
finalHeapSize = std::max(heapMemory->getUnderlyingBufferSize(), finalHeapSize);
}