mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-20 13:11:34 +08:00
Recycle old command buffers of immediate command lists
Related-To: NEO-6242 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
dd01cff879
commit
8f93f4f3ec
@ -229,12 +229,16 @@ IndirectHeap *CommandContainer::getHeapWithRequiredSizeAndAlignment(HeapType hea
|
||||
|
||||
void CommandContainer::handleCmdBufferAllocations(size_t startIndex) {
|
||||
for (size_t i = startIndex; i < cmdBufferAllocations.size(); i++) {
|
||||
if (this->reusableAllocationList) {
|
||||
this->device->getMemoryManager()->handleFenceCompletion(cmdBufferAllocations[i]);
|
||||
reusableAllocationList->pushFrontOne(*cmdBufferAllocations[i]);
|
||||
} else {
|
||||
this->device->getMemoryManager()->freeGraphicsMemory(cmdBufferAllocations[i]);
|
||||
}
|
||||
handleCmdBufferAllocation(cmdBufferAllocations[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void CommandContainer::handleCmdBufferAllocation(GraphicsAllocation *allocation) {
|
||||
if (this->reusableAllocationList) {
|
||||
this->device->getMemoryManager()->handleFenceCompletion(allocation);
|
||||
reusableAllocationList->pushFrontOne(*allocation);
|
||||
} else {
|
||||
this->device->getMemoryManager()->freeGraphicsMemory(allocation);
|
||||
}
|
||||
}
|
||||
|
||||
@ -264,6 +268,11 @@ void CommandContainer::allocateNextCommandBuffer() {
|
||||
auto cmdBufferAllocation = this->obtainNextCommandBufferAllocation();
|
||||
UNRECOVERABLE_IF(!cmdBufferAllocation);
|
||||
|
||||
if (getFlushTaskUsedForImmediate()) {
|
||||
NEO::GraphicsAllocation *oldCmdBuffer = cmdBufferAllocations.back();
|
||||
handleCmdBufferAllocation(oldCmdBuffer);
|
||||
cmdBufferAllocations.pop_back();
|
||||
}
|
||||
cmdBufferAllocations.push_back(cmdBufferAllocation);
|
||||
|
||||
size_t alignedSize = alignUp<size_t>(totalCmdBufferSize, MemoryConstants::pageSize64k);
|
||||
|
@ -88,6 +88,7 @@ class CommandContainer : public NonCopyableOrMovableClass {
|
||||
void closeAndAllocateNextCommandBuffer();
|
||||
|
||||
void handleCmdBufferAllocations(size_t startIndex);
|
||||
void handleCmdBufferAllocation(GraphicsAllocation *allocation);
|
||||
GraphicsAllocation *obtainNextCommandBufferAllocation();
|
||||
|
||||
void reset();
|
||||
|
Reference in New Issue
Block a user