This commit is contained in:
Jay D Dee
2019-06-26 14:16:01 -04:00
parent d6e8d7a46e
commit 0d48d573ce
174 changed files with 1352 additions and 1556 deletions

View File

@@ -134,14 +134,12 @@ cpuminer_SOURCES = \
algo/lyra2/phi2-4way.c \ algo/lyra2/phi2-4way.c \
algo/lyra2/phi2.c \ algo/lyra2/phi2.c \
algo/m7m.c \ algo/m7m.c \
algo/neoscrypt/neoscrypt.c \
algo/nist5/nist5-gate.c \ algo/nist5/nist5-gate.c \
algo/nist5/nist5-4way.c \ algo/nist5/nist5-4way.c \
algo/nist5/nist5.c \ algo/nist5/nist5.c \
algo/nist5/zr5.c \ algo/nist5/zr5.c \
algo/panama/sph_panama.c \ algo/panama/sph_panama.c \
algo/radiogatun/sph_radiogatun.c \ algo/radiogatun/sph_radiogatun.c \
algo/pluck.c \
algo/quark/quark-gate.c \ algo/quark/quark-gate.c \
algo/quark/quark.c \ algo/quark/quark.c \
algo/quark/quark-4way.c \ algo/quark/quark-4way.c \
@@ -162,7 +160,9 @@ cpuminer_SOURCES = \
algo/ripemd/lbry-gate.c \ algo/ripemd/lbry-gate.c \
algo/ripemd/lbry.c \ algo/ripemd/lbry.c \
algo/ripemd/lbry-4way.c \ algo/ripemd/lbry-4way.c \
algo/scrypt.c \ algo/scrypt/scrypt.c \
algo/scrypt/neoscrypt.c \
algo/scrypt/pluck.c \
algo/scryptjane/scrypt-jane.c \ algo/scryptjane/scrypt-jane.c \
algo/sha/sph_sha2.c \ algo/sha/sph_sha2.c \
algo/sha/sph_sha2big.c \ algo/sha/sph_sha2big.c \
@@ -198,7 +198,6 @@ cpuminer_SOURCES = \
algo/whirlpool/sph_whirlpool.c \ algo/whirlpool/sph_whirlpool.c \
algo/whirlpool/whirlpool-hash-4way.c \ algo/whirlpool/whirlpool-hash-4way.c \
algo/whirlpool/whirlpool-gate.c \ algo/whirlpool/whirlpool-gate.c \
algo/whirlpool/whirlpool-4way.c \
algo/whirlpool/whirlpool.c \ algo/whirlpool/whirlpool.c \
algo/whirlpool/whirlpoolx.c \ algo/whirlpool/whirlpoolx.c \
algo/x11/x11-gate.c \ algo/x11/x11-gate.c \

View File

@@ -59,9 +59,6 @@ Supported Algorithms
blake2s Blake-2 S blake2s Blake-2 S
bmw BMW 256 bmw BMW 256
c11 Chaincoin c11 Chaincoin
cryptolight Cryptonight-light
cryptonight
cryptonightv7 Monero (XMR)
decred decred
deep Deepcoin (DCN) deep Deepcoin (DCN)
dmd-gr Diamond-Groestl dmd-gr Diamond-Groestl
@@ -78,9 +75,9 @@ Supported Algorithms
luffa Luffa luffa Luffa
lyra2h Hppcoin lyra2h Hppcoin
lyra2re lyra2 lyra2re lyra2
lyra2rev2 lyra2v2, Vertcoin lyra2rev2 lyra2v2
lyra2rev3 lyrav2v3, Vertcoin lyra2rev3 lyrav2v3, Vertcoin
lyra2z Zcoin (XZC) lyra2z
lyra2z330 Lyra2 330 rows, Zoin (ZOI) lyra2z330 Lyra2 330 rows, Zoin (ZOI)
m7m Magi (XMG) m7m Magi (XMG)
myr-gr Myriad-Groestl myr-gr Myriad-Groestl
@@ -97,6 +94,7 @@ Supported Algorithms
scrypt:N scrypt(N, 1, 1) scrypt:N scrypt(N, 1, 1)
scryptjane:nf scryptjane:nf
sha256d Double SHA-256 sha256d Double SHA-256
sha256q Quad SHA-256, Pyrite (PYE)
sha256t Triple SHA-256, Onecoin (OC) sha256t Triple SHA-256, Onecoin (OC)
shavite3 Shavite3 shavite3 Shavite3
skein Skein+Sha (Skeincoin) skein Skein+Sha (Skeincoin)

View File

@@ -38,6 +38,14 @@ supported.
Change Log Change Log
---------- ----------
v3.9.5
New share reporting information includes calculation of equivalent hhashrate
based on share difficulty, network latency, 5 minute summary.
Per-thread hash rate reports are disabled by default.
New command line option --hash-meter added to enable per-thread hash rates.
v3.9.4 v3.9.4
Faster AVX2 for lyra2v3, quark, anime. Faster AVX2 for lyra2v3, quark, anime.

View File

