Add multiGraphicsAllocation to CSR

Related-To: NEO-5508
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala
2021-02-25 09:38:48 +01:00
committed by Compute-Runtime-Automation
parent 7fdbf4f6ef
commit 4abe4a96b8
26 changed files with 266 additions and 125 deletions

View File

@@ -213,8 +213,12 @@ void CommandStreamReceiver::cleanupResources() {
commandStream.replaceBuffer(nullptr, 0);
}
if (tagAllocation) {
getMemoryManager()->freeGraphicsMemory(tagAllocation);
if (tagsMultiAllocation) {
for (auto graphicsAllocation : tagsMultiAllocation->getGraphicsAllocations()) {
getMemoryManager()->freeGraphicsMemory(graphicsAllocation);
}
delete tagsMultiAllocation;
tagsMultiAllocation = nullptr;
tagAllocation = nullptr;
tagAddress = nullptr;
}
@@ -280,6 +284,25 @@ void CommandStreamReceiver::setTagAllocation(GraphicsAllocation *allocation) {
reinterpret_cast<uint8_t *>(allocation->getUnderlyingBuffer()) + debugPauseStateAddressOffset);
}
MultiGraphicsAllocation &CommandStreamReceiver::createTagsMultiAllocation(ExecutionEnvironment &executionEnvironment, MemoryManager &memoryManager, uint32_t currentRootDeviceIndex) {
std::vector<uint32_t> rootDeviceIndices;
for (auto index = 0u; index < executionEnvironment.rootDeviceEnvironments.size(); index++) {
if (executionEnvironment.rootDeviceEnvironments[index].get()->getHardwareInfo()->platform.eProductFamily ==
executionEnvironment.rootDeviceEnvironments[currentRootDeviceIndex].get()->getHardwareInfo()->platform.eProductFamily) {
rootDeviceIndices.push_back(index);
}
}
auto maxRootDeviceIndex = *std::max_element(rootDeviceIndices.begin(), rootDeviceIndices.end(), std::less<uint32_t const>());
auto allocations = new MultiGraphicsAllocation(maxRootDeviceIndex);
AllocationProperties unifiedMemoryProperties{rootDeviceIndices.at(0), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::TAG_BUFFER, systemMemoryBitfield};
memoryManager.createMultiGraphicsAllocationInSystemMemoryPool(rootDeviceIndices, unifiedMemoryProperties, *allocations);
return *allocations;
}
FlushStamp CommandStreamReceiver::obtainCurrentFlushStamp() const {
return flushStamp->peekStamp();
}
@@ -473,7 +496,9 @@ void *CommandStreamReceiver::asyncDebugBreakConfirmation(void *arg) {
}
bool CommandStreamReceiver::initializeTagAllocation() {
auto tagAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::TAG_BUFFER, systemMemoryBitfield});
this->tagsMultiAllocation = &this->createTagsMultiAllocation(this->executionEnvironment, *this->getMemoryManager(), rootDeviceIndex);
auto tagAllocation = tagsMultiAllocation->getGraphicsAllocation(rootDeviceIndex);
if (!tagAllocation) {
return false;
}