SWDEV-482851 - Do not release last suballocator chunk
Change-Id: Ib28dc9df68e454ee0c0c699c1ff17588fd55f802
[ROCm/clr commit: 451b0ce768]
This commit is contained in:
committed by
Aidan Belton-Schure
szülő
50387f6eb5
commit
dc2fa93f37
@@ -2207,7 +2207,8 @@ bool MemorySubAllocator::Free(amd::Monitor* monitor, GpuMemoryReference* ref, Pa
|
||||
|
||||
it->second->Free(offset);
|
||||
// If this suballocator empty, then release memory chunk
|
||||
if (it->second->IsEmpty()) {
|
||||
// while keeping at least one chunk available, if retain_final_chunk is true
|
||||
if (it->second->IsEmpty() && !(retain_final_chunk_ && heaps_.size() == 1)) {
|
||||
delete it->second;
|
||||
heaps_.erase(it);
|
||||
release_mem = true;
|
||||
|
||||
@@ -535,7 +535,8 @@ typedef Util::BuddyAllocator<Device> MemBuddyAllocator;
|
||||
|
||||
class MemorySubAllocator : public amd::HeapObject {
|
||||
public:
|
||||
MemorySubAllocator(Device* device) : device_(device) {}
|
||||
MemorySubAllocator(Device* device, bool retain_final_chunk = false)
|
||||
: device_(device), retain_final_chunk_(retain_final_chunk) {}
|
||||
|
||||
~MemorySubAllocator();
|
||||
|
||||
@@ -553,6 +554,7 @@ class MemorySubAllocator : public amd::HeapObject {
|
||||
|
||||
Device* device_;
|
||||
std::unordered_map<GpuMemoryReference*, MemBuddyAllocator*> heaps_;
|
||||
bool retain_final_chunk_;
|
||||
};
|
||||
|
||||
class CoarseMemorySubAllocator : public MemorySubAllocator {
|
||||
@@ -564,7 +566,8 @@ class CoarseMemorySubAllocator : public MemorySubAllocator {
|
||||
|
||||
class FineMemorySubAllocator : public MemorySubAllocator {
|
||||
public:
|
||||
FineMemorySubAllocator(Device* device) : MemorySubAllocator(device) {}
|
||||
FineMemorySubAllocator(Device* device)
|
||||
: MemorySubAllocator(device, true /*retain_final_chunk*/) {}
|
||||
|
||||
bool CreateChunk(const Pal::IGpuMemory* reserved_va) override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user