SWDEV-498474 - APU: when total allocated is greater than 75% of invisible

Only when memory type is Local and the invisible memory is +ve
Should also fix SWDEV-490991

Change-Id: I78a4925a234ba90c63909bde5b7dc217568b4de3


[ROCm/clr commit: 7d763fb803]
Этот коммит содержится в:
Ajay
2024-10-08 16:29:10 -07:00
коммит произвёл Ajay GunaShekar
родитель 92b1136755
Коммит 7346f3bd29
2 изменённых файлов: 16 добавлений и 6 удалений
+7
Просмотреть файл
@@ -680,6 +680,13 @@ class Device : public NullDevice {
return heaps_[Pal::GpuHeapInvisible];
}
Pal::gpusize TotalAlloc() const {
Pal::gpusize local = allocedMem[Pal::GpuHeapLocal] - resourceCache().persistentCacheSize();
Pal::gpusize invisible = allocedMem[Pal::GpuHeapInvisible] - resourceCache().lclCacheSize();
Pal::gpusize total_alloced = local + invisible;
return total_alloced;
}
private:
static void PAL_STDCALL PalDeveloperCallback(void* pPrivateData, const Pal::uint32 deviceIndex,
Pal::Developer::CallbackType type, void* pCbData);
+9 -6
Просмотреть файл
@@ -113,18 +113,21 @@ bool Memory::create(Resource::MemoryType memType, Resource::CreateParams* params
dev().info().largeBar_) {
memType = Persistent;
}
if (dev().settings().apuSystem_) {
const Pal::GpuMemoryHeapProperties& invisibleHeap = dev().GetGpuHeapInvisible();
Pal::gpusize totalAlloc = dev().TotalAlloc();
if (invisibleHeap.logicalSize > 0 && memType == Local &&
(totalAlloc > (invisibleHeap.logicalSize * 0.75))) {
memType = RemoteUSWC;
}
}
// Create a resource in PAL
result = Resource::create(memType, params, forceLinear);
if (!result) {
size_t freeMemory[2];
// if requested memory is greater than available then exit the loop
dev().globalFreeMemory(freeMemory);
const Pal::GpuMemoryHeapProperties& invisibleHeap = dev().GetGpuHeapInvisible();
if (dev().settings().apuSystem_ && (size() > (invisibleHeap.logicalSize * 2))) {
memType = RemoteUSWC;
break;
}
// Local to Persistent
if (memoryType() == Local) {
// For dgpu freeMemory[0] reports a sum of visible+invisible fb