From 3c5e8921b764e03ef09c57b2207b9960d45123b0 Mon Sep 17 00:00:00 2001 From: Jay D Dee Date: Thu, 6 May 2021 14:55:03 -0400 Subject: [PATCH] v3.16.3 --- RELEASE_NOTES | 8 +- algo/blake/blake2b-hash-4way.h | 4 +- algo/blake/blake2s-hash-4way.h | 6 +- algo/blake/sph-blake2s.c | 10 +- algo/blake/sph-blake2s.h | 2 +- algo/blake/sph_blake2b.h | 2 +- algo/quark/quark-4way.c | 30 ++--- algo/verthash/Verthash.c | 204 ++++++++++++++++++--------------- algo/verthash/Verthash.h | 6 +- algo/verthash/verthash-gate.c | 18 ++- configure | 20 ++-- configure.ac | 2 +- cpu-miner.c | 29 ++--- util.c | 12 +- 14 files changed, 183 insertions(+), 170 deletions(-) diff --git a/RELEASE_NOTES b/RELEASE_NOTES index a1133db1..e1bd547c 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -65,11 +65,16 @@ If not what makes it happen or not happen? Change Log ---------- +v3.16.3 + +#313 Fix compile error with GCC 11. +Incremental improvements to verthash. + v3.16.2 Verthash: midstate prehash optimization for all architectures. Verthash: AVX2 optimization. -GBT: added support for Bech32 addresses, untested. +GBT: added support for Bech32 addresses. Linux: added CPU frequency to benchmark log. Fixed integer overflow in time calculations. @@ -111,7 +116,6 @@ RPC getmininginfo method. v3.15.5 Fix stratum jobs lost if 2 jobs received in less than one second. - v3.15.4 diff --git a/algo/blake/blake2b-hash-4way.h b/algo/blake/blake2b-hash-4way.h index 979e4b22..1256fb18 100644 --- a/algo/blake/blake2b-hash-4way.h +++ b/algo/blake/blake2b-hash-4way.h @@ -17,7 +17,7 @@ #if defined(__AVX512F__) && defined(__AVX512VL__) && defined(__AVX512DQ__) && defined(__AVX512BW__) -ALIGN(128) typedef struct { +typedef struct ALIGN( 64 ) { __m512i b[16]; // input buffer __m512i h[8]; // chained state uint64_t t[2]; // total number of bytes @@ -35,7 +35,7 @@ void blake2b_8way_final( blake2b_8way_ctx *ctx, void *out ); #if defined(__AVX2__) // state context -ALIGN(128) typedef struct { +typedef struct ALIGN( 64 ) { __m256i b[16]; // input buffer __m256i h[8]; // chained state uint64_t t[2]; // total number of bytes diff --git a/algo/blake/blake2s-hash-4way.h b/algo/blake/blake2s-hash-4way.h index baf28656..fc86c4fc 100644 --- a/algo/blake/blake2s-hash-4way.h +++ b/algo/blake/blake2s-hash-4way.h @@ -60,7 +60,7 @@ typedef struct __blake2s_nway_param } blake2s_nway_param; #pragma pack(pop) -ALIGN( 64 ) typedef struct __blake2s_4way_state +typedef struct ALIGN( 64 ) __blake2s_4way_state { __m128i h[8]; uint8_t buf[ BLAKE2S_BLOCKBYTES * 4 ]; @@ -80,7 +80,7 @@ int blake2s_4way_full_blocks( blake2s_4way_state *S, void *out, #if defined(__AVX2__) -ALIGN( 64 ) typedef struct __blake2s_8way_state +typedef struct ALIGN( 64 ) __blake2s_8way_state { __m256i h[8]; uint8_t buf[ BLAKE2S_BLOCKBYTES * 8 ]; @@ -101,7 +101,7 @@ int blake2s_8way_full_blocks( blake2s_8way_state *S, void *out, #if defined(__AVX512F__) && defined(__AVX512VL__) && defined(__AVX512DQ__) && defined(__AVX512BW__) -ALIGN( 128 ) typedef struct __blake2s_16way_state +typedef struct ALIGN( 64 ) __blake2s_16way_state { __m512i h[8]; uint8_t buf[ BLAKE2S_BLOCKBYTES * 16 ]; diff --git a/algo/blake/sph-blake2s.c b/algo/blake/sph-blake2s.c index a732910d..0ebe547b 100644 --- a/algo/blake/sph-blake2s.c +++ b/algo/blake/sph-blake2s.c @@ -323,7 +323,7 @@ int blake2s_final( blake2s_state *S, uint8_t *out, uint8_t outlen ) int blake2s( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen ) { - blake2s_state S[1]; + blake2s_state S; /* Verify parameters */ if ( NULL == in ) return -1; @@ -334,15 +334,15 @@ int blake2s( uint8_t *out, const void *in, const void *key, const uint8_t outlen if( keylen > 0 ) { - if( blake2s_init_key( S, outlen, key, keylen ) < 0 ) return -1; + if( blake2s_init_key( &S, outlen, key, keylen ) < 0 ) return -1; } else { - if( blake2s_init( S, outlen ) < 0 ) return -1; + if( blake2s_init( &S, outlen ) < 0 ) return -1; } - blake2s_update( S, ( uint8_t * )in, inlen ); - blake2s_final( S, out, outlen ); + blake2s_update( &S, ( uint8_t * )in, inlen ); + blake2s_final( &S, out, outlen ); return 0; } diff --git a/algo/blake/sph-blake2s.h b/algo/blake/sph-blake2s.h index 2949fa62..eb66b7a5 100644 --- a/algo/blake/sph-blake2s.h +++ b/algo/blake/sph-blake2s.h @@ -116,7 +116,7 @@ extern "C" { uint8_t personal[BLAKE2S_PERSONALBYTES]; // 32 } blake2s_param; - ALIGN( 64 ) typedef struct __blake2s_state + typedef struct ALIGN( 64 ) __blake2s_state { uint32_t h[8]; uint32_t t[2]; diff --git a/algo/blake/sph_blake2b.h b/algo/blake/sph_blake2b.h index eaae071d..17f4381c 100644 --- a/algo/blake/sph_blake2b.h +++ b/algo/blake/sph_blake2b.h @@ -18,7 +18,7 @@ #endif // state context -ALIGN(64) typedef struct { +typedef ALIGN(64) struct { uint8_t b[128]; // input buffer uint64_t h[8]; // chained state uint64_t t[2]; // total number of bytes diff --git a/algo/quark/quark-4way.c b/algo/quark/quark-4way.c index d15e6bd8..f29b951d 100644 --- a/algo/quark/quark-4way.c +++ b/algo/quark/quark-4way.c @@ -127,10 +127,8 @@ void quark_8way_hash( void *state, const void *input ) rintrlv_8x64_4x128( vhashA, vhashB, vhash, 512 ); - if ( ( vh_mask & 0x0f ) != 0x0f ) - groestl512_4way_full( &ctx.groestl, vhashA, vhashA, 64 ); - if ( ( vh_mask & 0xf0 ) != 0xf0 ) - groestl512_4way_full( &ctx.groestl, vhashB, vhashB, 64 ); + groestl512_4way_full( &ctx.groestl, vhashA, vhashA, 64 ); + groestl512_4way_full( &ctx.groestl, vhashB, vhashB, 64 ); rintrlv_4x128_8x64( vhash, vhashA, vhashB, 512 ); @@ -139,22 +137,14 @@ void quark_8way_hash( void *state, const void *input ) dintrlv_8x64( hash0, hash1, hash2, hash3, hash4, hash5, hash6, hash7, vhash, 512 ); - if ( hash0[0] & 8 ) - groestl512_full( &ctx.groestl, (char*)hash0, (char*)hash0, 512 ); - if ( hash1[0] & 8 ) - groestl512_full( &ctx.groestl, (char*)hash1, (char*)hash1, 512 ); - if ( hash2[0] & 8) - groestl512_full( &ctx.groestl, (char*)hash2, (char*)hash2, 512 ); - if ( hash3[0] & 8 ) - groestl512_full( &ctx.groestl, (char*)hash3, (char*)hash3, 512 ); - if ( hash4[0] & 8 ) - groestl512_full( &ctx.groestl, (char*)hash4, (char*)hash4, 512 ); - if ( hash5[0] & 8 ) - groestl512_full( &ctx.groestl, (char*)hash5, (char*)hash5, 512 ); - if ( hash6[0] & 8 ) - groestl512_full( &ctx.groestl, (char*)hash6, (char*)hash6, 512 ); - if ( hash7[0] & 8 ) - groestl512_full( &ctx.groestl, (char*)hash7, (char*)hash7, 512 ); + groestl512_full( &ctx.groestl, (char*)hash0, (char*)hash0, 512 ); + groestl512_full( &ctx.groestl, (char*)hash1, (char*)hash1, 512 ); + groestl512_full( &ctx.groestl, (char*)hash2, (char*)hash2, 512 ); + groestl512_full( &ctx.groestl, (char*)hash3, (char*)hash3, 512 ); + groestl512_full( &ctx.groestl, (char*)hash4, (char*)hash4, 512 ); + groestl512_full( &ctx.groestl, (char*)hash5, (char*)hash5, 512 ); + groestl512_full( &ctx.groestl, (char*)hash6, (char*)hash6, 512 ); + groestl512_full( &ctx.groestl, (char*)hash7, (char*)hash7, 512 ); intrlv_8x64( vhash, hash0, hash1, hash2, hash3, hash4, hash5, hash6, hash7, 512 ); diff --git a/algo/verthash/Verthash.c b/algo/verthash/Verthash.c index 475c79a7..0d971f2e 100644 --- a/algo/verthash/Verthash.c +++ b/algo/verthash/Verthash.c @@ -44,8 +44,8 @@ int verthash_info_init(verthash_info_t* info, const char* file_name) if ( opt_data_file || !opt_verify ) { if ( opt_data_file ) - applog( LOG_ERR, - "Verthash data file not found or invalid: %s", info->fileName ); + applog( LOG_ERR, "Verthash data file not found or invalid: %s", + info->fileName ); else { applog( LOG_ERR, @@ -134,76 +134,117 @@ static inline uint32_t fnv1a(const uint32_t a, const uint32_t b) return (a ^ b) * 0x1000193; } -void verthash_hash( const unsigned char* blob_bytes, - const size_t blob_size, - const unsigned char(*input)[VH_HEADER_SIZE], - unsigned char(*output)[VH_HASH_OUT_SIZE] ) +#if 0 +static void rotate_indexes( uint32_t *p ) { - unsigned char p1[ VH_HASH_OUT_SIZE ] __attribute__ ((aligned (64))); - unsigned char p0[ VH_N_SUBSET ] __attribute__ ((aligned (64))); - uint32_t seek_indexes[VH_N_INDEXES] __attribute__ ((aligned (64))); - uint32_t* p0_index = (uint32_t*)p0; +#if defined(__AVX2__) - verthash_sha3_512_final_8( p0, ( (uint64_t*)input )[ 9 ] ); - - for ( size_t x = 0; x < VH_N_ROT; ++x ) - { - memcpy( seek_indexes + x * (VH_N_SUBSET / sizeof(uint32_t)), - p0, VH_N_SUBSET); + for ( size_t x = 0; x < VH_N_SUBSET / sizeof(__m256i); x += 8 ) + { + __m256i *px = (__m256i*)p + x; -#if defined(__AVX2__) + px[0] = mm256_rol_32( px[0], 1 ); + px[1] = mm256_rol_32( px[1], 1 ); + px[2] = mm256_rol_32( px[2], 1 ); + px[3] = mm256_rol_32( px[3], 1 ); + px[4] = mm256_rol_32( px[4], 1 ); + px[5] = mm256_rol_32( px[5], 1 ); + px[6] = mm256_rol_32( px[6], 1 ); + px[7] = mm256_rol_32( px[7], 1 ); + } - for ( size_t y = 0; y < VH_N_SUBSET / sizeof(__m256i); y += 8) - { - casti_m256i( p0_index, y ) = mm256_rol_32( - casti_m256i( p0_index, y ), 1 ); - casti_m256i( p0_index, y+1 ) = mm256_rol_32( - casti_m256i( p0_index, y+1 ), 1 ); - casti_m256i( p0_index, y+2 ) = mm256_rol_32( - casti_m256i( p0_index, y+2 ), 1 ); - casti_m256i( p0_index, y+3 ) = mm256_rol_32( - casti_m256i( p0_index, y+3 ), 1 ); - casti_m256i( p0_index, y+4 ) = mm256_rol_32( - casti_m256i( p0_index, y+4 ), 1 ); - casti_m256i( p0_index, y+5 ) = mm256_rol_32( - casti_m256i( p0_index, y+5 ), 1 ); - casti_m256i( p0_index, y+6 ) = mm256_rol_32( - casti_m256i( p0_index, y+6 ), 1 ); - casti_m256i( p0_index, y+7 ) = mm256_rol_32( - casti_m256i( p0_index, y+7 ), 1 ); - } +#else + + for ( size_t x = 0; x < VH_N_SUBSET / sizeof(__m128i); x += 8 ) + { + __m128i *px = (__m128i*)p0_index + x; + + px[0] = mm128_rol_32( px[0], 1 ); + px[1] = mm128_rol_32( px[1], 1 ); + px[2] = mm128_rol_32( px[2], 1 ); + px[3] = mm128_rol_32( px[3], 1 ); + px[4] = mm128_rol_32( px[4], 1 ); + px[5] = mm128_rol_32( px[5], 1 ); + px[6] = mm128_rol_32( px[6], 1 ); + px[7] = mm128_rol_32( px[7], 1 ); + } + +#endif +/* + for ( size_t x = 0; x < VH_N_SUBSET / sizeof(uint32_t); ++x ) + p[x] = ( p[x] << 1 ) | ( p[x] >> 31 ); +*/ +} +#endif + +static inline uint32_t rotl32( uint32_t a, size_t r ) +{ + return ( a << r ) | ( a >> (32-r) ); +} + +// Vectorized and targetted version of fnv1a +#if defined (__AVX2__) + +#define MULXOR \ + *(__m256i*)hash = _mm256_mullo_epi32( _mm256_xor_si256( \ + *(__m256i*)hash, *(__m256i*)blob_off ), k ); + +#elif defined(__SSE41__) + +#define MULXOR \ + casti_m128i( hash, 0 ) = _mm_mullo_epi32( _mm_xor_si128( \ + casti_m128i( hash, 0 ), casti_m128i( blob_off, 0 ) ), k ); \ + casti_m128i( hash, 1 ) = _mm_mullo_epi32( _mm_xor_si128( \ + casti_m128i( hash, 1 ), casti_m128i( blob_off, 1 ) ), k ); #else - for ( size_t y = 0; y < VH_N_SUBSET / sizeof(__m128i); y += 8) - { - casti_m128i( p0_index, y ) = mm128_rol_32( - casti_m128i( p0_index, y ), 1 ); - casti_m128i( p0_index, y+1 ) = mm128_rol_32( - casti_m128i( p0_index, y+1 ), 1 ); - casti_m128i( p0_index, y+2 ) = mm128_rol_32( - casti_m128i( p0_index, y+2 ), 1 ); - casti_m128i( p0_index, y+3 ) = mm128_rol_32( - casti_m128i( p0_index, y+3 ), 1 ); - casti_m128i( p0_index, y+4 ) = mm128_rol_32( - casti_m128i( p0_index, y+4 ), 1 ); - casti_m128i( p0_index, y+5 ) = mm128_rol_32( - casti_m128i( p0_index, y+5 ), 1 ); - casti_m128i( p0_index, y+6 ) = mm128_rol_32( - casti_m128i( p0_index, y+6 ), 1 ); - casti_m128i( p0_index, y+7 ) = mm128_rol_32( - casti_m128i( p0_index, y+7 ), 1 ); - } - +#define MULXOR \ + for ( size_t j = 0; j < VH_HASH_OUT_SIZE / sizeof(uint32_t); j++ ) \ + hash[j] = fnv1a( hash[j], blob_off[j] ); \ + #endif - } +#define UPDATE_ACCUMULATOR \ + accumulator = fnv1a( accumulator, blob_off[0] ); \ + accumulator = fnv1a( accumulator, blob_off[1] ); \ + accumulator = fnv1a( accumulator, blob_off[2] ); \ + accumulator = fnv1a( accumulator, blob_off[3] ); \ + accumulator = fnv1a( accumulator, blob_off[4] ); \ + accumulator = fnv1a( accumulator, blob_off[5] ); \ + accumulator = fnv1a( accumulator, blob_off[6] ); \ + accumulator = fnv1a( accumulator, blob_off[7] ) + + +// first pass no rotate +#define ROUND_0 \ +for ( size_t i = 0; i < VH_N_SUBSET / sizeof(uint32_t); i++ ) \ +{ \ + const uint32_t *blob_off = blob + \ + ( ( fnv1a( subset[i], accumulator ) % mdiv ) \ + * ( VH_BYTE_ALIGNMENT / sizeof(uint32_t) ) ); \ + UPDATE_ACCUMULATOR; \ + MULXOR; \ +} - sha3( &input[0], VH_HEADER_SIZE, &p1[0], VH_HASH_OUT_SIZE ); - - uint32_t* p1_32 = (uint32_t*)p1; - uint32_t* blob_bytes_32 = (uint32_t*)blob_bytes; - uint32_t value_accumulator = 0x811c9dc5; +// subsequent passes rotate by r on demand, no need for mass rotate +#define ROUND_r( r ) \ +for ( size_t i = 0; i < VH_N_SUBSET / sizeof(uint32_t); i++ ) \ +{ \ + const uint32_t *blob_off = blob + \ + ( ( fnv1a( rotl32( subset[i], r ), accumulator ) % mdiv ) \ + * ( VH_BYTE_ALIGNMENT / sizeof(uint32_t) ) ); \ + UPDATE_ACCUMULATOR; \ + MULXOR; \ +} + +void verthash_hash( const void *blob_bytes, const size_t blob_size, + const void *input, void *output ) +{ + uint32_t hash[ VH_HASH_OUT_SIZE / 4 ] __attribute__ ((aligned (64))); + uint32_t subset[ VH_N_SUBSET / 4 ] __attribute__ ((aligned (64))); + const uint32_t *blob = (const uint32_t*)blob_bytes; + uint32_t accumulator = 0x811c9dc5; const uint32_t mdiv = ( ( blob_size - VH_HASH_OUT_SIZE ) / VH_BYTE_ALIGNMENT ) + 1; #if defined (__AVX2__) @@ -211,40 +252,15 @@ void verthash_hash( const unsigned char* blob_bytes, #elif defined(__SSE41__) const __m128i k = _mm_set1_epi32( 0x1000193 ); #endif + + sha3( input, VH_HEADER_SIZE, hash, VH_HASH_OUT_SIZE ); + verthash_sha3_512_final_8( subset, ( (uint64_t*)input )[ 9 ] ); - for ( size_t i = 0; i < VH_N_INDEXES; i++ ) - { - const uint32_t offset = - ( fnv1a( seek_indexes[i], value_accumulator) % mdiv ) - * ( VH_BYTE_ALIGNMENT / sizeof(uint32_t) ); - const uint32_t *blob_off = blob_bytes_32 + offset; - - // update value accumulator for next seek index - value_accumulator = fnv1a( value_accumulator, blob_off[0] ); - value_accumulator = fnv1a( value_accumulator, blob_off[1] ); - value_accumulator = fnv1a( value_accumulator, blob_off[2] ); - value_accumulator = fnv1a( value_accumulator, blob_off[3] ); - value_accumulator = fnv1a( value_accumulator, blob_off[4] ); - value_accumulator = fnv1a( value_accumulator, blob_off[5] ); - value_accumulator = fnv1a( value_accumulator, blob_off[6] ); - value_accumulator = fnv1a( value_accumulator, blob_off[7] ); - -#if defined (__AVX2__) - *(__m256i*)p1_32 = _mm256_mullo_epi32( _mm256_xor_si256( - *(__m256i*)p1_32, *(__m256i*)blob_off ), k ); -#elif defined(__SSE41__) - casti_m128i( p1_32, 0 ) = _mm_mullo_epi32( _mm_xor_si128( - casti_m128i( p1_32, 0 ), casti_m128i( blob_off, 0 ) ), k ); - casti_m128i( p1_32, 1 ) = _mm_mullo_epi32( _mm_xor_si128( - casti_m128i( p1_32, 1 ), casti_m128i( blob_off, 1 ) ), k ); -#else - for ( size_t i2 = 0; i2 < VH_HASH_OUT_SIZE / sizeof(uint32_t); i2++ ) - p1_32[i2] = fnv1a( p1_32[i2], blob_off[i2] ); -#endif - - } + ROUND_0; + for ( size_t r = 1; r < VH_N_ROT; ++r ) + ROUND_r( r ); - memcpy( output, p1, VH_HASH_OUT_SIZE ); + memcpy( output, hash, VH_HASH_OUT_SIZE ); } //----------------------------------------------------------------------------- diff --git a/algo/verthash/Verthash.h b/algo/verthash/Verthash.h index 5cce653a..e3e4029b 100644 --- a/algo/verthash/Verthash.h +++ b/algo/verthash/Verthash.h @@ -47,10 +47,8 @@ void verthash_info_free(verthash_info_t* info); //! Generate verthash data file and save it to specified location. int verthash_generate_data_file(const char* output_file_name); -void verthash_hash(const unsigned char* blob_bytes, - const size_t blob_size, - const unsigned char(*input)[VH_HEADER_SIZE], - unsigned char(*output)[VH_HASH_OUT_SIZE]); +void verthash_hash( const void *blob_bytes, const size_t blob_size, + const void *input, void *output ); void verthash_sha3_512_prehash_72( const void *input ); void verthash_sha3_512_final_8( void *hash, const uint64_t nonce ); diff --git a/algo/verthash/verthash-gate.c b/algo/verthash/verthash-gate.c index 029ce462..a0103444 100644 --- a/algo/verthash/verthash-gate.c +++ b/algo/verthash/verthash-gate.c @@ -62,7 +62,7 @@ void verthash_sha3_512_final_8( void *hash, const uint64_t nonce ) __m256i vhashB[ 10 ] __attribute__ ((aligned (64))); sha3_4way_ctx_t ctx; - __m256i vnonce = _mm256_set1_epi64x( nonce ); + const __m256i vnonce = _mm256_set1_epi64x( nonce ); memcpy( &ctx, &sha3_mid_ctxA, sizeof ctx ); sha3_4way_update( &ctx, &vnonce, 8 ); @@ -88,14 +88,13 @@ void verthash_sha3_512_final_8( void *hash, const uint64_t nonce ) #endif } - int scanhash_verthash( struct work *work, uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr ) { uint32_t edata[20] __attribute__((aligned(64))); uint32_t hash[8] __attribute__((aligned(64))); uint32_t *pdata = work->data; - uint32_t *ptarget = work->target; + const uint32_t *ptarget = work->target; const uint32_t first_nonce = pdata[19]; const uint32_t last_nonce = max_nonce - 1; uint32_t n = first_nonce; @@ -109,8 +108,7 @@ int scanhash_verthash( struct work *work, uint32_t max_nonce, { edata[19] = n; verthash_hash( verthashInfo.data, verthashInfo.dataSize, - (const unsigned char (*)[80]) edata, - (unsigned char (*)[32]) hash ); + edata, hash ); if ( valid_hash( hash, ptarget ) && !bench ) { pdata[19] = bswap_32( n ); @@ -123,17 +121,16 @@ int scanhash_verthash( struct work *work, uint32_t max_nonce, return 0; } -const char *default_verthash_data_file = "verthash.dat"; +static const char *default_verthash_data_file = "verthash.dat"; bool register_verthash_algo( algo_gate_t* gate ) { - opt_target_factor = 256.0; gate->scanhash = (void*)&scanhash_verthash; gate->optimizations = AVX2_OPT; - char *verthash_data_file = opt_data_file ? opt_data_file - : default_verthash_data_file; + const char *verthash_data_file = opt_data_file ? opt_data_file + : default_verthash_data_file; int vhLoadResult = verthash_info_init( &verthashInfo, verthash_data_file ); if (vhLoadResult == 0) // No Error @@ -160,7 +157,8 @@ bool register_verthash_algo( algo_gate_t* gate ) // Handle Verthash error codes if ( vhLoadResult == 1 ) { - applog( LOG_ERR, "Verthash data file not found: %s", verthash_data_file ); + applog( LOG_ERR, "Verthash data file not found: %s", + verthash_data_file ); if ( !opt_data_file ) applog( LOG_NOTICE, "Add '--verify' to create verthash.dat"); } diff --git a/configure b/configure index e18537aa..1d15c406 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for cpuminer-opt 3.16.2. +# Generated by GNU Autoconf 2.69 for cpuminer-opt 3.16.3. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -577,8 +577,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='cpuminer-opt' PACKAGE_TARNAME='cpuminer-opt' -PACKAGE_VERSION='3.16.2' -PACKAGE_STRING='cpuminer-opt 3.16.2' +PACKAGE_VERSION='3.16.3' +PACKAGE_STRING='cpuminer-opt 3.16.3' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1332,7 +1332,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures cpuminer-opt 3.16.2 to adapt to many kinds of systems. +\`configure' configures cpuminer-opt 3.16.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1404,7 +1404,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of cpuminer-opt 3.16.2:";; + short | recursive ) echo "Configuration of cpuminer-opt 3.16.3:";; esac cat <<\_ACEOF @@ -1509,7 +1509,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -cpuminer-opt configure 3.16.2 +cpuminer-opt configure 3.16.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2012,7 +2012,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by cpuminer-opt $as_me 3.16.2, which was +It was created by cpuminer-opt $as_me 3.16.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2993,7 +2993,7 @@ fi # Define the identity of the package. PACKAGE='cpuminer-opt' - VERSION='3.16.2' + VERSION='3.16.3' cat >>confdefs.h <<_ACEOF @@ -6690,7 +6690,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by cpuminer-opt $as_me 3.16.2, which was +This file was extended by cpuminer-opt $as_me 3.16.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6756,7 +6756,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -cpuminer-opt config.status 3.16.2 +cpuminer-opt config.status 3.16.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 5ee7b2f7..82a90496 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([cpuminer-opt], [3.16.2]) +AC_INIT([cpuminer-opt], [3.16.3]) AC_PREREQ([2.59c]) AC_CANONICAL_SYSTEM diff --git a/cpu-miner.c b/cpu-miner.c index e52168bd..6b62a3c6 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -1145,7 +1145,7 @@ void report_summary_log( bool force ) if ( mismatch ) { if ( mismatch != 1 ) - applog(LOG_WARNING,"Share count mismatch: %d, stats may be incorrect", mismatch ); + applog(LOG_WARNING,"Share count mismatch: %d, stats may be inaccurate", mismatch ); else applog(LOG_INFO,"Share count mismatch, submitted share may still be pending" ); } @@ -2171,11 +2171,11 @@ static void *miner_thread( void *userdata ) /* Set worker threads to nice 19 and then preferentially to SCHED_IDLE * and if that fails, then SCHED_BATCH. No need for this to be an * error if it fails */ - if (!opt_benchmark && opt_priority == 0) + if ( !opt_priority ) { setpriority(PRIO_PROCESS, 0, 19); - if ( !thr_id && !opt_quiet ) - applog(LOG_INFO, "Miner thread priority %d (nice 19)", opt_priority ); + if ( !thr_id && opt_debug ) + applog(LOG_INFO, "Default miner thread priority %d (nice 19)", opt_priority ); drop_policy(); } else @@ -2192,9 +2192,12 @@ static void *miner_thread( void *userdata ) case 4: prio = -10; break; case 5: prio = -15; } - if ( !( thr_id || opt_quiet ) ) - applog( LOG_INFO, "Miner thread priority %d (nice %d)", + if ( !thr_id ) + { + applog( LOG_INFO, "User set miner thread priority %d (nice %d)", opt_priority, prio ); + applog( LOG_WARNING, "High priority mining threads may cause system instability"); + } #endif setpriority(PRIO_PROCESS, 0, prio); if ( opt_priority == 0 ) @@ -2439,7 +2442,7 @@ static void *miner_thread( void *userdata ) char hr_units[2] = {0,0}; scale_hash_for_display( &hashrate, hr_units ); sprintf( hr, "%.2f", hashrate ); -#if ((defined(_WIN64) || defined(__WINDOWS__)) || defined(_WIN32)) +#if (defined(_WIN64) || defined(__WINDOWS__) || defined(_WIN32)) applog( LOG_NOTICE, "Total: %s %sH/s", hr, hr_units ); #else float lo_freq = 0., hi_freq = 0.; @@ -2739,10 +2742,10 @@ static void *stratum_thread(void *userdata ) stratum.url = strdup( rpc_url ); applog(LOG_BLUE, "Connection changed to %s", short_url); } - else // if ( !opt_quiet ) + else applog(LOG_WARNING, "Stratum connection reset"); // reset stats queue as well - s_get_ptr = s_put_ptr = 0; + if ( s_get_ptr != s_put_ptr ) s_get_ptr = s_put_ptr = 0; } while ( !stratum.curl ) @@ -2789,13 +2792,15 @@ static void *stratum_thread(void *userdata ) else { applog(LOG_WARNING, "Stratum connection interrupted"); - stratum_disconnect( &stratum ); +// stratum_disconnect( &stratum ); + stratum_need_reset = true; } } else { applog(LOG_ERR, "Stratum connection timeout"); - stratum_disconnect( &stratum ); + stratum_need_reset = true; +// stratum_disconnect( &stratum ); } } // loop @@ -3394,8 +3399,6 @@ void parse_arg(int key, char *arg ) v = atoi(arg); if (v < 0 || v > 5) /* sanity check */ show_usage_and_exit(1); - // option is deprecated, show warning - applog( LOG_WARNING, "High priority mining threads may cause system instability"); opt_priority = v; break; case 'N': // N parameter for various scrypt algos diff --git a/util.c b/util.c index a3b764e2..2bfc8095 100644 --- a/util.c +++ b/util.c @@ -1789,10 +1789,14 @@ bool stratum_authorize(struct stratum_ctx *sctx, const char *user, const char *p if ( !stratum_handle_method( sctx, sret ) ) applog( LOG_WARNING, "Stratum answer id is not correct!" ); } - res_val = json_object_get( extra, "result" ); - if (opt_debug && (!res_val || json_is_false(res_val))) - applog(LOG_DEBUG, "Method extranonce.subscribe is not supported"); - json_decref( extra ); + else + { + res_val = json_object_get( extra, "result" ); + if ( opt_debug && ( !res_val || json_is_false( res_val ) ) ) + applog( LOG_DEBUG, + "Method extranonce.subscribe is not supported" ); + } + json_decref( extra ); } free(sret); }