From c3023259e2bbdc92717e58e2263a6eecbead0a13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Wed, 5 Feb 2025 14:06:06 +0800 Subject: [PATCH] GPU (macOS): use `recommendedMaxWorkingSetSize` as total GPU mem size Worth noting that the value is static. It won't change even if the free global memory is smaller than the value. --- src/detection/gpu/gpu_apple.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/detection/gpu/gpu_apple.m b/src/detection/gpu/gpu_apple.m index 95e4c3058..9334c6840 100644 --- a/src/detection/gpu/gpu_apple.m +++ b/src/detection/gpu/gpu_apple.m @@ -68,6 +68,9 @@ const char* ffGpuDetectMetal(FFlist* gpus) gpu->type = device.location == MTLDeviceLocationBuiltIn ? FF_GPU_TYPE_INTEGRATED : FF_GPU_TYPE_DISCRETE; gpu->index = (uint32_t) device.locationNumber; #endif + + if (device.hasUnifiedMemory && device.recommendedMaxWorkingSetSize > 0) + gpu->shared.total = device.recommendedMaxWorkingSetSize; } return NULL; }