@@ -71,7 +71,6 @@ bool return_false () { return false; }
void *return_null () { return NULL; } void *return_null () { return NULL; }
void call_error () { printf("ERR: Uninitialized function pointer\n"); } void call_error () { printf("ERR: Uninitialized function pointer\n"); }
void algo_not_tested() void algo_not_tested()
{ {
applog( LOG_WARNING,"Algo %s has not been tested live. It may not work", applog( LOG_WARNING,"Algo %s has not been tested live. It may not work",
@@ -149,111 +148,110 @@ void init_algo_gate( algo_gate_t* gate )
// called by each thread that uses the gate // called by each thread that uses the gate
bool register_algo_gate( int algo, algo_gate_t *gate ) bool register_algo_gate( int algo, algo_gate_t *gate )
{ {
if ( NULL == gate ) if ( NULL == gate )
{ {
applog(LOG_ERR,"FAIL: algo_gate registration failed, NULL gate\n"); applog(LOG_ERR,"FAIL: algo_gate registration failed, NULL gate\n");
return false; return false;
} }
init_algo_gate( gate ); init_algo_gate( gate );
switch (algo) switch (algo)
{ {
case ALGO_ALLIUM: register_allium_algo ( gate ); break; case ALGO_ALLIUM: register_allium_algo ( gate ); break;
case ALGO_ANIME: register_anime_algo ( gate ); break; case ALGO_ANIME: register_anime_algo ( gate ); break;
case ALGO_ARGON2: register_argon2_algo ( gate ); break; case ALGO_ARGON2: register_argon2_algo ( gate ); break;
case ALGO_ARGON2D250: register_argon2d_crds_algo ( gate ); break; case ALGO_ARGON2D250: register_argon2d_crds_algo ( gate ); break;
case ALGO_ARGON2D500: register_argon2d_dyn_algo ( gate ); break; case ALGO_ARGON2D500: register_argon2d_dyn_algo ( gate ); break;
case ALGO_ARGON2D4096: register_argon2d4096_algo ( gate ); break; case ALGO_ARGON2D4096: register_argon2d4096_algo ( gate ); break;
case ALGO_AXIOM: register_axiom_algo ( gate ); break; case ALGO_AXIOM: register_axiom_algo ( gate ); break;
case ALGO_BASTION: register_bastion_algo ( gate ); break; case ALGO_BASTION: register_bastion_algo ( gate ); break;
case ALGO_BLAKE: register_blake_algo ( gate ); break; case ALGO_BLAKE: register_blake_algo ( gate ); break;
case ALGO_BLAKECOIN: register_blakecoin_algo ( gate ); break; case ALGO_BLAKECOIN: register_blakecoin_algo ( gate ); break;
// case ALGO_BLAKE2B: register_blake2b_algo ( gate ); break; // case ALGO_BLAKE2B: register_blake2b_algo ( gate ); break;
case ALGO_BLAKE2S: register_blake2s_algo ( gate ); break; case ALGO_BLAKE2S: register_blake2s_algo ( gate ); break;
case ALGO_C11: register_c11_algo ( gate ); break; case ALGO_C11: register_c11_algo ( gate ); break;
case ALGO_CRYPTOLIGHT: register_cryptolight_algo ( gate ); break; case ALGO_CRYPTOLIGHT: register_cryptolight_algo ( gate ); break;
case ALGO_CRYPTONIGHT: register_cryptonight_algo ( gate ); break; case ALGO_CRYPTONIGHT: register_cryptonight_algo ( gate ); break;
case ALGO_CRYPTONIGHTV7:register_cryptonightv7_algo( gate ); break; case ALGO_CRYPTONIGHTV7: register_cryptonightv7_algo ( gate ); break;
case ALGO_DECRED: register_decred_algo ( gate ); break; case ALGO_DECRED: register_decred_algo ( gate ); break;
case ALGO_DEEP: register_deep_algo ( gate ); break; case ALGO_DEEP: register_deep_algo ( gate ); break;
case ALGO_DMD_GR: register_dmd_gr_algo ( gate ); break; case ALGO_DMD_GR: register_dmd_gr_algo ( gate ); break;
case ALGO_DROP: register_drop_algo ( gate ); break; case ALGO_DROP: register_drop_algo ( gate ); break;
case ALGO_FRESH: register_fresh_algo ( gate ); break; case ALGO_FRESH: register_fresh_algo ( gate ); break;
case ALGO_GROESTL: register_groestl_algo ( gate ); break; case ALGO_GROESTL: register_groestl_algo ( gate ); break;
case ALGO_HEAVY: register_heavy_algo ( gate ); break; case ALGO_HEAVY: register_heavy_algo ( gate ); break;
case ALGO_HMQ1725: register_hmq1725_algo ( gate ); break; case ALGO_HMQ1725: register_hmq1725_algo ( gate ); break;
case ALGO_HODL: register_hodl_algo ( gate ); break; case ALGO_HODL: register_hodl_algo ( gate ); break;
case ALGO_JHA: register_jha_algo ( gate ); break; case ALGO_JHA: register_jha_algo ( gate ); break;
case ALGO_KECCAK: register_keccak_algo ( gate ); break; case ALGO_KECCAK: register_keccak_algo ( gate ); break;
case ALGO_KECCAKC: register_keccakc_algo ( gate ); break; case ALGO_KECCAKC: register_keccakc_algo ( gate ); break;
case ALGO_LBRY: register_lbry_algo ( gate ); break; case ALGO_LBRY: register_lbry_algo ( gate ); break;
case ALGO_LUFFA: register_luffa_algo ( gate ); break; case ALGO_LUFFA: register_luffa_algo ( gate ); break;
case ALGO_LYRA2H: register_lyra2h_algo ( gate ); break; case ALGO_LYRA2H: register_lyra2h_algo ( gate ); break;
case ALGO_LYRA2RE: register_lyra2re_algo ( gate ); break; case ALGO_LYRA2RE: register_lyra2re_algo ( gate ); break;
case ALGO_LYRA2REV2: register_lyra2rev2_algo ( gate ); break; case ALGO_LYRA2REV2: register_lyra2rev2_algo ( gate ); break;
case ALGO_LYRA2REV3: register_lyra2rev3_algo ( gate ); break; case ALGO_LYRA2REV3: register_lyra2rev3_algo ( gate ); break;
case ALGO_LYRA2Z: register_lyra2z_algo ( gate ); break; case ALGO_LYRA2Z: register_lyra2z_algo ( gate ); break;
case ALGO_LYRA2Z330: register_lyra2z330_algo ( gate ); break; case ALGO_LYRA2Z330: register_lyra2z330_algo ( gate ); break;
case ALGO_M7M: register_m7m_algo ( gate ); break; case ALGO_M7M: register_m7m_algo ( gate ); break;
case ALGO_MYR_GR: register_myriad_algo ( gate ); break; case ALGO_MYR_GR: register_myriad_algo ( gate ); break;
case ALGO_NEOSCRYPT: register_neoscrypt_algo ( gate ); break; case ALGO_NEOSCRYPT: register_neoscrypt_algo ( gate ); break;
case ALGO_NIST5: register_nist5_algo ( gate ); break; case ALGO_NIST5: register_nist5_algo ( gate ); break;
case ALGO_PENTABLAKE: register_pentablake_algo ( gate ); break; case ALGO_PENTABLAKE: register_pentablake_algo ( gate ); break;
case ALGO_PHI1612: register_phi1612_algo ( gate ); break; case ALGO_PHI1612: register_phi1612_algo ( gate ); break;
case ALGO_PHI2: register_phi2_algo ( gate ); break; case ALGO_PHI2: register_phi2_algo ( gate ); break;
case ALGO_PLUCK: register_pluck_algo ( gate ); break; case ALGO_PLUCK: register_pluck_algo ( gate ); break;
case ALGO_POLYTIMOS: register_polytimos_algo ( gate ); break; case ALGO_POLYTIMOS: register_polytimos_algo ( gate ); break;
case ALGO_QUARK: register_quark_algo ( gate ); break; case ALGO_QUARK: register_quark_algo ( gate ); break;
case ALGO_QUBIT: register_qubit_algo ( gate ); break; case ALGO_QUBIT: register_qubit_algo ( gate ); break;
case ALGO_SCRYPT: register_scrypt_algo ( gate ); break; case ALGO_SCRYPT: register_scrypt_algo ( gate ); break;
case ALGO_SCRYPTJANE: register_scryptjane_algo ( gate ); break; case ALGO_SCRYPTJANE: register_scryptjane_algo ( gate ); break;
case ALGO_SHA256D: register_sha256d_algo ( gate ); break; case ALGO_SHA256D: register_sha256d_algo ( gate ); break;
case ALGO_SHA256T: register_sha256t_algo ( gate ); break; case ALGO_SHA256Q: register_sha256q_algo ( gate ); break;
case ALGO_SHA256Q: register_sha256q_algo ( gate ); break; case ALGO_SHA256T: register_sha256t_algo ( gate ); break;
case ALGO_SHAVITE3: register_shavite_algo ( gate ); break; case ALGO_SHAVITE3: register_shavite_algo ( gate ); break;
case ALGO_SKEIN: register_skein_algo ( gate ); break; case ALGO_SKEIN: register_skein_algo ( gate ); break;
case ALGO_SKEIN2: register_skein2_algo ( gate ); break; case ALGO_SKEIN2: register_skein2_algo ( gate ); break;
case ALGO_SKUNK: register_skunk_algo ( gate ); break; case ALGO_SKUNK: register_skunk_algo ( gate ); break;
case ALGO_SONOA: register_sonoa_algo ( gate ); break; case ALGO_SONOA: register_sonoa_algo ( gate ); break;
case ALGO_TIMETRAVEL: register_timetravel_algo ( gate ); break; case ALGO_TIMETRAVEL: register_timetravel_algo ( gate ); break;
case ALGO_TIMETRAVEL10: register_timetravel10_algo ( gate ); break; case ALGO_TIMETRAVEL10: register_timetravel10_algo ( gate ); break;
case ALGO_TRIBUS: register_tribus_algo ( gate ); break; case ALGO_TRIBUS: register_tribus_algo ( gate ); break;
case ALGO_VANILLA: register_vanilla_algo ( gate ); break; case ALGO_VANILLA: register_vanilla_algo ( gate ); break;
case ALGO_VELTOR: register_veltor_algo ( gate ); break; case ALGO_VELTOR: register_veltor_algo ( gate ); break;
case ALGO_WHIRLPOOL: register_whirlpool_algo ( gate ); break; case ALGO_WHIRLPOOL: register_whirlpool_algo ( gate ); break;
case ALGO_WHIRLPOOLX: register_whirlpoolx_algo ( gate ); break; case ALGO_WHIRLPOOLX: register_whirlpoolx_algo ( gate ); break;
case ALGO_X11: register_x11_algo ( gate ); break; case ALGO_X11: register_x11_algo ( gate ); break;
case ALGO_X11EVO: register_x11evo_algo ( gate ); break; case ALGO_X11EVO: register_x11evo_algo ( gate ); break;
case ALGO_X11GOST: register_x11gost_algo ( gate ); break; case ALGO_X11GOST: register_x11gost_algo ( gate ); break;
case ALGO_X12: register_x12_algo ( gate ); break; case ALGO_X12: register_x12_algo ( gate ); break;
case ALGO_X13: register_x13_algo ( gate ); break; case ALGO_X13: register_x13_algo ( gate ); break;
case ALGO_X13SM3: register_x13sm3_algo ( gate ); break; case ALGO_X13SM3: register_x13sm3_algo ( gate ); break;
case ALGO_X14: register_x14_algo ( gate ); break; case ALGO_X14: register_x14_algo ( gate ); break;
case ALGO_X15: register_x15_algo ( gate ); break; case ALGO_X15: register_x15_algo ( gate ); break;
case ALGO_X16R: register_x16r_algo ( gate ); break; case ALGO_X16R: register_x16r_algo ( gate ); break;
case ALGO_X16S: register_x16s_algo ( gate ); break; case ALGO_X16S: register_x16s_algo ( gate ); break;
case ALGO_X17: register_x17_algo ( gate ); break; case ALGO_X17: register_x17_algo ( gate ); break;
case ALGO_XEVAN: register_xevan_algo ( gate ); break; case ALGO_XEVAN: register_xevan_algo ( gate ); break;
/* case ALGO_YESCRYPT: register_yescrypt_05_algo ( gate ); break; /* case ALGO_YESCRYPT: register_yescrypt_05_algo ( gate ); break;
case ALGO_YESCRYPTR8: register_yescryptr8_05_algo ( gate ); break; case ALGO_YESCRYPTR8: register_yescryptr8_05_algo ( gate ); break;
case ALGO_YESCRYPTR16: register_yescryptr16_05_algo ( gate ); break; case ALGO_YESCRYPTR16: register_yescryptr16_05_algo ( gate ); break;
case ALGO_YESCRYPTR32: register_yescryptr32_05_algo ( gate ); break; case ALGO_YESCRYPTR32: register_yescryptr32_05_algo ( gate ); break;
*/ */
case ALGO_YESCRYPT: register_yescrypt_algo ( gate ); break; case ALGO_YESCRYPT: register_yescrypt_algo ( gate ); break;
case ALGO_YESCRYPTR8: register_yescryptr8_algo ( gate ); break; case ALGO_YESCRYPTR8: register_yescryptr8_algo ( gate ); break;
case ALGO_YESCRYPTR16: register_yescryptr16_algo ( gate ); break; case ALGO_YESCRYPTR16: register_yescryptr16_algo ( gate ); break;
case ALGO_YESCRYPTR32: register_yescryptr32_algo ( gate ); break; case ALGO_YESCRYPTR32: register_yescryptr32_algo ( gate ); break;
case ALGO_YESPOWER: register_yespower_algo ( gate ); break;
case ALGO_YESPOWERR16: register_yespowerr16_algo ( gate ); break;
case ALGO_ZR5: register_zr5_algo ( gate ); break;
default:
applog(LOG_ERR,"FAIL: algo_gate registration failed, unknown algo %s.\n", algo_names[opt_algo] );
return false;
} // switch
case ALGO_YESPOWER: register_yespower_algo ( gate ); break; // ensure required functions were defined.
case ALGO_YESPOWERR16: register_yespowerr16_algo ( gate ); break;
case ALGO_ZR5: register_zr5_algo ( gate ); break;
default:
applog(LOG_ERR,"FAIL: algo_gate registration failed, unknown algo %s.\n", algo_names[opt_algo] );
return false;
} // switch
// ensure required functions were defined.
if ( gate->scanhash == (void*)&null_scanhash ) if ( gate->scanhash == (void*)&null_scanhash )
{ {
applog(LOG_ERR, "FAIL: Required algo_gate functions undefined\n"); applog(LOG_ERR, "FAIL: Required algo_gate functions undefined\n");
@@ -363,16 +361,16 @@ void get_algo_alias( char** algo_or_alias )
#undef ALIAS #undef ALIAS
#undef PROPER #undef PROPER
// only for parallel when there are lanes.
bool submit_solution( struct work *work, void *hash, bool submit_solution( struct work *work, void *hash,
struct thr_info *thr, int lane ) struct thr_info *thr )
{ {
work_set_target_ratio( work, hash ); work_set_target_ratio( work, hash );
if ( submit_work( thr, work ) ) if ( submit_work( thr, work ) )
{ {
applog( LOG_NOTICE, "Share %d submitted by thread %d, lane %d.", if ( !opt_quiet )
accepted_share_count + rejected_share_count + 1, applog( LOG_NOTICE, "Share %d submitted by thread %d.",
thr->id, lane ); accepted_share_count + rejected_share_count + 1,
thr->id );
return true; return true;
} }
else else
@@ -380,4 +378,20 @@ bool submit_solution( struct work *work, void *hash,
return false; return false;
} }
bool submit_lane_solution( struct work *work, void *hash,
struct thr_info *thr, int lane )
{
work_set_target_ratio( work, hash );
if ( submit_work( thr, work ) )
{
if ( !opt_quiet )
applog( LOG_NOTICE, "Share %d submitted by thread %d, lane %d.",
accepted_share_count + rejected_share_count + 1, thr->id,
lane );
return true;
}
else
applog( LOG_WARNING, "Failed to submit share." );
return false;
}

View File

@@ -116,7 +116,7 @@ typedef struct
// Added a 5th arg for the thread_info structure to replace the int thr id // Added a 5th arg for the thread_info structure to replace the int thr id
// in the first arg. Both will co-exist during the trasition. // in the first arg. Both will co-exist during the trasition.
//int ( *scanhash ) ( int, struct work*, uint32_t, uint64_t* ); //int ( *scanhash ) ( int, struct work*, uint32_t, uint64_t* );
int ( *scanhash ) ( int, struct work*, uint32_t, uint64_t*, struct thr_info* ); int ( *scanhash ) ( struct work*, uint32_t, uint64_t*, struct thr_info* );
// optional unsafe, must be overwritten if algo uses function // optional unsafe, must be overwritten if algo uses function
void ( *hash ) ( void*, const void*, uint32_t ) ; void ( *hash ) ( void*, const void*, uint32_t ) ;
@@ -153,7 +153,6 @@ int ntime_index;
int nbits_index; int nbits_index;
int nonce_index; // use with caution, see warning below int nonce_index; // use with caution, see warning below
int work_cmp_size; int work_cmp_size;
} algo_gate_t; } algo_gate_t;
extern algo_gate_t algo_gate; extern algo_gate_t algo_gate;
@@ -194,9 +193,12 @@ void four_way_not_tested();
// allways returns failure // allways returns failure
int null_scanhash(); int null_scanhash();
// The one and only, a callback for scanhash. // Allow algos to submit from scanhash loop.
bool submit_solution( struct work *work, void *hash, bool submit_solution( struct work *work, void *hash,
struct thr_info *thr, int lane ); struct thr_info *thr );
bool submit_lane_solution( struct work *work, void *hash,
struct thr_info *thr, int lane );
bool submit_work( struct thr_info *thr, const struct work *work_in ); bool submit_work( struct thr_info *thr, const struct work *work_in );

View File

@@ -42,12 +42,14 @@ void argon2hash(void *output, const void *input)
(unsigned char *)output); (unsigned char *)output);
} }
int scanhash_argon2(int thr_id, struct work* work, uint32_t max_nonce, uint64_t *hashes_done) int scanhash_argon2( struct work* work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t _ALIGN(64) endiandata[20]; uint32_t _ALIGN(64) endiandata[20];
uint32_t _ALIGN(64) hash[8]; uint32_t _ALIGN(64) hash[8];
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
int thr_id = mythr->id; // thr_id arg is deprecated
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];

View File

@@ -33,13 +33,14 @@ void argon2d_crds_hash( void *output, const void *input )
argon2_ctx( &context, Argon2_d ); argon2_ctx( &context, Argon2_d );
} }
int scanhash_argon2d_crds( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_argon2d_crds( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t _ALIGN(64) endiandata[20]; uint32_t _ALIGN(64) endiandata[20];
uint32_t _ALIGN(64) hash[8]; uint32_t _ALIGN(64) hash[8];
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
int thr_id = mythr->id; // thr_id arg is deprecated
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
@@ -103,13 +104,14 @@ void argon2d_dyn_hash( void *output, const void *input )
argon2_ctx( &context, Argon2_d ); argon2_ctx( &context, Argon2_d );
} }
int scanhash_argon2d_dyn( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_argon2d_dyn( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t _ALIGN(64) endiandata[20]; uint32_t _ALIGN(64) endiandata[20];
uint32_t _ALIGN(64) hash[8]; uint32_t _ALIGN(64) hash[8];
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
int thr_id = mythr->id; // thr_id arg is deprecated
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
@@ -147,8 +149,8 @@ bool register_argon2d_dyn_algo( algo_gate_t* gate )
// Unitus // Unitus
int scanhash_argon2d4096( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_argon2d4096( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t _ALIGN(64) vhash[8]; uint32_t _ALIGN(64) vhash[8];
uint32_t _ALIGN(64) endiandata[20]; uint32_t _ALIGN(64) endiandata[20];
@@ -157,7 +159,7 @@ int scanhash_argon2d4096( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t n = first_nonce; uint32_t n = first_nonce;
int thr_id = mythr->id; // thr_id arg is deprecated
uint32_t t_cost = 1; // 1 iteration uint32_t t_cost = 1; // 1 iteration
uint32_t m_cost = 4096; // use 4MB uint32_t m_cost = 4096; // use 4MB
uint32_t parallelism = 1; // 1 thread, 2 lanes uint32_t parallelism = 1; // 1 thread, 2 lanes

View File

@@ -9,23 +9,23 @@ bool register_argon2d_crds_algo( algo_gate_t* gate );
void argon2d_crds_hash( void *state, const void *input ); void argon2d_crds_hash( void *state, const void *input );
int scanhash_argon2d_crds( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_argon2d_crds( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
// Dynamic: version = 0x10, m_cost = 500. // Dynamic: version = 0x10, m_cost = 500.
bool register_argon2d_dyn_algo( algo_gate_t* gate ); bool register_argon2d_dyn_algo( algo_gate_t* gate );
void argon2d_dyn_hash( void *state, const void *input ); void argon2d_dyn_hash( void *state, const void *input );
int scanhash_argon2d_dyn( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_argon2d_dyn( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
// Unitus: version = 0x13, m_cost = 4096. // Unitus: version = 0x13, m_cost = 4096.
bool register_argon2d4096_algo( algo_gate_t* gate ); bool register_argon2d4096_algo( algo_gate_t* gate );
int scanhash_argon2d4096( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_argon2d4096( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif

View File

@@ -15,11 +15,11 @@ void blakehash_4way(void *state, const void *input)
memcpy( &ctx, &blake_4w_ctx, sizeof ctx ); memcpy( &ctx, &blake_4w_ctx, sizeof ctx );
blake256r14_4way( &ctx, input + (64<<2), 16 ); blake256r14_4way( &ctx, input + (64<<2), 16 );
blake256r14_4way_close( &ctx, vhash ); blake256r14_4way_close( &ctx, vhash );
mm128_deinterleave_4x32( state, state+32, state+64, state+96, vhash, 256 ); mm128_dintrlv_4x32( state, state+32, state+64, state+96, vhash, 256 );
} }
int scanhash_blake_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_blake_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t vdata[20*4] __attribute__ ((aligned (64))); uint32_t vdata[20*4] __attribute__ ((aligned (64)));
uint32_t hash[8*4] __attribute__ ((aligned (32))); uint32_t hash[8*4] __attribute__ ((aligned (32)));
@@ -29,15 +29,14 @@ int scanhash_blake_4way( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t HTarget = ptarget[7]; uint32_t HTarget = ptarget[7];
uint32_t _ALIGN(32) edata[20]; uint32_t _ALIGN(32) edata[20];
uint32_t n = first_nonce; uint32_t n = first_nonce;
uint32_t *nonces = work->nonces; int thr_id = mythr->id; // thr_id arg is deprecated
int num_found = 0;
if (opt_benchmark) if (opt_benchmark)
HTarget = 0x7f; HTarget = 0x7f;
// we need big endian data... // we need big endian data...
swab32_array( edata, pdata, 20 ); swab32_array( edata, pdata, 20 );
mm128_interleave_4x32( vdata, edata, edata, edata, edata, 640 ); mm128_intrlv_4x32( vdata, edata, edata, edata, edata, 640 );
blake256r14_4way_init( &blake_4w_ctx ); blake256r14_4way_init( &blake_4w_ctx );
blake256r14_4way( &blake_4w_ctx, vdata, 64 ); blake256r14_4way( &blake_4w_ctx, vdata, 64 );
@@ -51,19 +50,17 @@ int scanhash_blake_4way( int thr_id, struct work *work, uint32_t max_nonce,
blakehash_4way( hash, vdata ); blakehash_4way( hash, vdata );
for ( int i = 0; i < 4; i++ ) for ( int i = 0; i < 4; i++ )
if ( (hash+(i<<3))[7] <= HTarget && fulltest( hash+(i<<3), ptarget ) ) if ( (hash+(i<<3))[7] <= HTarget )
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{ {
pdata[19] = n+i; pdata[19] = n+i;
nonces[ num_found++ ] = n+i; submit_lane_solution( work, hash+(i<<3), mythr, i );
work_set_target_ratio( work, hash+(i<<3) );
} }
n += 4; n += 4;
} while ( (num_found == 0) && (n < max_nonce) } while ( (n < max_nonce) && !work_restart[thr_id].restart );
&& !work_restart[thr_id].restart );
*hashes_done = n - first_nonce + 1; *hashes_done = n - first_nonce + 1;
return num_found; return 0;
} }
#endif #endif
@@ -79,13 +76,13 @@ void blakehash_8way( void *state, const void *input )
memcpy( &ctx, &blake_8w_ctx, sizeof ctx ); memcpy( &ctx, &blake_8w_ctx, sizeof ctx );
blake256r14_8way( &ctx, input + (64<<3), 16 ); blake256r14_8way( &ctx, input + (64<<3), 16 );
blake256r14_8way_close( &ctx, vhash ); blake256r14_8way_close( &ctx, vhash );
mm256_deinterleave_8x32( state, state+ 32, state+ 64, state+ 96, mm256_dintrlv_8x32( state, state+ 32, state+ 64, state+ 96,
state+128, state+160, state+192, state+224, state+128, state+160, state+192, state+224,
vhash, 256 ); vhash, 256 );
} }
int scanhash_blake_8way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_blake_8way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t vdata[20*8] __attribute__ ((aligned (64))); uint32_t vdata[20*8] __attribute__ ((aligned (64)));
uint32_t hash[8*8] __attribute__ ((aligned (32))); uint32_t hash[8*8] __attribute__ ((aligned (32)));
@@ -95,8 +92,7 @@ int scanhash_blake_8way( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t HTarget = ptarget[7]; uint32_t HTarget = ptarget[7];
uint32_t _ALIGN(32) edata[20]; uint32_t _ALIGN(32) edata[20];
uint32_t n = first_nonce; uint32_t n = first_nonce;
uint32_t *nonces = work->nonces; int thr_id = mythr->id; // thr_id arg is deprecated
int num_found = 0;
if (opt_benchmark) if (opt_benchmark)
HTarget = 0x7f; HTarget = 0x7f;
@@ -104,7 +100,7 @@ int scanhash_blake_8way( int thr_id, struct work *work, uint32_t max_nonce,
// we need big endian data... // we need big endian data...
swab32_array( edata, pdata, 20 ); swab32_array( edata, pdata, 20 );
mm256_interleave_8x32( vdata, edata, edata, edata, edata, mm256_intrlv_8x32( vdata, edata, edata, edata, edata,
edata, edata, edata, edata, 640 ); edata, edata, edata, edata, 640 );
blake256r14_8way_init( &blake_8w_ctx ); blake256r14_8way_init( &blake_8w_ctx );
@@ -128,17 +124,14 @@ int scanhash_blake_8way( int thr_id, struct work *work, uint32_t max_nonce,
if ( (hash+i)[7] <= HTarget && fulltest( hash+i, ptarget ) ) if ( (hash+i)[7] <= HTarget && fulltest( hash+i, ptarget ) )
{ {
pdata[19] = n+i; pdata[19] = n+i;
num_found++; submit_lane_solution( work, hash+(i<<3), mythr, i );
nonces[i] = n+i;
work_set_target_ratio( work, hash+1 );
} }
n += 8; n += 8;
} while ( (num_found == 0) && (n < max_nonce) } while ( (n < max_nonce) !work_restart[thr_id].restart );
&& !work_restart[thr_id].restart );
*hashes_done = n - first_nonce + 1; *hashes_done = n - first_nonce + 1;
return num_found; return 0;
} }
#endif #endif

View File

@@ -10,12 +10,12 @@
#if defined (BLAKE_4WAY) #if defined (BLAKE_4WAY)
void blakehash_4way(void *state, const void *input); void blakehash_4way(void *state, const void *input);
int scanhash_blake_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_blake_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif
void blakehash( void *state, const void *input ); void blakehash( void *state, const void *input );
int scanhash_blake( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_blake( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif

View File

@@ -39,8 +39,8 @@ void blakehash(void *state, const void *input)
} }
int scanhash_blake( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_blake( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
@@ -49,6 +49,7 @@ int scanhash_blake( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t _ALIGN(32) hash64[8]; uint32_t _ALIGN(32) hash64[8];
uint32_t _ALIGN(32) endiandata[20]; uint32_t _ALIGN(32) endiandata[20];
uint32_t n = first_nonce; uint32_t n = first_nonce;
int thr_id = mythr->id; // thr_id arg is deprecated
ctx_midstate_done = false; ctx_midstate_done = false;

View File

@@ -35,13 +35,14 @@ static void blake2b_hash_end(uint32_t *output, const uint32_t *input)
} }
*/ */
int scanhash_blake2b( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_blake2b( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t _ALIGN(A) vhashcpu[8]; uint32_t _ALIGN(A) vhashcpu[8];
uint32_t _ALIGN(A) endiandata[20]; uint32_t _ALIGN(A) endiandata[20];
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
int thr_id = mythr->id; // thr_id arg is deprecated
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
const uint32_t first_nonce = pdata[8]; const uint32_t first_nonce = pdata[8];

View File

@@ -16,13 +16,13 @@ void blake2s_8way_hash( void *output, const void *input )
blake2s_8way_update( &ctx, input + (64<<3), 16 ); blake2s_8way_update( &ctx, input + (64<<3), 16 );
blake2s_8way_final( &ctx, vhash, BLAKE2S_OUTBYTES ); blake2s_8way_final( &ctx, vhash, BLAKE2S_OUTBYTES );
mm256_deinterleave_8x32( output, output+ 32, output+ 64, output+ 96, mm256_dintrlv_8x32( output, output+ 32, output+ 64, output+ 96,
output+128, output+160, output+192, output+224, output+128, output+160, output+192, output+224,
vhash, 256 ); vhash, 256 );
} }
int scanhash_blake2s_8way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_blake2s_8way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t vdata[20*8] __attribute__ ((aligned (64))); uint32_t vdata[20*8] __attribute__ ((aligned (64)));
uint32_t hash[8*8] __attribute__ ((aligned (32))); uint32_t hash[8*8] __attribute__ ((aligned (32)));
@@ -32,12 +32,11 @@ int scanhash_blake2s_8way( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t n = first_nonce; uint32_t n = first_nonce;
uint32_t *nonces = work->nonces;
int num_found = 0;
uint32_t *noncep = vdata + 152; // 19*8 uint32_t *noncep = vdata + 152; // 19*8
int thr_id = mythr->id; // thr_id arg is deprecated
swab32_array( edata, pdata, 20 ); swab32_array( edata, pdata, 20 );
mm256_interleave_8x32( vdata, edata, edata, edata, edata, mm256_intrlv_8x32( vdata, edata, edata, edata, edata,
edata, edata, edata, edata, 640 ); edata, edata, edata, edata, 640 );
blake2s_8way_init( &blake2s_8w_ctx, BLAKE2S_OUTBYTES ); blake2s_8way_init( &blake2s_8w_ctx, BLAKE2S_OUTBYTES );
blake2s_8way_update( &blake2s_8w_ctx, vdata, 64 ); blake2s_8way_update( &blake2s_8w_ctx, vdata, 64 );
@@ -57,19 +56,18 @@ int scanhash_blake2s_8way( int thr_id, struct work *work, uint32_t max_nonce,
for ( int i = 0; i < 8; i++ ) for ( int i = 0; i < 8; i++ )
if ( (hash+(i<<3))[7] <= Htarg && fulltest( hash+(i<<3), ptarget ) ) if ( (hash+(i<<3))[7] <= Htarg )
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{ {
pdata[19] = n+i; pdata[19] = n+i;
nonces[ num_found++ ] = n+i; submit_lane_solution( work, hash+(i<<3), mythr, i );
work_set_target_ratio( work, hash+(i<<3) );
} }
n += 8; n += 8;
} while ( (num_found == 0) && (n < max_nonce) } while ( (n < max_nonce) && !work_restart[thr_id].restart );
&& !work_restart[thr_id].restart );
*hashes_done = n - first_nonce + 1; *hashes_done = n - first_nonce + 1;
return num_found; return 0;
} }
#elif defined(BLAKE2S_4WAY) #elif defined(BLAKE2S_4WAY)
@@ -85,12 +83,12 @@ void blake2s_4way_hash( void *output, const void *input )
blake2s_4way_update( &ctx, input + (64<<2), 16 ); blake2s_4way_update( &ctx, input + (64<<2), 16 );
blake2s_4way_final( &ctx, vhash, BLAKE2S_OUTBYTES ); blake2s_4way_final( &ctx, vhash, BLAKE2S_OUTBYTES );
mm128_deinterleave_4x32( output, output+32, output+64, output+96, mm128_dintrlv_4x32( output, output+32, output+64, output+96,
vhash, 256 ); vhash, 256 );
} }
int scanhash_blake2s_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_blake2s_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t vdata[20*4] __attribute__ ((aligned (64))); uint32_t vdata[20*4] __attribute__ ((aligned (64)));
uint32_t hash[8*4] __attribute__ ((aligned (32))); uint32_t hash[8*4] __attribute__ ((aligned (32)));
@@ -100,12 +98,11 @@ int scanhash_blake2s_4way( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t n = first_nonce; uint32_t n = first_nonce;
uint32_t *nonces = work->nonces;
int num_found = 0;
uint32_t *noncep = vdata + 76; // 19*4 uint32_t *noncep = vdata + 76; // 19*4
int thr_id = mythr->id; // thr_id arg is deprecated
swab32_array( edata, pdata, 20 ); swab32_array( edata, pdata, 20 );
mm128_interleave_4x32( vdata, edata, edata, edata, edata, 640 ); mm128_intrlv_4x32( vdata, edata, edata, edata, edata, 640 );
blake2s_4way_init( &blake2s_4w_ctx, BLAKE2S_OUTBYTES ); blake2s_4way_init( &blake2s_4w_ctx, BLAKE2S_OUTBYTES );
blake2s_4way_update( &blake2s_4w_ctx, vdata, 64 ); blake2s_4way_update( &blake2s_4w_ctx, vdata, 64 );
@@ -119,19 +116,18 @@ int scanhash_blake2s_4way( int thr_id, struct work *work, uint32_t max_nonce,
blake2s_4way_hash( hash, vdata ); blake2s_4way_hash( hash, vdata );
for ( int i = 0; i < 4; i++ ) for ( int i = 0; i < 4; i++ )
if ( (hash+(i<<3))[7] <= Htarg && fulltest( hash+(i<<3), ptarget ) ) if ( (hash+(i<<3))[7] <= Htarg )
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{ {
pdata[19] = n+i; pdata[19] = n+i;
nonces[ num_found++ ] = n+i; submit_lane_solution( work, hash+(i<<3), mythr, i );
work_set_target_ratio( work, hash+(i<<3) );
} }
n += 4; n += 4;
} while ( (num_found == 0) && (n < max_nonce) } while ( (n < max_nonce) && !work_restart[thr_id].restart );
&& !work_restart[thr_id].restart );
*hashes_done = n - first_nonce + 1; *hashes_done = n - first_nonce + 1;
return num_found; return 0;
} }
#endif #endif

View File

@@ -16,19 +16,19 @@ bool register_blake2s_algo( algo_gate_t* gate );
#if defined(BLAKE2S_8WAY) #if defined(BLAKE2S_8WAY)
void blake2s_8way_hash( void *state, const void *input ); void blake2s_8way_hash( void *state, const void *input );
int scanhash_blake2s_8way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_blake2s_8way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
#elif defined (BLAKE2S_4WAY) #elif defined (BLAKE2S_4WAY)
void blake2s_4way_hash( void *state, const void *input ); void blake2s_4way_hash( void *state, const void *input );
int scanhash_blake2s_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_blake2s_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
#else #else
void blake2s_hash( void *state, const void *input ); void blake2s_hash( void *state, const void *input );
int scanhash_blake2s( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_blake2s( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif

View File

@@ -32,14 +32,15 @@ static void blake2s_hash_end(uint32_t *output, const uint32_t *input)
blake2s_final(&s_ctx, (uint8_t*) output, BLAKE2S_OUTBYTES); blake2s_final(&s_ctx, (uint8_t*) output, BLAKE2S_OUTBYTES);
} }
*/ */
int scanhash_blake2s(int thr_id, struct work *work, int scanhash_blake2s( struct work *work,
uint32_t max_nonce, uint64_t *hashes_done) uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
uint32_t _ALIGN(64) hash64[8]; uint32_t _ALIGN(64) hash64[8];
uint32_t _ALIGN(64) endiandata[20]; uint32_t _ALIGN(64) endiandata[20];
int thr_id = mythr->id; // thr_id arg is deprecated
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];

View File

