From 161d590405caa35ecd3569a3731004211506b4ff Mon Sep 17 00:00:00 2001 From: Ioannis Assiouras Date: Thu, 19 Dec 2024 23:55:02 +0000 Subject: [PATCH] SWDEV-503760 - Only consider allocations that are less than X% larger in a mempool request Change-Id: I94acbca606fd4c575e2e1a9e34959ce650571867 [ROCm/clr commit: 44b6b6813da5c9c65d7b6227472a06dbb3ce8e78] --- projects/clr/hipamd/src/hip_mempool_impl.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/projects/clr/hipamd/src/hip_mempool_impl.cpp b/projects/clr/hipamd/src/hip_mempool_impl.cpp index bb2b839ffc..2dd2e40be5 100644 --- a/projects/clr/hipamd/src/hip_mempool_impl.cpp +++ b/projects/clr/hipamd/src/hip_mempool_impl.cpp @@ -53,13 +53,11 @@ amd::Memory* Heap::FindMemory(size_t size, Stream* stream, bool opportunistic, check_address = true; } // Runtime can accept an allocation with 12.5% on the size threshold - bool opp_mode = opportunistic; if (it->first.first > (size / 8.0) * 9) { - // Disable opportunistic mode for more aggressive search - opp_mode = false; + return nullptr; } // Check if size can match and it's safe to use this resource. - if (check_address && (it->second.IsSafeFind(stream, opp_mode))) { + if (check_address && (it->second.IsSafeFind(stream, opportunistic))) { memory = it->first.second; total_size_ -= memory->getSize(); // Preserve event, since the logic could skip GPU wait on reuse