fix: usm reuse, clean from largest

When trimming old allocations in usm reuse start from largest
allocations.
This will reduce memory usage more quickly once max hold time is hit.

Related-To: NEO-6893, NEO-14429

Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
Dominik Dabek
2025-04-04 10:05:48 +00:00
committed by Compute-Runtime-Automation
parent cc308719d8
commit bd516b3552
3 changed files with 58 additions and 28 deletions

View File

@@ -165,6 +165,12 @@ class SVMAllocsManager {
bool operator<(size_t const &size) const {
return allocationSize < size;
}
void markForDelete() {
allocationSize = 0u;
}
static bool isMarkedForDelete(SvmCacheAllocationInfo const &info) {
return 0 == info.allocationSize;
}
};
struct SvmAllocationCache {
@@ -195,7 +201,7 @@ class SVMAllocsManager {
bool isInUse(SvmAllocationData *svmData);
void *get(size_t size, const UnifiedMemoryProperties &unifiedMemoryProperties);
void trim();
void trimOldAllocs(std::chrono::high_resolution_clock::time_point trimTimePoint, bool shouldLimitReuse);
void trimOldAllocs(std::chrono::high_resolution_clock::time_point trimTimePoint, bool trimAll);
void cleanup();
void logCacheOperation(const SvmAllocationCachePerfInfo &cachePerfEvent) const;