From e13b962b42915dc1c0bd534b048085c820f7bf61 Mon Sep 17 00:00:00 2001 From: Decho Kocharin Date: Sun, 6 Mar 2022 01:03:23 +0700 Subject: [PATCH] Update README.md --- README.md | 4 +-- algo/x11/hash0x10-4way.c | 74 ++++++++++++++++++---------------------- cpu-miner.c | 16 +++------ miner.h | 1 - 4 files changed, 40 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 8cf37c19..f3482b84 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ Supported Algorithms lyra2z330 Lyra2 330 rows, Zoin (ZOI) m7m Magi (XMG) minotaur Ringcoin (RNG) - myr-gr Myriad-Groestl + myr-gr Myriad-Groestl neoscrypt NeoScrypt(128, 2, 1) nist5 Nist5 pentablake Pentablake @@ -157,7 +157,7 @@ Supported Algorithms yespowerARWN Arowanacoin(ARWN) yespowerr16 Yenten (YTN) yespowerSUGAR Suagrchain (SUGAR) - yespowerURX UraniumX (URX) + yespowerURX UraniumX (URX) yespower-b2b generic yespower + blake2b zr5 Ziftr diff --git a/algo/x11/hash0x10-4way.c b/algo/x11/hash0x10-4way.c index c49dac69..71185282 100644 --- a/algo/x11/hash0x10-4way.c +++ b/algo/x11/hash0x10-4way.c @@ -436,48 +436,40 @@ void hash0x10_4way_hash( void *state, const void *input ) int scanhash_hash0x10_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 *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 - __m256i *noncev = (__m256i*)vdata + 9; // aligned - const uint32_t Htarg = ptarget[7]; - uint64_t htmax[] = { 0, 0xF, 0xFF, - 0xFFF, 0xFFFF, hash0x10000000 }; - uint32_t masks[] = { 0xFFFFFFFF, 0xFFFFFFF0, 0xFFFFFF00, - 0xFFFFF000, 0xFFFF0000, 0 }; - - mm256_bswap32_intrlv80_4x64( vdata, pdata ); - - for (int m=0; m < 6; m++) - if (Htarg <= htmax[m]) - { - 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 ); - - hash0x10_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 ) + uint32_t endiandata[20] __attribute__((aligned(64))); + uint32_t hash64[8] __attribute__((aligned(64))); + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + uint32_t n = pdata[19] - 1; + const uint32_t first_nonce = pdata[19]; + int thr_id = mythr->id; + const uint32_t Htarg = ptarget[7]; + uint64_t htmax[] = { 0, 0xF, 0xFF, 0xFFF,0xFFFF, 0x10000000 }; + uint32_t masks[] = { 0xFFFFFFFF, 0xFFFFFFF0, 0xFFFFFF00, 0xFFFFF000, 0xFFFF0000, 0 }; + + // big endian encode 0..18 uint32_t, 64 bits at a time + swab32_array( endiandata, pdata, 20 ); + + for (int m=0; m < 6; m++) + if (Htarg <= htmax[m]) + { + uint32_t mask = masks[m]; + do { - pdata[19] = n+i; - submit_solution( work, hash+(i<<3), mythr ); - } - n += 4; - } while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); - break; - } - - *hashes_done = n - first_nonce + 1; - return 0; + pdata[19] = ++n; + be32enc( &endiandata[19], n ); + hash0x10_4way_hash( hash64, &endiandata ); + if ( ( hash64[7] & mask ) == 0 ) + { + if ( fulltest( hash64, ptarget ) ) + submit_solution( work, hash64, mythr ); + } + } while ( n < max_nonce && !work_restart[thr_id].restart ); + } + + *hashes_done = n - first_nonce + 1; + pdata[19] = n; + return 0; } #endif \ No newline at end of file diff --git a/cpu-miner.c b/cpu-miner.c index d78f3044..47658c3c 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -156,7 +156,6 @@ double opt_diff_factor = 1.0; double opt_target_factor = 1.0; uint32_t zr5_pok = 0; bool opt_stratum_stats = false; -bool opt_hash_meter = false; uint32_t submitted_share_count= 0; uint32_t accepted_share_count = 0; uint32_t rejected_share_count = 0; @@ -2429,14 +2428,12 @@ static void *miner_thread( void *userdata ) } // display hashrate - if ( unlikely( opt_hash_meter ) ) + if (!opt_quiet) { char hr[16]; char hr_units[2] = {0,0}; - double hashrate; - - hashrate = thr_hashrates[thr_id]; - if ( hashrate != 0. ) + double hashrate = thr_hashrates[thr_id]; + if ( hashrate ) { scale_hash_for_display( &hashrate, hr_units ); sprintf( hr, "%.2f", hashrate ); @@ -2447,8 +2444,8 @@ static void *miner_thread( void *userdata ) // Display benchmark total // Update hashrate for API if no shares accepted yet. - if ( unlikely( ( opt_benchmark || !accepted_share_count ) - && thr_id == opt_n_threads - 1 ) ) + if ( ( opt_benchmark || !accepted_share_count ) + && thr_id == opt_n_threads - 1 ) { double hashrate = 0.; pthread_mutex_lock( &stats_lock ); @@ -3442,9 +3439,6 @@ void parse_arg(int key, char *arg ) case 1012: // no-extranonce opt_extranonce = false; break; - case 1014: // hash-meter - opt_hash_meter = true; - break; case 1016: /* --coinbase-addr */ if ( arg ) coinbase_address = strdup( arg ); break; diff --git a/miner.h b/miner.h index 440b59e7..aef8a9fe 100644 --- a/miner.h +++ b/miner.h @@ -775,7 +775,6 @@ extern bool opt_stratum_stats; extern int num_cpus; extern int num_cpugroups; extern int opt_priority; -extern bool opt_hash_meter; extern uint32_t accepted_share_count; extern uint32_t rejected_share_count; extern uint32_t solved_block_count;