diff --git a/CHANGELOG.md b/CHANGELOG.md index bcaf27c7..95575c3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,11 @@ # v2.6.0-beta2 +- Improved performance for `cryptonight v7` especially in double hash mode. - [#499](https://github.com/xmrig/xmrig/issues/499) IPv6 disabled for internal HTTP API by default, was cause issues on some systems. - Added short aliases for algorithm names: `cn`, `cn-lite` and `cn-heavy`. - Fixed regressions (v2.6.0-beta1 affected) - [#494](https://github.com/xmrig/xmrig/issues/494) Command line option `--donate-level` was broken. - - [#502](https://github.com/xmrig/xmrig/issues/502) Build without libmicrohttpd was broken. + - [#502](https://github.com/xmrig/xmrig/issues/502) Build without libmicrohttpd was broken. + - Fixed nonce calculation for `--av 4` (software AES, double hash) was cause reduction of effective hashrate and rejected shares on nicehash. # v2.6.0-beta1 - [#476](https://github.com/xmrig/xmrig/issues/476) **Added Cryptonight-Heavy support for Sumokoin ASIC resistance fork.** diff --git a/README.md b/README.md index 3cf26d17..010a03fc 100644 --- a/README.md +++ b/README.md @@ -124,10 +124,10 @@ Please note performance is highly dependent on system load. The numbers above ar ## Release checksums ### SHA-256 ``` -bd14bc3cfd9528e4a7583ab39aecc876250333e1e0faab83781584bb7f65e3eb xmrig-2.6.0-beta1-xenial-amd64.tar.gz/xmrig-2.6.0-beta1/xmrig -32eebf71e5631029202ae5cbf6f03caad912f1722aa86a1be01a26d491801aba xmrig-2.6.0-beta1-gcc-win32.zip/xmrig.exe -1cc08844ff019408e2e2c9560fee0c4e0b2dbc2a72bcc1c1da4a847a1787eca3 xmrig-2.6.0-beta1-gcc-win64.zip/xmrig.exe -fdf99aa8e7792a34b1be0cc6c77e4e83ff9a4b21abb27989f7927dcfed82f6e2 xmrig-2.6.0-beta1-msvc-win64.zip/xmrig.exe +232af0c5f3b1cdbc2d90b514873a764b434d5621d2790da67954b35c17e44fe3 xmrig-2.6.0-beta2-xenial-amd64.tar.gz/xmrig-2.6.0-beta2/xmrig +2366a06729d4de538ef511862bf11d0c7ad40fd245e7aeab3c1957307d63471a xmrig-2.6.0-beta2-gcc-win32.zip/xmrig.exe +2f6538c765e001d13ca380cbc1558d51efcb97d4bccdfa40993cb872be4e9efd xmrig-2.6.0-beta2-gcc-win64.zip/xmrig.exe +3c0479acb78a3cee8fe416ee438dbff09c786acf50fbaf28a820127fcd0c6e62 xmrig-2.6.0-beta2-msvc-win64.zip/xmrig.exe ``` ## Contacts diff --git a/src/Summary.cpp b/src/Summary.cpp index 7e341ce0..56f3f522 100644 --- a/src/Summary.cpp +++ b/src/Summary.cpp @@ -123,7 +123,7 @@ static void print_pools(xmrig::Config *config) # ifdef APP_DEBUG for (size_t i = 0; i < pools.size(); ++i) { - Log::i()->text("%s:%d, user: %s, pass: %s, ka: %d, nicehash: %d", pools[i]->host(), pools[i]->port(), pools[i]->user(), pools[i]->password(), pools[i]->isKeepAlive(), pools[i]->isNicehash()); + Log::i()->text("%s:%d, user: %s, pass: %s, ka: %d, nicehash: %d", pools[i]->host(), pools[i]->port(), pools[i]->user(), pools[i]->password(), pools[i]->keepAlive(), pools[i]->isNicehash()); } # endif } diff --git a/src/crypto/CryptoNight_x86.h b/src/crypto/CryptoNight_x86.h index 95422449..333e2191 100644 --- a/src/crypto/CryptoNight_x86.h +++ b/src/crypto/CryptoNight_x86.h @@ -389,6 +389,22 @@ static inline void cn_implode_scratchpad(const __m128i *input, __m128i *output) } +static inline void cryptonight_monero_tweak(uint64_t* mem_out, __m128i tmp) +{ + mem_out[0] = EXTRACT64(tmp); + + tmp = _mm_castps_si128(_mm_movehl_ps(_mm_castsi128_ps(tmp), _mm_castsi128_ps(tmp))); + uint64_t vh = EXTRACT64(tmp); + + uint8_t x = vh >> 24; + static const uint16_t table = 0x7531; + const uint8_t index = (((x >> 3) & 6) | (x & 1)) << 1; + vh ^= ((table >> index) & 0x3) << 28; + + mem_out[1] = vh; +} + + template inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t size, uint8_t *__restrict__ output, cryptonight_ctx *__restrict__ ctx) { @@ -403,7 +419,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si keccak(input, (int) size, ctx->state0, 200); - VARIANT1_INIT(0); + VARIANT1_INIT(0) cn_explode_scratchpad((__m128i*) ctx->state0, (__m128i*) ctx->memory); @@ -416,7 +432,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si uint64_t idx0 = h0[0] ^ h0[4]; void* mp = ((uint8_t*) l0) + ((idx0) & MASK); - + for (size_t i = 0; i < ITERATIONS; i++) { __m128i cx; @@ -501,80 +517,83 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si uint64_t idx0 = h0[0] ^ h0[4]; uint64_t idx1 = h1[0] ^ h1[4]; + void* mp0 = ((uint8_t*) l0) + ((idx0) & MASK); + void* mp1 = ((uint8_t*) l1) + ((idx1) & MASK); + for (size_t i = 0; i < ITERATIONS; i++) { __m128i cx0, cx1; if (SOFT_AES) { - cx0 = soft_aesenc((uint32_t*)&l0[idx0 & MASK], _mm_set_epi64x(ah0, al0)); - cx1 = soft_aesenc((uint32_t*)&l1[idx1 & MASK], _mm_set_epi64x(ah1, al1)); - } - else { - cx0 = _mm_load_si128((__m128i *) &l0[idx0 & MASK]); - cx1 = _mm_load_si128((__m128i *) &l1[idx1 & MASK]); + cx0 = soft_aesenc((uint32_t*) mp0, _mm_set_epi64x(ah0, al0)); + cx1 = soft_aesenc((uint32_t*) mp1, _mm_set_epi64x(ah1, al1)); + } else { + cx0 = _mm_load_si128((__m128i *) mp0); + cx1 = _mm_load_si128((__m128i *)mp1); cx0 = _mm_aesenc_si128(cx0, _mm_set_epi64x(ah0, al0)); cx1 = _mm_aesenc_si128(cx1, _mm_set_epi64x(ah1, al1)); } - _mm_store_si128((__m128i *) &l0[idx0 & MASK], _mm_xor_si128(bx0, cx0)); - _mm_store_si128((__m128i *) &l1[idx1 & MASK], _mm_xor_si128(bx1, cx1)); - VARIANT1_1(&l0[idx0 & MASK]); - VARIANT1_1(&l1[idx1 & MASK]); + if (VARIANT > 0) { + cryptonight_monero_tweak((uint64_t*)mp0, _mm_xor_si128(bx0, cx0)); + cryptonight_monero_tweak((uint64_t*)mp1, _mm_xor_si128(bx1, cx1)); + } else { + _mm_store_si128((__m128i *) mp0, _mm_xor_si128(bx0, cx0)); + _mm_store_si128((__m128i *) mp1, _mm_xor_si128(bx1, cx1)); + } - idx0 = EXTRACT64(cx0); - idx1 = EXTRACT64(cx1); + mp0 = ((uint8_t*) l0) + ((idx0 = EXTRACT64(cx0)) & MASK); + mp1 = ((uint8_t*) l1) + ((idx1 = EXTRACT64(cx1)) & MASK); bx0 = cx0; bx1 = cx1; uint64_t hi, lo, cl, ch; - cl = ((uint64_t*) &l0[idx0 & MASK])[0]; - ch = ((uint64_t*) &l0[idx0 & MASK])[1]; + cl = ((uint64_t*) mp0)[0]; + ch = ((uint64_t*) mp0)[1]; lo = __umul128(idx0, cl, &hi); al0 += hi; ah0 += lo; VARIANT1_2(ah0, 0); - ((uint64_t*) &l0[idx0 & MASK])[0] = al0; - ((uint64_t*) &l0[idx0 & MASK])[1] = ah0; + ((uint64_t*) mp0)[0] = al0; + ((uint64_t*) mp0)[1] = ah0; VARIANT1_2(ah0, 0); ah0 ^= ch; al0 ^= cl; - idx0 = al0; + mp0 = ((uint8_t*) l0) + ((al0) & MASK); if (ALGO == xmrig::CRYPTONIGHT_HEAVY) { - int64_t n = ((int64_t*)&l0[idx0 & MASK])[0]; - int32_t d = ((int32_t*)&l0[idx0 & MASK])[2]; + int64_t n = ((int64_t*)mp0)[0]; + int32_t d = ((int32_t*)mp0)[2]; int64_t q = n / (d | 0x5); - ((int64_t*)&l0[idx0 & MASK])[0] = n ^ q; - idx0 = d ^ q; + ((int64_t*) mp0)[0] = n ^ q; } - cl = ((uint64_t*) &l1[idx1 & MASK])[0]; - ch = ((uint64_t*) &l1[idx1 & MASK])[1]; + cl = ((uint64_t*) mp1)[0]; + ch = ((uint64_t*) mp1)[1]; lo = __umul128(idx1, cl, &hi); al1 += hi; ah1 += lo; VARIANT1_2(ah1, 1); - ((uint64_t*) &l1[idx1 & MASK])[0] = al1; - ((uint64_t*) &l1[idx1 & MASK])[1] = ah1; + ((uint64_t*) mp1)[0] = al1; + ((uint64_t*) mp1)[1] = ah1; VARIANT1_2(ah1, 1); ah1 ^= ch; al1 ^= cl; - idx1 = al1; + mp1 = ((uint8_t*) l1) + ((al1) & MASK); if (ALGO == xmrig::CRYPTONIGHT_HEAVY) { - int64_t n = ((int64_t*)&l1[idx1 & MASK])[0]; - int32_t d = ((int32_t*)&l1[idx1 & MASK])[2]; + int64_t n = ((int64_t*)mp1)[0]; + int32_t d = ((int32_t*)mp1)[2]; int64_t q = n / (d | 0x5); - ((int64_t*)&l1[idx1 & MASK])[0] = n ^ q; - idx1 = d ^ q; + ((int64_t*)mp1)[0] = n ^ q; } } diff --git a/src/version.h b/src/version.h index db7c2013..4ea70a57 100644 --- a/src/version.h +++ b/src/version.h @@ -27,7 +27,7 @@ #define APP_ID "xmrig" #define APP_NAME "XMRig" #define APP_DESC "XMRig CPU miner" -#define APP_VERSION "2.6.0-beta1" +#define APP_VERSION "2.6.0-beta2" #define APP_DOMAIN "xmrig.com" #define APP_SITE "www.xmrig.com" #define APP_COPYRIGHT "Copyright (C) 2016-2018 xmrig.com" @@ -36,7 +36,7 @@ #define APP_VER_MAJOR 2 #define APP_VER_MINOR 6 #define APP_VER_BUILD 0 -#define APP_VER_REV 1 +#define APP_VER_REV 2 #ifdef _MSC_VER # if (_MSC_VER >= 1910) diff --git a/src/workers/CpuThread.cpp b/src/workers/CpuThread.cpp index b8be966f..7e68a990 100644 --- a/src/workers/CpuThread.cpp +++ b/src/workers/CpuThread.cpp @@ -146,28 +146,28 @@ xmrig::CpuThread *xmrig::CpuThread::createFromAV(size_t index, Algo algorithm, A softAES = true; break; - case AV_DOUBLE: - multiway = DoubleWay; case AV_DOUBLE_SOFT: softAES = true; + case AV_DOUBLE: + multiway = DoubleWay; break; - case AV_TRIPLE: - multiway = TripleWay; case AV_TRIPLE_SOFT: softAES = true; + case AV_TRIPLE: + multiway = TripleWay; break; - case AV_QUAD: - multiway = QuadWay; case AV_QUAD_SOFT: softAES = true; + case AV_QUAD: + multiway = QuadWay; break; - case AV_PENTA: - multiway = PentaWay; case AV_PENTA_SOFT: softAES = true; + case AV_PENTA: + multiway = PentaWay; break; default: