mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Improve checkGpuUsageAndDestroy method to work with multiple CSRs
Change-Id: I7b8325116c90151c6339f95a81880c467e81748f Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
2fec06007d
commit
c905dad62f
@@ -137,11 +137,24 @@ void MemoryManager::freeGraphicsMemory(GraphicsAllocation *gfxAllocation) {
|
||||
//if not in use destroy in place
|
||||
//if in use pass to temporary allocation list that is cleaned on blocking calls
|
||||
void MemoryManager::checkGpuUsageAndDestroyGraphicsAllocations(GraphicsAllocation *gfxAllocation) {
|
||||
if (!gfxAllocation->isUsed() || gfxAllocation->getTaskCount(defaultEngineIndex) <= *getCommandStreamReceivers()[0][defaultEngineIndex]->getTagAddress()) {
|
||||
if (!gfxAllocation->isUsed()) {
|
||||
freeGraphicsMemory(gfxAllocation);
|
||||
} else {
|
||||
getCommandStreamReceivers()[0][defaultEngineIndex]->getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(gfxAllocation), TEMPORARY_ALLOCATION);
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto &csr : getCommandStreamReceivers()[0]) {
|
||||
if (csr) {
|
||||
auto osContextId = csr->getOsContext().getContextId();
|
||||
auto allocationTaskCount = gfxAllocation->getTaskCount(osContextId);
|
||||
|
||||
if (gfxAllocation->isUsedByContext(osContextId) &&
|
||||
allocationTaskCount > *csr->getTagAddress()) {
|
||||
csr->getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(gfxAllocation), TEMPORARY_ALLOCATION);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
freeGraphicsMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
void MemoryManager::waitForDeletions() {
|
||||
|
||||
@@ -286,10 +286,10 @@ void WddmMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation
|
||||
}
|
||||
}
|
||||
|
||||
UNRECOVERABLE_IF(DebugManager.flags.CreateMultipleDevices.get() == 0 &&
|
||||
gfxAllocation->isUsed() && this->executionEnvironment.commandStreamReceivers.size() > 0 &&
|
||||
this->getDefaultCommandStreamReceiver(0) && this->getDefaultCommandStreamReceiver(0)->getTagAddress() &&
|
||||
gfxAllocation->getTaskCount(defaultEngineIndex) > *this->getDefaultCommandStreamReceiver(0)->getTagAddress());
|
||||
DEBUG_BREAK_IF(DebugManager.flags.CreateMultipleDevices.get() == 0 &&
|
||||
gfxAllocation->isUsed() && this->executionEnvironment.commandStreamReceivers.size() > 0 &&
|
||||
this->getDefaultCommandStreamReceiver(0) && this->getDefaultCommandStreamReceiver(0)->getTagAddress() &&
|
||||
gfxAllocation->getTaskCount(defaultEngineIndex) > *this->getDefaultCommandStreamReceiver(0)->getTagAddress());
|
||||
|
||||
if (input->gmm) {
|
||||
if (input->gmm->isRenderCompressed && wddm->getPageTableManager()) {
|
||||
|
||||
Reference in New Issue
Block a user