From e96a6bd699ff0a95449447680b6d295e1b07652c Mon Sep 17 00:00:00 2001 From: Jay D Dee Date: Thu, 9 Apr 2020 12:56:18 -0400 Subject: [PATCH] v3.12.8 --- .RELEASE_NOTES.swp | Bin 0 -> 16384 bytes RELEASE_NOTES | 10 + algo-gate-api.c | 9 +- algo-gate-api.h | 25 +-- algo/blake/blake-4way.c | 4 +- algo/blake/blake2b-4way.c | 4 +- algo/blake/blake2s-4way.c | 6 +- algo/blake/blakecoin-4way.c | 4 +- algo/blake/decred-4way.c | 2 +- algo/blake/pentablake-4way.c | 2 +- algo/bmw/bmw512-4way.c | 4 +- algo/groestl/groestl-4way.c | 2 +- algo/groestl/myrgr-4way.c | 4 +- algo/jh/jha-4way.c | 2 +- algo/keccak/keccak-4way.c | 4 +- algo/keccak/sha3d-4way.c | 4 +- algo/lyra2/allium-4way.c | 4 +- algo/lyra2/lyra2h-4way.c | 2 +- algo/lyra2/lyra2rev2-4way.c | 6 +- algo/lyra2/lyra2rev3-4way.c | 6 +- algo/lyra2/lyra2z-4way.c | 6 +- algo/lyra2/lyra2z330.c | 2 +- algo/lyra2/phi2-4way.c | 4 +- algo/nist5/nist5-4way.c | 4 +- algo/quark/anime-4way.c | 4 +- algo/quark/hmq1725-4way.c | 4 +- algo/quark/quark-4way.c | 4 +- algo/qubit/deep-2way.c | 4 +- algo/qubit/qubit-2way.c | 6 +- algo/ripemd/lbry-4way.c | 4 +- algo/sha/sha256q-4way.c | 4 +- algo/sha/sha256t-4way.c | 4 +- algo/skein/skein-4way.c | 4 +- algo/skein/skein2-4way.c | 4 +- algo/x11/c11-4way.c | 4 +- algo/x11/timetravel-4way.c | 2 +- algo/x11/timetravel10-4way.c | 2 +- algo/x11/tribus-4way.c | 4 +- algo/x11/x11-4way.c | 4 +- algo/x11/x11evo-4way.c | 2 +- algo/x11/x11gost-4way.c | 4 +- algo/x12/x12-4way.c | 4 +- algo/x13/phi1612-4way.c | 4 +- algo/x13/skunk-4way.c | 4 +- algo/x13/x13-4way.c | 4 +- algo/x13/x13bcd-4way.c | 4 +- algo/x13/x13sm3-4way.c | 2 +- algo/x14/polytimos-4way.c | 2 +- algo/x14/veltor-4way.c | 2 +- algo/x14/x14-4way.c | 4 +- algo/x15/x15-4way.c | 4 +- algo/x16/x16r-4way.c | 4 +- algo/x16/x16rt-4way.c | 4 +- algo/x16/x16rv2-4way.c | 4 +- algo/x16/x21s-4way.c | 4 +- algo/x17/x17-4way.c | 4 +- algo/x17/xevan-4way.c | 4 +- algo/x22/x22i-4way.c | 2 +- algo/x22/x25x-4way.c | 2 +- algo/yespower/yescrypt-r8g.c | 20 +- algo/yespower/yescrypt-r8g.h | 49 ----- algo/yespower/yespower-blake2b.c | 37 +--- algo/yespower/yespower-gate.c | 49 +++-- algo/yespower/yespower-opt.c | 26 +-- algo/yespower/yespower.h | 59 +----- configure | 20 +- configure.ac | 2 +- cpu-miner.c | 331 +++++++++++++------------------ miner.h | 44 ++-- simd-utils/simd-128.h | 18 +- simd-utils/simd-256.h | 9 +- simd-utils/simd-512.h | 4 +- util.c | 173 +++++++++------- 73 files changed, 462 insertions(+), 625 deletions(-) create mode 100644 .RELEASE_NOTES.swp delete mode 100644 algo/yespower/yescrypt-r8g.h diff --git a/.RELEASE_NOTES.swp b/.RELEASE_NOTES.swp new file mode 100644 index 0000000000000000000000000000000000000000..272c3f365905feac567dd95a33031048db2516a8 GIT binary patch literal 16384 zcmeI3Ta0AKS;s4h6Kvu&5j+s`Kq?z8-pzEM+3vaQdW2ZUyJI|PFJ@=GYkMt*)2FMu zkLO%^&t-agMYx9tkU+6TA_BRBgGe3_JOqK1h!)w{%J+2D33F_ z{GDFqwCt{ar%8t;GgGwlakab>bh^R$BiGvg+V!o=TbnyuyH~H> z*xLDT++#6ip@D@4zMTe6sFiNVhWgu2zD_uO-I z++SY2Ei|yuz(NBH4JEPk|@F zTfh&1`@t)3RO)5$3Gi|7G4NC10{9WI3^aHv`22S(^&EH>jKC0R@WuO-`YZ5mP=OM3 z!CS!(g0J1H)JMVd;5qOt_&Kl(ei$h5ci*MdAA?VTkAn|^4}$lC_kaZKfm7hG-=NeN zz~{m9;CI1qgWm!_0qz6$g3rBPsn3EJ!3*F$;5Wb&9DsL#`@tK*>%eQlU(kE_bMTAc z7r-N63;Zihihlv00-pr$1V0TbP=Y1!x7hJT@B(-iyc^sEkAoE;cJ6@x#cQ+QH+`K| zacXpx>_GkI@$k{5eA$%kcthnPyfZs@}F>&WP`3KOGyNgnN$Ej+RE)LCBXx{R}-j_M-OWtp&M=4D|63$lF z^$!Vyoeh1QcsU9Sb4c4Wp~I}-+^40~zWr^>no`%Q5qc=o5SF7+m<>%S8WknVdz_Ao zd|#Nz${3Yp(bQ6klCX%YDRMhgjN;+Ql$9Mz@`?QzMP^)y?kqzPE9*23i>VNog?dszoM$>8=!=g%uEW6~&bW(?OXMlXNjQbvWMne0{&u?>6(;P9y)U^5 zdK8u;%SNMQ)2oNNA6B7Nwa8hRXRt!UnJnIRV)iv`L~-ePa1?f{eAikE9qgOJ4i1Vu z)vGWyjIkG@bl=;c#C62+yj4uaorV0o*&B1L6OWzsceHdF71ME*bz3^k zu_g4QJT<|L{@TihhULVhsLXoj;VrDY&u%dl2cMXtr4PDm2lBTY%im6k6Ey6ut$Hu- zVc!uZ`p;uvXXmo!2UFtrr|08gV|n?^OoX5_M;A8drGFJ`R!qdrvpht7;-Z7X+^Mab z@rJJ;JI;|8mA-3=yu>FYZao{K#1P%os6w2ExG6B_Os;cHbYT0KDSd-x<8j5Z#Dsge zQXGwR6xJn5BoM6ERVE!9iT1)YQk_$32Lo`YK7Ux6)nn^pVOheOSYSSY5M|~^fl6`| z*3au644fV$d03r4d&aJgv#QfQuO*U3sj1?~dW8?Uz78YOOXvblT{n{=uY6q3dt#kg zhbqw=K8bu`g-oc8)KNk!L0zI)WYp|?-XFvtyKC#>?>1o45XoFH=`tMPYd%GsSE@aG zsf#v4=*#&KD-UcUoQ%Rsr{NxXBd&k_ZQP9@}T34=bRG8MJ- z`3>Mu#~Jx7?E49%7zXXg1!T)+y2IVllJZ1rja&F6h_@9Gkg>R`!Ync^t7OSzxokIK zFHR&sYPA~ZP3tqo%>A15f(Dq5U!>5AlDaQ!jYzY3F_k2cj}1}kZd~z8#S8|?V}V+M zX1^bcCP<#pAd{v#ud8uwMV$ztFq>*q6fl~avJ54$^EsD%Z;6Tl!k#2|8*(TERc3=c zP~AXp9fa&tWF2vxgnR4L=0Nhf_>ps{@nq)3FRl)(K{*W41g*iP)~mc{2ZUoYe<`>I60}Q-UvPX_SJCi-7#*lURk?-0wJblc7(i zHQN!!PQr@a=nRT{%sPZuwRpSSC1JO6-oPDGyZvD7Fk{b=8UUXn#c$|QRgFs$9bZOu zFF-NNKORmmT{7m#PezyRs!}~%vwcQTfdQAkP;PIk+2X8`v6e~0m?+4#r^A;1qeHnS z#I2nT@T4SF|O;R@P$~F#SM3QW*2_&L#cil`A&`wZ5u*__o!i z5cXzxl_qhjG3lbEH?w|`6If#V>tQ+W;YL&aSWJmGy9XgsnM7Y?f9eWRN-)`F__TTD z5_OCT(*ot5rhF6_RBXgkK}?W;RCHZNb^y}W((@h5~> zbK%zZ)l1iI?O0DiWn)S364OOpyNr00bd$u?ML&1j&TXbj3~=Lqplp(#m0;F~NTV*z z6Y{wx#U)fNHV;WPf*_?KRkJn7wk^Rp9!b%naM^eeV|wxCa%}iSE)vHx2UwSk%%(+} z_jQsGk#c8D)@L^`WuR}64%7`6%#miFken?ZV0q;Wen!@<$ih?>vJapI8_*>?B7|@i z$;NJ;P2JPHCfj8X!j4R}OqKbdnuuN80I`~}T}grsEDw&DyD5wxi97Nqk?HChGEYv% zKvmddOu-YVabA+H_TePVN}EF{lVeglbzMr(*!yqZB#O*tW3A`O?(;wb{zVq-S0 zt_aUf26wz;1ks~kh|L;S$R8m`p8Xhu&6YS95oep*r=718KHi~_#HA7mD0GnP>sypyDp&)npbc8! zP2j5!aNY*bgAaiBgPWiQzD{r8MeqXn6!;`~A9xzv1~cWNoQm(B;Pr{n!nV!+F#_-$|<#Z^9c%hPSKoVJ^`vP@RTKI>)M0KZ)0Qo1TR+?4-1cvL>qWY10cDBwnE6LR zX%~s?o?2I_*?GY0i+SlePNGYz-BW(nikyHcO0QDKOSMiRo6s(GM17s*jxP4hkkLP- zdwMwEm!YmzDK(%Jk5X1iccBk$TRk`0op3DW0IoN;cBEpy#fdlNT;es_%(6D1PCuMr zk781;O8Y}XZXH5ci7X7Sff4UVmlniK@=!i(q_@VSVES{pl`GL&e&{C5Xn)1(zR_X zf4*|w%=hJ}Eo8KGZe3^9hJj3$l9vYubUB0yx=Ey>?g78BVUr0S4=3a>SG4k|pE_ zb4B`H(wU2@QLi3wd4O?f8hO?%AG^N$CIzw;#L{RpISW&0ScwL{+b0zBXxDf9geF|h zli8KVdF#IFasmYz_C`oJe$Rh^Vu_r2;#|1Nf={(kj=2QgJ zCpZ1^{iO6JPG0wq7EVgzyQ*nMw;Q^`Bn>9t{PH~k`)H)BdvXSrzNUz06GGw=g18$j zh}I7eXA16usuLgHyZ$3kG~TQ@;NKo1N7`{n9|;hISg0vfB-t z1NvmUJ&OCrPC6;P3(#ov~G>e}`hJ*cG(a7bKeO7G1tIxzcW zR+~CbKgi}uiMUGv_8@JpSuXHThNL07)=Iqevwu1s(@>#%*g+)uipzx7P$dOOV~w$Jkm lX}Djd3lgzcmdYtfpSH?BLpGc1g1HB<{xQz^&O_{`{{hETnnC~o literal 0 HcmV?d00001 diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 505d88e..a831994 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -65,6 +65,16 @@ If not what makes it happen or not happen? Change Log ---------- +v3.12.8 + +Yespower sha256 prehash made thread safe. + +Rewrote diff conversion functions from scratch to be simpler and use +long double (float80) and int128 arithmetic for improved accuracy and +precision. + +Some code cleanup and assorted small changes. + v3.12.7 Issue #257: fixed a file descriptor leak which caused the CPU temperature diff --git a/algo-gate-api.c b/algo-gate-api.c index 5f75f1e..9dfe7d2 100644 --- a/algo-gate-api.c +++ b/algo-gate-api.c @@ -102,23 +102,16 @@ int null_hash() applog(LOG_WARNING,"SWERR: null_hash unsafe null function"); return 0; }; -/* -void null_hash_suw() -{ - applog(LOG_WARNING,"SWERR: null_hash_suw unsafe null function"); -}; -*/ + void init_algo_gate( algo_gate_t* gate ) { gate->miner_thread_init = (void*)&return_true; gate->scanhash = (void*)&null_scanhash; gate->hash = (void*)&null_hash; -// gate->hash_suw = (void*)&null_hash_suw; gate->get_new_work = (void*)&std_get_new_work; gate->work_decode = (void*)&std_le_work_decode; gate->decode_extra_data = (void*)&do_nothing; gate->gen_merkle_root = (void*)&sha256d_gen_merkle_root; - gate->stratum_gen_work = (void*)&std_stratum_gen_work; gate->build_stratum_request = (void*)&std_le_build_stratum_request; gate->malloc_txs_request = (void*)&std_malloc_txs_request; gate->submit_getwork_result = (void*)&std_le_submit_getwork_result; diff --git a/algo-gate-api.h b/algo-gate-api.h index 2fb41be..a31f9ac 100644 --- a/algo-gate-api.h +++ b/algo-gate-api.h @@ -75,7 +75,7 @@ // my hack at creating a set data type using bit masks. Set inclusion, // exclusion union and intersection operations are provided for convenience. In // some cases it may be desireable to use boolean algebra directly on the -// data to perfomr set operations. Sets can be represented as single +// data to perform set operations. Sets can be represented as single // elements, a bitwise OR of multiple elements, a bitwise OR of multiple // set variables or constants, or combinations of the above. // Examples: @@ -110,13 +110,11 @@ inline bool set_excl ( set_t a, set_t b ) { return (a & b) == 0; } typedef struct { -// mandatory functions, must be overwritten +// mandatory function, must be overwritten int ( *scanhash ) ( struct work*, uint32_t, uint64_t*, struct thr_info* ); -// not used anywhere -// optional unsafe, must be overwritten if algo uses function +// Deprecated, will be removed int ( *hash ) ( void*, const void*, uint32_t ) ; -//void ( *hash_suw ) ( void*, const void* ); //optional, safe to use default in most cases @@ -124,9 +122,6 @@ int ( *hash ) ( void*, const void*, uint32_t ) ; // threads. bool ( *miner_thread_init ) ( int ); -// Generate global blockheader from stratum data. -void ( *stratum_gen_work ) ( struct stratum_ctx*, struct work* ); - // Get thread local copy of blockheader with unique nonce. void ( *get_new_work ) ( struct work*, struct work*, int, uint32_t* ); @@ -166,7 +161,9 @@ bool ( *do_this_thread ) ( int ); // After do_this_thread void ( *resync_threads ) ( struct work* ); +// No longer needed json_t* (*longpoll_rpc_call) ( CURL*, int*, char* ); + set_t optimizations; int ( *get_work_data_size ) (); int ntime_index; @@ -215,15 +212,12 @@ int null_scanhash(); // displays warning int null_hash (); -//void null_hash_suw(); // optional safe targets, default listed first unless noted. void std_get_new_work( struct work *work, struct work *g_work, int thr_id, uint32_t* end_nonce_ptr ); -void std_stratum_gen_work( struct stratum_ctx *sctx, struct work *work ); - void sha256d_gen_merkle_root( char *merkle_root, struct stratum_ctx *sctx ); void SHA256_gen_merkle_root ( char *merkle_root, struct stratum_ctx *sctx ); @@ -251,10 +245,6 @@ void std_build_block_header( struct work* g_work, uint32_t version, void std_build_extraheader( struct work *work, struct stratum_ctx *sctx ); json_t* std_longpoll_rpc_call( CURL *curl, int *err, char *lp_url ); -//json_t* jr2_longpoll_rpc_call( CURL *curl, int *err ); - -//bool std_stratum_handle_response( json_t *val ); -//bool jr2_stratum_handle_response( json_t *val ); bool std_ready_to_mine( struct work* work, struct stratum_ctx* stratum, int thr_id ); @@ -273,11 +263,6 @@ bool register_algo_gate( int algo, algo_gate_t *gate ); // compiler warnings but that's just more work for devs adding new algos. bool register_algo( algo_gate_t *gate ); -// Overrides a common set of functions used by RPC2 and other RPC2-specific -// init. Called by algo's register function before initializing algo-specific -// functions and data. -//bool register_json_rpc2( algo_gate_t *gate ); - // use this to call the hash function of an algo directly, ie util.c test. void exec_hash_function( int algo, void *output, const void *pdata ); diff --git a/algo/blake/blake-4way.c b/algo/blake/blake-4way.c index c397a40..4487533 100644 --- a/algo/blake/blake-4way.c +++ b/algo/blake/blake-4way.c @@ -48,7 +48,7 @@ int scanhash_blake_4way( struct work *work, uint32_t max_nonce, if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; @@ -107,7 +107,7 @@ int scanhash_blake_8way( struct work *work, uint32_t max_nonce, if ( (hash+i)[7] <= HTarget && fulltest( hash+i, ptarget ) ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 8; diff --git a/algo/blake/blake2b-4way.c b/algo/blake/blake2b-4way.c index a9ed0a7..5936773 100644 --- a/algo/blake/blake2b-4way.c +++ b/algo/blake/blake2b-4way.c @@ -45,7 +45,7 @@ int scanhash_blake2b_8way( struct work *work, uint32_t max_nonce, if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 8; @@ -100,7 +100,7 @@ int scanhash_blake2b_4way( struct work *work, uint32_t max_nonce, if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 4; diff --git a/algo/blake/blake2s-4way.c b/algo/blake/blake2s-4way.c index 9a5c6eb..ea8b266 100644 --- a/algo/blake/blake2s-4way.c +++ b/algo/blake/blake2s-4way.c @@ -49,7 +49,7 @@ int scanhash_blake2s_16way( struct work *work, uint32_t max_nonce, if ( likely( fulltest( lane_hash, ptarget ) && !opt_benchmark ) ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 16; @@ -104,7 +104,7 @@ int scanhash_blake2s_8way( struct work *work, uint32_t max_nonce, if ( likely( fulltest( lane_hash, ptarget ) && !opt_benchmark ) ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 8; @@ -157,7 +157,7 @@ int scanhash_blake2s_4way( struct work *work, uint32_t max_nonce, if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 4; diff --git a/algo/blake/blakecoin-4way.c b/algo/blake/blakecoin-4way.c index de0e073..dd26230 100644 --- a/algo/blake/blakecoin-4way.c +++ b/algo/blake/blakecoin-4way.c @@ -49,7 +49,7 @@ int scanhash_blakecoin_4way( struct work *work, uint32_t max_nonce, && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; @@ -108,7 +108,7 @@ int scanhash_blakecoin_8way( struct work *work, uint32_t max_nonce, && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 8; } while ( (n < max_nonce) && !work_restart[thr_id].restart ); diff --git a/algo/blake/decred-4way.c b/algo/blake/decred-4way.c index 27d9c18..9002b54 100644 --- a/algo/blake/decred-4way.c +++ b/algo/blake/decred-4way.c @@ -62,7 +62,7 @@ int scanhash_decred_4way( struct work *work, uint32_t max_nonce, if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[DECRED_NONCE_INDEX] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; } while ( (n < max_nonce) && !work_restart[thr_id].restart ); diff --git a/algo/blake/pentablake-4way.c b/algo/blake/pentablake-4way.c index 5683174..d1e7cf0 100644 --- a/algo/blake/pentablake-4way.c +++ b/algo/blake/pentablake-4way.c @@ -105,7 +105,7 @@ int scanhash_pentablake_4way( struct work *work, && fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n + i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; diff --git a/algo/bmw/bmw512-4way.c b/algo/bmw/bmw512-4way.c index ff59611..392e5f5 100644 --- a/algo/bmw/bmw512-4way.c +++ b/algo/bmw/bmw512-4way.c @@ -46,7 +46,7 @@ int scanhash_bmw512_8way( struct work *work, uint32_t max_nonce, if ( fulltest( lane_hash, ptarget ) ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 8; @@ -99,7 +99,7 @@ int scanhash_bmw512_4way( struct work *work, uint32_t max_nonce, if ( fulltest( lane_hash, ptarget ) ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 4; diff --git a/algo/groestl/groestl-4way.c b/algo/groestl/groestl-4way.c index 9c02153..ae5cac4 100644 --- a/algo/groestl/groestl-4way.c +++ b/algo/groestl/groestl-4way.c @@ -53,7 +53,7 @@ int scanhash_groestl_4way( struct work *work, uint32_t max_nonce, if ( fulltest( hash+(lane<<3), ptarget) && !opt_benchmark ) { pdata[19] = n + lane; - submit_lane_solution( work, hash+(lane<<3), mythr, lane ); + submit_solution( work, hash+(lane<<3), mythr ); } n += 4; } while ( ( n < last_nonce ) && !work_restart[thr_id].restart ); diff --git a/algo/groestl/myrgr-4way.c b/algo/groestl/myrgr-4way.c index 7f8d3ba..9fca48b 100644 --- a/algo/groestl/myrgr-4way.c +++ b/algo/groestl/myrgr-4way.c @@ -143,7 +143,7 @@ int scanhash_myriad_8way( struct work *work, uint32_t max_nonce, if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 8; @@ -226,7 +226,7 @@ int scanhash_myriad_4way( struct work *work, uint32_t max_nonce, if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 4; diff --git a/algo/jh/jha-4way.c b/algo/jh/jha-4way.c index d514335..2609e1b 100644 --- a/algo/jh/jha-4way.c +++ b/algo/jh/jha-4way.c @@ -129,7 +129,7 @@ int scanhash_jha_4way( struct work *work, uint32_t max_nonce, if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, lane_hash, mythr, i ); + submit_solution( work, lane_hash, mythr ); } } n += 4; diff --git a/algo/keccak/keccak-4way.c b/algo/keccak/keccak-4way.c index 3f4b671..514fc75 100644 --- a/algo/keccak/keccak-4way.c +++ b/algo/keccak/keccak-4way.c @@ -45,7 +45,7 @@ int scanhash_keccak_8way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm512_add_epi32( *noncev, @@ -97,7 +97,7 @@ int scanhash_keccak_4way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget )) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm256_add_epi32( *noncev, diff --git a/algo/keccak/sha3d-4way.c b/algo/keccak/sha3d-4way.c index 41259e8..14451c0 100644 --- a/algo/keccak/sha3d-4way.c +++ b/algo/keccak/sha3d-4way.c @@ -52,7 +52,7 @@ int scanhash_sha3d_8way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm512_add_epi32( *noncev, @@ -111,7 +111,7 @@ int scanhash_sha3d_4way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm256_add_epi32( *noncev, diff --git a/algo/lyra2/allium-4way.c b/algo/lyra2/allium-4way.c index 44c568e..de8ca72 100644 --- a/algo/lyra2/allium-4way.c +++ b/algo/lyra2/allium-4way.c @@ -245,7 +245,7 @@ int scanhash_allium_16way( struct work *work, uint32_t max_nonce, if ( unlikely( valid_hash( hash+(lane<<3), ptarget ) && !bench ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, hash+(lane<<3), mythr, lane ); + submit_solution( work, hash+(lane<<3), mythr ); } *noncev = _mm512_add_epi32( *noncev, m512_const1_32( 16 ) ); n += 16; @@ -394,7 +394,7 @@ int scanhash_allium_8way( struct work *work, uint32_t max_nonce, if ( unlikely( valid_hash( lane_hash, ptarget ) && !bench ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 8; diff --git a/algo/lyra2/lyra2h-4way.c b/algo/lyra2/lyra2h-4way.c index 49a4087..e4281c8 100644 --- a/algo/lyra2/lyra2h-4way.c +++ b/algo/lyra2/lyra2h-4way.c @@ -76,7 +76,7 @@ int scanhash_lyra2h_4way( struct work *work, uint32_t max_nonce, && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; } while ( (n < max_nonce-4) && !work_restart[thr_id].restart); diff --git a/algo/lyra2/lyra2rev2-4way.c b/algo/lyra2/lyra2rev2-4way.c index 603c34d..0211a98 100644 --- a/algo/lyra2/lyra2rev2-4way.c +++ b/algo/lyra2/lyra2rev2-4way.c @@ -200,7 +200,7 @@ int scanhash_lyra2rev2_16way( struct work *work, const uint32_t max_nonce, if ( likely( valid_hash( lane_hash, ptarget ) && !bench ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm512_add_epi32( *noncev, m512_const1_32( 16 ) ); @@ -342,7 +342,7 @@ int scanhash_lyra2rev2_8way( struct work *work, const uint32_t max_nonce, if ( likely( valid_hash( lane_hash, ptarget ) && !bench ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm256_add_epi32( *noncev, m256_const1_32( 8 ) ); @@ -469,7 +469,7 @@ int scanhash_lyra2rev2_4way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) && !opt_benchmark ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 4; diff --git a/algo/lyra2/lyra2rev3-4way.c b/algo/lyra2/lyra2rev3-4way.c index b9f0821..13c442a 100644 --- a/algo/lyra2/lyra2rev3-4way.c +++ b/algo/lyra2/lyra2rev3-4way.c @@ -165,7 +165,7 @@ int scanhash_lyra2rev3_16way( struct work *work, const uint32_t max_nonce, if ( likely( valid_hash( lane_hash, ptarget ) && !opt_benchmark ) ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 16; @@ -284,7 +284,7 @@ int scanhash_lyra2rev3_8way( struct work *work, const uint32_t max_nonce, if ( likely( valid_hash( lane_hash, ptarget ) && !bench ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm256_add_epi32( *noncev, m256_const1_32( 8 ) ); @@ -386,7 +386,7 @@ int scanhash_lyra2rev3_4way( struct work *work, const uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) && !opt_benchmark ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm_add_epi32( *noncev, m128_const1_32( 4 ) ); diff --git a/algo/lyra2/lyra2z-4way.c b/algo/lyra2/lyra2z-4way.c index e31e43b..a5f8c9a 100644 --- a/algo/lyra2/lyra2z-4way.c +++ b/algo/lyra2/lyra2z-4way.c @@ -124,7 +124,7 @@ int scanhash_lyra2z_16way( struct work *work, uint32_t max_nonce, if ( unlikely( valid_hash( lane_hash, ptarget ) && !bench ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm512_add_epi32( *noncev, m512_const1_32( 16 ) ); @@ -222,7 +222,7 @@ int scanhash_lyra2z_8way( struct work *work, uint32_t max_nonce, if ( unlikely( valid_hash( lane_hash, ptarget ) && !bench ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm256_add_epi32( *noncev, m256_const1_32( 8 ) ); @@ -301,7 +301,7 @@ int scanhash_lyra2z_4way( struct work *work, uint32_t max_nonce, if ( unlikely( valid_hash( lane_hash, ptarget ) && !bench ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm_add_epi32( *noncev, m128_const1_32( 4 ) ); diff --git a/algo/lyra2/lyra2z330.c b/algo/lyra2/lyra2z330.c index d49d603..3adf83c 100644 --- a/algo/lyra2/lyra2z330.c +++ b/algo/lyra2/lyra2z330.c @@ -68,7 +68,7 @@ bool lyra2z330_thread_init() bool register_lyra2z330_algo( algo_gate_t* gate ) { - gate->optimizations = SSE42_OPT | AVX2_OPT; + gate->optimizations = SSE2_OPT | AVX2_OPT; gate->miner_thread_init = (void*)&lyra2z330_thread_init; gate->scanhash = (void*)&scanhash_lyra2z330; gate->hash = (void*)&lyra2z330_hash; diff --git a/algo/lyra2/phi2-4way.c b/algo/lyra2/phi2-4way.c index b203546..cecfd8d 100644 --- a/algo/lyra2/phi2-4way.c +++ b/algo/lyra2/phi2-4way.c @@ -302,7 +302,7 @@ int scanhash_phi2_8way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) ) { be32enc( pdata + 19, n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 8; @@ -483,7 +483,7 @@ int scanhash_phi2_4way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) ) { be32enc( pdata + 19, n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } edata[ 19 ] += 4; diff --git a/algo/nist5/nist5-4way.c b/algo/nist5/nist5-4way.c index da9a5fa..f2bbd75 100644 --- a/algo/nist5/nist5-4way.c +++ b/algo/nist5/nist5-4way.c @@ -108,7 +108,7 @@ int scanhash_nist5_8way( struct work *work, uint32_t max_nonce, if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 8; @@ -196,7 +196,7 @@ int scanhash_nist5_4way( struct work *work, uint32_t max_nonce, if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 4; diff --git a/algo/quark/anime-4way.c b/algo/quark/anime-4way.c index 994d290..0d5b5d4 100644 --- a/algo/quark/anime-4way.c +++ b/algo/quark/anime-4way.c @@ -223,7 +223,7 @@ int scanhash_anime_8way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm512_add_epi32( *noncev, @@ -383,7 +383,7 @@ int scanhash_anime_4way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm256_add_epi32( *noncev, diff --git a/algo/quark/hmq1725-4way.c b/algo/quark/hmq1725-4way.c index fd78d5b..8832ea7 100644 --- a/algo/quark/hmq1725-4way.c +++ b/algo/quark/hmq1725-4way.c @@ -596,7 +596,7 @@ int scanhash_hmq1725_8way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm512_add_epi32( *noncev, @@ -1018,7 +1018,7 @@ int scanhash_hmq1725_4way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm256_add_epi32( *noncev, diff --git a/algo/quark/quark-4way.c b/algo/quark/quark-4way.c index 5e02c39..d15e6bd 100644 --- a/algo/quark/quark-4way.c +++ b/algo/quark/quark-4way.c @@ -235,7 +235,7 @@ int scanhash_quark_8way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm512_add_epi32( *noncev, @@ -408,7 +408,7 @@ int scanhash_quark_4way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm256_add_epi32( *noncev, diff --git a/algo/qubit/deep-2way.c b/algo/qubit/deep-2way.c index 9ca6608..f825215 100644 --- a/algo/qubit/deep-2way.c +++ b/algo/qubit/deep-2way.c @@ -106,13 +106,13 @@ int scanhash_deep_2way( struct work *work,uint32_t max_nonce, if ( fulltest( hash, ptarget) && !opt_benchmark ) { pdata[19] = n; - submit_lane_solution( work, hash, mythr, 0 ); + submit_solution( work, hash, mythr ); } if ( !( (hash+8)[7] & mask ) ) if ( fulltest( hash+8, ptarget) && !opt_benchmark ) { pdata[19] = n+1; - submit_lane_solution( work, hash+8, mythr, 1 ); + submit_solution( work, hash+8, mythr ); } n += 2; } while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); diff --git a/algo/qubit/qubit-2way.c b/algo/qubit/qubit-2way.c index 9948d06..a6f4969 100644 --- a/algo/qubit/qubit-2way.c +++ b/algo/qubit/qubit-2way.c @@ -153,7 +153,7 @@ int scanhash_qubit_4way( struct work *work,uint32_t max_nonce, if ( likely( fulltest( hash+(lane<<3), ptarget) && !opt_benchmark ) ) { pdata[19] = n + lane; - submit_lane_solution( work, hash+(lane<<3), mythr, lane ); + submit_solution( work, hash+(lane<<3), mythr ); } n += 4; } while ( ( n < max_nonce-4 ) && !work_restart[thr_id].restart ); @@ -255,13 +255,13 @@ int scanhash_qubit_2way( struct work *work,uint32_t max_nonce, if ( likely( fulltest( hash, ptarget) && !opt_benchmark ) ) { pdata[19] = n; - submit_lane_solution( work, hash, mythr, 0 ); + submit_solution( work, hash, mythr ); } if ( unlikely( ( (hash+8))[7] <= Htarg ) ) if ( likely( fulltest( hash+8, ptarget) && !opt_benchmark ) ) { pdata[19] = n+1; - submit_lane_solution( work, hash+8, mythr, 1 ); + submit_solution( work, hash+8, mythr ); } n += 2; } while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); diff --git a/algo/ripemd/lbry-4way.c b/algo/ripemd/lbry-4way.c index 0228c86..386e245 100644 --- a/algo/ripemd/lbry-4way.c +++ b/algo/ripemd/lbry-4way.c @@ -132,7 +132,7 @@ int scanhash_lbry_16way( struct work *work, uint32_t max_nonce, if ( likely( fulltest( lane_hash, ptarget ) && !opt_benchmark ) ) { pdata[27] = n + i; - submit_lane_solution( work, lane_hash, mythr, i ); + submit_solution( work, lane_hash, mythr ); } } n += 16; @@ -251,7 +251,7 @@ int scanhash_lbry_8way( struct work *work, uint32_t max_nonce, if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) { pdata[27] = n + i; - submit_lane_solution( work, lane_hash, mythr, i ); + submit_solution( work, lane_hash, mythr ); } } n += 8; diff --git a/algo/sha/sha256q-4way.c b/algo/sha/sha256q-4way.c index 2cecfcc..34c67b4 100644 --- a/algo/sha/sha256q-4way.c +++ b/algo/sha/sha256q-4way.c @@ -85,7 +85,7 @@ int scanhash_sha256q_8way( struct work *work, uint32_t max_nonce, if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 8; @@ -173,7 +173,7 @@ int scanhash_sha256q_4way( struct work *work, uint32_t max_nonce, if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 4; diff --git a/algo/sha/sha256t-4way.c b/algo/sha/sha256t-4way.c index b48633b..b1d073a 100644 --- a/algo/sha/sha256t-4way.c +++ b/algo/sha/sha256t-4way.c @@ -78,7 +78,7 @@ int scanhash_sha256t_8way( struct work *work, const uint32_t max_nonce, if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 8; @@ -161,7 +161,7 @@ int scanhash_sha256t_4way( struct work *work, const uint32_t max_nonce, if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 4; diff --git a/algo/skein/skein-4way.c b/algo/skein/skein-4way.c index 1495727..0c1a7df 100644 --- a/algo/skein/skein-4way.c +++ b/algo/skein/skein-4way.c @@ -65,7 +65,7 @@ int scanhash_skein_8way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm512_add_epi32( *noncev, @@ -162,7 +162,7 @@ int scanhash_skein_4way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm256_add_epi32( *noncev, diff --git a/algo/skein/skein2-4way.c b/algo/skein/skein2-4way.c index 6fd1c27..2eb0deb 100644 --- a/algo/skein/skein2-4way.c +++ b/algo/skein/skein2-4way.c @@ -53,7 +53,7 @@ int scanhash_skein2_8way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) && !bench ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm512_add_epi32( *noncev, @@ -115,7 +115,7 @@ int scanhash_skein2_4way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) && !bench ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm256_add_epi32( *noncev, diff --git a/algo/x11/c11-4way.c b/algo/x11/c11-4way.c index fb95861..1431b67 100644 --- a/algo/x11/c11-4way.c +++ b/algo/x11/c11-4way.c @@ -279,7 +279,7 @@ int scanhash_c11_8way( struct work *work, uint32_t max_nonce, && fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 8; } while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); @@ -459,7 +459,7 @@ int scanhash_c11_4way( struct work *work, uint32_t max_nonce, && fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; } while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); diff --git a/algo/x11/timetravel-4way.c b/algo/x11/timetravel-4way.c index 94d36f7..e54b71d 100644 --- a/algo/x11/timetravel-4way.c +++ b/algo/x11/timetravel-4way.c @@ -221,7 +221,7 @@ int scanhash_timetravel_4way( struct work *work, uint32_t max_nonce, && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; } while ( ( n < max_nonce ) && !(*restart) ); diff --git a/algo/x11/timetravel10-4way.c b/algo/x11/timetravel10-4way.c index 9353124..52779d6 100644 --- a/algo/x11/timetravel10-4way.c +++ b/algo/x11/timetravel10-4way.c @@ -256,7 +256,7 @@ int scanhash_timetravel10_4way( struct work *work, && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; } while ( ( n < max_nonce ) && !(*restart) ); diff --git a/algo/x11/tribus-4way.c b/algo/x11/tribus-4way.c index 0092763..bf76d14 100644 --- a/algo/x11/tribus-4way.c +++ b/algo/x11/tribus-4way.c @@ -128,7 +128,7 @@ int scanhash_tribus_8way( struct work *work, uint32_t max_nonce, if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 8; } while ( ( n < max_nonce-8 ) && !work_restart[thr_id].restart); @@ -213,7 +213,7 @@ int scanhash_tribus_4way( struct work *work, uint32_t max_nonce, if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; } while ( ( n < max_nonce-4 ) && !work_restart[thr_id].restart); diff --git a/algo/x11/x11-4way.c b/algo/x11/x11-4way.c index 44b6c8e..fada82f 100644 --- a/algo/x11/x11-4way.c +++ b/algo/x11/x11-4way.c @@ -279,7 +279,7 @@ int scanhash_x11_8way( struct work *work, uint32_t max_nonce, && fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 8; } while ( ( n < last_nonce ) && !work_restart[thr_id].restart ); @@ -469,7 +469,7 @@ int scanhash_x11_4way( struct work *work, uint32_t max_nonce, && fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; } while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); diff --git a/algo/x11/x11evo-4way.c b/algo/x11/x11evo-4way.c index 11e5366..544077e 100644 --- a/algo/x11/x11evo-4way.c +++ b/algo/x11/x11evo-4way.c @@ -269,7 +269,7 @@ int scanhash_x11evo_4way( struct work* work, uint32_t max_nonce, && fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; } while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); diff --git a/algo/x11/x11gost-4way.c b/algo/x11/x11gost-4way.c index 345bf08..d4cb175 100644 --- a/algo/x11/x11gost-4way.c +++ b/algo/x11/x11gost-4way.c @@ -312,7 +312,7 @@ int scanhash_x11gost_8way( struct work *work, uint32_t max_nonce, && fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 8; } while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); @@ -498,7 +498,7 @@ int scanhash_x11gost_4way( struct work *work, uint32_t max_nonce, && fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; } while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); diff --git a/algo/x12/x12-4way.c b/algo/x12/x12-4way.c index 71a081e..31e1342 100644 --- a/algo/x12/x12-4way.c +++ b/algo/x12/x12-4way.c @@ -263,7 +263,7 @@ int scanhash_x12_8way( struct work *work, uint32_t max_nonce, if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 8; @@ -431,7 +431,7 @@ int scanhash_x12_4way( struct work *work, uint32_t max_nonce, if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; } while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); diff --git a/algo/x13/phi1612-4way.c b/algo/x13/phi1612-4way.c index eb143e8..aa0c6a7 100644 --- a/algo/x13/phi1612-4way.c +++ b/algo/x13/phi1612-4way.c @@ -208,7 +208,7 @@ int scanhash_phi1612_8way( struct work *work, uint32_t max_nonce, if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 8; } while ( ( n < max_nonce-8 ) && !work_restart[thr_id].restart ); @@ -344,7 +344,7 @@ int scanhash_phi1612_4way( struct work *work, uint32_t max_nonce, if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; } while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); diff --git a/algo/x13/skunk-4way.c b/algo/x13/skunk-4way.c index c7f6fd6..e469839 100644 --- a/algo/x13/skunk-4way.c +++ b/algo/x13/skunk-4way.c @@ -125,7 +125,7 @@ int scanhash_skunk_8way( struct work *work, uint32_t max_nonce, if ( unlikely( valid_hash( hash+(i<<3), ptarget ) && !bench ) ) { pdata[19] = bswap_32( n+i ); - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } *noncev = _mm512_add_epi32( *noncev, m512_const1_64( 0x0000000800000000 ) ); @@ -237,7 +237,7 @@ int scanhash_skunk_4way( struct work *work, uint32_t max_nonce, if ( unlikely( valid_hash( hash+(i<<3), ptarget ) && !bench ) ) { pdata[19] = bswap_32( n + i ); - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } *noncev = _mm256_add_epi32( *noncev, m256_const1_64( 0x0000000400000000 ) ); diff --git a/algo/x13/x13-4way.c b/algo/x13/x13-4way.c index 6fac9d8..6518655 100644 --- a/algo/x13/x13-4way.c +++ b/algo/x13/x13-4way.c @@ -319,7 +319,7 @@ int scanhash_x13_8way( struct work *work, uint32_t max_nonce, && fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 8; } while ( ( n < last_nonce ) && !work_restart[thr_id].restart ); @@ -531,7 +531,7 @@ int scanhash_x13_4way( struct work *work, uint32_t max_nonce, if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; } while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); diff --git a/algo/x13/x13bcd-4way.c b/algo/x13/x13bcd-4way.c index a6c7d19..188b18b 100644 --- a/algo/x13/x13bcd-4way.c +++ b/algo/x13/x13bcd-4way.c @@ -321,7 +321,7 @@ int scanhash_x13bcd_8way( struct work *work, uint32_t max_nonce, if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 8; } while ( ( n < last_nonce ) && !work_restart[thr_id].restart ); @@ -541,7 +541,7 @@ int scanhash_x13bcd_4way( struct work *work, uint32_t max_nonce, if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; } while ( ( n < last_nonce ) && !work_restart[thr_id].restart ); diff --git a/algo/x13/x13sm3-4way.c b/algo/x13/x13sm3-4way.c index e71ce78..b842204 100644 --- a/algo/x13/x13sm3-4way.c +++ b/algo/x13/x13sm3-4way.c @@ -246,7 +246,7 @@ int scanhash_x13sm3_4way( struct work *work, uint32_t max_nonce, if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; } while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); diff --git a/algo/x14/polytimos-4way.c b/algo/x14/polytimos-4way.c index 09f99b1..df3bb37 100644 --- a/algo/x14/polytimos-4way.c +++ b/algo/x14/polytimos-4way.c @@ -129,7 +129,7 @@ int scanhash_polytimos_4way( struct work *work, uint32_t max_nonce, if( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; diff --git a/algo/x14/veltor-4way.c b/algo/x14/veltor-4way.c index 1f8ea39..cfa778b 100644 --- a/algo/x14/veltor-4way.c +++ b/algo/x14/veltor-4way.c @@ -108,7 +108,7 @@ int scanhash_veltor_4way( struct work *work, uint32_t max_nonce, if ( (hash+(i<<3))[7] <= Htarg && fulltest( hash+(i<<3), ptarget ) ) { pdata[19] = n+i; - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } n += 4; } while ( ( n < max_nonce ) && !(*restart) ); diff --git a/algo/x14/x14-4way.c b/algo/x14/x14-4way.c index 42f8f43..5ac8d8a 100644 --- a/algo/x14/x14-4way.c +++ b/algo/x14/x14-4way.c @@ -324,7 +324,7 @@ int scanhash_x14_8way( struct work *work, uint32_t max_nonce, if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 8; @@ -534,7 +534,7 @@ int scanhash_x14_4way( struct work *work, uint32_t max_nonce, if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 4; diff --git a/algo/x15/x15-4way.c b/algo/x15/x15-4way.c index f9feb07..7fff408 100644 --- a/algo/x15/x15-4way.c +++ b/algo/x15/x15-4way.c @@ -364,7 +364,7 @@ int scanhash_x15_8way( struct work *work, uint32_t max_nonce, if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash, mythr, i ); + submit_solution( work, hash, mythr ); } n += 8; } while ( ( n < last_nonce ) && !work_restart[thr_id].restart ); @@ -592,7 +592,7 @@ int scanhash_x15_4way( struct work *work, uint32_t max_nonce, if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) { pdata[19] = n+i; - submit_lane_solution( work, hash, mythr, i ); + submit_solution( work, hash, mythr ); } n += 4; } while ( ( n < last_nonce ) && !work_restart[thr_id].restart ); diff --git a/algo/x16/x16r-4way.c b/algo/x16/x16r-4way.c index 6cbfa44..7955961 100644 --- a/algo/x16/x16r-4way.c +++ b/algo/x16/x16r-4way.c @@ -505,7 +505,7 @@ int scanhash_x16r_8way( struct work *work, uint32_t max_nonce, if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) ) { pdata[19] = bswap_32( n+i ); - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } *noncev = _mm512_add_epi32( *noncev, m512_const1_64( 0x0000000800000000 ) ); @@ -869,7 +869,7 @@ int scanhash_x16r_4way( struct work *work, uint32_t max_nonce, if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) ) { pdata[19] = bswap_32( n+i ); - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } *noncev = _mm256_add_epi32( *noncev, m256_const1_64( 0x0000000400000000 ) ); diff --git a/algo/x16/x16rt-4way.c b/algo/x16/x16rt-4way.c index 156dcb0..fcd56af 100644 --- a/algo/x16/x16rt-4way.c +++ b/algo/x16/x16rt-4way.c @@ -46,7 +46,7 @@ int scanhash_x16rt_8way( struct work *work, uint32_t max_nonce, if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) ) { pdata[19] = bswap_32( n+i ); - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } *noncev = _mm512_add_epi32( *noncev, m512_const1_64( 0x0000000800000000 ) ); @@ -99,7 +99,7 @@ int scanhash_x16rt_4way( struct work *work, uint32_t max_nonce, if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) ) { pdata[19] = bswap_32( n+i ); - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } *noncev = _mm256_add_epi32( *noncev, m256_const1_64( 0x0000000400000000 ) ); diff --git a/algo/x16/x16rv2-4way.c b/algo/x16/x16rv2-4way.c index ad6129a..1db130c 100644 --- a/algo/x16/x16rv2-4way.c +++ b/algo/x16/x16rv2-4way.c @@ -678,7 +678,7 @@ int scanhash_x16rv2_8way( struct work *work, uint32_t max_nonce, if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) ) { pdata[19] = bswap_32( n+i ); - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } *noncev = _mm512_add_epi32( *noncev, m512_const1_64( 0x0000000800000000 ) ); @@ -1131,7 +1131,7 @@ int scanhash_x16rv2_4way( struct work *work, uint32_t max_nonce, if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) ) { pdata[19] = bswap_32( n+i ); - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } *noncev = _mm256_add_epi32( *noncev, m256_const1_64( 0x0000000400000000 ) ); diff --git a/algo/x16/x21s-4way.c b/algo/x16/x21s-4way.c index 8e90477..262971f 100644 --- a/algo/x16/x21s-4way.c +++ b/algo/x16/x21s-4way.c @@ -177,7 +177,7 @@ int scanhash_x21s_8way( struct work *work, uint32_t max_nonce, if ( likely( valid_hash( lane_hash, ptarget ) && !bench ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm512_add_epi32( *noncev, @@ -347,7 +347,7 @@ int scanhash_x21s_4way( struct work *work, uint32_t max_nonce, if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) ) { pdata[19] = bswap_32( n+i ); - submit_lane_solution( work, hash+(i<<3), mythr, i ); + submit_solution( work, hash+(i<<3), mythr ); } *noncev = _mm256_add_epi32( *noncev, m256_const1_64( 0x0000000400000000 ) ); diff --git a/algo/x17/x17-4way.c b/algo/x17/x17-4way.c index 8846dbd..7f203ea 100644 --- a/algo/x17/x17-4way.c +++ b/algo/x17/x17-4way.c @@ -264,7 +264,7 @@ int scanhash_x17_8way( struct work *work, uint32_t max_nonce, if ( likely( valid_hash( lane_hash, ptarget ) ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm512_add_epi32( *noncev, @@ -432,7 +432,7 @@ int scanhash_x17_4way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm256_add_epi32( *noncev, diff --git a/algo/x17/xevan-4way.c b/algo/x17/xevan-4way.c index 02b0e13..e840e8f 100644 --- a/algo/x17/xevan-4way.c +++ b/algo/x17/xevan-4way.c @@ -429,7 +429,7 @@ int scanhash_xevan_8way( struct work *work, uint32_t max_nonce, if ( likely( valid_hash( lane_hash, ptarget ) ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm512_add_epi32( *noncev, @@ -699,7 +699,7 @@ int scanhash_xevan_4way( struct work *work, uint32_t max_nonce, if ( valid_hash( lane_hash, ptarget ) ) { pdata[19] = bswap_32( n + lane ); - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } *noncev = _mm256_add_epi32( *noncev, diff --git a/algo/x22/x22i-4way.c b/algo/x22/x22i-4way.c index 7ad8573..8d519ee 100644 --- a/algo/x22/x22i-4way.c +++ b/algo/x22/x22i-4way.c @@ -493,7 +493,7 @@ int scanhash_x22i_8way( struct work* work, uint32_t max_nonce, if ( likely( fulltest( lane_hash, ptarget ) && !opt_benchmark ) ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 8; diff --git a/algo/x22/x25x-4way.c b/algo/x22/x25x-4way.c index 0f333a3..3e672af 100644 --- a/algo/x22/x25x-4way.c +++ b/algo/x22/x25x-4way.c @@ -625,7 +625,7 @@ int scanhash_x25x_8way( struct work* work, uint32_t max_nonce, if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) { pdata[19] = n + lane; - submit_lane_solution( work, lane_hash, mythr, lane ); + submit_solution( work, lane_hash, mythr ); } } n += 8; diff --git a/algo/yespower/yescrypt-r8g.c b/algo/yespower/yescrypt-r8g.c index 5ee79ea..1670eb7 100644 --- a/algo/yespower/yescrypt-r8g.c +++ b/algo/yespower/yescrypt-r8g.c @@ -19,11 +19,12 @@ */ #include "cpuminer-config.h" -#include "miner.h" #include #include #include -#include "yescrypt-r8g.h" +#include +#include "algo-gate-api.h" +#include "yespower.h" int scanhash_yespower_r8g( struct work *work, uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr ) @@ -37,7 +38,17 @@ int scanhash_yespower_r8g( struct work *work, uint32_t max_nonce, const uint32_t last_nonce = max_nonce; const int thr_id = mythr->id; - yespower_params_t params = + static __thread int initialized = 0; + static __thread yespower_local_t local; + + if ( !initialized ) + { + if ( yespower_init_local( &local ) ) + return -1; + initialized = 1; + } + + yespower_params_t params = { .version = YESPOWER_0_5, .N = 2048, @@ -56,7 +67,7 @@ int scanhash_yespower_r8g( struct work *work, uint32_t max_nonce, SHA256_Update( &sha256_prehash_ctx, endiandata, 64 ); do { - yespower_tls( (unsigned char *)endiandata, params.perslen, + yespower_hash( &local, (unsigned char *)endiandata, params.perslen, ¶ms, (yespower_binary_t*)hash, thr_id ); if unlikely( valid_hash( hash, ptarget ) && !opt_benchmark ) @@ -76,7 +87,6 @@ bool register_yescryptr8g_algo( algo_gate_t* gate ) { gate->optimizations = SSE2_OPT | SHA_OPT; gate->scanhash = (void*)&scanhash_yespower_r8g; - gate->hash = (void*)&yespower_tls; pk_buffer_size = 26; opt_sapling = true; opt_target_factor = 65536.0; diff --git a/algo/yespower/yescrypt-r8g.h b/algo/yespower/yescrypt-r8g.h deleted file mode 100644 index 57f5cec..0000000 --- a/algo/yespower/yescrypt-r8g.h +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * Copyright 2009 Colin Percival - * Copyright 2013-2018 Alexander Peslyak - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file was originally written by Colin Percival as part of the Tarsnap - * online backup system. - */ -#ifndef _YESPOWERR8G_H_ -#define _YESPOWERR8G_H_ - -#include -#include /* for size_t */ -#include "algo-gate-api.h" -#include "algo/yespower/yespower.h" - -#ifdef __cplusplus -extern "C" { -#endif - -extern int yespowerr8g_tls(const uint8_t *src, size_t srclen, - const yespower_params_t *params, yespower_binary_t *dst); - -#ifdef __cplusplus -} -#endif - -#endif /* !_YESPOWERR8G_H_ */ diff --git a/algo/yespower/yespower-blake2b.c b/algo/yespower/yespower-blake2b.c index 4f54201..4175a6e 100644 --- a/algo/yespower/yespower-blake2b.c +++ b/algo/yespower/yespower-blake2b.c @@ -1112,10 +1112,10 @@ static void smix(uint8_t *B, size_t r, uint32_t N, * * Return 0 on success; or -1 on error. */ -int yespower_b2b(yespower_local_t *local, +int yespower_b2b_hash(yespower_local_t *local, const uint8_t *src, size_t srclen, const yespower_params_t *params, - yespower_binary_t *dst, int thrid ) + void *dst, int thrid ) { uint32_t N = params->N; uint32_t r = params->r; @@ -1191,37 +1191,4 @@ fail: return 0; } -/** - * yespower_tls(src, srclen, params, dst): - * Compute yespower(src[0 .. srclen - 1], N, r), to be checked for "< target". - * The memory allocation is maintained internally using thread-local storage. - * - * Return 0 on success; or -1 on error. - */ -int yespower_b2b_tls(const uint8_t *src, size_t srclen, - const yespower_params_t *params, yespower_binary_t *dst, int thrid ) -{ - static __thread int initialized = 0; - static __thread yespower_local_t local; - - if (!initialized) { - init_region(&local); - initialized = 1; - } - - return yespower_b2b(&local, src, srclen, params, dst, thrid); -} -/* -int yespower_init_local(yespower_local_t *local) -{ - init_region(local); - return 0; -} - -int yespower_free_local(yespower_local_t *local) -{ - return free_region(local); -} -*/ - #endif diff --git a/algo/yespower/yespower-gate.c b/algo/yespower/yespower-gate.c index a2255ac..7e6798c 100644 --- a/algo/yespower/yespower-gate.c +++ b/algo/yespower/yespower-gate.c @@ -23,25 +23,17 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * This file was originally written by Cryply team as part of the Cryply - * coin. */ #include "yespower.h" - #include "algo-gate-api.h" yespower_params_t yespower_params; -SHA256_CTX sha256_prehash_ctx; +// Give each thread its own copy to avoid requiring mutex. +__thread SHA256_CTX sha256_prehash_ctx; // YESPOWER -int yespower_hash( const char *input, char *output, uint32_t len, int thrid ) -{ - return yespower_tls( input, len, &yespower_params, - (yespower_binary_t*)output, thrid ); -} - int scanhash_yespower( struct work *work, uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr ) { @@ -54,6 +46,16 @@ int scanhash_yespower( struct work *work, uint32_t max_nonce, uint32_t n = first_nonce; const int thr_id = mythr->id; + static __thread int initialized = 0; + static __thread yespower_local_t local; + + if ( !initialized ) + { + if ( yespower_init_local( &local ) ) + return -1; + initialized = 1; + } + for ( int k = 0; k < 19; k++ ) be32enc( &endiandata[k], pdata[k] ); endiandata[19] = n; @@ -63,7 +65,8 @@ int scanhash_yespower( struct work *work, uint32_t max_nonce, SHA256_Update( &sha256_prehash_ctx, endiandata, 64 ); do { - if ( yespower_hash( (char*)endiandata, (char*)vhash, 80, thr_id ) ) + if ( yespower_hash( &local, (char*)endiandata, 80, &yespower_params, + (char*)vhash, thr_id ) ) if unlikely( valid_hash( vhash, ptarget ) && !opt_benchmark ) { be32enc( pdata+19, n ); @@ -78,11 +81,6 @@ int scanhash_yespower( struct work *work, uint32_t max_nonce, // YESPOWER-B2B -int yespower_b2b_hash( const char *input, char *output, uint32_t len, int thrid ) -{ - return yespower_b2b_tls( input, len, &yespower_params, (yespower_binary_t*)output, thrid ); -} - int scanhash_yespower_b2b( struct work *work, uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr ) { @@ -95,6 +93,16 @@ int scanhash_yespower_b2b( struct work *work, uint32_t max_nonce, const uint32_t last_nonce = max_nonce; const int thr_id = mythr->id; + static __thread int initialized = 0; + static __thread yespower_local_t local; + + if ( !initialized ) + { + if ( yespower_init_local( &local ) ) + return -1; + initialized = 1; + } + for ( int k = 0; k < 19; k++ ) be32enc( &endiandata[k], pdata[k] ); endiandata[19] = n; @@ -104,7 +112,8 @@ int scanhash_yespower_b2b( struct work *work, uint32_t max_nonce, SHA256_Update( &sha256_prehash_ctx, endiandata, 64 ); do { - if (yespower_b2b_hash( (char*) endiandata, (char*) vhash, 80, thr_id ) ) + if (yespower_b2b_hash( &local, (char*) endiandata, 80, &yespower_params, + (char*) vhash, thr_id ) ) if unlikely( valid_hash( vhash, ptarget ) && !opt_benchmark ) { be32enc( pdata+19, n ); @@ -145,7 +154,6 @@ bool register_yespower_algo( algo_gate_t* gate ) gate->optimizations = SSE2_OPT | SHA_OPT; gate->scanhash = (void*)&scanhash_yespower; - gate->hash = (void*)&yespower_hash; opt_target_factor = 65536.0; return true; }; @@ -159,7 +167,6 @@ bool register_yespowerr16_algo( algo_gate_t* gate ) yespower_params.perslen = 0; gate->optimizations = SSE2_OPT | SHA_OPT; gate->scanhash = (void*)&scanhash_yespower; - gate->hash = (void*)&yespower_hash; opt_target_factor = 65536.0; return true; }; @@ -268,9 +275,8 @@ bool register_power2b_algo( algo_gate_t* gate ) applog( LOG_NOTICE,"Key= \"%s\"", yespower_params.pers ); applog( LOG_NOTICE,"Key length= %d\n", yespower_params.perslen ); - gate->optimizations = SSE2_OPT | SHA_OPT; + gate->optimizations = SSE2_OPT; gate->scanhash = (void*)&scanhash_yespower_b2b; - gate->hash = (void*)&yespower_b2b_hash; opt_target_factor = 65536.0; return true; }; @@ -310,7 +316,6 @@ bool register_yespower_b2b_algo( algo_gate_t* gate ) gate->optimizations = SSE2_OPT; gate->scanhash = (void*)&scanhash_yespower_b2b; - gate->hash = (void*)&yespower_b2b_hash; opt_target_factor = 65536.0; return true; }; diff --git a/algo/yespower/yespower-opt.c b/algo/yespower/yespower-opt.c index f26de51..3596027 100644 --- a/algo/yespower/yespower-opt.c +++ b/algo/yespower/yespower-opt.c @@ -1024,10 +1024,10 @@ static void smix(uint8_t *B, size_t r, uint32_t N, * * Return 0 on success; or -1 on error. */ -int yespower(yespower_local_t *local, +int yespower_hash( yespower_local_t *local, const uint8_t *src, size_t srclen, const yespower_params_t *params, - yespower_binary_t *dst, int thrid ) + void *dst, int thrid ) { yespower_version_t version = params->version; uint32_t N = params->N; @@ -1158,27 +1158,6 @@ int yespower(yespower_local_t *local, return 1; } -/** - * yespower_tls(src, srclen, params, dst): - * Compute yespower(src[0 .. srclen - 1], N, r), to be checked for "< target". - * The memory allocation is maintained internally using thread-local storage. - * - * Return 0 on success; or -1 on error. - */ -int yespower_tls(const uint8_t *src, size_t srclen, - const yespower_params_t *params, yespower_binary_t *dst, int thrid ) -{ - static __thread int initialized = 0; - static __thread yespower_local_t local; - - if (!initialized) { - if (yespower_init_local(&local)) - return -1; - initialized = 1; - } - - return yespower( &local, src, srclen, params, dst, thrid ); -} int yespower_init_local(yespower_local_t *local) { @@ -1190,4 +1169,5 @@ int yespower_free_local(yespower_local_t *local) { return free_region(local); } + #endif diff --git a/algo/yespower/yespower.h b/algo/yespower/yespower.h index 4436780..9c37662 100644 --- a/algo/yespower/yespower.h +++ b/algo/yespower/yespower.h @@ -76,67 +76,21 @@ typedef struct { unsigned char uc[32]; } yespower_binary_t __attribute__ ((aligned (64))); -yespower_params_t yespower_params; +extern yespower_params_t yespower_params; -SHA256_CTX sha256_prehash_ctx; +extern __thread SHA256_CTX sha256_prehash_ctx; -/** - * yespower_init_local(local): - * Initialize the thread-local (RAM) data structure. Actual memory allocation - * is currently fully postponed until a call to yespower(). - * - * Return 0 on success; or -1 on error. - * - * MT-safe as long as local is local to the thread. - */ extern int yespower_init_local(yespower_local_t *local); -/** - * yespower_free_local(local): - * Free memory that may have been allocated for an initialized thread-local - * (RAM) data structure. - * - * Return 0 on success; or -1 on error. - * - * MT-safe as long as local is local to the thread. - */ extern int yespower_free_local(yespower_local_t *local); -/** - * yespower(local, src, srclen, params, dst): - * Compute yespower(src[0 .. srclen - 1], N, r), to be checked for "< target". - * local is the thread-local data structure, allowing to preserve and reuse a - * memory allocation across calls, thereby reducing processing overhead. - * - * Return 0 on success; or -1 on error. - * - * local must be initialized with yespower_init_local(). - * - * MT-safe as long as local and dst are local to the thread. - */ -extern int yespower(yespower_local_t *local, +extern int yespower_hash(yespower_local_t *local, const uint8_t *src, size_t srclen, - const yespower_params_t *params, yespower_binary_t *dst, int thrid); + const yespower_params_t *params, void *dst, int thrid); -extern int yespower_b2b(yespower_local_t *local, +extern int yespower_b2b_hash(yespower_local_t *local, const uint8_t *src, size_t srclen, - const yespower_params_t *params, yespower_binary_t *dst, int thrid ); - -/** - * yespower_tls(src, srclen, params, dst): - * Compute yespower(src[0 .. srclen - 1], N, r), to be checked for "< target". - * The memory allocation is maintained internally using thread-local storage. - * - * Return 0 on success; or -1 on error. - * - * MT-safe as long as dst is local to the thread. - */ -extern int yespower_tls(const uint8_t *src, size_t srclen, - const yespower_params_t *params, yespower_binary_t *dst, int thr_id); - -extern int yespower_b2b_tls(const uint8_t *src, size_t srclen, - const yespower_params_t *params, yespower_binary_t *dst, int thr_id); - + const yespower_params_t *params, void *dst, int thrid ); #if defined(__AVX2__) @@ -149,7 +103,6 @@ extern int yespower_8way( yespower_local_t *local, const __m256i *src, size_t srclen, const yespower_params_t *params, yespower_8way_binary_t *dst, int thrid ); - extern int yespower_8way_tls( const __m256i *src, size_t srclen, const yespower_params_t *params, yespower_8way_binary_t *dst, int thr_id ); diff --git a/configure b/configure index c66f4d9..f6854b0 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.7. +# Generated by GNU Autoconf 2.69 for cpuminer-opt 3.12.8. # # # 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.7' -PACKAGE_STRING='cpuminer-opt 3.12.7' +PACKAGE_VERSION='3.12.8' +PACKAGE_STRING='cpuminer-opt 3.12.8' 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.7 to adapt to many kinds of systems. +\`configure' configures cpuminer-opt 3.12.8 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.7:";; + short | recursive ) echo "Configuration of cpuminer-opt 3.12.8:";; 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.7 +cpuminer-opt configure 3.12.8 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.7, which was +It was created by cpuminer-opt $as_me 3.12.8, 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.7' + VERSION='3.12.8' 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.7, which was +This file was extended by cpuminer-opt $as_me 3.12.8, 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.7 +cpuminer-opt config.status 3.12.8 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 4184b18..a8215a9 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([cpuminer-opt], [3.12.7]) +AC_INIT([cpuminer-opt], [3.12.8]) AC_PREREQ([2.59c]) AC_CANONICAL_SYSTEM diff --git a/cpu-miner.c b/cpu-miner.c index bd97641..39feae3 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -196,9 +196,8 @@ static uint64_t reject_sum = 0; static uint64_t solved_sum = 0; static double norm_diff_sum = 0.; static uint32_t last_block_height = 0; -static double highest_share = 0; // all shares include discard and reject -static double lowest_share = 9e99; // lowest accepted -//static bool new_job = false; +static double highest_share = 0; // highest accepted share diff +static double lowest_share = 9e99; // lowest accepted share diff static double last_targetdiff = 0.; #if !(defined(__WINDOWS__) || defined(_WIN64) || defined(_WIN32)) static uint32_t hi_temp = 0; @@ -212,7 +211,6 @@ static char const short_options[] = "a:b:Bc:CDf:hK:m:n:N:p:Px:qr:R:s:t:T:o:u:O:V"; static struct work g_work __attribute__ ((aligned (64))) = {{ 0 }}; -//static struct work tmp_work; time_t g_work_time = 0; static pthread_mutex_t g_work_lock; static bool submit_old = false; @@ -453,7 +451,7 @@ static bool work_decode( const json_t *val, struct work *work ) return false; if ( !allow_mininginfo ) net_diff = algo_gate.calc_network_diff( work ); - work->targetdiff = target_to_diff( work->target ); + work->targetdiff = hash_to_diff( work->target ); stratum_diff = last_targetdiff = work->targetdiff; work->sharediff = 0; algo_gate.decode_extra_data( work, &net_blocks ); @@ -908,10 +906,13 @@ static inline void sprintf_et( char *str, int seconds ) else // 0m00s sprintf( str, "%um%02us", min, sec ); } - -const double exp32 = 4294967296.; // 2**32 -const double exp48 = 4294967296. * 65536.; // 2**48 -const double exp64 = 4294967296. * 4294967296.; // 2**64 + +const long double exp32 = EXP32; // 2**32 +const long double exp48 = EXP32 * EXP16; // 2**48 +const long double exp64 = EXP32 * EXP32; // 2**64 +const long double exp96 = EXP32 * EXP32 * EXP32; // 2**96 +const long double exp128 = EXP32 * EXP32 * EXP32 * EXP32; // 2**128 +const long double exp160 = EXP32 * EXP32 * EXP32 * EXP32 * EXP16; // 2**160 struct share_stats_t { @@ -970,8 +971,9 @@ void report_summary_log( bool force ) double shrate = share_time == 0. ? 0. : exp32 * last_targetdiff * (double)(accepts) / share_time; double sess_hrate = uptime.tv_sec == 0. ? 0. : exp32 * norm_diff_sum - / (double)uptime.tv_sec; - double submit_rate = share_time == 0. ? 0. : (double)submits*60. / share_time; + / (double)uptime.tv_sec; + double submit_rate = share_time == 0. ? 0. : (double)submits*60. + / share_time; char shr_units[4] = {0}; char ghr_units[4] = {0}; char sess_hr_units[4] = {0}; @@ -1081,7 +1083,8 @@ static int share_result( int result, struct work *work, if ( likely( result ) ) { accepted_share_count++; - if ( my_stats.share_diff < lowest_share ) + if ( ( my_stats.share_diff > 0. ) + && ( my_stats.share_diff < lowest_share ) ) lowest_share = my_stats.share_diff; if ( my_stats.share_diff > highest_share ) highest_share = my_stats.share_diff; @@ -1119,7 +1122,6 @@ static int share_result( int result, struct work *work, rejected_share_count++; sprintf( sres, "S%d", stale_share_count ); sprintf( rres, "Rejected %d" , rejected_share_count ); -// lowdiff_debug = true; } } @@ -1186,19 +1188,17 @@ static int share_result( int result, struct work *work, applog( LOG_WARNING, "Reject reason: %s", reason ); // display share hash and target for troubleshooting - diff_to_target( str, my_stats.share_diff ); - applog2( LOG_INFO, "Hash: %08x%08x%08x%08x...", - str[7], str[6], str[5], str[4] ); + diff_to_hash( str, my_stats.share_diff ); + applog2( LOG_INFO, "Hash: %08x%08x%08x...", str[7], str[6], str[5] ); uint32_t *targ; if ( work ) targ = work->target; else { - diff_to_target( str, my_stats.target_diff ); + diff_to_hash( str, my_stats.target_diff ); targ = &str[0]; } - applog2( LOG_INFO, "Target: %08x%08x%08x%08x...", - targ[7], targ[6], targ[5], targ[4] ); + applog2( LOG_INFO, "Target: %08x%08x%08x...", targ[7], targ[6], targ[5] ); } return 1; } @@ -1312,7 +1312,6 @@ char* std_malloc_txs_request( struct work *work ) json_t *val; char data_str[2 * sizeof(work->data) + 1]; int i; - int datasize = work->sapling ? 112 : 80; for ( i = 0; i < ARRAY_SIZE(work->data); i++ ) @@ -1681,7 +1680,7 @@ static bool get_work(struct thr_info *thr, struct work *work) return true; } -bool submit_work( struct thr_info *thr, const struct work *work_in ) +static bool submit_work( struct thr_info *thr, const struct work *work_in ) { struct workio_cmd *wc; @@ -1705,20 +1704,8 @@ err_out: return false; } -/* -// __float128? -// Convert little endian 256 bit (38 decimal digits) unsigned integer to -// double precision floating point with 15 decimal digits precision. -static inline double u256_to_double( const uint64_t *u ) -{ - return ( ( u[3] * exp64 + u[2] ) * exp64 + u[1] ) * exp64 + u[0]; -} -*/ - static void update_submit_stats( struct work *work, const void *hash ) { -// work->sharediff = hash ? exp32 / ( (uint64_t*)hash )[3] : 0.; - pthread_mutex_lock( &stats_lock ); submitted_share_count++; @@ -1738,19 +1725,17 @@ static void update_submit_stats( struct work *work, const void *hash ) bool submit_solution( struct work *work, const void *hash, struct thr_info *thr ) { - work->sharediff = hash ? exp32 / ( (uint64_t*)hash )[3] : 0.; - + work->sharediff = hash_to_diff( hash ); if ( likely( submit_work( thr, work ) ) ) - { + { update_submit_stats( work, hash ); - if ( !opt_quiet ) { if ( have_stratum ) applog( LOG_NOTICE, "%d Submitted Diff %.5g, Block %d, Job %s", submitted_share_count, work->sharediff, work->height, work->job_id ); - else + else applog( LOG_NOTICE, "%d Submitted Diff %.5g, Block %d, Ntime %08x", submitted_share_count, work->sharediff, work->height, work->data[ algo_gate.ntime_index ] ); @@ -1766,49 +1751,10 @@ bool submit_solution( struct work *work, const void *hash, t[7],t[6],t[5],t[4],t[3],t[2],t[1],t[0]); } return true; - } - else + } + else applog( LOG_WARNING, "%d failed to submit share", submitted_share_count ); - return false; -} - -// deprecated, use submit_solution -bool submit_lane_solution( struct work *work, const void *hash, - struct thr_info *thr, const int lane ) -{ - work->sharediff = hash ? exp32 / ( (uint64_t*)hash )[3] : 0.; - - if ( likely( submit_work( thr, work ) ) ) - { - update_submit_stats( work, hash ); - - if ( !opt_quiet ) - { - if ( have_stratum ) - applog( LOG_NOTICE, "%d Submitted Diff %.5g, Block %d, Job %s", - submitted_share_count, work->sharediff, work->height, - work->job_id ); - else - applog( LOG_NOTICE, "%d Submitted Diff %.5g, Block %d, Ntime %08x", - submitted_share_count, work->sharediff, work->height, - work->data[ algo_gate.ntime_index ] ); - } - - 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 - applog( LOG_WARNING, "%d failed to submit share", submitted_share_count ); - - return false; + return false; } static bool wanna_mine(int thr_id) @@ -1914,8 +1860,6 @@ void std_get_new_work( struct work* work, struct work* g_work, int thr_id, work_free( work ); work_copy( work, g_work ); *nonceptr = 0xffffffffU / opt_n_threads * thr_id; -// if ( opt_randomize ) -// *nonceptr += ( (rand() *4 ) & UINT32_MAX ) / opt_n_threads; *end_nonce_ptr = ( 0xffffffffU / opt_n_threads ) * (thr_id+1) - 0x20; } else @@ -1933,6 +1877,108 @@ bool std_ready_to_mine( struct work* work, struct stratum_ctx* stratum, return true; } +static void stratum_gen_work( struct stratum_ctx *sctx, struct work *g_work ) +{ + pthread_mutex_lock( &sctx->work_lock ); + free( g_work->job_id ); + g_work->job_id = strdup( sctx->job.job_id ); + g_work->xnonce2_len = sctx->xnonce2_size; + g_work->xnonce2 = (uchar*) realloc( g_work->xnonce2, sctx->xnonce2_size ); + memcpy( g_work->xnonce2, sctx->job.xnonce2, sctx->xnonce2_size ); + algo_gate.build_extraheader( g_work, sctx ); + net_diff = algo_gate.calc_network_diff( g_work ); + algo_gate.set_work_data_endian( g_work ); + g_work->height = sctx->block_height; + g_work->targetdiff = sctx->job.diff + / ( opt_target_factor * opt_diff_factor ); + diff_to_hash( g_work->target, g_work->targetdiff ); + + pthread_mutex_unlock( &sctx->work_lock ); + + restart_threads(); + + if ( opt_debug ) + { + unsigned char *xnonce2str = abin2hex( g_work->xnonce2, + g_work->xnonce2_len ); + applog( LOG_DEBUG, "DEBUG: job_id='%s' extranonce2=%s ntime=%08x", + g_work->job_id, xnonce2str, swab32( g_work->data[17] ) ); + free( xnonce2str ); + } + + double hr = 0.; + pthread_mutex_lock( &stats_lock ); + + for ( int i = 0; i < opt_n_threads; i++ ) + hr += thr_hashrates[i]; + global_hashrate = hr; + pthread_mutex_unlock( &stats_lock ); + + if ( stratum_diff != sctx->job.diff ) + applog( LOG_BLUE, "New Diff %g, Block %d, Job %s", + sctx->job.diff, sctx->block_height, g_work->job_id ); + else if ( last_block_height != sctx->block_height ) + applog( LOG_BLUE, "New Block %d, Job %s", + sctx->block_height, g_work->job_id ); + else if ( g_work->job_id ) + applog( LOG_BLUE,"New Job %s", g_work->job_id ); + + // Update data and calculate new estimates. + if ( ( stratum_diff != sctx->job.diff ) + || ( last_block_height != sctx->block_height ) ) + { + static bool multipool = false; + if ( stratum.block_height < last_block_height ) multipool = true; + if ( unlikely( !session_first_block ) ) + session_first_block = stratum.block_height; + last_block_height = stratum.block_height; + stratum_diff = sctx->job.diff; + last_targetdiff = g_work->targetdiff; + if ( lowest_share < last_targetdiff ) + lowest_share = 9e99; + + if ( !opt_quiet ) + { + applog2( LOG_INFO, "Diff: Net %.5g, Stratum %.5g, Target %.5g", + net_diff, stratum_diff, g_work->targetdiff ); + + if ( likely( hr > 0. ) ) + { + char hr_units[4] = {0}; + char block_ttf[32]; + char share_ttf[32]; + + sprintf_et( block_ttf, ( net_diff * exp32 ) / hr ); + sprintf_et( share_ttf, g_work->targetdiff * exp32 / hr ); + scale_hash_for_display ( &hr, hr_units ); + applog2( LOG_INFO, "TTF @ %.2f %sh/s: Block %s, Share %s", + hr, hr_units, block_ttf, share_ttf ); + + if ( !multipool && last_block_height > session_first_block ) + { + struct timeval now, et; + gettimeofday( &now, NULL ); + timeval_subtract( &et, &now, &session_start ); + uint64_t net_ttf = + ( last_block_height - session_first_block ) == 0 ? 0 + : et.tv_sec / ( last_block_height - session_first_block ); + if ( net_diff && net_ttf ) + { + double net_hr = net_diff * exp32 / net_ttf; +// char net_ttf_str[32]; + char net_hr_units[4] = {0}; + +// sprintf_et( net_ttf_str, net_ttf ); + scale_hash_for_display ( &net_hr, net_hr_units ); + applog2( LOG_INFO, "Net hash rate (est) %.2f %sh/s", + net_hr, net_hr_units ); + } + } + } // hr > 0 + } // !quiet + } // new diff/block +} + static void *miner_thread( void *userdata ) { struct work work __attribute__ ((aligned (64))) ; @@ -2053,7 +2099,7 @@ static void *miner_thread( void *userdata ) pthread_mutex_lock( &g_work_lock ); if ( *nonceptr >= end_nonce ) - algo_gate.stratum_gen_work( &stratum, &g_work ); + stratum_gen_work( &stratum, &g_work ); algo_gate.get_new_work( &work, &g_work, thr_id, &end_nonce ); pthread_mutex_unlock( &g_work_lock ); } @@ -2104,14 +2150,6 @@ static void *miner_thread( void *userdata ) else // getwork inline max64 = opt_scantime * thr_hashrates[thr_id]; -/* - if ( have_stratum ) - max64 = LP_SCANTIME; - else - max64 = g_work_time + ( have_longpoll ? LP_SCANTIME : opt_scantime ) - - time(NULL); -*/ - // time limit if ( unlikely( opt_time_limit && firstwork_time ) ) { @@ -2144,7 +2182,6 @@ static void *miner_thread( void *userdata ) // Initial value arbitrarilly set to 1000 just to get // a sample hashrate for the next time. uint32_t work_nonce = *nonceptr; -// max64 = 60 * thr_hashrates[thr_id]; if ( max64 <= 0) max64 = 1000; if ( work_nonce + max64 > end_nonce ) @@ -2531,106 +2568,6 @@ void std_build_extraheader( struct work* g_work, struct stratum_ctx* sctx ) sctx->job.final_sapling_hash ); } -void std_stratum_gen_work( struct stratum_ctx *sctx, struct work *g_work ) -{ - pthread_mutex_lock( &sctx->work_lock ); - free( g_work->job_id ); - g_work->job_id = strdup( sctx->job.job_id ); - g_work->xnonce2_len = sctx->xnonce2_size; - g_work->xnonce2 = (uchar*) realloc( g_work->xnonce2, sctx->xnonce2_size ); - memcpy( g_work->xnonce2, sctx->job.xnonce2, sctx->xnonce2_size ); - algo_gate.build_extraheader( g_work, sctx ); - net_diff = algo_gate.calc_network_diff( g_work ); - algo_gate.set_work_data_endian( g_work ); - g_work->height = sctx->block_height; - g_work->targetdiff = sctx->job.diff - / ( opt_target_factor * opt_diff_factor ); - diff_to_target( g_work->target, g_work->targetdiff ); - - pthread_mutex_unlock( &sctx->work_lock ); - - restart_threads(); - - if ( opt_debug ) - { - unsigned char *xnonce2str = abin2hex( g_work->xnonce2, - g_work->xnonce2_len ); - applog( LOG_DEBUG, "DEBUG: job_id='%s' extranonce2=%s ntime=%08x", - g_work->job_id, xnonce2str, swab32( g_work->data[17] ) ); - free( xnonce2str ); - } - - double hr = 0.; - pthread_mutex_lock( &stats_lock ); - - for ( int i = 0; i < opt_n_threads; i++ ) - hr += thr_hashrates[i]; - global_hashrate = hr; - pthread_mutex_unlock( &stats_lock ); - - if ( stratum_diff != sctx->job.diff ) - applog( LOG_BLUE, "New Diff %g, Block %d, Job %s", - sctx->job.diff, sctx->block_height, g_work->job_id ); - else if ( last_block_height != sctx->block_height ) - applog( LOG_BLUE, "New Block %d, Job %s", - sctx->block_height, g_work->job_id ); - else if ( g_work->job_id ) - applog( LOG_BLUE,"New Job %s", g_work->job_id ); - - // Update data and calculate new estimates. - if ( ( stratum_diff != sctx->job.diff ) - || ( last_block_height != sctx->block_height ) ) - { - static bool multipool = false; - if ( stratum.block_height < last_block_height ) multipool = true; - if ( unlikely( !session_first_block ) ) - session_first_block = stratum.block_height; - last_block_height = stratum.block_height; - stratum_diff = sctx->job.diff; - last_targetdiff = g_work->targetdiff; - - if ( !opt_quiet ) - { - applog2( LOG_INFO, "Diff: Net %.5g, Stratum %.5g, Target %.5g", - net_diff, stratum_diff, g_work->targetdiff ); - - if ( likely( hr > 0. ) ) - { - char hr_units[4] = {0}; - char block_ttf[32]; - char share_ttf[32]; - - sprintf_et( block_ttf, ( net_diff * exp32 ) / hr ); - sprintf_et( share_ttf, g_work->targetdiff * exp32 / hr ); - scale_hash_for_display ( &hr, hr_units ); - applog2( LOG_INFO, "TTF @ %.2f %sh/s: Block %s, Share %s", - hr, hr_units, block_ttf, share_ttf ); - - if ( !multipool && last_block_height > session_first_block ) - { - struct timeval now, et; - gettimeofday( &now, NULL ); - timeval_subtract( &et, &now, &session_start ); - uint64_t net_ttf = - ( last_block_height - session_first_block ) == 0 ? 0 - : et.tv_sec / ( last_block_height - session_first_block ); - if ( net_diff && net_ttf ) - { - double net_hr = net_diff * exp32 / net_ttf; -// char net_ttf_str[32]; - char net_hr_units[4] = {0}; - -// sprintf_et( net_ttf_str, net_ttf ); - scale_hash_for_display ( &net_hr, net_hr_units ); - applog2( LOG_INFO, "Net hash rate (est) %.2f %sh/s", - net_hr, net_hr_units ); - } - } - } // hr > 0 - } // !quiet - } // new diff/block -} - static void *stratum_thread(void *userdata ) { struct thr_info *mythr = (struct thr_info *) userdata; @@ -2692,10 +2629,10 @@ static void *stratum_thread(void *userdata ) if ( stratum.job.job_id && ( !g_work_time || strcmp( stratum.job.job_id, g_work.job_id ) ) ) { - pthread_mutex_lock(&g_work_lock); - algo_gate.stratum_gen_work( &stratum, &g_work ); - time(&g_work_time); - pthread_mutex_unlock(&g_work_lock); + pthread_mutex_lock( &g_work_lock ); + stratum_gen_work( &stratum, &g_work ); + time( &g_work_time ); + pthread_mutex_unlock( &g_work_lock ); restart_threads(); } @@ -3564,7 +3501,7 @@ int main(int argc, char *argv[]) } // Initialize stats times and counters - memset( share_stats, 0, 2 * sizeof (struct share_stats_t) ); + memset( share_stats, 0, s_stats_size * sizeof (struct share_stats_t) ); gettimeofday( &last_submit_time, NULL ); memcpy( &five_min_start, &last_submit_time, sizeof (struct timeval) ); memcpy( &session_start, &last_submit_time, sizeof (struct timeval) ); diff --git a/miner.h b/miner.h index 3e609c8..c4cabfc 100644 --- a/miner.h +++ b/miner.h @@ -322,16 +322,20 @@ int timeval_subtract( struct timeval *result, struct timeval *x, // // diff_to_hash = 2**32 = 0x100000000 = 4294967296 = exp32; -const double exp32; // 2**32 -const double exp48; // 2**48 -const double exp64; // 2**64 +#define EXP16 65536. +#define EXP32 4294967296. +const long double exp32; // 2**32 +const long double exp48; // 2**48 +const long double exp64; // 2**64 +const long double exp96; // 2**96 +const long double exp128; // 2**128 +const long double exp160; // 2**160 bool fulltest( const uint32_t *hash, const uint32_t *target ); bool valid_hash( const void*, const void* ); -void work_set_target( struct work* work, double diff ); -double target_to_diff( uint32_t* target ); -extern void diff_to_target( uint32_t *target, double diff ); +double hash_to_diff( const void* ); +extern void diff_to_hash( uint32_t*, const double ); double hash_target_ratio( uint32_t* hash, uint32_t* target ); void work_set_target_ratio( struct work* work, const void *hash ); @@ -344,21 +348,12 @@ struct thr_info { struct cpu_info cpu; }; -//struct thr_info *thr_info; - -void test_hash_and_submit( struct work *work, const void *hash, - struct thr_info *thr ); +//int test_hash_and_submit( struct work *work, const void *hash, +// struct thr_info *thr ); bool submit_solution( struct work *work, const void *hash, struct thr_info *thr ); -// deprecated -bool submit_lane_solution( struct work *work, const void *hash, - struct thr_info *thr, const int lane ); - -bool submit_work( struct thr_info *thr, const struct work *work_in ); - - void get_currentalgo( char* buf, int sz ); /* bool has_sha(); @@ -541,9 +536,6 @@ enum algos { ALGO_BMW, ALGO_BMW512, ALGO_C11, - ALGO_CRYPTOLIGHT, - ALGO_CRYPTONIGHT, - ALGO_CRYPTONIGHTV7, ALGO_DECRED, ALGO_DEEP, ALGO_DMD_GR, @@ -635,9 +627,6 @@ static const char* const algo_names[] = { "bmw", "bmw512", "c11", - "cryptolight", - "cryptonight", - "cryptonightv7", "decred", "deep", "dmd-gr", @@ -794,9 +783,6 @@ Options:\n\ bmw BMW 256\n\ bmw512 BMW 512\n\ c11 Chaincoin\n\ - cryptolight Cryptonight-light\n\ - cryptonight Cryptonote legacy\n\ - cryptonightv7 variant 7, Monero (XMR)\n\ decred Blake256r14dcr\n\ deep Deepcoin (DCN)\n\ dmd-gr Diamond\n\ @@ -812,8 +798,8 @@ Options:\n\ lyra2re lyra2\n\ lyra2rev2 lyrav2\n\ lyra2rev3 lyrav2v3, Vertcoin\n\ - lyra2z Zcoin (XZC)\n\ - lyra2z330 Lyra2 330 rows, Zoin (ZOI)\n\ + lyra2z\n\ + lyra2z330 Lyra2 330 rows\n\ m7m Magi (XMG)\n\ myr-gr Myriad-Groestl\n\ neoscrypt NeoScrypt(128, 2, 1)\n\ @@ -853,7 +839,7 @@ Options:\n\ x14 X14\n\ x15 X15\n\ x16r\n\ - x16rv2 Ravencoin (RVN)\n\ + x16rv2\n\ x16rt Gincoin (GIN)\n\ x16rt-veil Veil (VEIL)\n\ x16s\n\ diff --git a/simd-utils/simd-128.h b/simd-utils/simd-128.h index 6e32965..986304c 100644 --- a/simd-utils/simd-128.h +++ b/simd-utils/simd-128.h @@ -273,6 +273,20 @@ static inline void memcpy_128( __m128i *dst, const __m128i *src, const int n ) #define mm128_ror_1x32( v ) _mm_shuffle_epi32( v, 0x39 ) #define mm128_rol_1x32( v ) _mm_shuffle_epi32( v, 0x93 ) + +//#define mm128_swap_64( v ) _mm_alignr_epi8( v, v, 8 ) +//#define mm128_ror_1x32( v ) _mm_alignr_epi8( v, v, 4 ) +//#define mm128_rol_1x32( v ) _mm_alignr_epi8( v, v, 12 ) +#define mm128_ror_1x16( v ) _mm_alignr_epi8( v, v, 2 ) +#define mm128_rol_1x16( v ) _mm_alignr_epi8( v, v, 14 ) +#define mm128_ror_1x8( v ) _mm_alignr_epi8( v, v, 1 ) +#define mm128_rol_1x8( v ) _mm_alignr_epi8( v, v, 15 ) + +#define mm128_ror_x8( v, c ) _mm_alignr_epi8( v, c ) +#define mm128_rol_x8( v, c ) _mm_alignr_epi8( v, 16-(c) ) + + +/* // Rotate 16 byte (128 bit) vector by c bytes. // Less efficient using shift but more versatile. Use only for odd number // byte rotations. Use shuffle above whenever possible. @@ -312,6 +326,8 @@ static inline void memcpy_128( __m128i *dst, const __m128i *src, const int n ) _mm_or_si128( _mm_slli_si128( v, 1 ), _mm_srli_si128( v, 15 ) ) #endif // SSE3 else SSE2 +*/ + // Invert vector: {3,2,1,0} -> {0,1,2,3} #define mm128_invert_32( v ) _mm_shuffle_epi32( v, 0x1b ) @@ -331,7 +347,7 @@ static inline void memcpy_128( __m128i *dst, const __m128i *src, const int n ) // // Rotate elements within lanes. -#define mm128_swap_64_32( v ) _mm_shuffle_epi32( v, 0xb1 ) +#define mm128_swap64_32( v ) _mm_shuffle_epi32( v, 0xb1 ) #define mm128_rol64_8( v, c ) \ _mm_or_si128( _mm_slli_epi64( v, ( ( (c)<<3 ) ), \ diff --git a/simd-utils/simd-256.h b/simd-utils/simd-256.h index e3df440..9a16528 100644 --- a/simd-utils/simd-256.h +++ b/simd-utils/simd-256.h @@ -442,16 +442,19 @@ static inline void memcpy_256( __m256i *dst, const __m256i *src, const int n ) #define mm256_ror128_32( v ) _mm256_shuffle_epi32( v, 0x39 ) -#define mm256_rol128_1x32( v ) _mm256_shuffle_epi32( v, 0x93 ) +#define mm256_rol128_32( v ) _mm256_shuffle_epi32( v, 0x93 ) -// Rotave each 128 bit lane by c elements. +#define mm256_ror128_x8( v, c ) _mm256_alignr_epi8( v, v, c ) + +/* +// Rotate each 128 bit lane by c elements. #define mm256_ror128_8( v, c ) \ _mm256_or_si256( _mm256_bsrli_epi128( v, c ), \ _mm256_bslli_epi128( v, 16-(c) ) ) #define mm256_rol128_8( v, c ) \ _mm256_or_si256( _mm256_bslli_epi128( v, c ), \ _mm256_bsrli_epi128( v, 16-(c) ) ) - +*/ // Rotate elements in each 64 bit lane diff --git a/simd-utils/simd-512.h b/simd-utils/simd-512.h index c7d1a9c..cc1e38c 100644 --- a/simd-utils/simd-512.h +++ b/simd-utils/simd-512.h @@ -511,7 +511,9 @@ static inline void memcpy_512( __m512i *dst, const __m512i *src, const int n ) #define mm512_ror128_32( v ) _mm512_shuffle_epi32( v, 0x39 ) #define mm512_rol128_32( v ) _mm512_shuffle_epi32( v, 0x93 ) +#define mm512_ror128_x8( v, c ) _mm512_alignr_epi8( v, v, c ) +/* // Rotate 128 bit lanes by c bytes, faster than building that monstrous // constant above. #define mm512_ror128_8( v, c ) \ @@ -520,7 +522,7 @@ static inline void memcpy_512( __m512i *dst, const __m512i *src, const int n ) #define mm512_rol128_8( v, c ) \ _mm512_or_si512( _mm512_bslli_epi128( v, c ), \ _mm512_bsrli_epi128( v, 16-(c) ) ) - +*/ // // Rotate elements within 64 bit lanes. diff --git a/util.c b/util.c index 9dfb605..087d677 100644 --- a/util.c +++ b/util.c @@ -44,7 +44,7 @@ #include #endif -#include "miner.h" +//#include "miner.h" #include "elist.h" #include "algo-gate-api.h" @@ -983,24 +983,7 @@ int timeval_subtract(struct timeval *result, struct timeval *x, return x->tv_sec < y->tv_sec; } -// deprecated, use test_hash_and_submit -// Use this when deinterleaved -// do 64 bit test 4 iterations -inline bool valid_hash( const void *hash, const void *target ) -{ - const uint64_t *h = (const uint64_t*)hash; - const uint64_t *t = (const uint64_t*)target; - if ( h[3] > t[3] ) return false; - if ( h[3] < t[3] ) return true; - if ( h[2] > t[2] ) return false; - if ( h[2] < t[2] ) return true; - if ( h[1] > t[1] ) return false; - if ( h[1] < t[1] ) return true; - if ( h[0] > t[0] ) return false; - return true; -} - -// deprecated, use test_hash_and_submit +// Deprecated bool fulltest( const uint32_t *hash, const uint32_t *target ) { int i; @@ -1041,65 +1024,121 @@ bool fulltest( const uint32_t *hash, const uint32_t *target ) return rc; } -void diff_to_target(uint32_t *target, double diff) +// Mathmatically the difficulty is simply the reciprocal of the hash. +// Both are real numbers but the hash (target) is represented as a 256 bit +// number with the upper 32 bits representing the whole integer part and the +// lower 224 bits representing the fractional part: +// target[ 255:224 ] = trunc( 1/diff ) +// target[ 223: 0 ] = frac( 1/diff ) +// +// The 256 bit hash is exact but any floating point representation is not. +// Stratum provides the target difficulty as double precision, inexcact, and +// which must be converted to a hash target. The converted hash target will +// likely be less precise to to inexact input and conversion error. +// converted to 256 bit hash which will also be inexact and likelyless +// accurate to to error in conversion. +// On the other hand getwork provides a 256 bit hash target which is exact. +// +// How much precision is needed? +// +// 128 bit types are implemented in software by the compiler using 64 bit +// hardware resulting in lower performance and more error than would be +// expected with a hardware 128 bit implementtaion. +// Float80 exploits the internals of the FP unit which provide a 64 bit +// mantissa in an 80 bit register with hardware rounding. When the destination +// is double the data is rounded to float64 format. Long double returns all +// 80 bits without rounding and including any accumulated computation error. +// Float80 does not fit efficiently in memory. +// +// 256 bit hash: 76 +// float: 7 (float32, 80 bits with rounding to 32 bits) +// double: 15 (float64, 80 bits with rounding to 64 bits) +// long double 19 (float80, 80 bits with no rounding) +// __float128 33 (128 bits with no rounding) +// uint32_t: 9 +// uint64_t: 19 +// uint128_t 38 +// +// The concept of significant digits doesn't apply to the 256 bit hash +// representation. It's fixed point making leading zeros significant +// Leading zeros count in the 256 bit +// +// Doing calculations with float128 and uint128 increases precision for +// target_to_diff, but doesn't help with stratum diff being limited to +// double precision. Is the extra precision really worth the extra cost? +// +// With double the error rate is 1/1e15, or one hash in every Petahash +// with a very low difficulty, not a likely sitiation. Higher difficulty +// increases the effective precision. Due to the floating nature of the +// decimal point leading zeros aren't counted. +// +// Unfortunately I can't get float128 to work so long double it is. +// All calculations will be done using long double then converted to double. +// This prevent introducing significant new error while taking advantage +// of HW rounding. + +#if defined(GCC_INT128) + +void diff_to_hash( uint32_t *target, const double diff ) { - uint64_t m; - int k; - - for (k = 6; k > 0 && diff > 1.0; k--) - diff /= exp32; - -// diff /= 4294967296.0; - -// m = (uint64_t)(4294901760.0 / diff); - - m = (uint64_t)(exp32 / diff); - - if (m == 0 && k == 6) - memset(target, 0xff, 32); - else { - memset(target, 0, 32); - target[k] = (uint32_t)m; - target[k + 1] = (uint32_t)(m >> 32); - } + uint128_t *targ = (uint128_t*)target; + register long double m = 1. / diff; + targ[0] = 0; + targ[1] = (uint128_t)( m * exp96 ); } -// deprecated -void work_set_target(struct work* work, double diff) +double hash_to_diff( const void *target ) { - diff_to_target( work->target, diff ); - work->targetdiff = diff; + const uint128_t *targ = (const uint128_t*)target; + register long double m = ( (long double)targ[1] / exp96 ); +// + ( (long double)targ[0] / exp160 ); + return (double)( 1. / m ); } -double target_to_diff( uint32_t* target ) +inline bool valid_hash( const void *hash, const void *target ) { - uint64_t *targ = (uint64_t*)target; - // extract 64 bits from target[ 240:176 ] - uint64_t m = ( targ[3] << 16 ) | ( targ[2] >> 48 ); - return m ? (exp48-1.) / (double)m : 0.; + const uint128_t *h = (const uint128_t*)hash; + const uint128_t *t = (const uint128_t*)target; + if ( h[1] > t[1] ) return false; + if ( h[1] < t[1] ) return true; + if ( h[0] > t[0] ) return false; + return true; } -/* -double target_to_diff(uint32_t* target) -{ - uchar* tgt = (uchar*) target; - uint64_t m = - (uint64_t)tgt[29] << 56 | - (uint64_t)tgt[28] << 48 | - (uint64_t)tgt[27] << 40 | - (uint64_t)tgt[26] << 32 | - (uint64_t)tgt[25] << 24 | - (uint64_t)tgt[24] << 16 | - (uint64_t)tgt[23] << 8 | - (uint64_t)tgt[22] << 0; +#else - - if (!m) - return 0.; - else - return (double)0x0000ffff00000000/m; +void diff_to_hash( uint32_t *target, const double diff ) +{ + uint64_t *targ = (uint64_t*)target; + register long double m = ( 1. / diff ) * exp32; + targ[1] = targ[0] = 0; + targ[3] = (uint64_t)m; + targ[2] = (uint64_t)( ( m - (long double)targ[3] ) * exp64 ); } -*/ + +double hash_to_diff( const void *target ) +{ + const uint64_t *targ = (const uint64_t*)target; + register long double m = ( (long double)targ[3] / exp32 ) + + ( (long double)targ[2] / exp96 ); + return (double)( 1. / m ); +} + +inline bool valid_hash( const void *hash, const void *target ) +{ + const uint64_t *h = (const uint64_t*)hash; + const uint64_t *t = (const uint64_t*)target; + if ( h[3] > t[3] ) return false; + if ( h[3] < t[3] ) return true; + if ( h[2] > t[2] ) return false; + if ( h[2] < t[2] ) return true; + if ( h[1] > t[1] ) return false; + if ( h[1] < t[1] ) return true; + if ( h[0] > t[0] ) return false; + return true; +} + +#endif #ifdef WIN32 #define socket_blocks() (WSAGetLastError() == WSAEWOULDBLOCK)