From 2570b82dbb2d5620256ef87d78046d710f30fe49 Mon Sep 17 00:00:00 2001 From: Ilkka Saarelainen Date: Tue, 29 Mar 2022 13:30:06 +0300 Subject: [PATCH] Reduce advertised sys mem on 32 bit Android This CL reduces the advertised system memory amount in 32 bit Android builds to address some memory fragmentation issues in certain tests that rely on the advertised memory amount. Affects: dEQP-VK.api.buffer.suballocation.* dEQP-VK.api.buffer.dedicated_alloc.* dEQP-VK.api.object_management.* dEQP-VK.memory.allocation.* dEQP-VK.memory.device_group_allocation.* dEQP-VK.pipeline.render_to_image.*.small.* dEQP-VK.pipeline.render_to_image.*.huge.* Components: Framework, Vulkan VK-GL-CTS issue: 3586 Change-Id: I15ef027e3f69ddbb87e8704d0cff479782b6bda6 --- framework/platform/android/tcuAndroidPlatform.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/framework/platform/android/tcuAndroidPlatform.cpp b/framework/platform/android/tcuAndroidPlatform.cpp index f671854..a78d832 100644 --- a/framework/platform/android/tcuAndroidPlatform.cpp +++ b/framework/platform/android/tcuAndroidPlatform.cpp @@ -337,7 +337,20 @@ void Platform::getMemoryLimits (vk::PlatformMemoryLimits& limits) const // Worst-case estimates const size_t MiB = (size_t)(1<<20); const size_t baseMemUsage = 400*MiB; + +#if (DE_PTR_SIZE == 4) + // Some tests, such as: + // + // dEQP-VK.api.object_management.max_concurrent.* + // dEQP-VK.memory.allocation.random.* + // + // when run in succession, can lead to system memory fragmentation. It depends on the allocator, and on some 32-bit + // systems can lead to out of memory errors. As a workaround, we use a smaller amount of memory on 32-bit systems, + // as this typically avoids out of memory errors caused by fragmentation. + const double safeUsageRatio = 0.1; +#else const double safeUsageRatio = 0.25; +#endif limits.totalSystemMemory = de::max((size_t)(double(deInt64(m_totalSystemMemory)-deInt64(baseMemUsage)) * safeUsageRatio), 16*MiB); -- 2.7.4