From ed36ef8b4381e14024e824f1c50b33a9aa61aae0 Mon Sep 17 00:00:00 2001 From: Alex Azarov Date: Sun, 14 Jan 2024 18:02:00 +0100 Subject: [PATCH] Check for Xcode version before using recommendedMaxWorkingSetSize --- ggml-metal.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ggml-metal.m b/ggml-metal.m index 93681aa83..90c147d25 100644 --- a/ggml-metal.m +++ b/ggml-metal.m @@ -370,10 +370,11 @@ static struct ggml_metal_context * ggml_metal_init(int n_cb) { GGML_METAL_LOG_INFO("%s: simdgroup matrix mul. support = %s\n", __func__, ctx->support_simdgroup_mm ? "true" : "false"); GGML_METAL_LOG_INFO("%s: hasUnifiedMemory = %s\n", __func__, ctx->device.hasUnifiedMemory ? "true" : "false"); +#if TARGET_OS_OSX || (TARGET_OS_IOS && __clang_major__ >= 15) if (@available(macOS 10.12, iOS 16.0, *)) { GGML_METAL_LOG_INFO("%s: recommendedMaxWorkingSetSize = %8.2f MB\n", __func__, ctx->device.recommendedMaxWorkingSetSize / 1e6); } -#if TARGET_OS_OSX +#elif TARGET_OS_OSX if (ctx->device.maxTransferRate != 0) { GGML_METAL_LOG_INFO("%s: maxTransferRate = %8.2f MB/s\n", __func__, ctx->device.maxTransferRate / 1e6); } else { @@ -2373,7 +2374,7 @@ static const char * ggml_backend_metal_buffer_type_get_name(ggml_backend_buffer_ } static void ggml_backend_metal_log_allocated_size(id device) { -#if TARGET_OS_IOS || TARGET_OS_OSX +#if TARGET_OS_OSX || (TARGET_OS_IOS && __clang_major__ >= 15) if (@available(macOS 10.12, iOS 16.0, *)) { GGML_METAL_LOG_INFO(", (%8.2f / %8.2f)", device.currentAllocatedSize / 1024.0 / 1024.0,