fix: use real size when putting into usm reuse

Real allocation size should be used to properly apply limits and allow
more usm reuse hits.

Related-To: NEO-6893

Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
Dominik Dabek
2025-04-04 07:20:07 +00:00
committed by Compute-Runtime-Automation
parent f344eb9bca
commit 3703ff550c
2 changed files with 7 additions and 3 deletions

View File

@@ -652,7 +652,7 @@ bool SVMAllocsManager::freeSVMAlloc(void *ptr, bool blocking) {
}
if (InternalMemoryType::hostUnifiedMemory == svmData->memoryType &&
this->usmHostAllocationsCache) {
if (this->usmHostAllocationsCache->insert(svmData->size, ptr, svmData)) {
if (this->usmHostAllocationsCache->insert(svmData->gpuAllocations.getDefaultGraphicsAllocation()->getUnderlyingBufferSize(), ptr, svmData)) {
return true;
}
}
@@ -676,13 +676,13 @@ bool SVMAllocsManager::freeSVMAllocDefer(void *ptr) {
if (svmData) {
if (InternalMemoryType::deviceUnifiedMemory == svmData->memoryType &&
this->usmDeviceAllocationsCache) {
if (this->usmDeviceAllocationsCache->insert(svmData->size, ptr, svmData)) {
if (this->usmDeviceAllocationsCache->insert(svmData->gpuAllocations.getDefaultGraphicsAllocation()->getUnderlyingBufferSize(), ptr, svmData)) {
return true;
}
}
if (InternalMemoryType::hostUnifiedMemory == svmData->memoryType &&
this->usmHostAllocationsCache) {
if (this->usmHostAllocationsCache->insert(svmData->size, ptr, svmData)) {
if (this->usmHostAllocationsCache->insert(svmData->gpuAllocations.getDefaultGraphicsAllocation()->getUnderlyingBufferSize(), ptr, svmData)) {
return true;
}
}