@@ -17,11 +17,11 @@ void blakecoin_4way_hash(void *state, const void *input)
blake256r8_4way( &ctx, input + (64<<2), 16 ); blake256r8_4way( &ctx, input + (64<<2), 16 );
blake256r8_4way_close( &ctx, vhash ); blake256r8_4way_close( &ctx, vhash );
mm128_deinterleave_4x32( state, state+32, state+64, state+96, vhash, 256 ); mm128_dintrlv_4x32( state, state+32, state+64, state+96, vhash, 256 );
} }
int scanhash_blakecoin_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_blakecoin_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t vdata[20*4] __attribute__ ((aligned (64))); uint32_t vdata[20*4] __attribute__ ((aligned (64)));
uint32_t hash[8*4] __attribute__ ((aligned (32))); uint32_t hash[8*4] __attribute__ ((aligned (32)));
@@ -31,13 +31,12 @@ int scanhash_blakecoin_4way( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t HTarget = ptarget[7]; uint32_t HTarget = ptarget[7];
uint32_t _ALIGN(32) edata[20]; uint32_t _ALIGN(32) edata[20];
uint32_t n = first_nonce; uint32_t n = first_nonce;
uint32_t *nonces = work->nonces; int thr_id = mythr->id; // thr_id arg is deprecated
int num_found = 0;
if ( opt_benchmark ) if ( opt_benchmark )
HTarget = 0x7f; HTarget = 0x7f;
swab32_array( edata, pdata, 20 ); swab32_array( edata, pdata, 20 );
mm128_interleave_4x32( vdata, edata, edata, edata, edata, 640 ); mm128_intrlv_4x32( vdata, edata, edata, edata, edata, 640 );
blake256r8_4way_init( &blakecoin_4w_ctx ); blake256r8_4way_init( &blakecoin_4w_ctx );
blake256r8_4way( &blakecoin_4w_ctx, vdata, 64 ); blake256r8_4way( &blakecoin_4w_ctx, vdata, 64 );
@@ -51,19 +50,18 @@ int scanhash_blakecoin_4way( int thr_id, struct work *work, uint32_t max_nonce,
blakecoin_4way_hash( hash, vdata ); blakecoin_4way_hash( hash, vdata );
for ( int i = 0; i < 4; i++ ) for ( int i = 0; i < 4; i++ )
if ( (hash+(i<<3))[7] <= HTarget && fulltest( hash+(i<<3), ptarget ) ) if ( (hash+(i<<3))[7] <= HTarget && fulltest( hash+(i<<3), ptarget )
&& !opt_benchmark )
{ {
pdata[19] = n+i; pdata[19] = n+i;
nonces[ num_found++ ] = n+i; submit_lane_solution( work, hash+(i<<3), mythr, i );
work_set_target_ratio( work, hash+(i<<3) );
} }
n += 4; n += 4;
} while ( (num_found == 0) && (n < max_nonce) } while ( (n < max_nonce) && !work_restart[thr_id].restart );
&& !work_restart[thr_id].restart );
*hashes_done = n - first_nonce + 1; *hashes_done = n - first_nonce + 1;
return num_found; return 0;
} }
#endif #endif
@@ -81,13 +79,13 @@ void blakecoin_8way_hash( void *state, const void *input )
blake256r8_8way( &ctx, input + (64<<3), 16 ); blake256r8_8way( &ctx, input + (64<<3), 16 );
blake256r8_8way_close( &ctx, vhash ); blake256r8_8way_close( &ctx, vhash );
mm256_deinterleave_8x32( state, state+ 32, state+ 64, state+ 96, mm256_dintrlv_8x32( state, state+ 32, state+ 64, state+ 96,
state+128, state+160, state+192, state+224, state+128, state+160, state+192, state+224,
vhash, 256 ); vhash, 256 );
} }
int scanhash_blakecoin_8way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_blakecoin_8way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t vdata[20*8] __attribute__ ((aligned (64))); uint32_t vdata[20*8] __attribute__ ((aligned (64)));
uint32_t hash[8*8] __attribute__ ((aligned (32))); uint32_t hash[8*8] __attribute__ ((aligned (32)));
@@ -97,15 +95,14 @@ int scanhash_blakecoin_8way( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t HTarget = ptarget[7]; uint32_t HTarget = ptarget[7];
uint32_t _ALIGN(32) edata[20]; uint32_t _ALIGN(32) edata[20];
uint32_t n = first_nonce; uint32_t n = first_nonce;
uint32_t *nonces = work->nonces;
uint32_t *noncep = vdata + 152; // 19*8 uint32_t *noncep = vdata + 152; // 19*8
int num_found = 0; int thr_id = mythr->id; // thr_id arg is deprecated
if ( opt_benchmark ) if ( opt_benchmark )
HTarget = 0x7f; HTarget = 0x7f;
// we need big endian data... // we need big endian data...
swab32_array( edata, pdata, 20 ); swab32_array( edata, pdata, 20 );
mm256_interleave_8x32( vdata, edata, edata, edata, edata, mm256_intrlv_8x32( vdata, edata, edata, edata, edata,
edata, edata, edata, edata, 640 ); edata, edata, edata, edata, 640 );
blake256r8_8way_init( &blakecoin_8w_ctx ); blake256r8_8way_init( &blakecoin_8w_ctx );
blake256r8_8way( &blakecoin_8w_ctx, vdata, 64 ); blake256r8_8way( &blakecoin_8w_ctx, vdata, 64 );
@@ -123,18 +120,17 @@ int scanhash_blakecoin_8way( int thr_id, struct work *work, uint32_t max_nonce,
blakecoin_8way_hash( hash, vdata ); blakecoin_8way_hash( hash, vdata );
for ( int i = 0; i < 8; i++ ) for ( int i = 0; i < 8; i++ )
if ( (hash+(i<<3))[7] <= HTarget && fulltest( hash+(i<<3), ptarget ) ) if ( (hash+(i<<3))[7] <= HTarget && fulltest( hash+(i<<3), ptarget )
&& !opt_benchmark )
{ {
pdata[19] = n+i; pdata[19] = n+i;
nonces[ num_found++ ] = n+i; submit_lane_solution( work, hash+(i<<3), mythr, i );
work_set_target_ratio( work, hash+(i<<3) );
} }
n += 8; n += 8;
} while ( (num_found == 0) && (n < max_nonce) } while ( (n < max_nonce) && !work_restart[thr_id].restart );
&& !work_restart[thr_id].restart );
*hashes_done = n - first_nonce + 1; *hashes_done = n - first_nonce + 1;
return num_found; return 0;
} }
#endif #endif

View File

@@ -13,18 +13,18 @@
#if defined (BLAKECOIN_8WAY) #if defined (BLAKECOIN_8WAY)
void blakecoin_8way_hash(void *state, const void *input); void blakecoin_8way_hash(void *state, const void *input);
int scanhash_blakecoin_8way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_blakecoin_8way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif
#if defined (BLAKECOIN_4WAY) #if defined (BLAKECOIN_4WAY)
void blakecoin_4way_hash(void *state, const void *input); void blakecoin_4way_hash(void *state, const void *input);
int scanhash_blakecoin_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_blakecoin_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif
void blakecoinhash( void *state, const void *input ); void blakecoinhash( void *state, const void *input );
int scanhash_blakecoin( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_blakecoin( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif

View File

@@ -39,13 +39,14 @@ void blakecoinhash( void *state, const void *input )
memcpy( state, hash, 32 ); memcpy( state, hash, 32 );
} }
int scanhash_blakecoin( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_blakecoin( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t HTarget = ptarget[7]; uint32_t HTarget = ptarget[7];
int thr_id = mythr->id; // thr_id arg is deprecated
uint32_t _ALIGN(32) hash64[8]; uint32_t _ALIGN(32) hash64[8];
uint32_t _ALIGN(32) endiandata[20]; uint32_t _ALIGN(32) endiandata[20];

View File

@@ -23,11 +23,11 @@ void decred_hash_4way( void *state, const void *input )
memcpy( &ctx, &blake_mid, sizeof(blake_mid) ); memcpy( &ctx, &blake_mid, sizeof(blake_mid) );
blake256_4way( &ctx, tail, tail_len ); blake256_4way( &ctx, tail, tail_len );
blake256_4way_close( &ctx, vhash ); blake256_4way_close( &ctx, vhash );
mm128_deinterleave_4x32( state, state+32, state+64, state+96, vhash, 256 ); mm128_dintrlv_4x32( state, state+32, state+64, state+96, vhash, 256 );
} }
int scanhash_decred_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_decred_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t vdata[48*4] __attribute__ ((aligned (64))); uint32_t vdata[48*4] __attribute__ ((aligned (64)));
uint32_t hash[8*4] __attribute__ ((aligned (32))); uint32_t hash[8*4] __attribute__ ((aligned (32)));
@@ -37,14 +37,13 @@ int scanhash_decred_4way( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t first_nonce = pdata[DECRED_NONCE_INDEX]; const uint32_t first_nonce = pdata[DECRED_NONCE_INDEX];
uint32_t n = first_nonce; uint32_t n = first_nonce;
const uint32_t HTarget = opt_benchmark ? 0x7f : ptarget[7]; const uint32_t HTarget = opt_benchmark ? 0x7f : ptarget[7];
uint32_t *nonces = work->nonces; int thr_id = mythr->id; // thr_id arg is deprecated
int num_found = 0;
// copy to buffer guaranteed to be aligned. // copy to buffer guaranteed to be aligned.
memcpy( edata, pdata, 180 ); memcpy( edata, pdata, 180 );
// use the old way until new way updated for size. // use the old way until new way updated for size.
mm128_interleave_4x32x( vdata, edata, edata, edata, edata, 180*8 ); mm128_intrlv_4x32x( vdata, edata, edata, edata, edata, 180*8 );
blake256_4way_init( &blake_mid ); blake256_4way_init( &blake_mid );
blake256_4way( &blake_mid, vdata, DECRED_MIDSTATE_LEN ); blake256_4way( &blake_mid, vdata, DECRED_MIDSTATE_LEN );
@@ -59,18 +58,17 @@ int scanhash_decred_4way( int thr_id, struct work *work, uint32_t max_nonce,
decred_hash_4way( hash, vdata ); decred_hash_4way( hash, vdata );
for ( int i = 0; i < 4; i++ ) for ( int i = 0; i < 4; i++ )
if ( (hash+(i<<3))[7] <= HTarget && fulltest( hash+(i<<3), ptarget ) ) if ( (hash+(i<<3))[7] <= HTarget )
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{ {
pdata[DECRED_NONCE_INDEX] = n+i; pdata[DECRED_NONCE_INDEX] = n+i;
nonces[ num_found++ ] = n+i; submit_lane_solution( work, hash+(i<<3), mythr, i );
work_set_target_ratio( work, hash+(i<<3) );
} }
n += 4; n += 4;
} while ( (num_found == 0) && (n < max_nonce) } while ( (n < max_nonce) && !work_restart[thr_id].restart );
&& !work_restart[thr_id].restart );
*hashes_done = n - first_nonce + 1; *hashes_done = n - first_nonce + 1;
return num_found; return 0;
} }
#endif #endif

View File

