mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-05 18:39:57 +00:00
Workaround for AMD CPUs https://github.com/anrieff/libcpuid/issues/97
This commit is contained in:
parent
b145f14ad8
commit
583d892eb5
3 changed files with 12 additions and 5 deletions
11
cpu.c
11
cpu.c
|
@ -31,7 +31,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "utils/applog.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef BUILD_TEST
|
#ifndef BUILD_TEST
|
||||||
|
@ -47,9 +46,17 @@ void cpu_init_common() {
|
||||||
cpu_info.total_logical_cpus = data.total_logical_cpus;
|
cpu_info.total_logical_cpus = data.total_logical_cpus;
|
||||||
cpu_info.sockets = data.total_logical_cpus / data.num_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.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;
|
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__
|
# ifdef __x86_64__
|
||||||
cpu_info.flags |= CPU_FLAG_X86_64;
|
cpu_info.flags |= CPU_FLAG_X86_64;
|
||||||
# endif
|
# endif
|
||||||
|
|
|
@ -27,14 +27,14 @@
|
||||||
#define APP_ID "xmrig"
|
#define APP_ID "xmrig"
|
||||||
#define APP_NAME "XMRig"
|
#define APP_NAME "XMRig"
|
||||||
#define APP_DESC "Monero (XMR) CPU miner"
|
#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_DOMAIN "xmrig.com"
|
||||||
#define APP_SITE "www.xmrig.com"
|
#define APP_SITE "www.xmrig.com"
|
||||||
#define APP_COPYRIGHT "Copyright (C) 2016-2017 xmrig.com"
|
#define APP_COPYRIGHT "Copyright (C) 2016-2017 xmrig.com"
|
||||||
|
|
||||||
#define APP_VER_MAJOR 0
|
#define APP_VER_MAJOR 0
|
||||||
#define APP_VER_MINOR 8
|
#define APP_VER_MINOR 8
|
||||||
#define APP_VER_BUILD 1
|
#define APP_VER_BUILD 2
|
||||||
#define APP_VER_REV 0
|
#define APP_VER_REV 0
|
||||||
|
|
||||||
#endif /* __VERSION_H__ */
|
#endif /* __VERSION_H__ */
|
||||||
|
|
2
xmrig.c
2
xmrig.c
|
@ -641,8 +641,8 @@ static bool start_mining() {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
cpu_init();
|
|
||||||
applog_init();
|
applog_init();
|
||||||
|
cpu_init();
|
||||||
parse_cmdline(argc, argv);
|
parse_cmdline(argc, argv);
|
||||||
persistent_memory_allocate();
|
persistent_memory_allocate();
|
||||||
print_summary();
|
print_summary();
|
||||||
|
|
Loading…
Reference in a new issue