Improve waiting for MemObj completion

Change-Id: I62078224daa21ee1d6f58f1e6dc59e306ae420b6
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2019-03-22 14:04:25 +01:00
committed by sys_ocldev
parent a8db48dbca
commit cbe4e06165
8 changed files with 60 additions and 30 deletions

View File

@@ -69,7 +69,7 @@ MemObj::~MemObj() {
needWait = true;
}
if (needWait && graphicsAllocation->isUsed()) {
waitForCsrCompletion();
memoryManager->waitForEnginesCompletion(*graphicsAllocation);
}
destroyGraphicsAllocation(graphicsAllocation, doAsyncDestrucions);
graphicsAllocation = nullptr;
@@ -283,11 +283,6 @@ void MemObj::releaseAllocatedMapPtr() {
allocatedMapPtr = nullptr;
}
void MemObj::waitForCsrCompletion() {
auto osContextId = context->getDevice(0)->getDefaultEngine().osContext->getContextId();
memoryManager->getDefaultCommandStreamReceiver(0)->waitForCompletionWithTimeout(false, TimeoutControls::maxTimeout, graphicsAllocation->getTaskCount(osContextId));
}
void MemObj::destroyGraphicsAllocation(GraphicsAllocation *allocation, bool asyncDestroy) {
if (asyncDestroy) {
memoryManager->checkGpuUsageAndDestroyGraphicsAllocations(allocation);