From fc97ef174a61a17609304f7771a16954069a0b2f Mon Sep 17 00:00:00 2001 From: Jay D Dee Date: Thu, 6 Feb 2020 22:50:20 -0500 Subject: [PATCH] v3.12.0.1 --- RELEASE_NOTES | 11 ++++++++ algo/hodl/hodl-gate.c | 2 +- algo/quark/anime-4way.c | 62 +++++++++++++---------------------------- algo/quark/anime.c | 55 +++++++++++------------------------- configure | 20 ++++++------- configure.ac | 2 +- cpu-miner.c | 32 +++++++++++++++------ 7 files changed, 82 insertions(+), 102 deletions(-) diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 4585210..e55dd86 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -65,6 +65,17 @@ If not what makes it happen or not happen? Change Log ---------- +v3.12.0.1 + +Fixed hodl rejects, git issue #237. + +Fixed debug code added in v3.12.0 to work with AVX2 to be enabled only +after low difficulty share have been seen to avoid unnecessarily excessive +log outout. + +Added more digits of precision to diff in log output to help diagnose +low difficulty shares. + v3.12.0 Faster phi2 AVX2 +62%, AVX512 +150% on Intel CPUs. AMD Ryzen AVX2 is diff --git a/algo/hodl/hodl-gate.c b/algo/hodl/hodl-gate.c index 4f575dd..25528d3 100644 --- a/algo/hodl/hodl-gate.c +++ b/algo/hodl/hodl-gate.c @@ -144,7 +144,7 @@ int hodl_scanhash( struct work* work, uint32_t max_nonce, #if defined(__AES__) GenRandomGarbage( (CacheEntry*)hodl_scratchbuf, work->data, mythr->id ); pthread_barrier_wait( &hodl_barrier ); - return scanhash_hodl_wolf( work, max_nonce, hashes_done, thr_info ); + return scanhash_hodl_wolf( work, max_nonce, hashes_done, mythr ); #endif return false; } diff --git a/algo/quark/anime-4way.c b/algo/quark/anime-4way.c index be1c19f..a329d59 100644 --- a/algo/quark/anime-4way.c +++ b/algo/quark/anime-4way.c @@ -162,59 +162,35 @@ int scanhash_anime_4way( struct work *work, uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr ) { uint32_t hash[4*8] __attribute__ ((aligned (64))); - uint32_t vdata[24*4] __attribute__ ((aligned (64))); + uint32_t vdata[20*4] __attribute__ ((aligned (64))); uint32_t *pdata = work->data; uint32_t *ptarget = work->target; uint32_t n = pdata[19]; const uint32_t first_nonce = pdata[19]; + const uint32_t last_nonce = max_nonce - 4; __m256i *noncev = (__m256i*)vdata + 9; // aligned - int thr_id = mythr->id; // thr_id arg is deprecated - const uint32_t Htarg = ptarget[7]; - uint64_t htmax[] = { - 0, - 0xF, - 0xFF, - 0xFFF, - 0xFFFF, - 0x10000000 - }; - uint32_t masks[] = { - 0xFFFFFFFF, - 0xFFFFFFF0, - 0xFFFFFF00, - 0xFFFFF000, - 0xFFFF0000, - 0 - }; + const int thr_id = mythr->id; mm256_bswap32_intrlv80_4x64( vdata, pdata ); + *noncev = mm256_intrlv_blend_32( + _mm256_set_epi32( n+3, 0, n+2, 0, n+1, 0, n, 0 ), *noncev ); - for (int m=0; m < 6; m++) - if (Htarg <= htmax[m]) + do + { + anime_4way_hash( hash, vdata ); + + for ( int i = 0; i < 4; i++ ) + if ( valid_hash( hash+(i<<3), ptarget ) && !opt_benchmark ) { - uint32_t mask = masks[m]; - - do - { - *noncev = mm256_intrlv_blend_32( mm256_bswap_32( - _mm256_set_epi32( n+3, 0, n+2, 0, n+1, 0, n, 0 ) ), *noncev ); - - anime_4way_hash( hash, vdata ); - pdata[19] = n; - - for ( int i = 0; i < 4; i++ ) - if ( ( ( (hash+(i<<3))[7] & mask ) == 0 ) - && fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) - { - pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); - } - n += 4; - } while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); - break; + pdata[19] = bswap_32( n+i ); + submit_solution( work, hash+(i<<3), mythr ); } - - *hashes_done = n - first_nonce + 1; + *noncev = _mm256_add_epi32( *noncev, + m256_const1_64( 0x0000000400000000 ) ); + n += 4; + } while ( ( n < last_nonce ) && !work_restart[thr_id].restart ); + pdata[19] = n; + *hashes_done = n - first_nonce; return 0; } diff --git a/algo/quark/anime.c b/algo/quark/anime.c index fe07334..3c5bc80 100644 --- a/algo/quark/anime.c +++ b/algo/quark/anime.c @@ -126,49 +126,28 @@ int scanhash_anime( struct work *work, uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr) { uint32_t hash[8] __attribute__ ((aligned (64))); - uint32_t endiandata[20] __attribute__((aligned(64))); + uint32_t edata[20] __attribute__((aligned(64))); uint32_t *pdata = work->data; uint32_t *ptarget = work->target; uint32_t n = pdata[19]; const uint32_t first_nonce = pdata[19]; - int thr_id = mythr->id; // thr_id arg is deprecated - const uint32_t Htarg = ptarget[7]; - uint64_t htmax[] = { - 0, - 0xF, - 0xFF, - 0xFFF, - 0xFFFF, - 0x10000000 - }; - uint32_t masks[] = { - 0xFFFFFFFF, - 0xFFFFFFF0, - 0xFFFFFF00, - 0xFFFFF000, - 0xFFFF0000, - 0 - }; + const int thr_id = mythr->id; + const int bench = opt_benchmark; + + swab32_array( edata, pdata, 20 ); - swab32_array( endiandata, pdata, 20 ); - - for (int m=0; m < 6; m++) - if (Htarg <= htmax[m]) - { - uint32_t mask = masks[m]; - do - { - be32enc( &endiandata[19], n ); - anime_hash( hash, endiandata ); - pdata[19] = n; - - if ( ( hash[7] & mask ) == 0 && fulltest( hash, ptarget ) ) - submit_solution( work, hash, mythr ); - n++; - } while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); - break; - } - *hashes_done = n - first_nonce + 1; + do + { + edata[19] = n; + anime_hash( hash, edata ); + if ( valid_hash( hash, ptarget ) && !bench ) + { + be32enc( &pdata[19], n ); + submit_solution( work, hash, mythr ); + } + n++; + } while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); + *hashes_done = n - first_nonce; pdata[19] = n; return 0; } diff --git a/configure b/configure index 4a47d48..d3e30e0 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.12.0. +# Generated by GNU Autoconf 2.69 for cpuminer-opt 3.12.0.1. # # # 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.12.0' -PACKAGE_STRING='cpuminer-opt 3.12.0' +PACKAGE_VERSION='3.12.0.1' +PACKAGE_STRING='cpuminer-opt 3.12.0.1' 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.12.0 to adapt to many kinds of systems. +\`configure' configures cpuminer-opt 3.12.0.1 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.12.0:";; + short | recursive ) echo "Configuration of cpuminer-opt 3.12.0.1:";; 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.12.0 +cpuminer-opt configure 3.12.0.1 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.12.0, which was +It was created by cpuminer-opt $as_me 3.12.0.1, 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.12.0' + VERSION='3.12.0.1' 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.12.0, which was +This file was extended by cpuminer-opt $as_me 3.12.0.1, 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.12.0 +cpuminer-opt config.status 3.12.0.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 471fe87..ee11647 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([cpuminer-opt], [3.12.0]) +AC_INIT([cpuminer-opt], [3.12.0.1]) AC_PREREQ([2.59c]) AC_CANONICAL_SYSTEM diff --git a/cpu-miner.c b/cpu-miner.c index 91c4e1f..6b2fe34 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -998,7 +998,7 @@ void report_summary_log( bool force ) solved_block_count ); } -bool lowdiff_debug = true; +bool lowdiff_debug = false; static int share_result( int result, struct work *null_work, const char *reason ) @@ -1068,7 +1068,7 @@ static int share_result( int result, struct work *null_work, else { rejected_share_count++; - if ( strstr( reason, "Low diff " ) ) lowdiff_debug = true; + lowdiff_debug = true; } } @@ -1145,7 +1145,7 @@ static int share_result( int result, struct work *null_work, bres, share_time, latency ); if ( have_stratum && !opt_quiet ) - applog2( LOG_NOTICE, "Diff %.3g (%.3g%), %sBlock %d, %sJob %s" CL_WHT, + applog2( LOG_NOTICE, "Diff %.5g (%.3g%), %sBlock %d, %sJob %s" CL_WHT, my_stats.share_diff, share_ratio, bcol, stratum.block_height, scol, my_stats.job_id ); @@ -1163,13 +1163,15 @@ static int share_result( int result, struct work *null_work, for ( int i = 0; i < 8; i++ ) be32enc( str2 + i, str1[7 - i] ); bin2hex( str3, (unsigned char*)str2, 12 ); - applog2( LOG_INFO, "Share diff: %g, Hash: %s...", my_stats.share_diff, str3 ); + applog2( LOG_INFO, "Share diff: %.5g, Hash: %s...", + my_stats.share_diff, str3 ); diff_to_target( str1, my_stats.target_diff ); for ( int i = 0; i < 8; i++ ) be32enc( str2 + i, str1[7 - i] ); bin2hex( str3, (unsigned char*)str2, 12 ); - applog2( LOG_INFO, "Target diff: %g, Targ: %s...", str3 ); + applog2( LOG_INFO, "Target diff: %.5g, Targ: %s...", + my_stats.target_diff, str3 ); } if ( unlikely( opt_reset_on_stale && stale ) ) @@ -1710,9 +1712,9 @@ if ( lowdiff_debug ) { uint32_t* h = (uint32_t*)hash; uint32_t* t = (uint32_t*)work->target; - applog(LOG_INFO,"Hash[7:0}: %08x %08x %08x %08x %08x %08x %08x %08x", + applog(LOG_INFO,"Hash[7:0]: %08x %08x %08x %08x %08x %08x %08x %08x", h[7],h[6],h[5],h[4],h[3],h[2],h[1],h[0]); - applog(LOG_INFO,"Targ[7:0}: %08x %08x %08x %08x %08x %08x %08x %08x", + applog(LOG_INFO,"Targ[7:0]: %08x %08x %08x %08x %08x %08x %08x %08x", t[7],t[6],t[5],t[4],t[3],t[2],t[1],t[0]); } return true; @@ -1733,6 +1735,18 @@ bool submit_lane_solution( struct work *work, const void *hash, if ( !opt_quiet ) applog( LOG_NOTICE, "%d submitted by thread %d, lane %d, job %s", submitted_share_count, thr->id, lane, work->job_id ); + +if ( lowdiff_debug ) +{ + uint32_t* h = (uint32_t*)hash; + uint32_t* t = (uint32_t*)work->target; + applog(LOG_INFO,"Hash[7:0]: %08x %08x %08x %08x %08x %08x %08x %08x", + h[7],h[6],h[5],h[4],h[3],h[2],h[1],h[0]); + applog(LOG_INFO,"Targ[7:0]: %08x %08x %08x %08x %08x %08x %08x %08x", + t[7],t[6],t[5],t[4],t[3],t[2],t[1],t[0]); +} + + return true; } else @@ -2117,7 +2131,6 @@ static void *miner_thread( void *userdata ) int lo_freq, hi_freq; linux_cpu_hilo_freq( &lo_freq, &hi_freq ); memcpy( &cpu_temp_time, &tv_end, sizeof(cpu_temp_time) ); - if ( temp > hi_temp ) hi_temp = temp; if ( use_colors && ( temp >= 70 ) ) { if ( temp >= 80 ) @@ -2129,6 +2142,7 @@ static void *miner_thread( void *userdata ) sprintf( tempstr, "%d C", temp ); applog( LOG_INFO,"CPU temp: curr %s (max %d), Freq: %.3f/%.3f GHz", tempstr, hi_temp, (float)lo_freq / 1e6, (float)hi_freq/ 1e6 ); + if ( temp > hi_temp ) hi_temp = temp; } } #endif @@ -2483,7 +2497,7 @@ void std_stratum_gen_work( struct stratum_ctx *sctx, struct work *g_work ) if ( !opt_quiet ) { applog2( LOG_INFO, "%s: %s", algo_names[opt_algo], short_url ); - applog2( LOG_INFO, "Diff: Net %.3g, Stratum %.3g, Target %.3g", + applog2( LOG_INFO, "Diff: Net %.5g, Stratum %.5g, Target %.5g", net_diff, stratum_diff, last_targetdiff ); if ( likely( hr > 0. ) )