fix: Release usage when put cmd buffer to reusable list

Resolves: NEO-10004
Related-To: NEO-7116

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2024-01-11 11:58:28 +00:00
committed by Compute-Runtime-Automation
parent 6abce2b29d
commit 2bda9f0b58
2 changed files with 34 additions and 6 deletions

View File

@@ -298,15 +298,21 @@ void CommandContainer::handleCmdBufferAllocations(size_t startIndex) {
if (this->reusableAllocationList) {
if (isHandleFenceCompletionRequired) {
std::vector<std::unique_lock<CommandStreamReceiver::MutexType>> locks;
for (auto &engine : this->device->getMemoryManager()->getRegisteredEngines(cmdBufferAllocations[i]->getRootDeviceIndex())) {
if (cmdBufferAllocations[i]->isUsedByOsContext(engine.osContext->getContextId())) {
auto lock = engine.commandStreamReceiver->obtainUniqueOwnership();
locks.push_back(engine.commandStreamReceiver->obtainUniqueOwnership());
engine.commandStreamReceiver->stopDirectSubmission(false);
}
}
this->device->getMemoryManager()->handleFenceCompletion(cmdBufferAllocations[i]);
if (!locks.empty()) {
this->device->getMemoryManager()->handleFenceCompletion(cmdBufferAllocations[i]);
}
}
for (auto &engine : this->device->getMemoryManager()->getRegisteredEngines(cmdBufferAllocations[i]->getRootDeviceIndex())) {
cmdBufferAllocations[i]->releaseUsageInOsContext(engine.osContext->getContextId());
}
reusableAllocationList->pushFrontOne(*cmdBufferAllocations[i]);
} else {
this->device->getMemoryManager()->freeGraphicsMemory(cmdBufferAllocations[i]);