From 6cfc02d24f252093cb4a646727241710ddd00412 Mon Sep 17 00:00:00 2001 From: SChernykh <15806605+SChernykh@users.noreply.github.com> Date: Sat, 22 Mar 2025 11:34:23 +0100 Subject: [PATCH] Optimized autoconfig for AMD CPUs with < 2 MB L3 cache per thread --- src/backend/cpu/platform/HwlocCpuInfo.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/backend/cpu/platform/HwlocCpuInfo.cpp b/src/backend/cpu/platform/HwlocCpuInfo.cpp index e96edbeb..38fb0a26 100644 --- a/src/backend/cpu/platform/HwlocCpuInfo.cpp +++ b/src/backend/cpu/platform/HwlocCpuInfo.cpp @@ -320,8 +320,13 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith L2 += l2->attr->cache.size; L2_associativity = l2->attr->cache.associativity; - if (L3_exclusive && l2->attr->cache.size >= scratchpad) { - extra += scratchpad; + if (L3_exclusive) { + if (vendor() == VENDOR_AMD) { + extra += std::min(l2->attr->cache.size, scratchpad); + } + else if (l2->attr->cache.size >= scratchpad) { + extra += scratchpad; + } } } }