SWDEV-311271 - Make sure memory pool can accept default stream

Add lock protection for access to the pool list.
Remove destroyed stream from the list of the safe streams

Change-Id: I1863b89bd3f5e188c161227cc790c3adaf72cc58
This commit is contained in:
German Andryeyev
2022-04-14 19:04:01 -04:00
szülő b06ee8834d
commit 5957ff9f7b
6 fájl változott, egészen pontosan 63 új sor hozzáadva és 8 régi sor törölve
@@ -104,6 +104,9 @@ public:
/// Releases all memory, safe to the provided stream, until the threshold value is met
bool ReleaseAllMemory(hip::Stream* stream);
/// Remove the provided stream from the safe list
void RemoveStream(hip::Stream* stream);
/// Heap doesn't have any allocations
bool IsEmpty() const { return (allocations_.size() == 0) ? true : false; }
@@ -122,6 +125,7 @@ public:
/// Set maximum total, allocated by the heap
void SetMaxTotalSize(uint64_t value) { max_total_size_ = value; }
/// Erases single allocation form the heap's map
std::unordered_map<amd::Memory*, MemoryTimestamp>::iterator EraseAllocaton(
std::unordered_map<amd::Memory*, MemoryTimestamp>::iterator& it);
@@ -171,6 +175,9 @@ public:
/// @note The caller must make sure it's safe to release memory
void ReleaseFreedMemory(hip::Stream* stream = nullptr);
/// Removes a stream from tracking
void RemoveStream(hip::Stream* stream);
/// Releases all allocations in MemoryPool
void ReleaseAllMemory();