mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Fix multithreading issue in allocation cleanup.
Resolves: NEO-3582 Change-Id: I269fbe8b17cdafa198ed0c89e4b55c15acbc5126 Signed-off-by: Zdunowski, Piotr <piotr.zdunowski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
072048105d
commit
41ef3d6ebc
@@ -8,6 +8,8 @@
|
||||
#pragma once
|
||||
#include "core/memory_manager/graphics_allocation.h"
|
||||
|
||||
#include <mutex>
|
||||
|
||||
namespace NEO {
|
||||
class CommandStreamReceiver;
|
||||
|
||||
@@ -15,7 +17,10 @@ class AllocationsList : public IDList<GraphicsAllocation, true, true> {
|
||||
public:
|
||||
std::unique_ptr<GraphicsAllocation> detachAllocation(size_t requiredMinimalSize, CommandStreamReceiver &commandStreamReceiver, GraphicsAllocation::AllocationType allocationType);
|
||||
|
||||
std::unique_lock<std::mutex> obtainUniqueOwnership();
|
||||
|
||||
private:
|
||||
GraphicsAllocation *detachAllocationImpl(GraphicsAllocation *, void *);
|
||||
std::mutex mutex;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -39,6 +39,7 @@ void InternalAllocationStorage::cleanAllocationList(uint32_t waitTaskCount, uint
|
||||
}
|
||||
|
||||
void InternalAllocationStorage::freeAllocationsList(uint32_t waitTaskCount, AllocationsList &allocationsList) {
|
||||
auto lock = allocationsList.obtainUniqueOwnership();
|
||||
auto memoryManager = commandStreamReceiver.getMemoryManager();
|
||||
GraphicsAllocation *curr = allocationsList.detachNodes();
|
||||
|
||||
@@ -96,4 +97,8 @@ GraphicsAllocation *AllocationsList::detachAllocationImpl(GraphicsAllocation *,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> AllocationsList::obtainUniqueOwnership() {
|
||||
return std::unique_lock<std::mutex>(mutex);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user