forked from xmrig/xmrig
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
30 changed files
with
267 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet> | ||
* Copyright 2016 Jay D Dee <[email protected]> | ||
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt> | ||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh> | ||
* Copyright 2016-2019 XMRig <[email protected]> | ||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh> | ||
* Copyright 2016-2020 XMRig <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -62,6 +62,7 @@ class ICpuInfo | |
virtual Assembly::Id assembly() const = 0; | ||
virtual bool hasAES() const = 0; | ||
virtual bool hasAVX2() const = 0; | ||
virtual bool hasBMI2() const = 0; | ||
virtual bool hasOneGbPages() const = 0; | ||
virtual const char *backend() const = 0; | ||
virtual const char *brand() const = 0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet> | ||
* Copyright 2016 Jay D Dee <[email protected]> | ||
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt> | ||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh> | ||
* Copyright 2016-2019 XMRig <[email protected]> | ||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh> | ||
* Copyright 2016-2020 XMRig <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -153,6 +153,7 @@ xmrig::AdvancedCpuInfo::AdvancedCpuInfo() : | |
} | ||
|
||
m_avx2 = data.flags[CPU_FEATURE_AVX2] && data.flags[CPU_FEATURE_OSXSAVE]; | ||
m_bmi2 = data.flags[CPU_FEATURE_BMI2]; | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet> | ||
* Copyright 2016 Jay D Dee <[email protected]> | ||
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt> | ||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh> | ||
* Copyright 2016-2019 XMRig <[email protected]> | ||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh> | ||
* Copyright 2016-2020 XMRig <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -43,6 +43,7 @@ class AdvancedCpuInfo : public ICpuInfo | |
inline Assembly::Id assembly() const override { return m_assembly; } | ||
inline bool hasAES() const override { return m_aes; } | ||
inline bool hasAVX2() const override { return m_avx2; } | ||
inline bool hasBMI2() const override { return m_bmi2; } | ||
inline bool hasOneGbPages() const override { return m_pdpe1gb; } | ||
inline const char *backend() const override { return m_backend; } | ||
inline const char *brand() const override { return m_brand; } | ||
|
@@ -59,6 +60,7 @@ class AdvancedCpuInfo : public ICpuInfo | |
Assembly m_assembly; | ||
bool m_aes = false; | ||
bool m_avx2 = false; | ||
bool m_bmi2 = false; | ||
bool m_L2_exclusive = false; | ||
char m_backend[32]{}; | ||
char m_brand[64 + 5]{}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet> | ||
* Copyright 2016 Jay D Dee <[email protected]> | ||
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt> | ||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh> | ||
* Copyright 2016-2019 XMRig <[email protected]> | ||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh> | ||
* Copyright 2016-2020 XMRig <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -45,6 +45,10 @@ | |
# define bit_AVX2 (1 << 5) | ||
#endif | ||
|
||
#ifndef bit_BMI2 | ||
# define bit_BMI2 (1 << 8) | ||
#endif | ||
|
||
#ifndef bit_PDPE1GB | ||
# define bit_PDPE1GB (1 << 26) | ||
#endif | ||
|
@@ -141,6 +145,12 @@ static inline bool has_avx2() | |
} | ||
|
||
|
||
static inline bool has_bmi2() | ||
{ | ||
return has_feature(EXTENDED_FEATURES, EBX_Reg, bit_BMI2); | ||
} | ||
|
||
|
||
static inline bool has_pdpe1gb() | ||
{ | ||
return has_feature(PROCESSOR_EXT_INFO, EDX_Reg, bit_PDPE1GB); | ||
|
@@ -154,6 +164,7 @@ xmrig::BasicCpuInfo::BasicCpuInfo() : | |
m_threads(std::thread::hardware_concurrency()), | ||
m_aes(has_aes_ni()), | ||
m_avx2(has_avx2()), | ||
m_bmi2(has_bmi2()), | ||
m_pdpe1gb(has_pdpe1gb()) | ||
{ | ||
cpu_brand_string(m_brand); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet> | ||
* Copyright 2016 Jay D Dee <[email protected]> | ||
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt> | ||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh> | ||
* Copyright 2016-2019 XMRig <[email protected]> | ||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh> | ||
* Copyright 2016-2020 XMRig <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -44,6 +44,7 @@ class BasicCpuInfo : public ICpuInfo | |
inline Assembly::Id assembly() const override { return m_assembly; } | ||
inline bool hasAES() const override { return m_aes; } | ||
inline bool hasAVX2() const override { return m_avx2; } | ||
inline bool hasBMI2() const override { return m_bmi2; } | ||
inline bool hasOneGbPages() const override { return m_pdpe1gb; } | ||
inline const char *brand() const override { return m_brand; } | ||
inline MsrMod msrMod() const override { return m_msrMod; } | ||
|
@@ -63,6 +64,7 @@ class BasicCpuInfo : public ICpuInfo | |
Assembly m_assembly = Assembly::NONE; | ||
bool m_aes = false; | ||
const bool m_avx2 = false; | ||
const bool m_bmi2 = false; | ||
const bool m_pdpe1gb = false; | ||
MsrMod m_msrMod = MSR_MOD_NONE; | ||
Vendor m_vendor = VENDOR_UNKNOWN; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet> | ||
* Copyright 2016 Jay D Dee <[email protected]> | ||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt> | ||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh> | ||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <[email protected]> | ||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh> | ||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,8 @@ | |
* Copyright 2016 Jay D Dee <[email protected]> | ||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt> | ||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd> | ||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh> | ||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <[email protected]> | ||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh> | ||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -30,6 +30,7 @@ | |
|
||
|
||
#include <hwloc.h> | ||
#include <thread> | ||
|
||
|
||
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id) | ||
|
@@ -42,8 +43,11 @@ bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id) | |
} | ||
|
||
if (hwloc_set_cpubind(cpu->topology(), pu->cpuset, HWLOC_CPUBIND_THREAD | HWLOC_CPUBIND_STRICT) >= 0) { | ||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); | ||
return true; | ||
} | ||
|
||
return hwloc_set_cpubind(cpu->topology(), pu->cpuset, HWLOC_CPUBIND_THREAD) >= 0; | ||
const bool result = (hwloc_set_cpubind(cpu->topology(), pu->cpuset, HWLOC_CPUBIND_THREAD) >= 0); | ||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); | ||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,8 @@ | |
* Copyright 2014 Lucas Jones <https://github.com/lucasjones> | ||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet> | ||
* Copyright 2016 Jay D Dee <[email protected]> | ||
* Copyright 2016-2017 XMRig <support@xmrig.com> | ||
* | ||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh> | ||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -28,6 +28,7 @@ | |
#include <stdlib.h> | ||
#include <sys/resource.h> | ||
#include <uv.h> | ||
#include <thread> | ||
|
||
|
||
#include "base/kernel/Platform.h" | ||
|
@@ -67,7 +68,9 @@ bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id) | |
thread_affinity_policy_data_t policy = { static_cast<integer_t>(cpu_id) }; | ||
mach_thread = pthread_mach_thread_np(pthread_self()); | ||
|
||
return thread_policy_set(mach_thread, THREAD_AFFINITY_POLICY, (thread_policy_t)&policy, 1) == KERN_SUCCESS; | ||
const bool result = (thread_policy_set(mach_thread, THREAD_AFFINITY_POLICY, (thread_policy_t)&policy, 1) == KERN_SUCCESS); | ||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); | ||
return result; | ||
} | ||
#endif | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,8 @@ | |
* Copyright 2014 Lucas Jones <https://github.com/lucasjones> | ||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet> | ||
* Copyright 2016 Jay D Dee <[email protected]> | ||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt> | ||
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <[email protected]> | ||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh> | ||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -37,6 +37,7 @@ | |
#include <sys/resource.h> | ||
#include <unistd.h> | ||
#include <uv.h> | ||
#include <thread> | ||
|
||
|
||
#include "base/kernel/Platform.h" | ||
|
@@ -92,10 +93,13 @@ bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id) | |
CPU_SET(cpu_id, &mn); | ||
|
||
# ifndef __ANDROID__ | ||
return pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &mn) == 0; | ||
const bool result = (pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &mn) == 0); | ||
# else | ||
return sched_setaffinity(gettid(), sizeof(cpu_set_t), &mn) == 0; | ||
const bool result = (sched_setaffinity(gettid(), sizeof(cpu_set_t), &mn) == 0); | ||
# endif | ||
|
||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); | ||
return result; | ||
} | ||
#endif | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,8 @@ | |
* Copyright 2014 Lucas Jones <https://github.com/lucasjones> | ||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet> | ||
* Copyright 2016 Jay D Dee <[email protected]> | ||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt> | ||
* Copyright 2018 SChernykh <https://github.com/SChernykh> | ||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <[email protected]> | ||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh> | ||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -98,7 +97,9 @@ bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id) | |
LOG_ERR("Unable to set affinity. Windows supports only affinity up to 63."); | ||
} | ||
|
||
return SetThreadAffinityMask(GetCurrentThread(), 1ULL << cpu_id) != 0; | ||
const bool result = (SetThreadAffinityMask(GetCurrentThread(), 1ULL << cpu_id) != 0); | ||
Sleep(1); | ||
return result; | ||
} | ||
#endif | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
;# save VM register values | ||
add rsp, 24 | ||
add rsp, 40 | ||
pop rcx | ||
mov qword ptr [rcx+0], r8 | ||
mov qword ptr [rcx+8], r9 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
lea rcx, [rsi+rax] | ||
mov [rsp+16], rcx | ||
xor r8, qword ptr [rcx+0] | ||
xor r9, qword ptr [rcx+8] | ||
xor r10, qword ptr [rcx+16] | ||
xor r11, qword ptr [rcx+24] | ||
xor r12, qword ptr [rcx+32] | ||
xor r13, qword ptr [rcx+40] | ||
xor r14, qword ptr [rcx+48] | ||
xor r15, qword ptr [rcx+56] | ||
lea rcx, [rsi+rdx] | ||
mov [rsp+24], rcx | ||
cvtdq2pd xmm0, qword ptr [rcx+0] | ||
cvtdq2pd xmm1, qword ptr [rcx+8] | ||
cvtdq2pd xmm2, qword ptr [rcx+16] | ||
cvtdq2pd xmm3, qword ptr [rcx+24] | ||
cvtdq2pd xmm4, qword ptr [rcx+32] | ||
cvtdq2pd xmm5, qword ptr [rcx+40] | ||
cvtdq2pd xmm6, qword ptr [rcx+48] | ||
cvtdq2pd xmm7, qword ptr [rcx+56] | ||
vpcmov xmm4, xmm4, xmm14, xmm13 | ||
vpcmov xmm5, xmm5, xmm14, xmm13 | ||
vpcmov xmm6, xmm6, xmm14, xmm13 | ||
vpcmov xmm7, xmm7, xmm14, xmm13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.