diff --git a/src/core/MoBenchmark.cpp b/src/core/MoBenchmark.cpp index 471b754a..f7af4be8 100644 --- a/src/core/MoBenchmark.cpp +++ b/src/core/MoBenchmark.cpp @@ -56,6 +56,7 @@ void MoBenchmark::finish() { LOG_INFO("%s " BRIGHT_BLACK_BG(CYAN_BOLD_S " ALGO PERFORMANCE CALIBRATION COMPLETE "), Tags::benchmark()); m_controller->miner()->pause(); // do not compute anything before job from the pool JobResults::stop(); + JobResults::setListener(m_controller->network(), m_controller->config()->cpu().isHwAES()); m_controller->start(); } @@ -67,6 +68,7 @@ rapidjson::Value MoBenchmark::toJSON(rapidjson::Document &doc) const Value obj(kObjectType); for (const Algorithm a : Algorithm::all()) { + if (algo_perf[a.id()] == 0.0f) continue; obj.AddMember(StringRef(a.name()), algo_perf[a.id()], allocator); } @@ -118,10 +120,16 @@ double MoBenchmark::get_algo_perf(Algorithm::Id algo) const { case Algorithm::CN_RWZ: return algo_perf[Algorithm::CN_R] / 3 * 4; case Algorithm::CN_ZLS: return algo_perf[Algorithm::CN_R] / 3 * 4; case Algorithm::CN_DOUBLE: return algo_perf[Algorithm::CN_R] / 2; +# ifdef XMRIG_ALGO_CN_LITE case Algorithm::CN_LITE_0: return algo_perf[Algorithm::CN_LITE_1]; +# endif +# ifdef XMRIG_ALGO_CN_PICO case Algorithm::CN_PICO_TLO: return algo_perf[Algorithm::CN_PICO_0]; +# endif +# ifdef XMRIG_ALGO_RANDOMX case Algorithm::RX_SFX: return algo_perf[Algorithm::RX_0]; case Algorithm::RX_XEQ: return algo_perf[Algorithm::RX_ARQ]; +# endif default: return algo_perf[algo]; } } @@ -147,17 +155,21 @@ void MoBenchmark::start() { m_bench_job = Job(false, Algorithm(bench_algos[m_bench_algo]), "benchmark"); m_bench_job.setId(algo.name()); // need to set different id so that workers will see job change switch (algo.id()) { +# ifdef XMRIG_ALGO_KAWPOW case Algorithm::KAWPOW_RVN: m_bench_job.setBlob("4c38e8a5f7b2944d1e4274635d828519b97bc64a1f1c7896ecdbb139989aa0e80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); m_bench_job.setDiff(Job::toDiff(strtoull("000000639c000000", nullptr, 16))); m_bench_job.setHeight(1500000); break; +# endif +# ifdef XMRIG_ALGO_GHOSTRIDER case Algorithm::GHOSTRIDER_RTM: case Algorithm::FLEX_KCN: m_bench_job.setBlob("000000208c246d0b90c3b389c4086e8b672ee040d64db5b9648527133e217fbfa48da64c0f3c0a0b0e8350800568b40fbb323ac3ccdf2965de51b9aaeb939b4f11ff81c49b74a16156ff251c00000000"); m_bench_job.setDiff(1000); break; +# endif default: // 99 here to trigger all future bench_algo versions for auto veriant detection based on block version @@ -215,11 +227,15 @@ void MoBenchmark::onJobResult(const JobResult& result) { if (!(hashrate = t[1])) if (!(hashrate = t[0])) hashrate = static_cast(m_hash_count) * result.diff / (now - m_bench_start) * 1000.0f; +# ifdef XMRIG_ALGO_KAWPOW if (algo.id() == Algorithm::KAWPOW_RVN) hashrate /= ((double)0xFFFFFFFFFFFFFFFF) / 0xFF000000; +# endif algo_perf[algo.id()] = hashrate; // store hashrate result LOG_INFO("%s " BRIGHT_BLACK_BG(WHITE_BOLD_S " Algo " MAGENTA_BOLD_S "%s" WHITE_BOLD_S " hashrate: " CYAN_BOLD_S "%f "), Tags::benchmark(), algo.name(), hashrate); run_next_bench_algo(); - } else switch (algo.id()) { // Update GhostRider algo job to produce more accurate perf results + } +# ifdef XMRIG_ALGO_GHOSTRIDER + else switch (algo.id()) { // Update GhostRider algo job to produce more accurate perf results case Algorithm::GHOSTRIDER_RTM: { uint8_t* blob = m_bench_job.blob(); ++ *reinterpret_cast(blob+4); @@ -228,6 +244,7 @@ void MoBenchmark::onJobResult(const JobResult& result) { } default:; } +# endif } uint64_t MoBenchmark::get_now() const { // get current time in ms diff --git a/src/core/MoBenchmark.h b/src/core/MoBenchmark.h index 5398bf4e..65d4df6e 100644 --- a/src/core/MoBenchmark.h +++ b/src/core/MoBenchmark.h @@ -35,20 +35,36 @@ class Job; class MoBenchmark : public IJobResultListener { const Algorithm::Id bench_algos[15] = { +# ifdef XMRIG_ALGO_GHOSTRIDER Algorithm::FLEX_KCN, Algorithm::GHOSTRIDER_RTM, +# endif Algorithm::CN_R, +# ifdef XMRIG_ALGO_CN_LITE Algorithm::CN_LITE_1, +# endif +# ifdef XMRIG_ALGO_CN_HEAVY Algorithm::CN_HEAVY_XHV, +# endif +# ifdef XMRIG_ALGO_CN_PICO Algorithm::CN_PICO_0, +# endif Algorithm::CN_CCX, +# ifdef XMRIG_ALGO_CN_GPU Algorithm::CN_GPU, +# endif +# ifdef XMRIG_ALGO_ARGON2 Algorithm::AR2_CHUKWA_V2, +# endif +# ifdef XMRIG_ALGO_KAWPOW Algorithm::KAWPOW_RVN, +# endif +# ifdef XMRIG_ALGO_RANDOMX Algorithm::RX_0, Algorithm::RX_GRAFT, Algorithm::RX_ARQ, Algorithm::RX_XLA, +# endif Algorithm::INVALID }; diff --git a/src/crypto/cn/CryptoNight_arm.h b/src/crypto/cn/CryptoNight_arm.h index aa1eac1f..1402e2bf 100644 --- a/src/crypto/cn/CryptoNight_arm.h +++ b/src/crypto/cn/CryptoNight_arm.h @@ -63,8 +63,13 @@ static inline void do_skein_hash(const uint8_t *input, size_t len, uint8_t *outp xmr_skein(input, output); } +static inline void do_flex_skein_hash(const uint8_t* input, size_t len, uint8_t* output) { + int r = skein_hash(512, input, 8 * len, (uint8_t*)output); + assert(SKEIN_SUCCESS == r); +} void (* const extra_hashes[4])(const uint8_t *, size_t, uint8_t *) = {do_blake_hash, do_groestl_hash, do_jh_hash, do_skein_hash}; +void (* const extra_hashes_flex[3])(const uint8_t *, size_t, uint8_t *) = {do_blake_hash, do_groestl_hash, do_flex_skein_hash}; // This will shift and xor tmp1 into itself as 4 32-bit vals such as @@ -543,7 +548,10 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si cn_implode_scratchpad(reinterpret_cast(ctx[0]->memory), reinterpret_cast<__m128i *>(ctx[0]->state)); keccakf(h0, 24); - extra_hashes[ctx[0]->state[0] & 3](ctx[0]->state, 200, output); + if (height == 101) // Flex algo ugly hack + extra_hashes_flex[ctx[0]->state[0] & 2](ctx[0]->state, 200, output); + else + extra_hashes[ctx[0]->state[0] & 3](ctx[0]->state, 200, output); } diff --git a/src/crypto/flex/flex.cpp b/src/crypto/flex/flex.cpp index 8a96a73a..29cf429c 100644 --- a/src/crypto/flex/flex.cpp +++ b/src/crypto/flex/flex.cpp @@ -74,16 +74,14 @@ static void selectAlgo(unsigned char nibble, bool* selectedAlgos, uint8_t* selec } static void getAlgoString(void *mem, unsigned int size, uint8_t* selectedAlgoOutput, int algoCount) { - int i; unsigned char *p = (unsigned char *)mem; unsigned int len = size/2; - unsigned char j = 0; bool* selectedAlgo = new bool[algoCount]; for(int z=0; z < algoCount; z++) { selectedAlgo[z] = false; } int selectedCount = 0; - for (i=0;i