diff --git a/cpu.c b/cpu.c index bb8462389..2f6ef8b6f 100644 --- a/cpu.c +++ b/cpu.c @@ -31,7 +31,6 @@ #endif #include "cpu.h" -#include "utils/applog.h" #ifndef BUILD_TEST @@ -47,9 +46,17 @@ void cpu_init_common() { cpu_info.total_logical_cpus = data.total_logical_cpus; cpu_info.sockets = data.total_logical_cpus / data.num_logical_cpus; cpu_info.total_cores = data.num_cores * cpu_info.sockets; - cpu_info.l2_cache = data.l2_cache > 0 ? data.l2_cache * cpu_info.total_cores * cpu_info.sockets : 0; cpu_info.l3_cache = data.l3_cache > 0 ? data.l3_cache * cpu_info.sockets : 0; + // Workaround for AMD CPUs https://github.com/anrieff/libcpuid/issues/97 + if (data.vendor == VENDOR_AMD && data.l3_cache <= 0 && data.l2_assoc == 16 && data.ext_family >= 21) { + cpu_info.l2_cache = data.l2_cache * (cpu_info.total_cores / 2) * cpu_info.sockets; + } + else { + cpu_info.l2_cache = data.l2_cache > 0 ? data.l2_cache * cpu_info.total_cores * cpu_info.sockets : 0; + } + + # ifdef __x86_64__ cpu_info.flags |= CPU_FLAG_X86_64; # endif diff --git a/version.h b/version.h index 8804e2713..6b453bdbe 100644 --- a/version.h +++ b/version.h @@ -27,14 +27,14 @@ #define APP_ID "xmrig" #define APP_NAME "XMRig" #define APP_DESC "Monero (XMR) CPU miner" -#define APP_VERSION "0.8.1" +#define APP_VERSION "0.8.2" #define APP_DOMAIN "xmrig.com" #define APP_SITE "www.xmrig.com" #define APP_COPYRIGHT "Copyright (C) 2016-2017 xmrig.com" #define APP_VER_MAJOR 0 #define APP_VER_MINOR 8 -#define APP_VER_BUILD 1 +#define APP_VER_BUILD 2 #define APP_VER_REV 0 #endif /* __VERSION_H__ */ diff --git a/xmrig.c b/xmrig.c index d3c423a50..7b14933b1 100644 --- a/xmrig.c +++ b/xmrig.c @@ -641,8 +641,8 @@ static bool start_mining() { * @return */ int main(int argc, char *argv[]) { - cpu_init(); applog_init(); + cpu_init(); parse_cmdline(argc, argv); persistent_memory_allocate(); print_summary();