xmrig v6.2.2 based release

This commit is contained in:
MoneroOcean 2020-06-30 08:12:59 -07:00
commit 316af8c2b9
16 changed files with 136 additions and 34 deletions

View file

@ -61,6 +61,7 @@ public:
FLAG_SSE2,
FLAG_SSSE3,
FLAG_XOP,
FLAG_POPCNT,
FLAG_MAX
};

View file

@ -57,7 +57,7 @@
namespace xmrig {
static const std::array<const char *, ICpuInfo::FLAG_MAX> flagNames = { "aes", "avx2", "avx512f", "bmi2", "osxsave", "pdpe1gb", "sse2", "ssse3", "xop" };
static const std::array<const char *, ICpuInfo::FLAG_MAX> flagNames = { "aes", "avx2", "avx512f", "bmi2", "osxsave", "pdpe1gb", "sse2", "ssse3", "xop", "popcnt" };
static const std::array<const char *, ICpuInfo::MSR_MOD_MAX> msrNames = { "none", "ryzen", "intel", "custom" };
@ -119,15 +119,30 @@ static inline int32_t get_masked(int32_t val, int32_t h, int32_t l)
}
static inline uint64_t xgetbv()
{
#ifdef _MSC_VER
return _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
#else
uint32_t eax_reg = 0;
uint32_t edx_reg = 0;
__asm__ __volatile__("xgetbv": "=a"(eax_reg), "=d"(edx_reg) : "c"(0) : "cc");
return (static_cast<uint64_t>(edx_reg) << 32) | eax_reg;
#endif
}
static inline bool has_xcr_avx2() { return (xgetbv() & 0x06) == 0x06; }
static inline bool has_xcr_avx512() { return (xgetbv() & 0xE6) == 0xE6; }
static inline bool has_osxsave() { return has_feature(PROCESSOR_INFO, ECX_Reg, 1 << 27); }
static inline bool has_aes_ni() { return has_feature(PROCESSOR_INFO, ECX_Reg, 1 << 25); }
static inline bool has_avx2() { return has_feature(EXTENDED_FEATURES, EBX_Reg, 1 << 5) && has_osxsave(); }
static inline bool has_avx512f() { return has_feature(EXTENDED_FEATURES, EBX_Reg, 1 << 16) && has_osxsave(); }
static inline bool has_avx2() { return has_feature(EXTENDED_FEATURES, EBX_Reg, 1 << 5) && has_osxsave() && has_xcr_avx2(); }
static inline bool has_avx512f() { return has_feature(EXTENDED_FEATURES, EBX_Reg, 1 << 16) && has_osxsave() && has_xcr_avx512(); }
static inline bool has_bmi2() { return has_feature(EXTENDED_FEATURES, EBX_Reg, 1 << 8); }
static inline bool has_pdpe1gb() { return has_feature(PROCESSOR_EXT_INFO, EDX_Reg, 1 << 26); }
static inline bool has_sse2() { return has_feature(PROCESSOR_INFO, EDX_Reg, 1 << 26); }
static inline bool has_ssse3() { return has_feature(PROCESSOR_INFO, ECX_Reg, 1 << 9); }
static inline bool has_xop() { return has_feature(0x80000001, ECX_Reg, 1 << 11); }
static inline bool has_popcnt() { return has_feature(PROCESSOR_INFO, ECX_Reg, 1 << 23); }
} // namespace xmrig
@ -162,6 +177,7 @@ xmrig::BasicCpuInfo::BasicCpuInfo() :
m_flags.set(FLAG_SSE2, has_sse2());
m_flags.set(FLAG_SSSE3, has_ssse3());
m_flags.set(FLAG_XOP, has_xop());
m_flags.set(FLAG_POPCNT, has_popcnt());
# ifdef XMRIG_FEATURE_ASM
if (hasAES()) {

View file

@ -27,6 +27,7 @@
#include "backend/cuda/CudaWorker.h"
#include "backend/common/Tags.h"
#include "backend/cuda/runners/CudaCnRunner.h"
#include "backend/cuda/wrappers/CudaDevice.h"
#include "base/io/log/Log.h"
#include "base/tools/Chrono.h"
#include "core/Miner.h"
@ -71,7 +72,8 @@ static inline uint32_t roundSize(uint32_t intensity) { return kReserveCount / in
xmrig::CudaWorker::CudaWorker(size_t id, const CudaLaunchData &data) :
Worker(id, data.thread.affinity(), -1),
m_algorithm(data.algorithm),
m_miner(data.miner)
m_miner(data.miner),
m_deviceIndex(data.device.index())
{
switch (m_algorithm.family()) {
case Algorithm::RANDOM_X:
@ -165,7 +167,7 @@ void xmrig::CudaWorker::start()
}
if (foundCount) {
JobResults::submit(m_job.currentJob(), foundNonce, foundCount);
JobResults::submit(m_job.currentJob(), foundNonce, foundCount, m_deviceIndex);
}
const size_t batch_size = intensity();

View file

@ -66,6 +66,7 @@ private:
const Miner *m_miner;
ICudaRunner *m_runner = nullptr;
WorkerJob<1> m_job;
uint32_t m_deviceIndex;
};

View file

@ -83,7 +83,8 @@ xmrig::OclWorker::OclWorker(size_t id, const OclLaunchData &data) :
m_algorithm(data.algorithm),
m_miner(data.miner),
m_intensity(data.thread.intensity()),
m_sharedData(OclSharedState::get(data.device.index()))
m_sharedData(OclSharedState::get(data.device.index())),
m_deviceIndex(data.device.index())
{
switch (m_algorithm.family()) {
case Algorithm::RANDOM_X:
@ -210,7 +211,7 @@ void xmrig::OclWorker::start()
}
if (results[0xFF] > 0) {
JobResults::submit(m_job.currentJob(), results, results[0xFF]);
JobResults::submit(m_job.currentJob(), results, results[0xFF], m_deviceIndex);
}
if (!Nonce::isOutdated(Nonce::OPENCL, m_job.sequence()) && !m_job.nextRound(roundSize(runnerRoundSize), runnerRoundSize)) {

View file

@ -69,6 +69,7 @@ private:
IOclRunner *m_runner = nullptr;
OclSharedData &m_sharedData;
WorkerJob<1> m_job;
uint32_t m_deviceIndex;
};

View file

@ -36,27 +36,29 @@ bool AdlLib::m_ready = false;
static const std::string kPrefix = "/sys/bus/pci/drivers/amdgpu/";
static inline bool sysfs_is_file(const char *path)
static inline bool sysfs_is_file(const std::string &path)
{
struct stat sb;
return stat(path, &sb) == 0 && ((sb.st_mode & S_IFMT) == S_IFREG);
return stat(path.c_str(), &sb) == 0 && ((sb.st_mode & S_IFMT) == S_IFREG);
}
static inline std::string sysfs_prefix(const PciTopology &topology)
static inline bool sysfs_is_amdgpu(const std::string &path)
{
std::string path = kPrefix + "0000:" + topology.toString().data() + "/hwmon/hwmon";
if (sysfs_is_file((path + "2/name").c_str())) {
return path + "2/";
if (!sysfs_is_file(path)) {
return false;
}
if (sysfs_is_file((path + "3/name").c_str())) {
return path + "3/";
std::ifstream file(path);
if (!file.is_open()) {
return false;
}
return {};
std::string name;
std::getline(file, name);
return name == "amdgpu";
}
@ -74,6 +76,21 @@ uint32_t sysfs_read(const std::string &path)
}
static inline std::string sysfs_prefix(const PciTopology &topology)
{
const std::string path = kPrefix + "0000:" + topology.toString().data() + "/hwmon/hwmon";
for (uint32_t i = 1; i < 10; ++i) {
const std::string prefix = path + std::to_string(i) + "/";
if (sysfs_is_amdgpu(prefix + "name") && sysfs_read(prefix + "freq1_input")) {
return prefix;
}
}
return {};
}
} // namespace xmrig