Early preallocate command buffer to reuse for csr

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2022-10-13 15:53:33 +00:00
committed by Compute-Runtime-Automation
parent 502a9443f1
commit 06e5b1cd42
8 changed files with 90 additions and 6 deletions

View File

@@ -63,7 +63,6 @@ CommandStreamReceiver::CommandStreamReceiver(ExecutionEnvironment &executionEnvi
indirectHeap[i] = nullptr;
}
internalAllocationStorage = std::make_unique<InternalAllocationStorage>(*this);
const auto &hwInfo = peekHwInfo();
uint32_t subDeviceCount = static_cast<uint32_t>(deviceBitfield.count());
bool platformImplicitScaling = HwHelper::get(hwInfo.platform.eRenderCoreFamily).platformSupportsImplicitScaling(hwInfo);
@@ -235,6 +234,17 @@ void CommandStreamReceiver::ensureCommandBufferAllocation(LinearStream &commandS
commandStream.replaceGraphicsAllocation(allocation);
}
void CommandStreamReceiver::fillReusableAllocationsList() {
auto amountToFill = HwHelper::get(peekHwInfo().platform.eRenderCoreFamily).getAmountOfAllocationsToFill();
for (auto i = 0u; i < amountToFill; i++) {
const AllocationProperties commandStreamAllocationProperties{rootDeviceIndex, true, MemoryConstants::pageSize64k, AllocationType::COMMAND_BUFFER,
isMultiOsContextCapable(), false, osContext->getDeviceBitfield()};
auto allocation = this->getMemoryManager()->allocateGraphicsMemoryWithProperties(commandStreamAllocationProperties);
getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), REUSABLE_ALLOCATION);
this->makeResident(*allocation);
}
}
MemoryManager *CommandStreamReceiver::getMemoryManager() const {
DEBUG_BREAK_IF(!executionEnvironment.memoryManager);
return executionEnvironment.memoryManager.get();

View File

@@ -212,6 +212,7 @@ class CommandStreamReceiver {
InternalAllocationStorage *getInternalAllocationStorage() const { return internalAllocationStorage.get(); }
MOCKABLE_VIRTUAL bool createAllocationForHostSurface(HostPtrSurface &surface, bool requiresL3Flush);
virtual size_t getPreferredTagPoolSize() const;
virtual void fillReusableAllocationsList();
virtual void setupContext(OsContext &osContext) { this->osContext = &osContext; }
OsContext &getOsContext() const { return *osContext; }