diff --git a/opencl/source/event/event.cpp b/opencl/source/event/event.cpp index 30139b89c1..e93f43a0e0 100644 --- a/opencl/source/event/event.cpp +++ b/opencl/source/event/event.cpp @@ -463,6 +463,7 @@ inline WaitStatus Event::wait(bool blocking, bool useQuickKmdSleep) { auto *allocationStorage = cmdQueue->getGpgpuCommandStreamReceiver().getInternalAllocationStorage(); allocationStorage->cleanAllocationList(this->taskCount, TEMPORARY_ALLOCATION); + allocationStorage->cleanAllocationList(this->taskCount, DEFERRED_DEALLOCATION); return WaitStatus::Ready; } @@ -499,6 +500,7 @@ void Event::updateExecutionStatus() { unblockEventsBlockedByThis(CL_COMPLETE); auto *allocationStorage = cmdQueue->getGpgpuCommandStreamReceiver().getInternalAllocationStorage(); allocationStorage->cleanAllocationList(this->taskCount, TEMPORARY_ALLOCATION); + allocationStorage->cleanAllocationList(this->taskCount, DEFERRED_DEALLOCATION); return; } diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp index ffa18a9f79..829e08da2b 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp @@ -847,9 +847,9 @@ HWTEST_F(BcsTests, whenBlitFromHostPtrCalledThenCleanTemporaryAllocations) { flushBcsTask(&bcsCsr, blitProperties, true, *pDevice); - EXPECT_EQ(1u, mockInternalAllocationsStorage->cleanAllocationsCalled); + EXPECT_EQ(2u, mockInternalAllocationsStorage->cleanAllocationsCalled); EXPECT_EQ(bcsCsr.taskCount, mockInternalAllocationsStorage->lastCleanAllocationsTaskCount); - EXPECT_TRUE(TEMPORARY_ALLOCATION == mockInternalAllocationsStorage->lastCleanAllocationUsage); + EXPECT_TRUE(DEFERRED_DEALLOCATION == mockInternalAllocationsStorage->lastCleanAllocationUsage); } HWTEST_F(BcsTests, givenBufferWhenBlitOperationCalledThenProgramCorrectGpuAddresses) { diff --git a/shared/source/command_stream/command_stream_receiver.cpp b/shared/source/command_stream/command_stream_receiver.cpp index 0c06f6a146..21d03a9611 100644 --- a/shared/source/command_stream/command_stream_receiver.cpp +++ b/shared/source/command_stream/command_stream_receiver.cpp @@ -121,6 +121,7 @@ CommandStreamReceiver::~CommandStreamReceiver() { internalAllocationStorage->cleanAllocationList(-1, REUSABLE_ALLOCATION); internalAllocationStorage->cleanAllocationList(-1, TEMPORARY_ALLOCATION); + internalAllocationStorage->cleanAllocationList(-1, DEFERRED_DEALLOCATION); getMemoryManager()->unregisterEngineForCsr(this); } @@ -221,6 +222,9 @@ WaitStatus CommandStreamReceiver::waitForTaskCountAndCleanAllocationList(TaskCou waitStatus = this->CommandStreamReceiver::waitForTaskCount(requiredTaskCount); } internalAllocationStorage->cleanAllocationList(requiredTaskCount, allocationUsage); + if (allocationUsage == TEMPORARY_ALLOCATION) { + internalAllocationStorage->cleanAllocationList(requiredTaskCount, DEFERRED_DEALLOCATION); + } return waitStatus; } diff --git a/shared/source/command_stream/command_stream_receiver_hw_base.inl b/shared/source/command_stream/command_stream_receiver_hw_base.inl index ab866a63ab..e06b605ce3 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_base.inl @@ -1265,6 +1265,7 @@ TaskCountType CommandStreamReceiverHw::flushBcsTask(const BlitPropert if (blocking) { const auto waitStatus = waitForTaskCountWithKmdNotifyFallback(newTaskCount, flushStampToWait, false, QueueThrottle::MEDIUM); internalAllocationStorage->cleanAllocationList(newTaskCount, TEMPORARY_ALLOCATION); + internalAllocationStorage->cleanAllocationList(newTaskCount, DEFERRED_DEALLOCATION); if (waitStatus == WaitStatus::GpuHang) { return CompletionStamp::gpuHang; diff --git a/shared/source/memory_manager/internal_allocation_storage.cpp b/shared/source/memory_manager/internal_allocation_storage.cpp index 9811fe7d7f..d63a6585f1 100644 --- a/shared/source/memory_manager/internal_allocation_storage.cpp +++ b/shared/source/memory_manager/internal_allocation_storage.cpp @@ -40,10 +40,6 @@ void InternalAllocationStorage::storeAllocationWithTaskCount(std::unique_ptr