This commit is contained in:
Jay D Dee
2020-04-09 12:56:18 -04:00
parent fb9163185a
commit e96a6bd699
73 changed files with 462 additions and 625 deletions

View File

@@ -48,7 +48,7 @@ int scanhash_blake_4way( struct work *work, uint32_t max_nonce,
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;
@@ -107,7 +107,7 @@ int scanhash_blake_8way( struct work *work, uint32_t max_nonce,
if ( (hash+i)[7] <= HTarget && fulltest( hash+i, ptarget ) )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 8;

View File

@@ -45,7 +45,7 @@ int scanhash_blake2b_8way( struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 8;
@@ -100,7 +100,7 @@ int scanhash_blake2b_4way( struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 4;

View File

@@ -49,7 +49,7 @@ int scanhash_blake2s_16way( struct work *work, uint32_t max_nonce,
if ( likely( fulltest( lane_hash, ptarget ) && !opt_benchmark ) )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 16;
@@ -104,7 +104,7 @@ int scanhash_blake2s_8way( struct work *work, uint32_t max_nonce,
if ( likely( fulltest( lane_hash, ptarget ) && !opt_benchmark ) )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 8;
@@ -157,7 +157,7 @@ int scanhash_blake2s_4way( struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 4;

View File

@@ -49,7 +49,7 @@ int scanhash_blakecoin_4way( struct work *work, uint32_t max_nonce,
&& !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;
@@ -108,7 +108,7 @@ int scanhash_blakecoin_8way( struct work *work, uint32_t max_nonce,
&& !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 8;
} while ( (n < max_nonce) && !work_restart[thr_id].restart );

View File

@@ -62,7 +62,7 @@ int scanhash_decred_4way( struct work *work, uint32_t max_nonce,
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[DECRED_NONCE_INDEX] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;
} while ( (n < max_nonce) && !work_restart[thr_id].restart );

View File

@@ -105,7 +105,7 @@ int scanhash_pentablake_4way( struct work *work,
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n + i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;

View File

@@ -46,7 +46,7 @@ int scanhash_bmw512_8way( struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 8;
@@ -99,7 +99,7 @@ int scanhash_bmw512_4way( struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 4;

View File

@@ -53,7 +53,7 @@ int scanhash_groestl_4way( struct work *work, uint32_t max_nonce,
if ( fulltest( hash+(lane<<3), ptarget) && !opt_benchmark )
{
pdata[19] = n + lane;
submit_lane_solution( work, hash+(lane<<3), mythr, lane );
submit_solution( work, hash+(lane<<3), mythr );
}
n += 4;
} while ( ( n < last_nonce ) && !work_restart[thr_id].restart );

View File

@@ -143,7 +143,7 @@ int scanhash_myriad_8way( struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 8;
@@ -226,7 +226,7 @@ int scanhash_myriad_4way( struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 4;

View File

@@ -129,7 +129,7 @@ int scanhash_jha_4way( struct work *work, uint32_t max_nonce,
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, lane_hash, mythr, i );
submit_solution( work, lane_hash, mythr );
}
}
n += 4;

View File

@@ -45,7 +45,7 @@ int scanhash_keccak_8way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm512_add_epi32( *noncev,
@@ -97,7 +97,7 @@ int scanhash_keccak_4way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ))
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm256_add_epi32( *noncev,

View File

@@ -52,7 +52,7 @@ int scanhash_sha3d_8way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm512_add_epi32( *noncev,
@@ -111,7 +111,7 @@ int scanhash_sha3d_4way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm256_add_epi32( *noncev,

View File

@@ -245,7 +245,7 @@ int scanhash_allium_16way( struct work *work, uint32_t max_nonce,
if ( unlikely( valid_hash( hash+(lane<<3), ptarget ) && !bench ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, hash+(lane<<3), mythr, lane );
submit_solution( work, hash+(lane<<3), mythr );
}
*noncev = _mm512_add_epi32( *noncev, m512_const1_32( 16 ) );
n += 16;
@@ -394,7 +394,7 @@ int scanhash_allium_8way( struct work *work, uint32_t max_nonce,
if ( unlikely( valid_hash( lane_hash, ptarget ) && !bench ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 8;

View File

@@ -76,7 +76,7 @@ int scanhash_lyra2h_4way( struct work *work, uint32_t max_nonce,
&& !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;
} while ( (n < max_nonce-4) && !work_restart[thr_id].restart);

View File

@@ -200,7 +200,7 @@ int scanhash_lyra2rev2_16way( struct work *work, const uint32_t max_nonce,
if ( likely( valid_hash( lane_hash, ptarget ) && !bench ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm512_add_epi32( *noncev, m512_const1_32( 16 ) );
@@ -342,7 +342,7 @@ int scanhash_lyra2rev2_8way( struct work *work, const uint32_t max_nonce,
if ( likely( valid_hash( lane_hash, ptarget ) && !bench ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm256_add_epi32( *noncev, m256_const1_32( 8 ) );
@@ -469,7 +469,7 @@ int scanhash_lyra2rev2_4way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) && !opt_benchmark )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 4;

View File

@@ -165,7 +165,7 @@ int scanhash_lyra2rev3_16way( struct work *work, const uint32_t max_nonce,
if ( likely( valid_hash( lane_hash, ptarget ) && !opt_benchmark ) )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 16;
@@ -284,7 +284,7 @@ int scanhash_lyra2rev3_8way( struct work *work, const uint32_t max_nonce,
if ( likely( valid_hash( lane_hash, ptarget ) && !bench ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm256_add_epi32( *noncev, m256_const1_32( 8 ) );
@@ -386,7 +386,7 @@ int scanhash_lyra2rev3_4way( struct work *work, const uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) && !opt_benchmark )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm_add_epi32( *noncev, m128_const1_32( 4 ) );

View File

@@ -124,7 +124,7 @@ int scanhash_lyra2z_16way( struct work *work, uint32_t max_nonce,
if ( unlikely( valid_hash( lane_hash, ptarget ) && !bench ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm512_add_epi32( *noncev, m512_const1_32( 16 ) );
@@ -222,7 +222,7 @@ int scanhash_lyra2z_8way( struct work *work, uint32_t max_nonce,
if ( unlikely( valid_hash( lane_hash, ptarget ) && !bench ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm256_add_epi32( *noncev, m256_const1_32( 8 ) );
@@ -301,7 +301,7 @@ int scanhash_lyra2z_4way( struct work *work, uint32_t max_nonce,
if ( unlikely( valid_hash( lane_hash, ptarget ) && !bench ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm_add_epi32( *noncev, m128_const1_32( 4 ) );

View File

@@ -68,7 +68,7 @@ bool lyra2z330_thread_init()
bool register_lyra2z330_algo( algo_gate_t* gate )
{
gate->optimizations = SSE42_OPT | AVX2_OPT;
gate->optimizations = SSE2_OPT | AVX2_OPT;
gate->miner_thread_init = (void*)&lyra2z330_thread_init;
gate->scanhash = (void*)&scanhash_lyra2z330;
gate->hash = (void*)&lyra2z330_hash;

View File

@@ -302,7 +302,7 @@ int scanhash_phi2_8way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) )
{
be32enc( pdata + 19, n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 8;
@@ -483,7 +483,7 @@ int scanhash_phi2_4way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) )
{
be32enc( pdata + 19, n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
edata[ 19 ] += 4;

View File

@@ -108,7 +108,7 @@ int scanhash_nist5_8way( struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 8;
@@ -196,7 +196,7 @@ int scanhash_nist5_4way( struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 4;

View File

@@ -223,7 +223,7 @@ int scanhash_anime_8way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm512_add_epi32( *noncev,
@@ -383,7 +383,7 @@ int scanhash_anime_4way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm256_add_epi32( *noncev,

View File

@@ -596,7 +596,7 @@ int scanhash_hmq1725_8way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm512_add_epi32( *noncev,
@@ -1018,7 +1018,7 @@ int scanhash_hmq1725_4way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm256_add_epi32( *noncev,

View File

@@ -235,7 +235,7 @@ int scanhash_quark_8way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm512_add_epi32( *noncev,
@@ -408,7 +408,7 @@ int scanhash_quark_4way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm256_add_epi32( *noncev,

View File

@@ -106,13 +106,13 @@ int scanhash_deep_2way( struct work *work,uint32_t max_nonce,
if ( fulltest( hash, ptarget) && !opt_benchmark )
{
pdata[19] = n;
submit_lane_solution( work, hash, mythr, 0 );
submit_solution( work, hash, mythr );
}
if ( !( (hash+8)[7] & mask ) )
if ( fulltest( hash+8, ptarget) && !opt_benchmark )
{
pdata[19] = n+1;
submit_lane_solution( work, hash+8, mythr, 1 );
submit_solution( work, hash+8, mythr );
}
n += 2;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );

View File

@@ -153,7 +153,7 @@ int scanhash_qubit_4way( struct work *work,uint32_t max_nonce,
if ( likely( fulltest( hash+(lane<<3), ptarget) && !opt_benchmark ) )
{
pdata[19] = n + lane;
submit_lane_solution( work, hash+(lane<<3), mythr, lane );
submit_solution( work, hash+(lane<<3), mythr );
}
n += 4;
} while ( ( n < max_nonce-4 ) && !work_restart[thr_id].restart );
@@ -255,13 +255,13 @@ int scanhash_qubit_2way( struct work *work,uint32_t max_nonce,
if ( likely( fulltest( hash, ptarget) && !opt_benchmark ) )
{
pdata[19] = n;
submit_lane_solution( work, hash, mythr, 0 );
submit_solution( work, hash, mythr );
}
if ( unlikely( ( (hash+8))[7] <= Htarg ) )
if ( likely( fulltest( hash+8, ptarget) && !opt_benchmark ) )
{
pdata[19] = n+1;
submit_lane_solution( work, hash+8, mythr, 1 );
submit_solution( work, hash+8, mythr );
}
n += 2;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );

View File

@@ -132,7 +132,7 @@ int scanhash_lbry_16way( struct work *work, uint32_t max_nonce,
if ( likely( fulltest( lane_hash, ptarget ) && !opt_benchmark ) )
{
pdata[27] = n + i;
submit_lane_solution( work, lane_hash, mythr, i );
submit_solution( work, lane_hash, mythr );
}
}
n += 16;
@@ -251,7 +251,7 @@ int scanhash_lbry_8way( struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{
pdata[27] = n + i;
submit_lane_solution( work, lane_hash, mythr, i );
submit_solution( work, lane_hash, mythr );
}
}
n += 8;

View File

@@ -85,7 +85,7 @@ int scanhash_sha256q_8way( struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 8;
@@ -173,7 +173,7 @@ int scanhash_sha256q_4way( struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 4;

View File

@@ -78,7 +78,7 @@ int scanhash_sha256t_8way( struct work *work, const uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 8;
@@ -161,7 +161,7 @@ int scanhash_sha256t_4way( struct work *work, const uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 4;

View File

@@ -65,7 +65,7 @@ int scanhash_skein_8way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm512_add_epi32( *noncev,
@@ -162,7 +162,7 @@ int scanhash_skein_4way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm256_add_epi32( *noncev,

View File

@@ -53,7 +53,7 @@ int scanhash_skein2_8way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) && !bench )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm512_add_epi32( *noncev,
@@ -115,7 +115,7 @@ int scanhash_skein2_4way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) && !bench )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm256_add_epi32( *noncev,

View File

@@ -279,7 +279,7 @@ int scanhash_c11_8way( struct work *work, uint32_t max_nonce,
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 8;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
@@ -459,7 +459,7 @@ int scanhash_c11_4way( struct work *work, uint32_t max_nonce,
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );

View File

@@ -221,7 +221,7 @@ int scanhash_timetravel_4way( struct work *work, uint32_t max_nonce,
&& !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;
} while ( ( n < max_nonce ) && !(*restart) );

View File

@@ -256,7 +256,7 @@ int scanhash_timetravel10_4way( struct work *work,
&& !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;
} while ( ( n < max_nonce ) && !(*restart) );

View File

@@ -128,7 +128,7 @@ int scanhash_tribus_8way( struct work *work, uint32_t max_nonce,
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 8;
} while ( ( n < max_nonce-8 ) && !work_restart[thr_id].restart);
@@ -213,7 +213,7 @@ int scanhash_tribus_4way( struct work *work, uint32_t max_nonce,
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;
} while ( ( n < max_nonce-4 ) && !work_restart[thr_id].restart);

View File

@@ -279,7 +279,7 @@ int scanhash_x11_8way( struct work *work, uint32_t max_nonce,
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 8;
} while ( ( n < last_nonce ) && !work_restart[thr_id].restart );
@@ -469,7 +469,7 @@ int scanhash_x11_4way( struct work *work, uint32_t max_nonce,
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );

View File

@@ -269,7 +269,7 @@ int scanhash_x11evo_4way( struct work* work, uint32_t max_nonce,
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );

View File

@@ -312,7 +312,7 @@ int scanhash_x11gost_8way( struct work *work, uint32_t max_nonce,
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 8;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
@@ -498,7 +498,7 @@ int scanhash_x11gost_4way( struct work *work, uint32_t max_nonce,
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );

View File

@@ -263,7 +263,7 @@ int scanhash_x12_8way( struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 8;
@@ -431,7 +431,7 @@ int scanhash_x12_4way( struct work *work, uint32_t max_nonce,
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );

View File

@@ -208,7 +208,7 @@ int scanhash_phi1612_8way( struct work *work, uint32_t max_nonce,
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 8;
} while ( ( n < max_nonce-8 ) && !work_restart[thr_id].restart );
@@ -344,7 +344,7 @@ int scanhash_phi1612_4way( struct work *work, uint32_t max_nonce,
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );

View File

@@ -125,7 +125,7 @@ int scanhash_skunk_8way( struct work *work, uint32_t max_nonce,
if ( unlikely( valid_hash( hash+(i<<3), ptarget ) && !bench ) )
{
pdata[19] = bswap_32( n+i );
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
*noncev = _mm512_add_epi32( *noncev,
m512_const1_64( 0x0000000800000000 ) );
@@ -237,7 +237,7 @@ int scanhash_skunk_4way( struct work *work, uint32_t max_nonce,
if ( unlikely( valid_hash( hash+(i<<3), ptarget ) && !bench ) )
{
pdata[19] = bswap_32( n + i );
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
*noncev = _mm256_add_epi32( *noncev,
m256_const1_64( 0x0000000400000000 ) );

View File

@@ -319,7 +319,7 @@ int scanhash_x13_8way( struct work *work, uint32_t max_nonce,
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 8;
} while ( ( n < last_nonce ) && !work_restart[thr_id].restart );
@@ -531,7 +531,7 @@ int scanhash_x13_4way( struct work *work, uint32_t max_nonce,
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );

View File

@@ -321,7 +321,7 @@ int scanhash_x13bcd_8way( struct work *work, uint32_t max_nonce,
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 8;
} while ( ( n < last_nonce ) && !work_restart[thr_id].restart );
@@ -541,7 +541,7 @@ int scanhash_x13bcd_4way( struct work *work, uint32_t max_nonce,
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;
} while ( ( n < last_nonce ) && !work_restart[thr_id].restart );

View File

@@ -246,7 +246,7 @@ int scanhash_x13sm3_4way( struct work *work, uint32_t max_nonce,
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );

View File

@@ -129,7 +129,7 @@ int scanhash_polytimos_4way( struct work *work, uint32_t max_nonce,
if( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;

View File

@@ -108,7 +108,7 @@ int scanhash_veltor_4way( struct work *work, uint32_t max_nonce,
if ( (hash+(i<<3))[7] <= Htarg && fulltest( hash+(i<<3), ptarget ) )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
n += 4;
} while ( ( n < max_nonce ) && !(*restart) );

View File

@@ -324,7 +324,7 @@ int scanhash_x14_8way( struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 8;
@@ -534,7 +534,7 @@ int scanhash_x14_4way( struct work *work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 4;

View File

@@ -364,7 +364,7 @@ int scanhash_x15_8way( struct work *work, uint32_t max_nonce,
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash, mythr, i );
submit_solution( work, hash, mythr );
}
n += 8;
} while ( ( n < last_nonce ) && !work_restart[thr_id].restart );
@@ -592,7 +592,7 @@ int scanhash_x15_4way( struct work *work, uint32_t max_nonce,
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash, mythr, i );
submit_solution( work, hash, mythr );
}
n += 4;
} while ( ( n < last_nonce ) && !work_restart[thr_id].restart );

View File

@@ -505,7 +505,7 @@ int scanhash_x16r_8way( struct work *work, uint32_t max_nonce,
if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) )
{
pdata[19] = bswap_32( n+i );
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
*noncev = _mm512_add_epi32( *noncev,
m512_const1_64( 0x0000000800000000 ) );
@@ -869,7 +869,7 @@ int scanhash_x16r_4way( struct work *work, uint32_t max_nonce,
if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) )
{
pdata[19] = bswap_32( n+i );
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
*noncev = _mm256_add_epi32( *noncev,
m256_const1_64( 0x0000000400000000 ) );

View File

@@ -46,7 +46,7 @@ int scanhash_x16rt_8way( struct work *work, uint32_t max_nonce,
if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) )
{
pdata[19] = bswap_32( n+i );
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
*noncev = _mm512_add_epi32( *noncev,
m512_const1_64( 0x0000000800000000 ) );
@@ -99,7 +99,7 @@ int scanhash_x16rt_4way( struct work *work, uint32_t max_nonce,
if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) )
{
pdata[19] = bswap_32( n+i );
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
*noncev = _mm256_add_epi32( *noncev,
m256_const1_64( 0x0000000400000000 ) );

View File

@@ -678,7 +678,7 @@ int scanhash_x16rv2_8way( struct work *work, uint32_t max_nonce,
if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) )
{
pdata[19] = bswap_32( n+i );
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
*noncev = _mm512_add_epi32( *noncev,
m512_const1_64( 0x0000000800000000 ) );
@@ -1131,7 +1131,7 @@ int scanhash_x16rv2_4way( struct work *work, uint32_t max_nonce,
if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) )
{
pdata[19] = bswap_32( n+i );
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
*noncev = _mm256_add_epi32( *noncev,
m256_const1_64( 0x0000000400000000 ) );

View File

@@ -177,7 +177,7 @@ int scanhash_x21s_8way( struct work *work, uint32_t max_nonce,
if ( likely( valid_hash( lane_hash, ptarget ) && !bench ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm512_add_epi32( *noncev,
@@ -347,7 +347,7 @@ int scanhash_x21s_4way( struct work *work, uint32_t max_nonce,
if ( unlikely( valid_hash( hash + (i<<3), ptarget ) && !bench ) )
{
pdata[19] = bswap_32( n+i );
submit_lane_solution( work, hash+(i<<3), mythr, i );
submit_solution( work, hash+(i<<3), mythr );
}
*noncev = _mm256_add_epi32( *noncev,
m256_const1_64( 0x0000000400000000 ) );

View File

@@ -264,7 +264,7 @@ int scanhash_x17_8way( struct work *work, uint32_t max_nonce,
if ( likely( valid_hash( lane_hash, ptarget ) ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm512_add_epi32( *noncev,
@@ -432,7 +432,7 @@ int scanhash_x17_4way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm256_add_epi32( *noncev,

View File

@@ -429,7 +429,7 @@ int scanhash_xevan_8way( struct work *work, uint32_t max_nonce,
if ( likely( valid_hash( lane_hash, ptarget ) ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm512_add_epi32( *noncev,
@@ -699,7 +699,7 @@ int scanhash_xevan_4way( struct work *work, uint32_t max_nonce,
if ( valid_hash( lane_hash, ptarget ) )
{
pdata[19] = bswap_32( n + lane );
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
*noncev = _mm256_add_epi32( *noncev,

View File

@@ -493,7 +493,7 @@ int scanhash_x22i_8way( struct work* work, uint32_t max_nonce,
if ( likely( fulltest( lane_hash, ptarget ) && !opt_benchmark ) )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 8;

View File

@@ -625,7 +625,7 @@ int scanhash_x25x_8way( struct work* work, uint32_t max_nonce,
if ( fulltest( lane_hash, ptarget ) && !opt_benchmark )
{
pdata[19] = n + lane;
submit_lane_solution( work, lane_hash, mythr, lane );
submit_solution( work, lane_hash, mythr );
}
}
n += 8;

View File

@@ -19,11 +19,12 @@
*/
#include "cpuminer-config.h"
#include "miner.h"
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "yescrypt-r8g.h"
#include <stdlib.h>
#include "algo-gate-api.h"
#include "yespower.h"
int scanhash_yespower_r8g( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr )
@@ -37,7 +38,17 @@ int scanhash_yespower_r8g( struct work *work, uint32_t max_nonce,
const uint32_t last_nonce = max_nonce;
const int thr_id = mythr->id;
yespower_params_t params =
static __thread int initialized = 0;
static __thread yespower_local_t local;
if ( !initialized )
{
if ( yespower_init_local( &local ) )
return -1;
initialized = 1;
}
yespower_params_t params =
{
.version = YESPOWER_0_5,
.N = 2048,
@@ -56,7 +67,7 @@ int scanhash_yespower_r8g( struct work *work, uint32_t max_nonce,
SHA256_Update( &sha256_prehash_ctx, endiandata, 64 );
do {
yespower_tls( (unsigned char *)endiandata, params.perslen,
yespower_hash( &local, (unsigned char *)endiandata, params.perslen,
&params, (yespower_binary_t*)hash, thr_id );
if unlikely( valid_hash( hash, ptarget ) && !opt_benchmark )
@@ -76,7 +87,6 @@ bool register_yescryptr8g_algo( algo_gate_t* gate )
{
gate->optimizations = SSE2_OPT | SHA_OPT;
gate->scanhash = (void*)&scanhash_yespower_r8g;
gate->hash = (void*)&yespower_tls;
pk_buffer_size = 26;
opt_sapling = true;
opt_target_factor = 65536.0;

View File

@@ -1,49 +0,0 @@
/*-
* Copyright 2009 Colin Percival
* Copyright 2013-2018 Alexander Peslyak
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file was originally written by Colin Percival as part of the Tarsnap
* online backup system.
*/
#ifndef _YESPOWERR8G_H_
#define _YESPOWERR8G_H_
#include <stdint.h>
#include <stdlib.h> /* for size_t */
#include "algo-gate-api.h"
#include "algo/yespower/yespower.h"
#ifdef __cplusplus
extern "C" {
#endif
extern int yespowerr8g_tls(const uint8_t *src, size_t srclen,
const yespower_params_t *params, yespower_binary_t *dst);
#ifdef __cplusplus
}
#endif
#endif /* !_YESPOWERR8G_H_ */

View File

@@ -1112,10 +1112,10 @@ static void smix(uint8_t *B, size_t r, uint32_t N,
*
* Return 0 on success; or -1 on error.
*/
int yespower_b2b(yespower_local_t *local,
int yespower_b2b_hash(yespower_local_t *local,
const uint8_t *src, size_t srclen,
const yespower_params_t *params,
yespower_binary_t *dst, int thrid )
void *dst, int thrid )
{
uint32_t N = params->N;
uint32_t r = params->r;
@@ -1191,37 +1191,4 @@ fail:
return 0;
}
/**
* yespower_tls(src, srclen, params, dst):
* Compute yespower(src[0 .. srclen - 1], N, r), to be checked for "< target".
* The memory allocation is maintained internally using thread-local storage.
*
* Return 0 on success; or -1 on error.
*/
int yespower_b2b_tls(const uint8_t *src, size_t srclen,
const yespower_params_t *params, yespower_binary_t *dst, int thrid )
{
static __thread int initialized = 0;
static __thread yespower_local_t local;
if (!initialized) {
init_region(&local);
initialized = 1;
}
return yespower_b2b(&local, src, srclen, params, dst, thrid);
}
/*
int yespower_init_local(yespower_local_t *local)
{
init_region(local);
return 0;
}
int yespower_free_local(yespower_local_t *local)
{
return free_region(local);
}
*/
#endif

View File

@@ -23,25 +23,17 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file was originally written by Cryply team as part of the Cryply
* coin.
*/
#include "yespower.h"
#include "algo-gate-api.h"
yespower_params_t yespower_params;
SHA256_CTX sha256_prehash_ctx;
// Give each thread its own copy to avoid requiring mutex.
__thread SHA256_CTX sha256_prehash_ctx;
// YESPOWER
int yespower_hash( const char *input, char *output, uint32_t len, int thrid )
{
return yespower_tls( input, len, &yespower_params,
(yespower_binary_t*)output, thrid );
}
int scanhash_yespower( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr )
{
@@ -54,6 +46,16 @@ int scanhash_yespower( struct work *work, uint32_t max_nonce,
uint32_t n = first_nonce;
const int thr_id = mythr->id;
static __thread int initialized = 0;
static __thread yespower_local_t local;
if ( !initialized )
{
if ( yespower_init_local( &local ) )
return -1;
initialized = 1;
}
for ( int k = 0; k < 19; k++ )
be32enc( &endiandata[k], pdata[k] );
endiandata[19] = n;
@@ -63,7 +65,8 @@ int scanhash_yespower( struct work *work, uint32_t max_nonce,
SHA256_Update( &sha256_prehash_ctx, endiandata, 64 );
do {
if ( yespower_hash( (char*)endiandata, (char*)vhash, 80, thr_id ) )
if ( yespower_hash( &local, (char*)endiandata, 80, &yespower_params,
(char*)vhash, thr_id ) )
if unlikely( valid_hash( vhash, ptarget ) && !opt_benchmark )
{
be32enc( pdata+19, n );
@@ -78,11 +81,6 @@ int scanhash_yespower( struct work *work, uint32_t max_nonce,
// YESPOWER-B2B
int yespower_b2b_hash( const char *input, char *output, uint32_t len, int thrid )
{
return yespower_b2b_tls( input, len, &yespower_params, (yespower_binary_t*)output, thrid );
}
int scanhash_yespower_b2b( struct work *work, uint32_t max_nonce,
uint64_t *hashes_done, struct thr_info *mythr )
{
@@ -95,6 +93,16 @@ int scanhash_yespower_b2b( struct work *work, uint32_t max_nonce,
const uint32_t last_nonce = max_nonce;
const int thr_id = mythr->id;
static __thread int initialized = 0;
static __thread yespower_local_t local;
if ( !initialized )
{
if ( yespower_init_local( &local ) )
return -1;
initialized = 1;
}
for ( int k = 0; k < 19; k++ )
be32enc( &endiandata[k], pdata[k] );
endiandata[19] = n;
@@ -104,7 +112,8 @@ int scanhash_yespower_b2b( struct work *work, uint32_t max_nonce,
SHA256_Update( &sha256_prehash_ctx, endiandata, 64 );
do {
if (yespower_b2b_hash( (char*) endiandata, (char*) vhash, 80, thr_id ) )
if (yespower_b2b_hash( &local, (char*) endiandata, 80, &yespower_params,
(char*) vhash, thr_id ) )
if unlikely( valid_hash( vhash, ptarget ) && !opt_benchmark )
{
be32enc( pdata+19, n );
@@ -145,7 +154,6 @@ bool register_yespower_algo( algo_gate_t* gate )
gate->optimizations = SSE2_OPT | SHA_OPT;
gate->scanhash = (void*)&scanhash_yespower;
gate->hash = (void*)&yespower_hash;
opt_target_factor = 65536.0;
return true;
};
@@ -159,7 +167,6 @@ bool register_yespowerr16_algo( algo_gate_t* gate )
yespower_params.perslen = 0;
gate->optimizations = SSE2_OPT | SHA_OPT;
gate->scanhash = (void*)&scanhash_yespower;
gate->hash = (void*)&yespower_hash;
opt_target_factor = 65536.0;
return true;
};
@@ -268,9 +275,8 @@ bool register_power2b_algo( algo_gate_t* gate )
applog( LOG_NOTICE,"Key= \"%s\"", yespower_params.pers );
applog( LOG_NOTICE,"Key length= %d\n", yespower_params.perslen );
gate->optimizations = SSE2_OPT | SHA_OPT;
gate->optimizations = SSE2_OPT;
gate->scanhash = (void*)&scanhash_yespower_b2b;
gate->hash = (void*)&yespower_b2b_hash;
opt_target_factor = 65536.0;
return true;
};
@@ -310,7 +316,6 @@ bool register_yespower_b2b_algo( algo_gate_t* gate )
gate->optimizations = SSE2_OPT;
gate->scanhash = (void*)&scanhash_yespower_b2b;
gate->hash = (void*)&yespower_b2b_hash;
opt_target_factor = 65536.0;
return true;
};

View File

@@ -1024,10 +1024,10 @@ static void smix(uint8_t *B, size_t r, uint32_t N,
*
* Return 0 on success; or -1 on error.
*/
int yespower(yespower_local_t *local,
int yespower_hash( yespower_local_t *local,
const uint8_t *src, size_t srclen,
const yespower_params_t *params,
yespower_binary_t *dst, int thrid )
void *dst, int thrid )
{
yespower_version_t version = params->version;
uint32_t N = params->N;
@@ -1158,27 +1158,6 @@ int yespower(yespower_local_t *local,
return 1;
}
/**
* yespower_tls(src, srclen, params, dst):
* Compute yespower(src[0 .. srclen - 1], N, r), to be checked for "< target".
* The memory allocation is maintained internally using thread-local storage.
*
* Return 0 on success; or -1 on error.
*/
int yespower_tls(const uint8_t *src, size_t srclen,
const yespower_params_t *params, yespower_binary_t *dst, int thrid )
{
static __thread int initialized = 0;
static __thread yespower_local_t local;
if (!initialized) {
if (yespower_init_local(&local))
return -1;
initialized = 1;
}
return yespower( &local, src, srclen, params, dst, thrid );
}
int yespower_init_local(yespower_local_t *local)
{
@@ -1190,4 +1169,5 @@ int yespower_free_local(yespower_local_t *local)
{
return free_region(local);
}
#endif

View File

@@ -76,67 +76,21 @@ typedef struct {
unsigned char uc[32];
} yespower_binary_t __attribute__ ((aligned (64)));
yespower_params_t yespower_params;
extern yespower_params_t yespower_params;
SHA256_CTX sha256_prehash_ctx;
extern __thread SHA256_CTX sha256_prehash_ctx;
/**
* yespower_init_local(local):
* Initialize the thread-local (RAM) data structure. Actual memory allocation
* is currently fully postponed until a call to yespower().
*
* Return 0 on success; or -1 on error.
*
* MT-safe as long as local is local to the thread.
*/
extern int yespower_init_local(yespower_local_t *local);
/**
* yespower_free_local(local):
* Free memory that may have been allocated for an initialized thread-local
* (RAM) data structure.
*
* Return 0 on success; or -1 on error.
*
* MT-safe as long as local is local to the thread.
*/
extern int yespower_free_local(yespower_local_t *local);
/**
* yespower(local, src, srclen, params, dst):
* Compute yespower(src[0 .. srclen - 1], N, r), to be checked for "< target".
* local is the thread-local data structure, allowing to preserve and reuse a
* memory allocation across calls, thereby reducing processing overhead.
*
* Return 0 on success; or -1 on error.
*
* local must be initialized with yespower_init_local().
*
* MT-safe as long as local and dst are local to the thread.
*/
extern int yespower(yespower_local_t *local,
extern int yespower_hash(yespower_local_t *local,
const uint8_t *src, size_t srclen,
const yespower_params_t *params, yespower_binary_t *dst, int thrid);
const yespower_params_t *params, void *dst, int thrid);
extern int yespower_b2b(yespower_local_t *local,
extern int yespower_b2b_hash(yespower_local_t *local,
const uint8_t *src, size_t srclen,
const yespower_params_t *params, yespower_binary_t *dst, int thrid );
/**
* yespower_tls(src, srclen, params, dst):
* Compute yespower(src[0 .. srclen - 1], N, r), to be checked for "< target".
* The memory allocation is maintained internally using thread-local storage.
*
* Return 0 on success; or -1 on error.
*
* MT-safe as long as dst is local to the thread.
*/
extern int yespower_tls(const uint8_t *src, size_t srclen,
const yespower_params_t *params, yespower_binary_t *dst, int thr_id);
extern int yespower_b2b_tls(const uint8_t *src, size_t srclen,
const yespower_params_t *params, yespower_binary_t *dst, int thr_id);
const yespower_params_t *params, void *dst, int thrid );
#if defined(__AVX2__)
@@ -149,7 +103,6 @@ extern int yespower_8way( yespower_local_t *local, const __m256i *src,
size_t srclen, const yespower_params_t *params,
yespower_8way_binary_t *dst, int thrid );
extern int yespower_8way_tls( const __m256i *src, size_t srclen,
const yespower_params_t *params, yespower_8way_binary_t *dst, int thr_id );