@@ -14,7 +14,7 @@
#if defined (__AVX2__) #if defined (__AVX2__)
//void blakehash_84way(void *state, const void *input); //void blakehash_84way(void *state, const void *input);
//int scanhash_blake_8way( int thr_id, struct work *work, uint32_t max_nonce, //int scanhash_blake_8way( struct work *work, uint32_t max_nonce,
// uint64_t *hashes_done ); // uint64_t *hashes_done );
#endif #endif
@@ -24,13 +24,13 @@
#if defined (DECRED_4WAY) #if defined (DECRED_4WAY)
void decred_hash_4way(void *state, const void *input); void decred_hash_4way(void *state, const void *input);
int scanhash_decred_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_decred_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif
void decred_hash( void *state, const void *input ); void decred_hash( void *state, const void *input );
int scanhash_decred( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_decred( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif

View File

@@ -52,12 +52,14 @@ void decred_hash_simple(void *state, const void *input)
sph_blake256_close(&ctx, state); sph_blake256_close(&ctx, state);
} }
int scanhash_decred(int thr_id, struct work *work, uint32_t max_nonce, uint64_t *hashes_done) int scanhash_decred( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t _ALIGN(64) endiandata[48]; uint32_t _ALIGN(64) endiandata[48];
uint32_t _ALIGN(64) hash32[8]; uint32_t _ALIGN(64) hash32[8];
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
int thr_id = mythr->id; // thr_id arg is deprecated
// #define DCR_NONCE_OFT32 35 // #define DCR_NONCE_OFT32 35

View File

@@ -14,7 +14,7 @@
extern void pentablakehash_4way( void *output, const void *input ) extern void pentablakehash_4way( void *output, const void *input )
{ {
unsigned char _ALIGN(32) hash[128]; // unsigned char _ALIGN(32) hash[128];
// // same as uint32_t hashA[16], hashB[16]; // // same as uint32_t hashA[16], hashB[16];
// #define hashB hash+64 // #define hashB hash+64
@@ -29,7 +29,7 @@ extern void pentablakehash_4way( void *output, const void *input )
blake512_4way_init( &ctx ); blake512_4way_init( &ctx );
blake512_4way( &ctx, input, 80 ); blake512_4way( &ctx, input, 80 );
blake512_4way_close( &ctx, vhash ); blake512_4way_close( &ctx, vhash );
/*
uint64_t sin0[10], sin1[10], sin2[10], sin3[10]; uint64_t sin0[10], sin1[10], sin2[10], sin3[10];
mm256_deinterleave_4x64( sin0, sin1, sin2, sin3, input, 640 ); mm256_deinterleave_4x64( sin0, sin1, sin2, sin3, input, 640 );
sph_blake512_context ctx2_blake; sph_blake512_context ctx2_blake;
@@ -37,14 +37,14 @@ sph_blake512_init(&ctx2_blake);
sph_blake512(&ctx2_blake, sin0, 80); sph_blake512(&ctx2_blake, sin0, 80);
sph_blake512_close(&ctx2_blake, (void*) hash); sph_blake512_close(&ctx2_blake, (void*) hash);
mm256_deinterleave_4x64( hash0, hash1, hash2, hash3, vhash, 512 ); mm256_dintrlv_4x64( hash0, hash1, hash2, hash3, vhash, 512 );
uint64_t* hash64 = (uint64_t*)hash; uint64_t* hash64 = (uint64_t*)hash;
for( int i = 0; i < 8; i++ ) for( int i = 0; i < 8; i++ )
{ {
if ( hash0[i] != hash64[i] ) if ( hash0[i] != hash64[i] )
printf("hash mismatch %u\n",i); printf("hash mismatch %u\n",i);
} }
*/
blake512_4way_init( &ctx ); blake512_4way_init( &ctx );
blake512_4way( &ctx, vhash, 64 ); blake512_4way( &ctx, vhash, 64 );
blake512_4way_close( &ctx, vhash ); blake512_4way_close( &ctx, vhash );
@@ -61,7 +61,7 @@ for( int i = 0; i < 8; i++ )
blake512_4way( &ctx, vhash, 64 ); blake512_4way( &ctx, vhash, 64 );
blake512_4way_close( &ctx, vhash ); blake512_4way_close( &ctx, vhash );
mm256_deinterleave_4x64( hash0, hash1, hash2, hash3, vhash, 512 ); mm256_dintrlv_4x64( hash0, hash1, hash2, hash3, vhash, 512 );
memcpy( output, hash0, 32 ); memcpy( output, hash0, 32 );
memcpy( output+32, hash1, 32 ); memcpy( output+32, hash1, 32 );
memcpy( output+64, hash2, 32 ); memcpy( output+64, hash2, 32 );
@@ -99,8 +99,8 @@ for( int i = 0; i < 8; i++ )
*/ */
} }
int scanhash_pentablake_4way( int thr_id, struct work *work, int scanhash_pentablake_4way( struct work *work,
uint32_t max_nonce, uint64_t *hashes_done ) uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[4*8] __attribute__ ((aligned (64))); uint32_t hash[4*8] __attribute__ ((aligned (64)));
uint32_t vdata[20*4] __attribute__ ((aligned (64))); uint32_t vdata[20*4] __attribute__ ((aligned (64)));
@@ -110,9 +110,8 @@ int scanhash_pentablake_4way( int thr_id, struct work *work,
uint32_t n = pdata[19] - 1; uint32_t n = pdata[19] - 1;
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
uint32_t *nonces = work->nonces;
int num_found = 0;
uint32_t *noncep = vdata + 73; // 9*8 + 1 uint32_t *noncep = vdata + 73; // 9*8 + 1
int thr_id = mythr->id; // thr_id arg is deprecated
// uint32_t _ALIGN(32) hash64[8]; // uint32_t _ALIGN(32) hash64[8];
// uint32_t _ALIGN(32) endiandata[32]; // uint32_t _ALIGN(32) endiandata[32];
@@ -138,7 +137,7 @@ int scanhash_pentablake_4way( int thr_id, struct work *work,
swab32_array( endiandata, pdata, 20 ); swab32_array( endiandata, pdata, 20 );
uint64_t *edata = (uint64_t*)endiandata; uint64_t *edata = (uint64_t*)endiandata;
mm256_interleave_4x64( (uint64_t*)vdata, edata, edata, edata, edata, 640 ); mm256_intrlv_4x64( (uint64_t*)vdata, edata, edata, edata, edata, 640 );
for ( int m=0; m < 6; m++ ) for ( int m=0; m < 6; m++ )
{ {
@@ -155,10 +154,10 @@ int scanhash_pentablake_4way( int thr_id, struct work *work,
for ( int i = 0; i < 4; i++ ) for ( int i = 0; i < 4; i++ )
if ( !( (hash+(i<<3))[7] & mask ) if ( !( (hash+(i<<3))[7] & mask )
&& fulltest( hash+(i<<3), ptarget ) ) && fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{ {
nonces[ num_found++ ] = n+i; pdata[19] = n + i;
work_set_target_ratio( work, hash+(i<<3) ); submit_lane_solution( work, hash+(i<<3), mythr, i );
} }
n += 4; n += 4;

View File

@@ -10,12 +10,12 @@
#if defined(PENTABLAKE_4WAY) #if defined(PENTABLAKE_4WAY)
void pentablakehash_4way( void *state, const void *input ); void pentablakehash_4way( void *state, const void *input );
int scanhash_pentablake_4way( int thr_id, struct work *work, int scanhash_pentablake_4way( struct work *work,
uint32_t max_nonce, uint64_t *hashes_done ); uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif
void pentablakehash( void *state, const void *input ); void pentablakehash( void *state, const void *input );
int scanhash_pentablake( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_pentablake( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif

View File

@@ -40,8 +40,8 @@ extern void pentablakehash(void *output, const void *input)
} }
int scanhash_pentablake(int thr_id, struct work *work, uint32_t max_nonce, int scanhash_pentablake( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
@@ -49,6 +49,7 @@ int scanhash_pentablake(int thr_id, struct work *work, uint32_t max_nonce,
uint32_t n = pdata[19] - 1; uint32_t n = pdata[19] - 1;
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
int thr_id = mythr->id; // thr_id arg is deprecated
uint32_t _ALIGN(32) hash64[8]; uint32_t _ALIGN(32) hash64[8];
uint32_t _ALIGN(32) endiandata[32]; uint32_t _ALIGN(32) endiandata[32];

View File

@@ -19,14 +19,15 @@ void bmwhash(void *output, const void *input)
*/ */
} }
int scanhash_bmw(int thr_id, struct work *work, int scanhash_bmw( struct work *work, uint32_t max_nonce,
uint32_t max_nonce, uint64_t *hashes_done) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
uint32_t _ALIGN(64) hash64[8]; uint32_t _ALIGN(64) hash64[8];
uint32_t _ALIGN(64) endiandata[20]; uint32_t _ALIGN(64) endiandata[20];
int thr_id = mythr->id;
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];

View File

@@ -312,8 +312,8 @@ static void cryptolight_hash_ctx_aes_ni(void* output, const void* input,
oaes_free((OAES_CTX **) &ctx->aes_ctx); oaes_free((OAES_CTX **) &ctx->aes_ctx);
} }
int scanhash_cryptolight(int thr_id, struct work *work, int scanhash_cryptolight( struct work *work,
uint32_t max_nonce, uint64_t *hashes_done) uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr)
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
@@ -322,6 +322,7 @@ int scanhash_cryptolight(int thr_id, struct work *work,
const uint32_t first_nonce = n + 1; const uint32_t first_nonce = n + 1;
//const uint32_t Htarg = ptarget[7]; //const uint32_t Htarg = ptarget[7];
uint32_t _ALIGN(32) hash[HASH_SIZE / 4]; uint32_t _ALIGN(32) hash[HASH_SIZE / 4];
int thr_id = mythr->id;
struct cryptonight_ctx *ctx = (struct cryptonight_ctx*)malloc(sizeof(struct cryptonight_ctx)); struct cryptonight_ctx *ctx = (struct cryptonight_ctx*)malloc(sizeof(struct cryptonight_ctx));

View File

@@ -70,11 +70,12 @@ void cryptonight_hash_suw( void *restrict output, const void *input )
bool cryptonightV7 = false; bool cryptonightV7 = false;
int scanhash_cryptonight( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_cryptonight( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
int thr_id = mythr->id;
uint32_t *nonceptr = (uint32_t*) (((char*)pdata) + 39); uint32_t *nonceptr = (uint32_t*) (((char*)pdata) + 39);
uint32_t n = *nonceptr - 1; uint32_t n = *nonceptr - 1;

View File

@@ -40,8 +40,8 @@ void cryptonight_hash_ctx(void* output, const void* input, int len);
void keccakf(uint64_t st[25], int rounds); void keccakf(uint64_t st[25], int rounds);
extern void (* const extra_hashes[4])(const void *, size_t, char *); extern void (* const extra_hashes[4])(const void *, size_t, char *);
int scanhash_cryptonight( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_cryptonight( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
void cryptonight_hash_aes( void *restrict output, const void *input, int len ); void cryptonight_hash_aes( void *restrict output, const void *input, int len );

View File

@@ -43,7 +43,7 @@
# if !defined( __MINGW32__ ) && !defined( _AIX ) # if !defined( __MINGW32__ ) && !defined( _AIX )
# include <endian.h> # include <endian.h>
# if !defined( __BEOS__ ) # if !defined( __BEOS__ )
# include <byteswap.h> //# include <byteswap.h>
# endif # endif
# endif # endif
#endif #endif

View File

@@ -56,14 +56,15 @@ void groestlhash( void *output, const void *input )
memcpy(output, hash, 32); memcpy(output, hash, 32);
} }
int scanhash_groestl( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_groestl( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
uint32_t endiandata[20] __attribute__ ((aligned (64))); uint32_t endiandata[20] __attribute__ ((aligned (64)));
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t nonce = first_nonce; uint32_t nonce = first_nonce;
int thr_id = mythr->id; // thr_id arg is deprecated
if (opt_benchmark) if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x0000ff; ((uint32_t*)ptarget)[7] = 0x0000ff;

View File

@@ -54,8 +54,8 @@ void myriad_hash(void *output, const void *input)
memcpy(output, hash, 32); memcpy(output, hash, 32);
} }
int scanhash_myriad(int thr_id, struct work *work, int scanhash_myriad( struct work *work,
uint32_t max_nonce, uint64_t *hashes_done) uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr)
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
@@ -63,6 +63,7 @@ int scanhash_myriad(int thr_id, struct work *work,
uint32_t _ALIGN(64) endiandata[20]; uint32_t _ALIGN(64) endiandata[20];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t nonce = first_nonce; uint32_t nonce = first_nonce;
int thr_id = mythr->id; // thr_id arg is deprecated
if (opt_benchmark) if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x0000ff; ((uint32_t*)ptarget)[7] = 0x0000ff;

View File

@@ -33,7 +33,7 @@ void myriad_4way_hash( void *output, const void *input )
myrgr_4way_ctx_holder ctx; myrgr_4way_ctx_holder ctx;
memcpy( &ctx, &myrgr_4way_ctx, sizeof(myrgr_4way_ctx) ); memcpy( &ctx, &myrgr_4way_ctx, sizeof(myrgr_4way_ctx) );
mm128_deinterleave_4x32( hash0, hash1, hash2, hash3, input, 640 ); mm128_dintrlv_4x32( hash0, hash1, hash2, hash3, input, 640 );
update_and_final_groestl( &ctx.groestl, (char*)hash0, (char*)hash0, 640 ); update_and_final_groestl( &ctx.groestl, (char*)hash0, (char*)hash0, 640 );
memcpy( &ctx.groestl, &myrgr_4way_ctx.groestl, sizeof(hashState_groestl) ); memcpy( &ctx.groestl, &myrgr_4way_ctx.groestl, sizeof(hashState_groestl) );
@@ -43,29 +43,30 @@ void myriad_4way_hash( void *output, const void *input )
memcpy( &ctx.groestl, &myrgr_4way_ctx.groestl, sizeof(hashState_groestl) ); memcpy( &ctx.groestl, &myrgr_4way_ctx.groestl, sizeof(hashState_groestl) );
update_and_final_groestl( &ctx.groestl, (char*)hash3, (char*)hash3, 640 ); update_and_final_groestl( &ctx.groestl, (char*)hash3, (char*)hash3, 640 );
mm128_interleave_4x32( vhash, hash0, hash1, hash2, hash3, 512 ); mm128_intrlv_4x32( vhash, hash0, hash1, hash2, hash3, 512 );
sha256_4way( &ctx.sha, vhash, 64 ); sha256_4way( &ctx.sha, vhash, 64 );
sha256_4way_close( &ctx.sha, vhash ); sha256_4way_close( &ctx.sha, output );
mm128_deinterleave_4x32( output, output+32, output+64, output+96, // sha256_4way_close( &ctx.sha, vhash );
vhash, 256 ); // mm128_dintrlv_4x32( output, output+32, output+64, output+96,
// vhash, 256 );
} }
int scanhash_myriad_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_myriad_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[8*4] __attribute__ ((aligned (64))); uint32_t hash[8*4] __attribute__ ((aligned (64)));
uint32_t vdata[20*4] __attribute__ ((aligned (64))); uint32_t vdata[20*4] __attribute__ ((aligned (64)));
uint32_t _ALIGN(64) edata[20]; uint32_t lane_hash[8] __attribute__ ((aligned (64)));
uint32_t *hash7 = &(hash[7<<2]);
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t n = first_nonce; uint32_t n = first_nonce;
uint32_t *nonces = work->nonces; __m128i *noncev = (__m128i*)vdata + 19; // aligned
int num_found = 0; int thr_id = mythr->id; // thr_id arg is deprecated
uint32_t *noncep = vdata + 76; // 19*4
/* /*
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
@@ -78,31 +79,28 @@ int scanhash_myriad_4way( int thr_id, struct work *work, uint32_t max_nonce,
if ( opt_benchmark ) if ( opt_benchmark )
( (uint32_t*)ptarget )[7] = 0x0000ff; ( (uint32_t*)ptarget )[7] = 0x0000ff;
swab32_array( edata, pdata, 20 ); mm128_bswap_intrlv80_4x32( vdata, pdata );
mm128_interleave_4x32( vdata, edata, edata, edata, edata, 640 );
do { do {
be32enc( noncep, n ); *noncev = mm128_bswap_32( _mm_set_epi32( n+3,n+2,n+1,n ) );
be32enc( noncep+1, n+1 );
be32enc( noncep+2, n+2 );
be32enc( noncep+3, n+3 );
myriad_4way_hash( hash, vdata ); myriad_4way_hash( hash, vdata );
pdata[19] = n; pdata[19] = n;
for ( int i = 0; i < 4; i++ ) for ( int lane = 0; lane < 4; lane++ )
if ( (hash+(i<<3))[7] <= Htarg && fulltest( hash+(i<<3), ptarget ) ) if ( hash7[ lane ] <= Htarg )
{ {
pdata[19] = n+i; mm128_extract_lane_4x32( lane_hash, hash, lane, 256 );
nonces[ num_found++ ] = n+i; if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
work_set_target_ratio( work, hash+(i<<3) ); {
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
}
} }
n += 4; n += 4;
} while ( (num_found == 0) && (n < max_nonce-4) } while ( (n < max_nonce-4) && !work_restart[thr_id].restart);
&& !work_restart[thr_id].restart);
*hashes_done = n - first_nonce + 1; *hashes_done = n - first_nonce + 1;
return num_found; return 0;
} }
#endif #endif

View File

@@ -12,8 +12,8 @@
void myriad_4way_hash( void *state, const void *input ); void myriad_4way_hash( void *state, const void *input );
int scanhash_myriad_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_myriad_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
void init_myrgr_4way_ctx(); void init_myrgr_4way_ctx();
@@ -21,8 +21,8 @@ void init_myrgr_4way_ctx();
void myriad_hash( void *state, const void *input ); void myriad_hash( void *state, const void *input );
int scanhash_myriad( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_myriad( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
void init_myrgr_ctx(); void init_myrgr_ctx();

View File

@@ -131,12 +131,14 @@ void bastionhash(void *output, const void *input)
memcpy(output, hash, 32); memcpy(output, hash, 32);
} }
int scanhash_bastion(int thr_id, struct work *work, uint32_t max_nonce, uint64_t *hashes_done) int scanhash_bastion( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr)
{ {
uint32_t _ALIGN(64) hash32[8]; uint32_t _ALIGN(64) hash32[8];
uint32_t _ALIGN(64) endiandata[20]; uint32_t _ALIGN(64) endiandata[20];
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
int thr_id = mythr->id; // thr_id arg is deprecated
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];

View File

@@ -79,11 +79,12 @@ extern void heavyhash(unsigned char* output, const unsigned char* input, int len
} }
int scanhash_heavy(int thr_id, uint32_t *pdata, const uint32_t *ptarget, int scanhash_heavy( uint32_t *pdata, const uint32_t *ptarget,
uint32_t max_nonce, uint64_t *hashes_done) uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr)
{ {
uint32_t hash[8]; uint32_t hash[8];
uint32_t start_nonce = pdata[19]; uint32_t start_nonce = pdata[19];
int thr_id = mythr->id; // thr_id arg is deprecated
do { do {
heavyhash((unsigned char *)hash, (unsigned char *)pdata, 80); heavyhash((unsigned char *)hash, (unsigned char *)pdata, 80);

View File

@@ -143,13 +143,13 @@ bool hodl_do_this_thread( int thr_id )
return ( thr_id == 0 ); return ( thr_id == 0 );
} }
int hodl_scanhash( int thr_id, struct work* work, uint32_t max_nonce, int hodl_scanhash( struct work* work, uint32_t max_nonce,
uint64_t *hashes_done ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
#if defined(__AES__) #if defined(__AES__)
GenRandomGarbage( (CacheEntry*)hodl_scratchbuf, work->data, thr_id ); GenRandomGarbage( (CacheEntry*)hodl_scratchbuf, work->data, mythr->id );
pthread_barrier_wait( &hodl_barrier ); pthread_barrier_wait( &hodl_barrier );
return scanhash_hodl_wolf( thr_id, work, max_nonce, hashes_done ); return scanhash_hodl_wolf( work, max_nonce, hashes_done, thr_info );
#endif #endif
return false; return false;
} }

View File

@@ -61,13 +61,14 @@ void Rev256(uint32_t *Dest, const uint32_t *Src)
} }
*/ */
int scanhash_hodl_wolf( int threadNumber, struct work* work, uint32_t max_nonce, int scanhash_hodl_wolf( struct work* work, uint32_t max_nonce,
uint64_t *hashes_done ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
#ifdef __SSE4_2__ #ifdef __SSE4_2__
//#ifdef __AVX__ //#ifdef __AVX__
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
int threadNumber = mythr->id;
CacheEntry *Garbage = (CacheEntry*)hodl_scratchbuf; CacheEntry *Garbage = (CacheEntry*)hodl_scratchbuf;
CacheEntry Cache[AES_PARALLEL_N]; CacheEntry Cache[AES_PARALLEL_N];
__m128i* data[AES_PARALLEL_N]; __m128i* data[AES_PARALLEL_N];

View File

@@ -19,8 +19,8 @@ typedef union _CacheEntry
__m128i dqwords[GARBAGE_SLICE_SIZE >> 4] __attribute__((aligned(16))); __m128i dqwords[GARBAGE_SLICE_SIZE >> 4] __attribute__((aligned(16)));
} CacheEntry; } CacheEntry;
int scanhash_hodl_wolf( int thr_id, struct work* work, uint32_t max_nonce, int scanhash_hodl_wolf( struct work* work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
void GenRandomGarbage( CacheEntry *Garbage, uint32_t *pdata, int thr_id); void GenRandomGarbage( CacheEntry *Garbage, uint32_t *pdata, int thr_id);

View File

@@ -46,7 +46,7 @@ void jha_hash_4way( void *out, const void *input )
vh_mask = _mm256_cmpeq_epi64( _mm256_and_si256( vh_mask = _mm256_cmpeq_epi64( _mm256_and_si256(
vh[0], _mm256_set1_epi64x( 1 ) ), m256_zero ); vh[0], _mm256_set1_epi64x( 1 ) ), m256_zero );
mm256_deinterleave_4x64( hash0, hash1, hash2, hash3, vhash, 512 ); mm256_dintrlv_4x64( hash0, hash1, hash2, hash3, vhash, 512 );
init_groestl( &ctx_groestl, 64 ); init_groestl( &ctx_groestl, 64 );
update_and_final_groestl( &ctx_groestl, (char*)hash0, update_and_final_groestl( &ctx_groestl, (char*)hash0,
(char*)hash0, 512 ); (char*)hash0, 512 );
@@ -59,7 +59,7 @@ void jha_hash_4way( void *out, const void *input )
init_groestl( &ctx_groestl, 64 ); init_groestl( &ctx_groestl, 64 );
update_and_final_groestl( &ctx_groestl, (char*)hash3, update_and_final_groestl( &ctx_groestl, (char*)hash3,
(char*)hash3, 512 ); (char*)hash3, 512 );
mm256_interleave_4x64( vhashA, hash0, hash1, hash2, hash3, 512 ); mm256_intrlv_4x64( vhashA, hash0, hash1, hash2, hash3, 512 );
skein512_4way_init( &ctx_skein ); skein512_4way_init( &ctx_skein );
skein512_4way( &ctx_skein, vhash, 64 ); skein512_4way( &ctx_skein, vhash, 64 );
@@ -77,26 +77,26 @@ void jha_hash_4way( void *out, const void *input )
jh512_4way_close( &ctx_jh, vhashB ); jh512_4way_close( &ctx_jh, vhashB );
for ( int i = 0; i < 8; i++ ) for ( int i = 0; i < 8; i++ )
vh[i] = _mm256_blendv_epi8( vhA[i], vhB[i], vh_mask ); casti_m256i( out, i ) = _mm256_blendv_epi8( vhA[i], vhB[i], vh_mask );
} }
mm256_deinterleave_4x64( out, out+32, out+64, out+96, vhash, 256 ); // mm256_dintrlv_4x64( out, out+32, out+64, out+96, vhash, 256 );
} }
int scanhash_jha_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_jha_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[8*4] __attribute__ ((aligned (64))); uint32_t hash[8*4] __attribute__ ((aligned (64)));
uint32_t vdata[20*4] __attribute__ ((aligned (64))); uint32_t vdata[20*4] __attribute__ ((aligned (64)));
uint32_t endiandata[20] __attribute__((aligned(64))); uint32_t *hash7 = &(hash[25]);
uint32_t lane_hash[8];
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
uint32_t n = pdata[19]; uint32_t n = pdata[19];
uint32_t *nonces = work->nonces; __m256i *noncev = (__m256i*)vdata + 9; // aligned
int num_found = 0; int thr_id = mythr->id; // thr_id arg is deprecated
uint32_t *noncep = vdata + 73; // 9*8 + 1
uint64_t htmax[] = { uint64_t htmax[] = {
0, 0,
@@ -115,11 +115,12 @@ int scanhash_jha_4way( int thr_id, struct work *work, uint32_t max_nonce,
0 0
}; };
for ( int i=0; i < 19; i++ ) // for ( int i=0; i < 19; i++ )
be32enc( &endiandata[i], pdata[i] ); // be32enc( &endiandata[i], pdata[i] );
uint64_t *edata = (uint64_t*)endiandata; // uint64_t *edata = (uint64_t*)endiandata;
mm256_interleave_4x64( (uint64_t*)vdata, edata, edata, edata, edata, 640 ); // mm256_intrlv_4x64( (uint64_t*)vdata, edata, edata, edata, edata, 640 );
mm256_bswap_intrlv80_4x64( vdata, pdata );
for ( int m = 0; m < 6; m++ ) for ( int m = 0; m < 6; m++ )
{ {
@@ -127,29 +128,36 @@ int scanhash_jha_4way( int thr_id, struct work *work, uint32_t max_nonce,
{ {
uint32_t mask = masks[m]; uint32_t mask = masks[m];
do { do {
be32enc( noncep, n ); *noncev = mm256_intrlv_blend_32( mm256_bswap_32(
be32enc( noncep+2, n+1 ); _mm256_set_epi32( n+3, 0, n+2, 0, n+1, 0, n, 0 ) ), *noncev );
be32enc( noncep+4, n+2 ); // be32enc( noncep, n );
be32enc( noncep+6, n+3 ); // be32enc( noncep+2, n+1 );
// be32enc( noncep+4, n+2 );
// be32enc( noncep+6, n+3 );
jha_hash_4way( hash, vdata ); jha_hash_4way( hash, vdata );
pdata[19] = n; pdata[19] = n;
for ( int i = 0; i < 4; i++ ) // for ( int i = 0; i < 4; i++ )
if ( ( !( (hash+(i<<3))[7] & mask ) == 0 ) // if ( ( !( (hash+(i<<3))[7] & mask ) == 0 )
&& fulltest( hash+(i<<3), ptarget ) ) // && fulltest( hash+(i<<3), ptarget ) )
for ( int i = 0; i < 4; i++ ) if ( !( (hash7[i] & mask ) == 0 ) )
{ {
pdata[19] = n; mm256_extract_lane_4x64( lane_hash, hash, i, 256 );
nonces[ num_found++ ] = n+i; if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
work_set_target_ratio( work, hash+(i<<3) ); {
pdata[19] = n+i;
submit_lane_solution( work, lane_hash, mythr, i );
// nonces[ num_found++ ] = n+i;
// work_set_target_ratio( work, hash+(i<<3) );
}
} }
n += 4; n += 4;
} while ( ( num_found == 0 ) && ( n < max_nonce ) } while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
&& !work_restart[thr_id].restart );
break; break;
} }
} }
*hashes_done = n - first_nonce + 1; *hashes_done = n - first_nonce + 1;
return num_found; return 0;
} }
#endif #endif

View File

@@ -12,14 +12,14 @@
#if defined JHA_4WAY #if defined JHA_4WAY
void jha_hash_4way( void *state, const void *input ); void jha_hash_4way( void *state, const void *input );
int scanhash_jha_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_jha_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif
void jha_hash( void *state, const void *input ); void jha_hash( void *state, const void *input );
int scanhash_jha( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_jha( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif

View File

@@ -81,7 +81,8 @@ void jha_hash(void *output, const void *input)
memcpy(output, hash, 32); memcpy(output, hash, 32);
} }
int scanhash_jha(int thr_id, struct work *work, uint32_t max_nonce, uint64_t *hashes_done) int scanhash_jha( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t _ALIGN(128) hash32[8]; uint32_t _ALIGN(128) hash32[8];
uint32_t _ALIGN(128) endiandata[20]; uint32_t _ALIGN(128) endiandata[20];
@@ -89,7 +90,8 @@ int scanhash_jha(int thr_id, struct work *work, uint32_t max_nonce, uint64_t *ha
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
uint32_t n = pdata[19] - 1; uint32_t n = pdata[19] - 1;
int thr_id = mythr->id; // thr_id arg is deprecated
uint64_t htmax[] = { uint64_t htmax[] = {
0, 0,

View File

@@ -16,8 +16,8 @@ void keccakhash_4way(void *state, const void *input)
keccak256_4way_close( &ctx, state ); keccak256_4way_close( &ctx, state );
} }
int scanhash_keccak_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_keccak_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t vdata[24*4] __attribute__ ((aligned (64))); uint32_t vdata[24*4] __attribute__ ((aligned (64)));
uint32_t hash[8*4] __attribute__ ((aligned (32))); uint32_t hash[8*4] __attribute__ ((aligned (32)));
@@ -27,23 +27,14 @@ int scanhash_keccak_4way( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
uint32_t n = pdata[19]; uint32_t n = pdata[19];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
__m256i *noncev = (__m256i*)vdata + 9; // aligned
// const uint32_t Htarg = ptarget[7]; // const uint32_t Htarg = ptarget[7];
uint32_t endiandata[20]; int thr_id = mythr->id; // thr_id arg is deprecated
uint32_t *nonces = work->nonces;
int num_found = 0;
uint32_t *noncep = vdata + 73; // 9*8 + 1
for ( int i=0; i < 19; i++ )
be32enc( &endiandata[i], pdata[i] );
uint64_t *edata = (uint64_t*)endiandata;
mm256_interleave_4x64( (uint64_t*)vdata, edata, edata, edata, edata, 640 );
mm256_bswap_intrlv80_4x64( vdata, pdata );
do { do {
be32enc( noncep, n ); *noncev = mm256_intrlv_blend_32( mm256_bswap_32(
be32enc( noncep+2, n+1 ); _mm256_set_epi32( n+3, 0, n+2, 0, n+1, 0, n, 0 ) ), *noncev );
be32enc( noncep+4, n+2 );
be32enc( noncep+6, n+3 );
keccakhash_4way( hash, vdata ); keccakhash_4way( hash, vdata );
@@ -54,17 +45,15 @@ int scanhash_keccak_4way( int thr_id, struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) ) if ( fulltest( lane_hash, ptarget ) )
{ {
pdata[19] = n + lane; pdata[19] = n + lane;
nonces[ num_found++ ] = n + lane; submit_lane_solution( work, lane_hash, mythr, lane );
work_set_target_ratio( work, lane_hash );
} }
} }
n += 4; n += 4;
} while ( (num_found == 0) && (n < max_nonce-4) } while ( (n < max_nonce-4) && !work_restart[thr_id].restart);
&& !work_restart[thr_id].restart);
*hashes_done = n - first_nonce + 1; *hashes_done = n - first_nonce + 1;
return num_found; return 0;
} }
#endif #endif

View File

@@ -11,13 +11,13 @@
#if defined(KECCAK_4WAY) #if defined(KECCAK_4WAY)
void keccakhash_4way( void *state, const void *input ); void keccakhash_4way( void *state, const void *input );
int scanhash_keccak_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_keccak_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif
void keccakhash( void *state, const void *input ); void keccakhash( void *state, const void *input );
int scanhash_keccak( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_keccak( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif

View File

@@ -18,14 +18,15 @@ void keccakhash(void *state, const void *input)
memcpy(state, hash, 32); memcpy(state, hash, 32);
} }
int scanhash_keccak(int thr_id, struct work *work, int scanhash_keccak( struct work *work,
uint32_t max_nonce, uint64_t *hashes_done) uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
uint32_t n = pdata[19] - 1; uint32_t n = pdata[19] - 1;
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
//const uint32_t Htarg = ptarget[7]; //const uint32_t Htarg = ptarget[7];
int thr_id = mythr->id; // thr_id arg is deprecated
uint32_t _ALIGN(32) hash64[8]; uint32_t _ALIGN(32) hash64[8];
uint32_t endiandata[32]; uint32_t endiandata[32];

View File

@@ -87,7 +87,7 @@ void allium_4way_hash( void *state, const void *input )
update_and_final_groestl256( &ctx.groestl, state+96, hash3, 256 ); update_and_final_groestl256( &ctx.groestl, state+96, hash3, 256 );
} }
int scanhash_allium_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_allium_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[8*4] __attribute__ ((aligned (64))); uint32_t hash[8*4] __attribute__ ((aligned (64)));
@@ -98,7 +98,7 @@ int scanhash_allium_4way( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t n = first_nonce; uint32_t n = first_nonce;
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
__m128i *noncev = (__m128i*)vdata + 19; // aligned __m128i *noncev = (__m128i*)vdata + 19; // aligned
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
if ( opt_benchmark ) if ( opt_benchmark )
( (uint32_t*)ptarget )[7] = 0x0000ff; ( (uint32_t*)ptarget )[7] = 0x0000ff;
@@ -118,7 +118,7 @@ int scanhash_allium_4way( int thr_id, struct work *work, uint32_t max_nonce,
if ( fulltest( hash+(lane<<3), ptarget ) && !opt_benchmark ) if ( fulltest( hash+(lane<<3), ptarget ) && !opt_benchmark )
{ {
pdata[19] = n + lane; pdata[19] = n + lane;
submit_solution( work, hash+(lane<<3), mythr, lane ); submit_lane_solution( work, hash+(lane<<3), mythr, lane );
} }
} }
n += 4; n += 4;

View File

@@ -69,7 +69,7 @@ void allium_hash(void *state, const void *input)
memcpy(state, hash, 32); memcpy(state, hash, 32);
} }
int scanhash_allium( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_allium( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t _ALIGN(128) hash[8]; uint32_t _ALIGN(128) hash[8];
@@ -80,7 +80,7 @@ int scanhash_allium( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t nonce = first_nonce; uint32_t nonce = first_nonce;
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
if ( opt_benchmark ) if ( opt_benchmark )
ptarget[7] = 0x3ffff; ptarget[7] = 0x3ffff;
@@ -94,18 +94,14 @@ int scanhash_allium( int thr_id, struct work *work, uint32_t max_nonce,
do { do {
be32enc( &endiandata[19], nonce ); be32enc( &endiandata[19], nonce );
allium_hash( hash, endiandata ); allium_hash( hash, endiandata );
if ( hash[7] <= Htarg )
if ( hash[7] <= Htarg && fulltest( hash, ptarget ) ) if ( fulltest( hash, ptarget ) && !opt_benchmark )
{ {
work_set_target_ratio( work, hash );
pdata[19] = nonce; pdata[19] = nonce;
*hashes_done = pdata[19] - first_nonce; submit_solution( work, hash, mythr );
return 1;
} }
nonce++; nonce++;
} while ( nonce < max_nonce && !work_restart[thr_id].restart );
} while (nonce < max_nonce && !work_restart[thr_id].restart);
pdata[19] = nonce; pdata[19] = nonce;
*hashes_done = pdata[19] - first_nonce + 1; *hashes_done = pdata[19] - first_nonce + 1;
return 0; return 0;

View File

@@ -19,21 +19,21 @@ bool register_lyra2rev3_algo( algo_gate_t* gate );
#if defined(LYRA2REV3_8WAY) #if defined(LYRA2REV3_8WAY)
void lyra2rev3_8way_hash( void *state, const void *input ); void lyra2rev3_8way_hash( void *state, const void *input );
int scanhash_lyra2rev3_8way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2rev3_8way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
bool init_lyra2rev3_8way_ctx(); bool init_lyra2rev3_8way_ctx();
#elif defined(LYRA2REV3_4WAY) #elif defined(LYRA2REV3_4WAY)
void lyra2rev3_4way_hash( void *state, const void *input ); void lyra2rev3_4way_hash( void *state, const void *input );
int scanhash_lyra2rev3_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2rev3_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
bool init_lyra2rev3_4way_ctx(); bool init_lyra2rev3_4way_ctx();
#else #else
void lyra2rev3_hash( void *state, const void *input ); void lyra2rev3_hash( void *state, const void *input );
int scanhash_lyra2rev3( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2rev3( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
bool init_lyra2rev3_ctx(); bool init_lyra2rev3_ctx();
@@ -52,14 +52,14 @@ bool register_lyra2rev2_algo( algo_gate_t* gate );
#if defined(LYRA2REV2_4WAY) #if defined(LYRA2REV2_4WAY)
void lyra2rev2_4way_hash( void *state, const void *input ); void lyra2rev2_4way_hash( void *state, const void *input );
int scanhash_lyra2rev2_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2rev2_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
bool init_lyra2rev2_4way_ctx(); bool init_lyra2rev2_4way_ctx();
#else #else
void lyra2rev2_hash( void *state, const void *input ); void lyra2rev2_hash( void *state, const void *input );
int scanhash_lyra2rev2( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2rev2( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
bool init_lyra2rev2_ctx(); bool init_lyra2rev2_ctx();
@@ -80,21 +80,21 @@ bool init_lyra2rev2_ctx();
#if defined(LYRA2Z_8WAY) #if defined(LYRA2Z_8WAY)
void lyra2z_8way_hash( void *state, const void *input ); void lyra2z_8way_hash( void *state, const void *input );
int scanhash_lyra2z_8way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2z_8way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
bool lyra2z_8way_thread_init(); bool lyra2z_8way_thread_init();
#elif defined(LYRA2Z_4WAY) #elif defined(LYRA2Z_4WAY)
void lyra2z_4way_hash( void *state, const void *input ); void lyra2z_4way_hash( void *state, const void *input );
int scanhash_lyra2z_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2z_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
bool lyra2z_4way_thread_init(); bool lyra2z_4way_thread_init();
#else #else
void lyra2z_hash( void *state, const void *input ); void lyra2z_hash( void *state, const void *input );
int scanhash_lyra2z( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2z( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
bool lyra2z_thread_init(); bool lyra2z_thread_init();
@@ -111,14 +111,14 @@ bool lyra2z_thread_init();
#if defined(LYRA2H_4WAY) #if defined(LYRA2H_4WAY)
void lyra2h_4way_hash( void *state, const void *input ); void lyra2h_4way_hash( void *state, const void *input );
int scanhash_lyra2h_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2h_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
bool lyra2h_4way_thread_init(); bool lyra2h_4way_thread_init();
#else #else
void lyra2h_hash( void *state, const void *input ); void lyra2h_hash( void *state, const void *input );
int scanhash_lyra2h( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2h( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
bool lyra2h_thread_init(); bool lyra2h_thread_init();
@@ -135,14 +135,14 @@ bool register_allium_algo( algo_gate_t* gate );
#if defined(ALLIUM_4WAY) #if defined(ALLIUM_4WAY)
void allium_4way_hash( void *state, const void *input ); void allium_4way_hash( void *state, const void *input );
int scanhash_allium_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_allium_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
bool init_allium_4way_ctx(); bool init_allium_4way_ctx();
#else #else
void allium_hash( void *state, const void *input ); void allium_hash( void *state, const void *input );
int scanhash_allium( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_allium( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
bool init_allium_ctx(); bool init_allium_ctx();
@@ -160,14 +160,14 @@ bool register_phi2_algo( algo_gate_t* gate );
#if defined(PHI2_4WAY) #if defined(PHI2_4WAY)
void phi2_hash_4way( void *state, const void *input ); void phi2_hash_4way( void *state, const void *input );
int scanhash_phi2_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_phi2_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
//void init_phi2_ctx(); //void init_phi2_ctx();
#else #else
void phi2_hash( void *state, const void *input ); void phi2_hash( void *state, const void *input );
int scanhash_phi2( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_phi2( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
void init_phi2_ctx(); void init_phi2_ctx();

View File

@@ -48,7 +48,7 @@ void lyra2h_4way_hash( void *state, const void *input )
32, 16, 16, 16 ); 32, 16, 16, 16 );
} }
int scanhash_lyra2h_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2h_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[8*4] __attribute__ ((aligned (64))); uint32_t hash[8*4] __attribute__ ((aligned (64)));
@@ -59,7 +59,7 @@ int scanhash_lyra2h_4way( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t n = first_nonce; uint32_t n = first_nonce;
__m128i *noncev = (__m128i*)vdata + 19; // aligned __m128i *noncev = (__m128i*)vdata + 19; // aligned
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
if ( opt_benchmark ) if ( opt_benchmark )
ptarget[7] = 0x0000ff; ptarget[7] = 0x0000ff;
@@ -76,7 +76,7 @@ int scanhash_lyra2h_4way( int thr_id, struct work *work, uint32_t max_nonce,
&& !opt_benchmark ) && !opt_benchmark )
{ {
pdata[19] = n+i; pdata[19] = n+i;
submit_solution( work, hash+(i<<3), mythr, i ); submit_lane_solution( work, hash+(i<<3), mythr, i );
} }
n += 4; n += 4;
} while ( (n < max_nonce-4) && !work_restart[thr_id].restart); } while ( (n < max_nonce-4) && !work_restart[thr_id].restart);

View File

@@ -35,7 +35,7 @@ void lyra2h_hash( void *state, const void *input )
memcpy(state, hash, 32); memcpy(state, hash, 32);
} }
int scanhash_lyra2h( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2h( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t _ALIGN(64) hash[8]; uint32_t _ALIGN(64) hash[8];
@@ -45,7 +45,7 @@ int scanhash_lyra2h( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t nonce = first_nonce; uint32_t nonce = first_nonce;
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
if (opt_benchmark) if (opt_benchmark)
ptarget[7] = 0x0000ff; ptarget[7] = 0x0000ff;
@@ -54,22 +54,19 @@ int scanhash_lyra2h( int thr_id, struct work *work, uint32_t max_nonce,
be32enc(&endiandata[i], pdata[i]); be32enc(&endiandata[i], pdata[i]);
} }
lyra2h_midstate( endiandata ); lyra2h_midstate( endiandata );
do { do {
be32enc(&endiandata[19], nonce); be32enc(&endiandata[19], nonce);
lyra2h_hash( hash, endiandata ); lyra2h_hash( hash, endiandata );
if (hash[7] <= Htarg && fulltest(hash, ptarget)) { if ( hash[7] <= Htarg )
work_set_target_ratio(work, hash); if ( fulltest( hash, ptarget ) && !opt_benchmark )
{
pdata[19] = nonce; pdata[19] = nonce;
*hashes_done = pdata[19] - first_nonce; submit_solution( work, hash, mythr );
return 1; }
}
nonce++; nonce++;
} while (nonce < max_nonce && !work_restart[thr_id].restart); } while (nonce < max_nonce && !work_restart[thr_id].restart);
pdata[19] = nonce; pdata[19] = nonce;
*hashes_done = pdata[19] - first_nonce + 1; *hashes_done = pdata[19] - first_nonce + 1;
return 0; return 0;

View File

@@ -81,7 +81,7 @@ void lyra2re_hash(void *state, const void *input)
memcpy(state, hashA, 32); memcpy(state, hashA, 32);
} }
int scanhash_lyra2re( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2re( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
@@ -91,7 +91,7 @@ int scanhash_lyra2re( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t nonce = first_nonce; uint32_t nonce = first_nonce;
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
swab32_array( endiandata, pdata, 20 ); swab32_array( endiandata, pdata, 20 );
@@ -100,20 +100,14 @@ int scanhash_lyra2re( int thr_id, struct work *work, uint32_t max_nonce,
do { do {
be32enc(&endiandata[19], nonce); be32enc(&endiandata[19], nonce);
lyra2re_hash(hash, endiandata); lyra2re_hash(hash, endiandata);
if (hash[7] <= Htarg ) if ( hash[7] <= Htarg )
{ if ( fulltest(hash, ptarget) && !opt_benchmark )
if ( fulltest(hash, ptarget) ) {
{
pdata[19] = nonce; pdata[19] = nonce;
*hashes_done = pdata[19] - first_nonce; submit_solution( work, hash, mythr );
work_set_target_ratio( work, hash ); }
return 1;
}
}
nonce++; nonce++;
} while (nonce < max_nonce && !work_restart[thr_id].restart); } while (nonce < max_nonce && !work_restart[thr_id].restart);
pdata[19] = nonce; pdata[19] = nonce;
*hashes_done = pdata[19] - first_nonce + 1; *hashes_done = pdata[19] - first_nonce + 1;
return 0; return 0;

View File

@@ -84,7 +84,7 @@ void lyra2rev2_4way_hash( void *state, const void *input )
bmw256_4way_close( &ctx.bmw, state ); bmw256_4way_close( &ctx.bmw, state );
} }
int scanhash_lyra2rev2_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2rev2_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[8*4] __attribute__ ((aligned (64))); uint32_t hash[8*4] __attribute__ ((aligned (64)));
@@ -97,7 +97,7 @@ int scanhash_lyra2rev2_4way( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t n = first_nonce; uint32_t n = first_nonce;
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
__m128i *noncev = (__m128i*)vdata + 19; // aligned __m128i *noncev = (__m128i*)vdata + 19; // aligned
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
if ( opt_benchmark ) if ( opt_benchmark )
( (uint32_t*)ptarget )[7] = 0x0000ff; ( (uint32_t*)ptarget )[7] = 0x0000ff;
@@ -120,7 +120,7 @@ int scanhash_lyra2rev2_4way( int thr_id, struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{ {
pdata[19] = n + lane; pdata[19] = n + lane;
submit_solution( work, lane_hash, mythr, lane ); submit_lane_solution( work, lane_hash, mythr, lane );
} }
} }
n += 4; n += 4;

View File

@@ -40,31 +40,31 @@ void l2v2_blake256_midstate( const void* input )
void lyra2rev2_hash( void *state, const void *input ) void lyra2rev2_hash( void *state, const void *input )
{ {
lyra2v2_ctx_holder ctx __attribute__ ((aligned (64))); lyra2v2_ctx_holder ctx __attribute__ ((aligned (64)));
memcpy( &ctx, &lyra2v2_ctx, sizeof(lyra2v2_ctx) ); memcpy( &ctx, &lyra2v2_ctx, sizeof(lyra2v2_ctx) );
uint8_t hash[128] __attribute__ ((aligned (64))); uint8_t hash[128] __attribute__ ((aligned (64)));
#define hashA hash #define hashA hash
#define hashB hash+64 #define hashB hash+64
const int midlen = 64; // bytes const int midlen = 64; // bytes
const int tail = 80 - midlen; // 16 const int tail = 80 - midlen; // 16
memcpy( &ctx.blake, &l2v2_blake_mid, sizeof l2v2_blake_mid ); memcpy( &ctx.blake, &l2v2_blake_mid, sizeof l2v2_blake_mid );
sph_blake256( &ctx.blake, (uint8_t*)input + midlen, tail ); sph_blake256( &ctx.blake, (uint8_t*)input + midlen, tail );
sph_blake256_close( &ctx.blake, hashA ); sph_blake256_close( &ctx.blake, hashA );
sph_keccak256( &ctx.keccak, hashA, 32 ); sph_keccak256( &ctx.keccak, hashA, 32 );
sph_keccak256_close(&ctx.keccak, hashB); sph_keccak256_close(&ctx.keccak, hashB);
cubehashUpdateDigest( &ctx.cube1, (byte*) hashA, cubehashUpdateDigest( &ctx.cube1, (byte*) hashA,
(const byte*) hashB, 32 ); (const byte*) hashB, 32 );
LYRA2REV2( l2v2_wholeMatrix, hashA, 32, hashA, 32, hashA, 32, 1, 4, 4 ); LYRA2REV2( l2v2_wholeMatrix, hashA, 32, hashA, 32, hashA, 32, 1, 4, 4 );
sph_skein256( &ctx.skein, hashA, 32 ); sph_skein256( &ctx.skein, hashA, 32 );
sph_skein256_close( &ctx.skein, hashB ); sph_skein256_close( &ctx.skein, hashB );
cubehashUpdateDigest( &ctx.cube2, (byte*) hashA, cubehashUpdateDigest( &ctx.cube2, (byte*) hashA,
(const byte*) hashB, 32 ); (const byte*) hashB, 32 );
sph_bmw256( &ctx.bmw, hashA, 32 ); sph_bmw256( &ctx.bmw, hashA, 32 );
sph_bmw256_close( &ctx.bmw, hashB ); sph_bmw256_close( &ctx.bmw, hashB );
@@ -72,43 +72,37 @@ void lyra2rev2_hash( void *state, const void *input )
memcpy( state, hashB, 32 ); memcpy( state, hashB, 32 );
} }
int scanhash_lyra2rev2(int thr_id, struct work *work, int scanhash_lyra2rev2( struct work *work,
uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr) uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr)
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
uint32_t endiandata[20] __attribute__ ((aligned (64))); uint32_t endiandata[20] __attribute__ ((aligned (64)));
uint32_t hash[8] __attribute__((aligned(64))); uint32_t hash[8] __attribute__((aligned(64)));
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t nonce = first_nonce; uint32_t nonce = first_nonce;
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
if (opt_benchmark) if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x0000ff; ((uint32_t*)ptarget)[7] = 0x0000ff;
swab32_array( endiandata, pdata, 20 ); swab32_array( endiandata, pdata, 20 );
l2v2_blake256_midstate( endiandata ); l2v2_blake256_midstate( endiandata );
do { do {
be32enc(&endiandata[19], nonce); be32enc(&endiandata[19], nonce);
lyra2rev2_hash(hash, endiandata); lyra2rev2_hash(hash, endiandata);
if (hash[7] <= Htarg ) if (hash[7] <= Htarg )
{ if( fulltest( hash, ptarget ) && !opt_benchmark )
if( fulltest(hash, ptarget) ) {
{
pdata[19] = nonce; pdata[19] = nonce;
work_set_target_ratio( work, hash ); submit_solution( work, hash, mythr );
*hashes_done = pdata[19] - first_nonce; }
return 1;
}
}
nonce++; nonce++;
} while ( nonce < max_nonce && !work_restart[thr_id].restart );
} while (nonce < max_nonce && !work_restart[thr_id].restart);
pdata[19] = nonce; pdata[19] = nonce;
*hashes_done = pdata[19] - first_nonce + 1; *hashes_done = pdata[19] - first_nonce + 1;
return 0; return 0;

View File

@@ -86,7 +86,7 @@ void lyra2rev3_8way_hash( void *state, const void *input )
} }
int scanhash_lyra2rev3_8way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2rev3_8way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[8*8] __attribute__ ((aligned (64))); uint32_t hash[8*8] __attribute__ ((aligned (64)));
@@ -99,7 +99,7 @@ int scanhash_lyra2rev3_8way( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t n = first_nonce; uint32_t n = first_nonce;
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
__m256i *noncev = (__m256i*)vdata + 19; // aligned __m256i *noncev = (__m256i*)vdata + 19; // aligned
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
if ( opt_benchmark ) if ( opt_benchmark )
( (uint32_t*)ptarget )[7] = 0x0000ff; ( (uint32_t*)ptarget )[7] = 0x0000ff;
@@ -119,7 +119,7 @@ int scanhash_lyra2rev3_8way( int thr_id, struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{ {
pdata[19] = n + lane; pdata[19] = n + lane;
submit_solution( work, lane_hash, mythr, lane ); submit_lane_solution( work, lane_hash, mythr, lane );
} }
} }
n += 8; n += 8;
@@ -186,7 +186,7 @@ void lyra2rev3_4way_hash( void *state, const void *input )
bmw256_4way_close( &ctx.bmw, state ); bmw256_4way_close( &ctx.bmw, state );
} }
int scanhash_lyra2rev3_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2rev3_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[8*4] __attribute__ ((aligned (64))); uint32_t hash[8*4] __attribute__ ((aligned (64)));
@@ -199,7 +199,7 @@ int scanhash_lyra2rev3_4way( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t n = first_nonce; uint32_t n = first_nonce;
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
__m128i *noncev = (__m128i*)vdata + 19; // aligned __m128i *noncev = (__m128i*)vdata + 19; // aligned
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
if ( opt_benchmark ) if ( opt_benchmark )
( (uint32_t*)ptarget )[7] = 0x0000ff; ( (uint32_t*)ptarget )[7] = 0x0000ff;
@@ -218,7 +218,7 @@ int scanhash_lyra2rev3_4way( int thr_id, struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{ {
pdata[19] = n + lane; pdata[19] = n + lane;
submit_solution( work, lane_hash, mythr, lane ); submit_lane_solution( work, lane_hash, mythr, lane );
} }
} }
n += 4; n += 4;

View File

@@ -57,7 +57,7 @@ void lyra2rev3_hash( void *state, const void *input )
memcpy( state, hash, 32 ); memcpy( state, hash, 32 );
} }
int scanhash_lyra2rev3( int thr_id, struct work *work, int scanhash_lyra2rev3( struct work *work,
uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr ) uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
@@ -67,7 +67,7 @@ int scanhash_lyra2rev3( int thr_id, struct work *work,
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t nonce = first_nonce; uint32_t nonce = first_nonce;
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
if (opt_benchmark) if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x0000ff; ((uint32_t*)ptarget)[7] = 0x0000ff;
@@ -78,28 +78,20 @@ int scanhash_lyra2rev3( int thr_id, struct work *work,
casti_m128i( endiandata, 2 ) = mm128_bswap_32( casti_m128i( pdata, 2 ) ); casti_m128i( endiandata, 2 ) = mm128_bswap_32( casti_m128i( pdata, 2 ) );
casti_m128i( endiandata, 3 ) = mm128_bswap_32( casti_m128i( pdata, 3 ) ); casti_m128i( endiandata, 3 ) = mm128_bswap_32( casti_m128i( pdata, 3 ) );
casti_m128i( endiandata, 4 ) = mm128_bswap_32( casti_m128i( pdata, 4 ) ); casti_m128i( endiandata, 4 ) = mm128_bswap_32( casti_m128i( pdata, 4 ) );
l2v3_blake256_midstate( endiandata ); l2v3_blake256_midstate( endiandata );
do do
{ {
be32enc(&endiandata[19], nonce); be32enc(&endiandata[19], nonce);
lyra2rev3_hash(hash, endiandata); lyra2rev3_hash(hash, endiandata);
if (hash[7] <= Htarg ) if (hash[7] <= Htarg )
{ if( fulltest( hash, ptarget ) && !opt_benchmark )
if( fulltest(hash, ptarget) ) {
{ pdata[19] = nonce;
pdata[19] = nonce; submit_solution( work, hash, mythr );
work_set_target_ratio( work, hash ); }
*hashes_done = pdata[19] - first_nonce; nonce++;
return 1; } while ( nonce < max_nonce && !work_restart[thr_id].restart );
}
}
nonce++;
} while (nonce < max_nonce && !work_restart[thr_id].restart);
pdata[19] = nonce; pdata[19] = nonce;
*hashes_done = pdata[19] - first_nonce + 1; *hashes_done = pdata[19] - first_nonce + 1;
return 0; return 0;

View File

@@ -44,7 +44,7 @@ void lyra2z_4way_hash( void *state, const void *input )
LYRA2Z( lyra2z_4way_matrix, state+96, 32, hash3, 32, hash3, 32, 8, 8, 8 ); LYRA2Z( lyra2z_4way_matrix, state+96, 32, hash3, 32, hash3, 32, 8, 8, 8 );
} }
int scanhash_lyra2z_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2z_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[8*4] __attribute__ ((aligned (64))); uint32_t hash[8*4] __attribute__ ((aligned (64)));
@@ -55,7 +55,7 @@ int scanhash_lyra2z_4way( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t n = first_nonce; uint32_t n = first_nonce;
__m128i *noncev = (__m128i*)vdata + 19; // aligned __m128i *noncev = (__m128i*)vdata + 19; // aligned
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
if ( opt_benchmark ) if ( opt_benchmark )
ptarget[7] = 0x0000ff; ptarget[7] = 0x0000ff;
@@ -74,7 +74,7 @@ int scanhash_lyra2z_4way( int thr_id, struct work *work, uint32_t max_nonce,
&& !opt_benchmark ) && !opt_benchmark )
{ {
pdata[19] = n+i; pdata[19] = n+i;
submit_solution( work, hash+(i<<3), mythr, i ); submit_lane_solution( work, hash+(i<<3), mythr, i );
} }
n += 4; n += 4;
} while ( (n < max_nonce-4) && !work_restart[thr_id].restart); } while ( (n < max_nonce-4) && !work_restart[thr_id].restart);
@@ -141,7 +141,7 @@ void lyra2z_8way_hash( void *state, const void *input )
memcpy( state+224, hash7, 32 ); memcpy( state+224, hash7, 32 );
} }
int scanhash_lyra2z_8way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2z_8way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[8*8] __attribute__ ((aligned (64))); uint32_t hash[8*8] __attribute__ ((aligned (64)));
@@ -152,7 +152,7 @@ int scanhash_lyra2z_8way( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t n = first_nonce; uint32_t n = first_nonce;
__m256i *noncev = (__m256i*)vdata + 19; // aligned __m256i *noncev = (__m256i*)vdata + 19; // aligned
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
if ( opt_benchmark ) if ( opt_benchmark )
ptarget[7] = 0x0000ff; ptarget[7] = 0x0000ff;
@@ -171,7 +171,7 @@ int scanhash_lyra2z_8way( int thr_id, struct work *work, uint32_t max_nonce,
&& !opt_benchmark ) && !opt_benchmark )
{ {
pdata[19] = n+i; pdata[19] = n+i;
submit_solution( work, hash+(i<<3), mythr, i ); submit_lane_solution( work, hash+(i<<3), mythr, i );
} }
n += 8; n += 8;
} while ( (n < max_nonce-8) && !work_restart[thr_id].restart); } while ( (n < max_nonce-8) && !work_restart[thr_id].restart);

View File

@@ -43,7 +43,7 @@ void lyra2z_hash( void *state, const void *input )
memcpy(state, hash, 32); memcpy(state, hash, 32);
} }
int scanhash_lyra2z( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2z( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t _ALIGN(64) hash[8]; uint32_t _ALIGN(64) hash[8];
@@ -53,7 +53,7 @@ int scanhash_lyra2z( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t nonce = first_nonce; uint32_t nonce = first_nonce;
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
if (opt_benchmark) if (opt_benchmark)
ptarget[7] = 0x0000ff; ptarget[7] = 0x0000ff;
@@ -68,16 +68,14 @@ int scanhash_lyra2z( int thr_id, struct work *work, uint32_t max_nonce,
be32enc(&endiandata[19], nonce); be32enc(&endiandata[19], nonce);
lyra2z_hash( hash, endiandata ); lyra2z_hash( hash, endiandata );
if (hash[7] <= Htarg && fulltest(hash, ptarget)) { if ( hash[7] <= Htarg )
work_set_target_ratio(work, hash); if ( fulltest( hash, ptarget ) && !opt_benchmark )
{
pdata[19] = nonce; pdata[19] = nonce;
*hashes_done = pdata[19] - first_nonce; submit_solution( work, hash, mythr );
return 1; }
}
nonce++; nonce++;
} while ( nonce < max_nonce && !work_restart[thr_id].restart );
} while (nonce < max_nonce && !work_restart[thr_id].restart);
pdata[19] = nonce; pdata[19] = nonce;
*hashes_done = pdata[19] - first_nonce + 1; *hashes_done = pdata[19] - first_nonce + 1;
return 0; return 0;

View File

@@ -15,7 +15,7 @@ void lyra2z330_hash(void *state, const void *input, uint32_t height)
memcpy(state, hash, 32); memcpy(state, hash, 32);
} }
int scanhash_lyra2z330( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lyra2z330( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[8] __attribute__ ((aligned (64))); uint32_t hash[8] __attribute__ ((aligned (64)));
@@ -25,7 +25,7 @@ int scanhash_lyra2z330( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t nonce = first_nonce; uint32_t nonce = first_nonce;
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
if (opt_benchmark) if (opt_benchmark)
ptarget[7] = 0x0000ff; ptarget[7] = 0x0000ff;
@@ -38,21 +38,16 @@ int scanhash_lyra2z330( int thr_id, struct work *work, uint32_t max_nonce,
do do
{ {
be32enc(&endiandata[19], nonce); be32enc( &endiandata[19], nonce );
lyra2z330_hash( hash, endiandata, work->height ); lyra2z330_hash( hash, endiandata, work->height );
if ( hash[7] <= Htarg && fulltest(hash, ptarget) && !opt_benchmark ) if ( hash[7] <= Htarg )
if ( fulltest( hash, ptarget ) && !opt_benchmark )
{ {
work_set_target_ratio(work, hash);
pdata[19] = nonce; pdata[19] = nonce;
if ( submit_work( mythr, work ) ) submit_solution( work, hash, mythr );
applog( LOG_NOTICE, "Share %d submitted by thread %d",
accepted_share_count + rejected_share_count + 1,
mythr->id );
else
applog( LOG_WARNING, "Failed to submit share." );
} }
nonce++; nonce++;
} while (nonce < max_nonce && !work_restart[thr_id].restart); } while ( nonce < max_nonce && !work_restart[thr_id].restart );
pdata[19] = nonce; pdata[19] = nonce;
*hashes_done = pdata[19] - first_nonce + 1; *hashes_done = pdata[19] - first_nonce + 1;
return 0; return 0;

View File

@@ -161,7 +161,7 @@ void phi2_hash_4way( void *state, const void *input )
memcpy( state, vhash, 128 ); memcpy( state, vhash, 128 );
} }
int scanhash_phi2_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_phi2_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t _ALIGN(128) hash[8]; uint32_t _ALIGN(128) hash[8];
@@ -174,7 +174,7 @@ int scanhash_phi2_4way( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t n = first_nonce; uint32_t n = first_nonce;
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
if(opt_benchmark){ if(opt_benchmark){
ptarget[7] = 0x00ff; ptarget[7] = 0x00ff;
@@ -221,7 +221,7 @@ int scanhash_phi2_4way( int thr_id, struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{ {
pdata[19] = n + lane; pdata[19] = n + lane;
submit_solution( work, lane_hash, mythr, lane ); submit_lane_solution( work, lane_hash, mythr, lane );
} }
} }
n += 4; n += 4;

View File

@@ -92,7 +92,7 @@ void phi2_hash(void *state, const void *input)
memcpy(state, hash, 32); memcpy(state, hash, 32);
} }
int scanhash_phi2( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_phi2( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t _ALIGN(128) hash[8]; uint32_t _ALIGN(128) hash[8];
@@ -102,7 +102,7 @@ int scanhash_phi2( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t n = first_nonce; uint32_t n = first_nonce;
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
if(opt_benchmark){ if(opt_benchmark){
ptarget[7] = 0x00ff; ptarget[7] = 0x00ff;
@@ -111,30 +111,21 @@ int scanhash_phi2( int thr_id, struct work *work, uint32_t max_nonce,
phi2_has_roots = false; phi2_has_roots = false;
for ( int i=0; i < 36; i++ ) for ( int i=0; i < 36; i++ )
{ {
be32enc(&endiandata[i], pdata[i]); be32enc(&endiandata[i], pdata[i]);
if (i >= 20 && pdata[i]) phi2_has_roots = true; if ( i >= 20 && pdata[i] ) phi2_has_roots = true;
} }
do { do {
be32enc( &endiandata[19], n ); be32enc( &endiandata[19], n );
phi2_hash( hash, endiandata ); phi2_hash( hash, endiandata );
if ( hash[7] < Htarg )
if ( hash[7] < Htarg && fulltest( hash, ptarget ) ) if ( fulltest( hash, ptarget ) && !opt_benchmark )
{ {
pdata[19] = n; pdata[19] = n;
work_set_target_ratio( work, hash ); submit_solution( work, hash, mythr );
if ( submit_work( mythr, work ) ) }
applog( LOG_NOTICE, "Share %d submitted by thread %d.",
accepted_share_count + rejected_share_count + 1,
thr_id );
else
applog( LOG_WARNING, "Failed to submit share." );
*hashes_done = n - first_nonce + 1;
}
n++; n++;
} while ( n < max_nonce && !work_restart[thr_id].restart ); } while ( n < max_nonce && !work_restart[thr_id].restart );
*hashes_done = n - first_nonce + 1; *hashes_done = n - first_nonce + 1;
pdata[19] = n; pdata[19] = n;
return 0; return 0;

View File

@@ -144,7 +144,7 @@ void init_m7m_ctx()
#define NM7M 5 #define NM7M 5
#define SW_DIVS 5 #define SW_DIVS 5
#define M7_MIDSTATE_LEN 76 #define M7_MIDSTATE_LEN 76
int scanhash_m7m_hash( int thr_id, struct work* work, uint64_t max_nonce, int scanhash_m7m_hash( struct work* work, uint64_t max_nonce,
unsigned long *hashes_done, struct thr_info *mythr ) unsigned long *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
@@ -154,7 +154,7 @@ int scanhash_m7m_hash( int thr_id, struct work* work, uint64_t max_nonce,
uint32_t hash[8] __attribute__((aligned(64))); uint32_t hash[8] __attribute__((aligned(64)));
uint8_t bhash[7][64] __attribute__((aligned(64))); uint8_t bhash[7][64] __attribute__((aligned(64)));
uint32_t n = pdata[19] - 1; uint32_t n = pdata[19] - 1;
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
uint32_t usw_, mpzscale; uint32_t usw_, mpzscale;
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
char data_str[161], hash_str[65], target_str[65]; char data_str[161], hash_str[65], target_str[65];

View File

@@ -35,7 +35,7 @@ void nist5hash_4way( void *out, const void *input )
blake512_4way( &ctx_blake, input, 80 ); blake512_4way( &ctx_blake, input, 80 );
blake512_4way_close( &ctx_blake, vhash ); blake512_4way_close( &ctx_blake, vhash );
mm256_deinterleave_4x64( hash0, hash1, hash2, hash3, vhash, 512 ); mm256_dintrlv_4x64( hash0, hash1, hash2, hash3, vhash, 512 );
init_groestl( &ctx_groestl, 64 ); init_groestl( &ctx_groestl, 64 );
update_and_final_groestl( &ctx_groestl, (char*)hash0, update_and_final_groestl( &ctx_groestl, (char*)hash0,
@@ -50,7 +50,7 @@ void nist5hash_4way( void *out, const void *input )
update_and_final_groestl( &ctx_groestl, (char*)hash3, update_and_final_groestl( &ctx_groestl, (char*)hash3,
(const char*)hash3, 512 ); (const char*)hash3, 512 );
mm256_interleave_4x64( vhash, hash0, hash1, hash2, hash3, 512 ); mm256_intrlv_4x64( vhash, hash0, hash1, hash2, hash3, 512 );
jh512_4way_init( &ctx_jh ); jh512_4way_init( &ctx_jh );
jh512_4way( &ctx_jh, vhash, 64 ); jh512_4way( &ctx_jh, vhash, 64 );
@@ -65,8 +65,8 @@ void nist5hash_4way( void *out, const void *input )
skein512_4way_close( &ctx_skein, out ); skein512_4way_close( &ctx_skein, out );
} }
int scanhash_nist5_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_nist5_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[4*16] __attribute__ ((aligned (64))); uint32_t hash[4*16] __attribute__ ((aligned (64)));
uint32_t *hash7 = &(hash[25]); uint32_t *hash7 = &(hash[25]);
@@ -78,9 +78,8 @@ int scanhash_nist5_4way( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t n = pdata[19]; uint32_t n = pdata[19];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
uint32_t *nonces = work->nonces;
int num_found = 0;
uint32_t *noncep = vdata + 73; // 9*8 + 1 uint32_t *noncep = vdata + 73; // 9*8 + 1
int thr_id = mythr->id; // thr_id arg is deprecated
uint64_t htmax[] = { 0, uint64_t htmax[] = { 0,
0xF, 0xF,
@@ -100,7 +99,7 @@ int scanhash_nist5_4way( int thr_id, struct work *work, uint32_t max_nonce,
swab32_array( endiandata, pdata, 20 ); swab32_array( endiandata, pdata, 20 );
uint64_t *edata = (uint64_t*)endiandata; uint64_t *edata = (uint64_t*)endiandata;
mm256_interleave_4x64( (uint64_t*)vdata, edata, edata, edata, edata, 640 ); mm256_intrlv_4x64( (uint64_t*)vdata, edata, edata, edata, edata, 640 );
// precalc midstate // precalc midstate
// blake512_4way_init( &ctx_mid ); // blake512_4way_init( &ctx_mid );
@@ -124,22 +123,19 @@ int scanhash_nist5_4way( int thr_id, struct work *work, uint32_t max_nonce,
if ( ( hash7[ lane ] & mask ) == 0 ) if ( ( hash7[ lane ] & mask ) == 0 )
{ {
mm256_extract_lane_4x64( lane_hash, hash, lane, 256 ); mm256_extract_lane_4x64( lane_hash, hash, lane, 256 );
if ( fulltest( lane_hash, ptarget ) ) if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{ {
pdata[19] = n + lane; pdata[19] = n + lane;
nonces[ num_found++ ] = n + lane; submit_lane_solution( work, lane_hash, mythr, lane );
work_set_target_ratio( work, lane_hash );
} }
} }
n += 4; n += 4;
} while ( ( num_found == 0 ) && ( n < max_nonce ) } while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
&& !work_restart[thr_id].restart );
break; break;
} }
} }
*hashes_done = n - first_nonce + 1; *hashes_done = n - first_nonce + 1;
return num_found; return 0;
} }
#endif #endif

View File

@@ -12,15 +12,15 @@
void nist5hash_4way( void *state, const void *input ); void nist5hash_4way( void *state, const void *input );
int scanhash_nist5_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_nist5_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
#else #else
void nist5hash( void *state, const void *input ); void nist5hash( void *state, const void *input );
int scanhash_nist5( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_nist5( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done, struct thr_info *mythr );
void init_nist5_ctx(); void init_nist5_ctx();
#endif #endif

View File

@@ -81,8 +81,8 @@ void nist5hash(void *output, const void *input)
memcpy(output, hash, 32); memcpy(output, hash, 32);
} }
int scanhash_nist5(int thr_id, struct work *work, int scanhash_nist5( struct work *work, uint32_t max_nonce,
uint32_t max_nonce, uint64_t *hashes_done) uint64_t *hashes_done, struct thr_info *mythr)
{ {
uint32_t endiandata[20] __attribute__((aligned(64))); uint32_t endiandata[20] __attribute__((aligned(64)));
uint32_t hash64[8] __attribute__((aligned(32))); uint32_t hash64[8] __attribute__((aligned(32)));
@@ -90,6 +90,7 @@ int scanhash_nist5(int thr_id, struct work *work,
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
uint32_t n = pdata[19] - 1; uint32_t n = pdata[19] - 1;
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
int thr_id = mythr->id; // thr_id arg is deprecated
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
uint64_t htmax[] = { uint64_t htmax[] = {

View File

@@ -144,8 +144,8 @@ static const int arrOrder[][4] =
memcpy(state, hash, 32); memcpy(state, hash, 32);
} }
int scanhash_zr5( int thr_id, struct work *work, int scanhash_zr5( struct work *work, uint32_t max_nonce,
uint32_t max_nonce, unsigned long *hashes_done) unsigned long *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
@@ -154,6 +154,7 @@ int scanhash_zr5( int thr_id, struct work *work,
const uint32_t version = pdata[0] & (~POK_DATA_MASK); const uint32_t version = pdata[0] & (~POK_DATA_MASK);
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t nonce = first_nonce; uint32_t nonce = first_nonce;
int thr_id = mythr->id; // thr_id arg is deprecated
memcpy(tmpdata, pdata, 80); memcpy(tmpdata, pdata, 80);

View File

@@ -160,7 +160,7 @@ void anime_4way_hash( void *state, const void *input )
mm256_dintrlv_4x64( state, state+32, state+64, state+96, vhash, 256 ); mm256_dintrlv_4x64( state, state+32, state+64, state+96, vhash, 256 );
} }
int scanhash_anime_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_anime_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[4*8] __attribute__ ((aligned (64))); uint32_t hash[4*8] __attribute__ ((aligned (64)));
@@ -170,7 +170,7 @@ int scanhash_anime_4way( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t n = pdata[19]; uint32_t n = pdata[19];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
__m256i *noncev = (__m256i*)vdata + 9; // aligned __m256i *noncev = (__m256i*)vdata + 9; // aligned
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
uint64_t htmax[] = { uint64_t htmax[] = {
0, 0,
@@ -209,7 +209,7 @@ int scanhash_anime_4way( int thr_id, struct work *work, uint32_t max_nonce,
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) && fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{ {
pdata[19] = n+i; pdata[19] = n+i;
submit_solution( work, hash+(i<<3), mythr, i ); submit_lane_solution( work, hash+(i<<3), mythr, i );
} }
n += 4; n += 4;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); } while ( ( n < max_nonce ) && !work_restart[thr_id].restart );

View File

@@ -13,14 +13,14 @@ bool register_anime_algo( algo_gate_t* gate );
#if defined(ANIME_4WAY) #if defined(ANIME_4WAY)
void anime_4way_hash( void *state, const void *input ); void anime_4way_hash( void *state, const void *input );
int scanhash_anime_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_anime_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
void init_anime_4way_ctx(); void init_anime_4way_ctx();
#endif #endif
void anime_hash( void *state, const void *input ); void anime_hash( void *state, const void *input );
int scanhash_anime( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_anime( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
void init_anime_ctx(); void init_anime_ctx();

View File

@@ -119,7 +119,7 @@ void anime_hash( void *state, const void *input )
memcpy( state, hash, 32 ); memcpy( state, hash, 32 );
} }
int scanhash_anime( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_anime( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr) uint64_t *hashes_done, struct thr_info *mythr)
{ {
uint32_t hash[8] __attribute__ ((aligned (64))); uint32_t hash[8] __attribute__ ((aligned (64)));
@@ -128,7 +128,7 @@ int scanhash_anime( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
uint32_t n = pdata[19]; uint32_t n = pdata[19];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
uint64_t htmax[] = { uint64_t htmax[] = {
0, 0,

View File

@@ -47,7 +47,7 @@ typedef union _hmq1725_4way_context_overlay hmq1725_4way_context_overlay;
extern void hmq1725_4way_hash(void *state, const void *input) extern void hmq1725_4way_hash(void *state, const void *input)
{ {
// why so big? only really need 8, haval thing uses 16. // why so big? only really need 16.
uint32_t hash0 [32] __attribute__ ((aligned (64))); uint32_t hash0 [32] __attribute__ ((aligned (64)));
uint32_t hash1 [32] __attribute__ ((aligned (64))); uint32_t hash1 [32] __attribute__ ((aligned (64)));
uint32_t hash2 [32] __attribute__ ((aligned (64))); uint32_t hash2 [32] __attribute__ ((aligned (64)));
@@ -570,11 +570,11 @@ extern void hmq1725_4way_hash(void *state, const void *input)
memcpy(state, vhash, 32<<2 ); memcpy(state, vhash, 32<<2 );
} }
int scanhash_hmq1725_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_hmq1725_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[4*8] __attribute__ ((aligned (64))); uint32_t hash[4*8] __attribute__ ((aligned (64)));
// uint32_t *hash7 = &(hash[7<<2]); // uint32_t *hash7 = &(hash[25]);
// uint32_t lane_hash[8]; // uint32_t lane_hash[8];
uint32_t vdata[24*4] __attribute__ ((aligned (64))); uint32_t vdata[24*4] __attribute__ ((aligned (64)));
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
@@ -582,7 +582,7 @@ int scanhash_hmq1725_4way( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t n = pdata[19] - 1; uint32_t n = pdata[19] - 1;
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
__m256i *noncev = (__m256i*)vdata + 9; // aligned __m256i *noncev = (__m256i*)vdata + 9; // aligned
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
uint64_t htmax[] = { 0, 0xF, 0xFF, uint64_t htmax[] = { 0, 0xF, 0xFF,
0xFFF, 0xFFFF, 0x10000000 }; 0xFFF, 0xFFFF, 0x10000000 };
@@ -604,7 +604,7 @@ int scanhash_hmq1725_4way( int thr_id, struct work *work, uint32_t max_nonce,
if ( fulltest( (hash+(i<<3)), ptarget ) && !opt_benchmark ) if ( fulltest( (hash+(i<<3)), ptarget ) && !opt_benchmark )
{ {
pdata[19] = n + i; pdata[19] = n + i;
submit_solution( work, (hash+(i<<3)), mythr, i ); submit_lane_solution( work, (hash+(i<<3)), mythr, i );
} }
} }
n += 4; n += 4;

View File

@@ -13,13 +13,13 @@ bool register_hmq1725_algo( algo_gate_t* gate );
#if defined(HMQ1725_4WAY) #if defined(HMQ1725_4WAY)
void hmq1725_4way_hash( void *state, const void *input ); void hmq1725_4way_hash( void *state, const void *input );
int scanhash_hmq1725_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_hmq1725_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
#else #else
void hmq1725hash( void *state, const void *input ); void hmq1725hash( void *state, const void *input );
int scanhash_hmq1725( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_hmq1725( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
void init_hmq1725_ctx(); void init_hmq1725_ctx();

View File

@@ -298,7 +298,7 @@ extern void hmq1725hash(void *state, const void *input)
memcpy(state, hashA, 32); memcpy(state, hashA, 32);
} }
int scanhash_hmq1725( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_hmq1725( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
// uint32_t endiandata[32] __attribute__((aligned(64))); // uint32_t endiandata[32] __attribute__((aligned(64)));
@@ -308,7 +308,7 @@ int scanhash_hmq1725( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
uint32_t n = pdata[19] - 1; uint32_t n = pdata[19] - 1;
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
//const uint32_t Htarg = ptarget[7]; //const uint32_t Htarg = ptarget[7];
//we need bigendian data... //we need bigendian data...

View File

@@ -165,7 +165,7 @@ void quark_4way_hash( void *state, const void *input )
casti_m256i( state, 3 ) = _mm256_blendv_epi8( vhA[3], vhB[3], vh_mask ); casti_m256i( state, 3 ) = _mm256_blendv_epi8( vhA[3], vhB[3], vh_mask );
} }
int scanhash_quark_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_quark_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[4*8] __attribute__ ((aligned (64))); uint32_t hash[4*8] __attribute__ ((aligned (64)));
@@ -177,7 +177,7 @@ int scanhash_quark_4way( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t n = pdata[19]; uint32_t n = pdata[19];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
__m256i *noncev = (__m256i*)vdata + 9; // aligned __m256i *noncev = (__m256i*)vdata + 9; // aligned
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
mm256_bswap_intrlv80_4x64( vdata, pdata ); mm256_bswap_intrlv80_4x64( vdata, pdata );
do do
@@ -195,7 +195,7 @@ int scanhash_quark_4way( int thr_id, struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{ {
pdata[19] = n+i; pdata[19] = n+i;
submit_solution( work, lane_hash, mythr, i ); submit_lane_solution( work, lane_hash, mythr, i );
} }
} }
n += 4; n += 4;

View File

@@ -13,14 +13,14 @@ bool register_quark_algo( algo_gate_t* gate );
#if defined(QUARK_4WAY) #if defined(QUARK_4WAY)
void quark_4way_hash( void *state, const void *input ); void quark_4way_hash( void *state, const void *input );
int scanhash_quark_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_quark_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
void init_quark_4way_ctx(); void init_quark_4way_ctx();
#endif #endif
void quark_hash( void *state, const void *input ); void quark_hash( void *state, const void *input );
int scanhash_quark( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_quark( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
void init_quark_ctx(); void init_quark_ctx();

View File

@@ -172,7 +172,7 @@ void quark_hash(void *state, const void *input)
memcpy(state, hash, 32); memcpy(state, hash, 32);
} }
int scanhash_quark( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_quark( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t endiandata[20] __attribute__((aligned(64))); uint32_t endiandata[20] __attribute__((aligned(64)));
@@ -181,7 +181,7 @@ int scanhash_quark( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
uint32_t n = pdata[19] - 1; uint32_t n = pdata[19] - 1;
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
swab32_array( endiandata, pdata, 20 ); swab32_array( endiandata, pdata, 20 );

View File

@@ -39,7 +39,7 @@ void deep_2way_hash( void *output, const void *input )
memcpy( &ctx, &deep_2way_ctx, sizeof(deep_2way_ctx) ); memcpy( &ctx, &deep_2way_ctx, sizeof(deep_2way_ctx) );
luffa_2way_update( &ctx.luffa, input + (64<<1), 16 ); luffa_2way_update( &ctx.luffa, input + (64<<1), 16 );
luffa_2way_close( &ctx.luffa, vhash ); luffa_2way_close( &ctx.luffa, vhash );
mm256_deinterleave_2x128( hash0, hash1, vhash, 512 ); mm256_dintrlv_2x128( hash0, hash1, vhash, 512 );
cubehashUpdateDigest( &ctx.cube, (byte*)hash0, cubehashUpdateDigest( &ctx.cube, (byte*)hash0,
(const byte*) hash0, 64 ); (const byte*) hash0, 64 );
@@ -63,7 +63,7 @@ void deep_2way_hash( void *output, const void *input )
memcpy( output+32, hash1, 32 ); memcpy( output+32, hash1, 32 );
} }
int scanhash_deep_2way( int thr_id, struct work *work,uint32_t max_nonce, int scanhash_deep_2way( struct work *work,uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[4*8] __attribute__ ((aligned (64))); uint32_t hash[4*8] __attribute__ ((aligned (64)));
@@ -74,7 +74,7 @@ int scanhash_deep_2way( int thr_id, struct work *work,uint32_t max_nonce,
uint32_t n = pdata[19]; uint32_t n = pdata[19];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t *noncep = vdata + 32+3; // 4*8 + 3 uint32_t *noncep = vdata + 32+3; // 4*8 + 3
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
uint64_t htmax[] = { 0, 0xF, 0xFF, uint64_t htmax[] = { 0, 0xF, 0xFF,
0xFFF, 0xFFFF, 0x10000000 }; 0xFFF, 0xFFFF, 0x10000000 };
@@ -86,7 +86,7 @@ int scanhash_deep_2way( int thr_id, struct work *work,uint32_t max_nonce,
casti_m128i( endiandata, 4 ) = mm128_bswap_32( casti_m128i( pdata, 4 ) ); casti_m128i( endiandata, 4 ) = mm128_bswap_32( casti_m128i( pdata, 4 ) );
uint64_t *edata = (uint64_t*)endiandata; uint64_t *edata = (uint64_t*)endiandata;
mm256_interleave_2x128( (uint64_t*)vdata, edata, edata, 640 ); mm256_intrlv_2x128( (uint64_t*)vdata, edata, edata, 640 );
luffa_2way_init( &deep_2way_ctx.luffa, 512 ); luffa_2way_init( &deep_2way_ctx.luffa, 512 );
luffa_2way_update( &deep_2way_ctx.luffa, vdata, 64 ); luffa_2way_update( &deep_2way_ctx.luffa, vdata, 64 );
@@ -106,13 +106,13 @@ int scanhash_deep_2way( int thr_id, struct work *work,uint32_t max_nonce,
if ( fulltest( hash, ptarget) && !opt_benchmark ) if ( fulltest( hash, ptarget) && !opt_benchmark )
{ {
pdata[19] = n; pdata[19] = n;
submit_solution( work, hash, mythr, 0 ); submit_lane_solution( work, hash, mythr, 0 );
} }
if ( !( (hash+8)[7] & mask ) ) if ( !( (hash+8)[7] & mask ) )
if ( fulltest( hash+8, ptarget) && !opt_benchmark ) if ( fulltest( hash+8, ptarget) && !opt_benchmark )
{ {
pdata[19] = n+1; pdata[19] = n+1;
submit_solution( work, hash+8, mythr, 1 ); submit_lane_solution( work, hash+8, mythr, 1 );
} }
n += 2; n += 2;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); } while ( ( n < max_nonce ) && !work_restart[thr_id].restart );

View File

@@ -13,14 +13,14 @@ bool register_deep_algo( algo_gate_t* gate );
#if defined(DEEP_2WAY) #if defined(DEEP_2WAY)
void deep_2way_hash( void *state, const void *input ); void deep_2way_hash( void *state, const void *input );
int scanhash_deep_2way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_deep_2way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
void init_deep_2way_ctx(); void init_deep_2way_ctx();
#endif #endif
void deep_hash( void *state, const void *input ); void deep_hash( void *state, const void *input );
int scanhash_deep( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_deep( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
void init_deep_ctx(); void init_deep_ctx();

View File

@@ -71,7 +71,7 @@ void deep_hash(void *output, const void *input)
memcpy(output, hash, 32); memcpy(output, hash, 32);
} }
int scanhash_deep( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_deep( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t endiandata[20] __attribute__((aligned(64))); uint32_t endiandata[20] __attribute__((aligned(64)));
@@ -80,7 +80,7 @@ int scanhash_deep( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
uint32_t n = pdata[19] - 1; uint32_t n = pdata[19] - 1;
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
uint64_t htmax[] = { 0, 0xF, 0xFF, 0xFFF, 0xFFFF, 0x10000000 }; uint64_t htmax[] = { 0, 0xF, 0xFF, 0xFFF, 0xFFFF, 0x10000000 };

View File

@@ -41,7 +41,7 @@ void qubit_2way_hash( void *output, const void *input )
memcpy( &ctx, &qubit_2way_ctx, sizeof(qubit_2way_ctx) ); memcpy( &ctx, &qubit_2way_ctx, sizeof(qubit_2way_ctx) );
luffa_2way_update( &ctx.luffa, input + (64<<1), 16 ); luffa_2way_update( &ctx.luffa, input + (64<<1), 16 );
luffa_2way_close( &ctx.luffa, vhash ); luffa_2way_close( &ctx.luffa, vhash );
mm256_deinterleave_2x128( hash0, hash1, vhash, 512 ); mm256_dintrlv_2x128( hash0, hash1, vhash, 512 );
cubehashUpdateDigest( &ctx.cube, (byte*)hash0, cubehashUpdateDigest( &ctx.cube, (byte*)hash0,
(const byte*) hash0, 64 ); (const byte*) hash0, 64 );
@@ -55,9 +55,9 @@ void qubit_2way_hash( void *output, const void *input )
sph_shavite512( &ctx.shavite, hash1, 64 ); sph_shavite512( &ctx.shavite, hash1, 64 );
sph_shavite512_close( &ctx.shavite, hash1 ); sph_shavite512_close( &ctx.shavite, hash1 );
mm256_interleave_2x128( vhash, hash0, hash1, 512 ); mm256_intrlv_2x128( vhash, hash0, hash1, 512 );
simd_2way_update_close( &ctx.simd, vhash, vhash, 512 ); simd_2way_update_close( &ctx.simd, vhash, vhash, 512 );
mm256_deinterleave_2x128( hash0, hash1, vhash, 512 ); mm256_dintrlv_2x128( hash0, hash1, vhash, 512 );
update_final_echo( &ctx.echo, (BitSequence *)hash0, update_final_echo( &ctx.echo, (BitSequence *)hash0,
(const BitSequence *) hash0, 512 ); (const BitSequence *) hash0, 512 );
@@ -69,7 +69,7 @@ void qubit_2way_hash( void *output, const void *input )
memcpy( output+32, hash1, 32 ); memcpy( output+32, hash1, 32 );
} }
int scanhash_qubit_2way( int thr_id, struct work *work,uint32_t max_nonce, int scanhash_qubit_2way( struct work *work,uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[4*8] __attribute__ ((aligned (64))); uint32_t hash[4*8] __attribute__ ((aligned (64)));
@@ -80,7 +80,7 @@ int scanhash_qubit_2way( int thr_id, struct work *work,uint32_t max_nonce,
uint32_t n = pdata[19]; uint32_t n = pdata[19];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t *noncep = vdata + 32+3; // 4*8 + 3 uint32_t *noncep = vdata + 32+3; // 4*8 + 3
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
uint64_t htmax[] = { 0, 0xF, 0xFF, uint64_t htmax[] = { 0, 0xF, 0xFF,
0xFFF, 0xFFFF, 0x10000000 }; 0xFFF, 0xFFFF, 0x10000000 };
@@ -92,7 +92,7 @@ int scanhash_qubit_2way( int thr_id, struct work *work,uint32_t max_nonce,
casti_m128i( endiandata, 4 ) = mm128_bswap_32( casti_m128i( pdata, 4 ) ); casti_m128i( endiandata, 4 ) = mm128_bswap_32( casti_m128i( pdata, 4 ) );
uint64_t *edata = (uint64_t*)endiandata; uint64_t *edata = (uint64_t*)endiandata;
mm256_interleave_2x128( (uint64_t*)vdata, edata, edata, 640 ); mm256_intrlv_2x128( (uint64_t*)vdata, edata, edata, 640 );
luffa_2way_init( &qubit_2way_ctx.luffa, 512 ); luffa_2way_init( &qubit_2way_ctx.luffa, 512 );
luffa_2way_update( &qubit_2way_ctx.luffa, vdata, 64 ); luffa_2way_update( &qubit_2way_ctx.luffa, vdata, 64 );
@@ -111,13 +111,13 @@ int scanhash_qubit_2way( int thr_id, struct work *work,uint32_t max_nonce,
if ( fulltest( hash, ptarget) && !opt_benchmark ) if ( fulltest( hash, ptarget) && !opt_benchmark )
{ {
pdata[19] = n; pdata[19] = n;
submit_solution( work, hash, mythr, 0 ); submit_lane_solution( work, hash, mythr, 0 );
} }
if ( !( (hash+8)[7] & mask ) ) if ( !( (hash+8)[7] & mask ) )
if ( fulltest( hash+8, ptarget) && !opt_benchmark ) if ( fulltest( hash+8, ptarget) && !opt_benchmark )
{ {
pdata[19] = n+1; pdata[19] = n+1;
submit_solution( work, hash+8, mythr, 1 ); submit_lane_solution( work, hash+8, mythr, 1 );
} }
n += 2; n += 2;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart ); } while ( ( n < max_nonce ) && !work_restart[thr_id].restart );

View File

@@ -13,14 +13,14 @@ bool register_qubit_algo( algo_gate_t* gate );
#if defined(QUBIT_2WAY) #if defined(QUBIT_2WAY)
void qubit_2way_hash( void *state, const void *input ); void qubit_2way_hash( void *state, const void *input );
int scanhash_qubit_2way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_qubit_2way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
void init_qubit_2way_ctx(); void init_qubit_2way_ctx();
#endif #endif
void qubit_hash( void *state, const void *input ); void qubit_hash( void *state, const void *input );
int scanhash_qubit( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_qubit( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
void init_qubit_ctx(); void init_qubit_ctx();

View File

@@ -83,7 +83,7 @@ void qubit_hash(void *output, const void *input)
memcpy(output, hash, 32); memcpy(output, hash, 32);
} }
int scanhash_qubit( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_qubit( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t endiandata[20] __attribute__((aligned(64))); uint32_t endiandata[20] __attribute__((aligned(64)));
@@ -92,7 +92,7 @@ int scanhash_qubit( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
uint32_t n = pdata[19] - 1; uint32_t n = pdata[19] - 1;
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
uint64_t htmax[] = { 0, 0xF, 0xFF, 0xFFF, 0xFFFF, 0x10000000 }; uint64_t htmax[] = { 0, 0xF, 0xFF, 0xFFF, 0xFFFF, 0x10000000 };

View File

@@ -75,7 +75,7 @@ void lbry_8way_hash( void* output, const void* input )
sha256_8way_close( &ctx_sha256, output ); sha256_8way_close( &ctx_sha256, output );
} }
int scanhash_lbry_8way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lbry_8way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[8*8] __attribute__ ((aligned (64))); uint32_t hash[8*8] __attribute__ ((aligned (64)));
@@ -89,7 +89,7 @@ int scanhash_lbry_8way( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
uint32_t edata[32] __attribute__ ((aligned (64))); uint32_t edata[32] __attribute__ ((aligned (64)));
__m256i *noncev = (__m256i*)vdata + 27; // aligned __m256i *noncev = (__m256i*)vdata + 27; // aligned
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
uint64_t htmax[] = { 0, 0xF, 0xFF, uint64_t htmax[] = { 0, 0xF, 0xFF,
0xFFF, 0xFFFF, 0x10000000 }; 0xFFF, 0xFFFF, 0x10000000 };
@@ -122,7 +122,7 @@ int scanhash_lbry_8way( int thr_id, struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{ {
pdata[27] = n + i; pdata[27] = n + i;
submit_solution( work, lane_hash, mythr, i ); submit_lane_solution( work, lane_hash, mythr, i );
} }
} }
n += 8; n += 8;

View File

@@ -21,19 +21,19 @@ bool register_lbry_algo( algo_gate_t* gate );
#if defined(LBRY_8WAY) #if defined(LBRY_8WAY)
void lbry_8way_hash( void *state, const void *input ); void lbry_8way_hash( void *state, const void *input );
int scanhash_lbry_8way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lbry_8way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
/* /*
#elif defined(LBRY_4WAY) #elif defined(LBRY_4WAY)
void lbry_4way_hash( void *state, const void *input ); void lbry_4way_hash( void *state, const void *input );
int scanhash_lbry_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lbry_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done ); uint64_t *hashes_done );
*/ */
#else #else
void lbry_hash( void *state, const void *input ); void lbry_hash( void *state, const void *input );
int scanhash_lbry( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lbry( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif
#endif #endif

View File

@@ -47,7 +47,7 @@ void lbry_hash(void* output, const void* input)
memcpy( output, hashA, 32 ); memcpy( output, hashA, 32 );
} }
int scanhash_lbry( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_lbry( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr) uint64_t *hashes_done, struct thr_info *mythr)
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
@@ -55,7 +55,7 @@ int scanhash_lbry( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t n = pdata[27] - 1; uint32_t n = pdata[27] - 1;
const uint32_t first_nonce = pdata[27]; const uint32_t first_nonce = pdata[27];
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
uint32_t hash64[8] __attribute__((aligned(64))); uint32_t hash64[8] __attribute__((aligned(64)));
uint32_t endiandata[32] __attribute__ ((aligned (64))); uint32_t endiandata[32] __attribute__ ((aligned (64)));

View File

@@ -1042,8 +1042,8 @@ static bool fulltest_le(const uint *hash, const uint *target)
return(rc); return(rc);
} }
int scanhash_neoscrypt( int thr_id, struct work *work, int scanhash_neoscrypt( struct work *work,
uint32_t max_nonce, uint64_t *hashes_done ) uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
@@ -1051,6 +1051,7 @@ int scanhash_neoscrypt( int thr_id, struct work *work,
uint32_t _ALIGN(64) hash[8]; uint32_t _ALIGN(64) hash[8];
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
int thr_id = mythr->id; // thr_id arg is deprecated
while (pdata[19] < max_nonce && !work_restart[thr_id].restart) while (pdata[19] < max_nonce && !work_restart[thr_id].restart)
{ {

View File

@@ -444,7 +444,7 @@ void pluck_hash(uint32_t *hash, const uint32_t *data, uchar *hashbuffer, const i
memcpy(hash, hashbuffer, 32); memcpy(hash, hashbuffer, 32);
} }
int scanhash_pluck(int thr_id, struct work *work, uint32_t max_nonce, int scanhash_pluck( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
@@ -452,9 +452,9 @@ int scanhash_pluck(int thr_id, struct work *work, uint32_t max_nonce,
uint32_t _ALIGN(64) endiandata[20]; uint32_t _ALIGN(64) endiandata[20];
uint32_t _ALIGN(64) hash[8]; uint32_t _ALIGN(64) hash[8];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
int thr_id = mythr->id; // thr_id arg is deprecated
volatile uint8_t *restart = &(work_restart[thr_id].restart); volatile uint8_t *restart = &(work_restart[thr_id].restart);
uint32_t n = first_nonce; uint32_t n = first_nonce;
/* int */ thr_id = mythr->id; // thr_id arg is deprecated
if (opt_benchmark) if (opt_benchmark)

View File

@@ -695,7 +695,7 @@ static void scrypt_1024_1_1_256_24way(const uint32_t *input,
} }
#endif /* HAVE_SCRYPT_6WAY */ #endif /* HAVE_SCRYPT_6WAY */
extern int scanhash_scrypt( int thr_id, struct work *work, uint32_t max_nonce, extern int scanhash_scrypt( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
@@ -704,7 +704,7 @@ extern int scanhash_scrypt( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t midstate[8]; uint32_t midstate[8];
uint32_t n = pdata[19] - 1; uint32_t n = pdata[19] - 1;
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
int throughput = scrypt_best_throughput(); int throughput = scrypt_best_throughput();
int i; int i;

View File

@@ -135,8 +135,8 @@ unsigned char GetNfactor(unsigned int nTimestamp, unsigned int ntime) {
} }
int scanhash_scryptjane( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_scryptjane( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done) uint64_t *hashes_done, struct thr_info *mythr )
{ {
scrypt_aligned_alloc YX, V; scrypt_aligned_alloc YX, V;
uint8_t *X, *Y; uint8_t *X, *Y;
@@ -150,6 +150,7 @@ int scanhash_scryptjane( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t _ALIGN(64) endiandata[20]; uint32_t _ALIGN(64) endiandata[20];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t nonce = first_nonce; uint32_t nonce = first_nonce;
int thr_id = mythr->id; // thr_id arg is deprecated
if (opt_benchmark) if (opt_benchmark)
ptarget[7] = 0x00ff; ptarget[7] = 0x00ff;

View File

@@ -586,8 +586,8 @@ static inline int scanhash_sha256d_8way(int thr_id, struct work *work,
#endif /* HAVE_SHA256_8WAY */ #endif /* HAVE_SHA256_8WAY */
int scanhash_sha256d(int thr_id, struct work *work, int scanhash_sha256d( struct work *work,
uint32_t max_nonce, uint64_t *hashes_done) uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
@@ -598,7 +598,8 @@ int scanhash_sha256d(int thr_id, struct work *work,
uint32_t n = pdata[19] - 1; uint32_t n = pdata[19] - 1;
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
int thr_id = mythr->id; // thr_id arg is deprecated
#ifdef HAVE_SHA256_8WAY #ifdef HAVE_SHA256_8WAY
if (sha256_use_8way()) if (sha256_use_8way())
return scanhash_sha256d_8way(thr_id, work, return scanhash_sha256d_8way(thr_id, work,
@@ -621,16 +622,14 @@ int scanhash_sha256d(int thr_id, struct work *work,
do { do {
data[3] = ++n; data[3] = ++n;
sha256d_ms(hash, data, midstate, prehash); sha256d_ms(hash, data, midstate, prehash);
if (unlikely(swab32(hash[7]) <= Htarg)) { if (unlikely(swab32(hash[7]) <= Htarg))
{
pdata[19] = data[3]; pdata[19] = data[3];
sha256d_80_swap(hash, pdata); sha256d_80_swap(hash, pdata);
if (fulltest(hash, ptarget)) { if ( fulltest(hash, ptarget) && !opt_benchmark )
*hashes_done = n - first_nonce + 1; submit_solution( work, hash, mythr );
return 1;
}
} }
} while (likely(n < max_nonce && !work_restart[thr_id].restart)); } while (likely(n < max_nonce && !work_restart[thr_id].restart));
*hashes_done = n - first_nonce + 1; *hashes_done = n - first_nonce + 1;
pdata[19] = n; pdata[19] = n;
return 0; return 0;

View File

@@ -31,7 +31,7 @@ void sha256q_8way_hash( void* output, const void* input )
sha256_8way_close( &ctx, output ); sha256_8way_close( &ctx, output );
} }
int scanhash_sha256q_8way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_sha256q_8way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t vdata[20*8] __attribute__ ((aligned (64))); uint32_t vdata[20*8] __attribute__ ((aligned (64)));
@@ -42,7 +42,7 @@ int scanhash_sha256q_8way( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t n = first_nonce; uint32_t n = first_nonce;
__m256i *noncev = (__m256i*)vdata + 19; // aligned __m256i *noncev = (__m256i*)vdata + 19; // aligned
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
const uint64_t htmax[] = { 0, const uint64_t htmax[] = { 0,
0xF, 0xF,
@@ -85,7 +85,7 @@ int scanhash_sha256q_8way( int thr_id, struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{ {
pdata[19] = n + lane; pdata[19] = n + lane;
submit_solution( work, lane_hash, mythr, lane ); submit_lane_solution( work, lane_hash, mythr, lane );
} }
} }
n += 8; n += 8;
@@ -124,7 +124,7 @@ void sha256q_4way_hash( void* output, const void* input )
sha256_4way_close( &ctx, output ); sha256_4way_close( &ctx, output );
} }
int scanhash_sha256q_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_sha256q_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t vdata[20*4] __attribute__ ((aligned (64))); uint32_t vdata[20*4] __attribute__ ((aligned (64)));
@@ -137,7 +137,7 @@ int scanhash_sha256q_4way( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t n = first_nonce; uint32_t n = first_nonce;
__m128i *noncev = (__m128i*)vdata + 19; // aligned __m128i *noncev = (__m128i*)vdata + 19; // aligned
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
const uint64_t htmax[] = { 0, const uint64_t htmax[] = { 0,
0xF, 0xF,
@@ -173,7 +173,7 @@ int scanhash_sha256q_4way( int thr_id, struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{ {
pdata[19] = n + lane; pdata[19] = n + lane;
submit_solution( work, lane_hash, mythr, lane ); submit_lane_solution( work, lane_hash, mythr, lane );
} }
} }
n += 4; n += 4;

View File

@@ -40,7 +40,7 @@ void sha256q_hash( void* output, const void* input )
memcpy( output, hash, 32 ); memcpy( output, hash, 32 );
} }
int scanhash_sha256q( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_sha256q( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
@@ -54,7 +54,7 @@ int scanhash_sha256q( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t hash64[8] __attribute__((aligned(32))); uint32_t hash64[8] __attribute__((aligned(32)));
#endif #endif
uint32_t endiandata[32]; uint32_t endiandata[32];
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
uint64_t htmax[] = { uint64_t htmax[] = {
0, 0,
@@ -91,22 +91,13 @@ int scanhash_sha256q( int thr_id, struct work *work, uint32_t max_nonce,
pdata[19] = ++n; pdata[19] = ++n;
be32enc(&endiandata[19], n); be32enc(&endiandata[19], n);
sha256q_hash( hash64, endiandata ); sha256q_hash( hash64, endiandata );
if ( ( !(hash64[7] & mask) ) && fulltest( hash64, ptarget ) ) if ( !( hash64[7] & mask ) )
{ if ( fulltest( hash64, ptarget ) && !opt_benchmark )
work_set_target_ratio( work, hash64 ); submit_solution( work, hash64, mythr );
if ( submit_work( mythr, work ) )
applog( LOG_NOTICE, "Share %d submitted by thread %d.",
accepted_share_count + rejected_share_count + 1,
thr_id );
else
applog( LOG_WARNING, "Failed to submit share." );
*hashes_done = n - first_nonce + 1;
}
} while ( n < max_nonce && !work_restart[thr_id].restart ); } while ( n < max_nonce && !work_restart[thr_id].restart );
break; break;
} }
} }
*hashes_done = n - first_nonce + 1; *hashes_done = n - first_nonce + 1;
pdata[19] = n; pdata[19] = n;
return 0; return 0;

View File

@@ -33,7 +33,7 @@ void sha256t_11way_hash( void *outx, void *outy, void *outz, const void *inpx,
sha256_11way_close( &ctx, outx, outy, outz ); sha256_11way_close( &ctx, outx, outy, outz );
} }
int scanhash_sha256t_11way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_sha256t_11way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t datax[20*8] __attribute__ ((aligned (64))); uint32_t datax[20*8] __attribute__ ((aligned (64)));
@@ -52,7 +52,7 @@ int scanhash_sha256t_11way( int thr_id, struct work *work, uint32_t max_nonce,
__m256i *noncex = (__m256i*) datax + 19; __m256i *noncex = (__m256i*) datax + 19;
__m64 *noncey = (__m64*) datay + 19; __m64 *noncey = (__m64*) datay + 19;
uint32_t *noncez = (uint32_t*)dataz + 19; uint32_t *noncez = (uint32_t*)dataz + 19;
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
int i; int i;
const uint64_t htmax[] = { 0, const uint64_t htmax[] = { 0,
0xF, 0xF,
@@ -103,7 +103,7 @@ int scanhash_sha256t_11way( int thr_id, struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) ) if ( fulltest( lane_hash, ptarget ) )
{ {
pdata[19] = n + i; pdata[19] = n + i;
submit_solution( work, lane_hash, mythr, i ); submit_lane_solution( work, lane_hash, mythr, i );
} }
} }
@@ -115,14 +115,14 @@ int scanhash_sha256t_11way( int thr_id, struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) ) if ( fulltest( lane_hash, ptarget ) )
{ {
pdata[19] = n + 8 + i; pdata[19] = n + 8 + i;
submit_solution( work, lane_hash, mythr, i+8 ); submit_lane_solution( work, lane_hash, mythr, i+8 );
} }
} }
if ( !(hashz[7] & mask ) && fulltest( hashz, ptarget ) ) if ( !(hashz[7] & mask ) && fulltest( hashz, ptarget ) )
{ {
pdata[19] = n+10; pdata[19] = n+10;
submit_solution( work, hashz, mythr, 10 ); submit_lane_solution( work, hashz, mythr, 10 );
} }
n += 11; n += 11;
@@ -158,7 +158,7 @@ void sha256t_8way_hash( void* output, const void* input )
sha256_8way_close( &ctx, output ); sha256_8way_close( &ctx, output );
} }
int scanhash_sha256t_8way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_sha256t_8way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t vdata[20*8] __attribute__ ((aligned (64))); uint32_t vdata[20*8] __attribute__ ((aligned (64)));
@@ -171,7 +171,7 @@ int scanhash_sha256t_8way( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t n = first_nonce; uint32_t n = first_nonce;
__m256i *noncev = (__m256i*)vdata + 19; // aligned __m256i *noncev = (__m256i*)vdata + 19; // aligned
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
const uint64_t htmax[] = { 0, const uint64_t htmax[] = { 0,
0xF, 0xF,
@@ -208,7 +208,7 @@ int scanhash_sha256t_8way( int thr_id, struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{ {
pdata[19] = n + lane; pdata[19] = n + lane;
submit_solution( work, lane_hash, mythr, lane ); submit_lane_solution( work, lane_hash, mythr, lane );
} }
} }
n += 8; n += 8;
@@ -243,7 +243,7 @@ void sha256t_4way_hash( void* output, const void* input )
sha256_4way_close( &ctx, output ); sha256_4way_close( &ctx, output );
} }
int scanhash_sha256t_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_sha256t_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t vdata[20*4] __attribute__ ((aligned (64))); uint32_t vdata[20*4] __attribute__ ((aligned (64)));
@@ -256,7 +256,7 @@ int scanhash_sha256t_4way( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t n = first_nonce; uint32_t n = first_nonce;
__m128i *noncev = (__m128i*)vdata + 19; // aligned __m128i *noncev = (__m128i*)vdata + 19; // aligned
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
const uint64_t htmax[] = { 0, const uint64_t htmax[] = { 0,
0xF, 0xF,
@@ -291,7 +291,7 @@ int scanhash_sha256t_4way( int thr_id, struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{ {
pdata[19] = n + lane; pdata[19] = n + lane;
submit_solution( work, lane_hash, mythr, lane ); submit_lane_solution( work, lane_hash, mythr, lane );
} }
} }
n += 4; n += 4;

View File

@@ -19,28 +19,28 @@ bool register_sha256q_algo( algo_gate_t* gate );
#if defined(SHA256T_8WAY) #if defined(SHA256T_8WAY)
void sha256t_8way_hash( void *output, const void *input ); void sha256t_8way_hash( void *output, const void *input );
int scanhash_sha256t_8way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_sha256t_8way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
void sha256q_8way_hash( void *output, const void *input ); void sha256q_8way_hash( void *output, const void *input );
int scanhash_sha256q_8way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_sha256q_8way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif
#if defined(SHA256T_4WAY) #if defined(SHA256T_4WAY)
void sha256t_4way_hash( void *output, const void *input ); void sha256t_4way_hash( void *output, const void *input );
int scanhash_sha256t_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_sha256t_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
void sha256q_4way_hash( void *output, const void *input ); void sha256q_4way_hash( void *output, const void *input );
int scanhash_sha256q_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_sha256q_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif
void sha256t_hash( void *output, const void *input ); void sha256t_hash( void *output, const void *input );
int scanhash_sha256t( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_sha256t( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
void sha256q_hash( void *output, const void *input ); void sha256q_hash( void *output, const void *input );
int scanhash_sha256q( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_sha256q( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif

View File

@@ -36,7 +36,7 @@ void sha256t_hash( void* output, const void* input )
memcpy( output, hash, 32 ); memcpy( output, hash, 32 );
} }
int scanhash_sha256t( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_sha256t( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
@@ -50,7 +50,7 @@ int scanhash_sha256t( int thr_id, struct work *work, uint32_t max_nonce,
uint32_t hash64[8] __attribute__((aligned(32))); uint32_t hash64[8] __attribute__((aligned(32)));
#endif #endif
uint32_t endiandata[32]; uint32_t endiandata[32];
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
uint64_t htmax[] = { uint64_t htmax[] = {
0, 0,
@@ -87,22 +87,13 @@ int scanhash_sha256t( int thr_id, struct work *work, uint32_t max_nonce,
pdata[19] = ++n; pdata[19] = ++n;
be32enc(&endiandata[19], n); be32enc(&endiandata[19], n);
sha256t_hash( hash64, endiandata ); sha256t_hash( hash64, endiandata );
if ( ( !(hash64[7] & mask) ) && fulltest( hash64, ptarget ) ) if ( !(hash64[7] & mask) )
{ if ( fulltest( hash64, ptarget ) && !opt_benchmark )
*hashes_done = n - first_nonce + 1; submit_solution( work, hash64, mythr );
work_set_target_ratio( work, hash64 );
if ( submit_work( mythr, work ) )
applog( LOG_NOTICE, "Share %d submitted by thread %d.",
accepted_share_count + rejected_share_count + 1,
thr_id );
else
applog( LOG_WARNING, "Failed to submit share." );
}
} while ( n < max_nonce && !work_restart[thr_id].restart ); } while ( n < max_nonce && !work_restart[thr_id].restart );
break; break;
} }
} }
*hashes_done = n - first_nonce + 1; *hashes_done = n - first_nonce + 1;
pdata[19] = n; pdata[19] = n;
return 0; return 0;

View File

@@ -31,11 +31,12 @@ extern void inkhash(void *state, const void *input)
*/ */
} }
int scanhash_ink(int thr_id, struct work *work, int scanhash_ink( struct work *work,
uint32_t max_nonce, uint64_t *hashes_done) uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
int thr_id = mythr->id;
uint32_t n = pdata[19] - 1; uint32_t n = pdata[19] - 1;
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];

View File

@@ -13,7 +13,6 @@
void skeinhash_4way( void *state, const void *input ) void skeinhash_4way( void *state, const void *input )
{ {
uint64_t vhash64[8*4] __attribute__ ((aligned (64))); uint64_t vhash64[8*4] __attribute__ ((aligned (64)));
uint32_t vhash32[16*4] __attribute__ ((aligned (64)));
skein512_4way_context ctx_skein; skein512_4way_context ctx_skein;
#if defined(__SHA__) #if defined(__SHA__)
uint32_t hash0[16] __attribute__ ((aligned (64))); uint32_t hash0[16] __attribute__ ((aligned (64)));
@@ -22,6 +21,7 @@ void skeinhash_4way( void *state, const void *input )
uint32_t hash3[16] __attribute__ ((aligned (64))); uint32_t hash3[16] __attribute__ ((aligned (64)));
SHA256_CTX ctx_sha256; SHA256_CTX ctx_sha256;
#else #else
uint32_t vhash32[16*4] __attribute__ ((aligned (64)));
sha256_4way_context ctx_sha256; sha256_4way_context ctx_sha256;
#endif #endif
@@ -58,7 +58,7 @@ void skeinhash_4way( void *state, const void *input )
#endif #endif
} }
int scanhash_skein_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_skein_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t vdata[20*4] __attribute__ ((aligned (64))); uint32_t vdata[20*4] __attribute__ ((aligned (64)));
@@ -71,7 +71,7 @@ int scanhash_skein_4way( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t n = first_nonce; uint32_t n = first_nonce;
__m256i *noncev = (__m256i*)vdata + 9; // aligned __m256i *noncev = (__m256i*)vdata + 9; // aligned
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
mm256_bswap_intrlv80_4x64( vdata, pdata ); mm256_bswap_intrlv80_4x64( vdata, pdata );
do do
@@ -88,7 +88,7 @@ int scanhash_skein_4way( int thr_id, struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) ) if ( fulltest( lane_hash, ptarget ) )
{ {
pdata[19] = n + lane; pdata[19] = n + lane;
submit_solution( work, lane_hash, mythr, lane ); submit_lane_solution( work, lane_hash, mythr, lane );
} }
} }
n += 4; n += 4;

View File

@@ -11,13 +11,13 @@
void skeinhash_4way( void *output, const void *input ); void skeinhash_4way( void *output, const void *input );
int scanhash_skein_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_skein_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif
void skeinhash( void *output, const void *input ); void skeinhash( void *output, const void *input );
int scanhash_skein( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_skein( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif

View File

@@ -21,7 +21,7 @@ void skeinhash(void *state, const void *input)
memcpy(state, hash, 32); memcpy(state, hash, 32);
} }
int scanhash_skein( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_skein( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
@@ -31,7 +31,7 @@ int scanhash_skein( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t n = first_nonce; uint32_t n = first_nonce;
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
swab32_array( endiandata, pdata, 20 ); swab32_array( endiandata, pdata, 20 );

View File

@@ -19,7 +19,7 @@ void skein2hash_4way( void *output, const void *input )
skein512_4way_close( &ctx, output ); skein512_4way_close( &ctx, output );
} }
int scanhash_skein2_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_skein2_4way( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t hash[8*4] __attribute__ ((aligned (64))); uint32_t hash[8*4] __attribute__ ((aligned (64)));
@@ -31,7 +31,7 @@ int scanhash_skein2_4way( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t n = first_nonce; uint32_t n = first_nonce;
__m256i *noncev = (__m256i*)vdata + 9; // aligned __m256i *noncev = (__m256i*)vdata + 9; // aligned
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
mm256_bswap_intrlv80_4x64( vdata, pdata ); mm256_bswap_intrlv80_4x64( vdata, pdata );
do do
@@ -49,7 +49,7 @@ int scanhash_skein2_4way( int thr_id, struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark ) if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{ {
pdata[19] = n + lane; pdata[19] = n + lane;
submit_solution( work, lane_hash, mythr, lane ); submit_lane_solution( work, lane_hash, mythr, lane );
} }
} }
n += 4; n += 4;

View File

@@ -9,12 +9,12 @@
#if defined(SKEIN2_4WAY) #if defined(SKEIN2_4WAY)
void skein2hash_4way( void *output, const void *input ); void skein2hash_4way( void *output, const void *input );
int scanhash_skein2_4way( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_skein2_4way( struct work *work, uint32_t max_nonce,
uint64_t* hashes_done, struct thr_info *mythr ); uint64_t* hashes_done, struct thr_info *mythr );
#endif #endif
void skein2hash( void *output, const void *input ); void skein2hash( void *output, const void *input );
int scanhash_skein2( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_skein2( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ); uint64_t *hashes_done, struct thr_info *mythr );
#endif #endif

View File

@@ -34,7 +34,7 @@ void skein2hash(void *output, const void *input)
} }
int scanhash_skein2( int thr_id, struct work *work, uint32_t max_nonce, int scanhash_skein2( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr ) uint64_t *hashes_done, struct thr_info *mythr )
{ {
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
@@ -44,7 +44,7 @@ int scanhash_skein2( int thr_id, struct work *work, uint32_t max_nonce,
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7];
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t n = first_nonce; uint32_t n = first_nonce;
/* int */ thr_id = mythr->id; // thr_id arg is deprecated int thr_id = mythr->id; // thr_id arg is deprecated
swab32_array( endiandata, pdata, 20 ); swab32_array( endiandata, pdata, 20 );

View File

@@ -1,105 +0,0 @@
#include "whirlpool-gate.h"
#if defined(__AVX2__)
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include "sph_whirlpool.h"
#include "whirlpool-hash-4way.h"
static __thread whirlpool_4way_context whirl_mid;
void whirlpool_hash_4way( void *state, const void *input )
{
uint64_t hash0[8] __attribute__ ((aligned (64)));
uint64_t hash1[8] __attribute__ ((aligned (64)));
uint64_t hash2[8] __attribute__ ((aligned (64)));
uint64_t hash3[8] __attribute__ ((aligned (64)));
uint64_t vhash[8*4] __attribute__ ((aligned (64)));
const int midlen = 64;
const int tail = 80 - midlen;
whirlpool_4way_context ctx;
memcpy( &ctx, &whirl_mid, sizeof whirl_mid );
whirlpool1_4way( &ctx, input + (midlen<<2), tail );
whirlpool1_4way_close( &ctx, vhash);
// whirlpool1_4way_init( &ctx );
// whirlpool1_4way( &ctx, input, 80 );
// whirlpool1_4way_close( &ctx, vhash);
whirlpool1_4way_init( &ctx );
whirlpool1_4way( &ctx, vhash, 64 );
whirlpool1_4way_close( &ctx, vhash);
whirlpool1_4way_init( &ctx );
whirlpool1_4way( &ctx, vhash, 64 );
whirlpool1_4way_close( &ctx, vhash);
whirlpool1_4way_init( &ctx );
whirlpool1_4way( &ctx, vhash, 64 );
whirlpool1_4way_close( &ctx, vhash);
mm256_deinterleave_4x64( hash0, hash1, hash2, hash3, vhash, 512 );
memcpy( state , hash0, 32 );
memcpy( state+32, hash1, 32 );
memcpy( state+64, hash2, 32 );
memcpy( state+96, hash3, 32 );
}
int scanhash_whirlpool_4way( int thr_id, struct work* work, uint32_t max_nonce,
uint64_t *hashes_done )
{
uint32_t hash[4*8] __attribute__ ((aligned (64)));
uint32_t vdata[20*4] __attribute__ ((aligned (64)));
uint32_t _ALIGN(128) endiandata[20];
uint32_t* pdata = work->data;
uint32_t* ptarget = work->target;
const uint32_t first_nonce = pdata[19];
uint32_t n = first_nonce;
uint32_t *nonces = work->nonces;
int num_found = 0;
uint32_t *noncep = vdata + 73; // 9*8 + 1
if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x0000ff;
for (int i=0; i < 19; i++)
be32enc(&endiandata[i], pdata[i]);
uint64_t *edata = (uint64_t*)endiandata;
mm256_interleave_4x64( (uint64_t*)vdata, edata, edata, edata, edata, 640 );
// midstate
whirlpool1_4way_init( &whirl_mid );
whirlpool1_4way( &whirl_mid, vdata, 64 );
do {
const uint32_t Htarg = ptarget[7];
be32enc( noncep, n );
be32enc( noncep+2, n+1 );
be32enc( noncep+4, n+2 );
be32enc( noncep+6, n+3 );
pdata[19] = n;
whirlpool_hash_4way( hash, vdata );
for ( int i = 0; i < 4; i++ )
if ( (hash+(i<<3))[7] <= Htarg && fulltest( hash+(i<<3), ptarget ) )
{
nonces[ num_found++ ] = n+i;
work_set_target_ratio( work, hash+(i<<3) );
}
n += 4;
} while ( ( num_found == 0 ) && ( n < max_nonce )
&& !work_restart[thr_id].restart );
*hashes_done = n - first_nonce + 1;
return num_found;
}
#endif

Some files were not shown because too many files have changed in this diff Show More