This commit is contained in:
Jay D Dee
2020-01-10 20:37:47 -05:00
parent 70089d1224
commit f990f6a702
64 changed files with 1475 additions and 1801 deletions

View File

@@ -275,7 +275,7 @@ int scanhash_c11_8way( struct work *work, uint32_t max_nonce,
pdata[19] = n;
for ( int i = 0; i < 8; i++ )
if ( ( ( hash+(i<<3) )[7] < Htarg )
if ( ( ( hash+(i<<3) )[7] <= Htarg )
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
@@ -443,37 +443,26 @@ int scanhash_c11_4way( struct work *work, uint32_t max_nonce,
int thr_id = mythr->id; // thr_id arg is deprecated
__m256i *noncev = (__m256i*)vdata + 9; // aligned
const uint32_t Htarg = ptarget[7];
uint64_t htmax[] = { 0, 0xF, 0xFF,
0xFFF, 0xFFFF, 0x10000000 };
uint32_t masks[] = { 0xFFFFFFFF, 0xFFFFFFF0, 0xFFFFFF00,
0xFFFFF000, 0xFFFF0000, 0 };
mm256_bswap32_intrlv80_4x64( vdata, pdata );
for (int m=0; m < 6; m++)
if (Htarg <= htmax[m])
{
uint32_t mask = masks[m];
do
{
*noncev = mm256_intrlv_blend_32( mm256_bswap_32(
_mm256_set_epi32( n+3, 0, n+2, 0, n+1, 0, n, 0 ) ), *noncev );
do
{
*noncev = mm256_intrlv_blend_32( mm256_bswap_32(
_mm256_set_epi32( n+3, 0, n+2, 0, n+1, 0, n, 0 ) ), *noncev );
c11_4way_hash( hash, vdata );
pdata[19] = n;
for ( int i = 0; i < 4; i++ )
if ( ( ( (hash+(i<<3))[7] & mask ) == 0 )
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
}
n += 4;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
break;
}
c11_4way_hash( hash, vdata );
pdata[19] = n;
for ( int i = 0; i < 4; i++ )
if ( ( ( hash+(i<<3) )[7] <= Htarg )
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
}
n += 4;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
*hashes_done = n - first_nonce + 1;
return 0;
}

View File

@@ -78,11 +78,9 @@ void c11_hash( void *output, const void *input )
sph_bmw512_close( &ctx.bmw, hash );
#if defined(__AES__)
init_groestl( &ctx.groestl, 64 );
update_and_final_groestl( &ctx.groestl, (char*)hash,
(const char*)hash, 512 );
#else
sph_groestl512_init( &ctx.groestl );
sph_groestl512( &ctx.groestl, hash, 64 );
sph_groestl512_close( &ctx.groestl, hash );
#endif
@@ -108,12 +106,12 @@ void c11_hash( void *output, const void *input )
update_final_sd( &ctx.simd, (BitSequence *)hash,
(const BitSequence *)hash, 512 );
#ifdef NO_AES_NI
sph_echo512( &ctx.echo, hash, 64 );
sph_echo512_close( &ctx.echo, hash );
#else
#if defined(__AES__)
update_final_echo ( &ctx.echo, (BitSequence *)hash,
(const BitSequence *)hash, 512 );
#else
sph_echo512( &ctx.echo, hash, 64 );
sph_echo512_close( &ctx.echo, hash );
#endif
memcpy(output, hash, 32);

View File

@@ -11,10 +11,10 @@
#include "algo/skein/sph_skein.h"
#include "algo/luffa/luffa_for_sse2.h"
#include "algo/cubehash/cubehash_sse2.h"
#ifdef NO_AES_NI
#include "algo/groestl/sph_groestl.h"
#else
#ifdef __AES__
#include "algo/groestl/aes_ni/hash-groestl.h"
#else
#include "algo/groestl/sph_groestl.h"
#endif
static __thread uint32_t s_ntime = UINT32_MAX;
@@ -28,10 +28,10 @@ typedef struct {
sph_keccak512_context keccak;
hashState_luffa luffa;
cubehashParam cube;
#ifdef NO_AES_NI
sph_groestl512_context groestl;
#else
#ifdef __AES__
hashState_groestl groestl;
#else
sph_groestl512_context groestl;
#endif
} tt_ctx_holder;
@@ -47,10 +47,10 @@ void init_tt8_ctx()
sph_keccak512_init( &tt_ctx.keccak );
init_luffa( &tt_ctx.luffa, 512 );
cubehashInit( &tt_ctx.cube, 512, 16, 32 );
#ifdef NO_AES_NI
sph_groestl512_init( &tt_ctx.groestl );
#else
#ifdef __AES__
init_groestl( &tt_ctx.groestl, 64 );
#else
sph_groestl512_init( &tt_ctx.groestl );
#endif
};
@@ -110,7 +110,10 @@ void timetravel_hash(void *output, const void *input)
}
break;
case 2:
#ifdef NO_AES_NI
#ifdef __AES__
update_and_final_groestl( &ctx.groestl, (char*)hashB,
(char*)hashA, dataLen*8 );
#else
if ( i == 0 )
{
memcpy( &ctx.groestl, &tt_mid.groestl, sizeof tt_mid.groestl );
@@ -122,19 +125,6 @@ void timetravel_hash(void *output, const void *input)
sph_groestl512( &ctx.groestl, hashA, dataLen );
sph_groestl512_close( &ctx.groestl, hashB );
}
#else
// groestl midstate is slower
// if ( i == 0 )
// {
// memcpy( &ctx.groestl, &tt_mid.groestl, sizeof tt_mid.groestl );
// update_and_final_groestl( &ctx.groestl, (char*)hashB,
// (char*)input + midlen, tail*8 );
// }
// else
// {
update_and_final_groestl( &ctx.groestl, (char*)hashB,
(char*)hashA, dataLen*8 );
// }
#endif
break;
case 3:
@@ -253,13 +243,9 @@ int scanhash_timetravel( struct work *work, uint32_t max_nonce,
sph_bmw512( &tt_mid.bmw, endiandata, 64 );
break;
case 2:
#ifdef NO_AES_NI
#ifndef __AES__
memcpy( &tt_mid.groestl, &tt_ctx.groestl, sizeof(tt_mid.groestl ) );
sph_groestl512( &tt_mid.groestl, endiandata, 64 );
#else
// groestl midstate is slower
// memcpy( &tt_mid.groestl, &tt_ctx.groestl, sizeof(tt_mid.groestl ) );
// update_groestl( &tt_mid.groestl, (char*)endiandata, 64*8 );
#endif
break;
case 3:

View File

@@ -12,11 +12,10 @@
#include "algo/cubehash/cubehash_sse2.h"
#include "algo/shavite/sph_shavite.h"
#include "algo/simd/nist.h"
#ifdef NO_AES_NI
#include "algo/groestl/sph_groestl.h"
#else
#ifdef __AES__
#include "algo/groestl/aes_ni/hash-groestl.h"
#else
#include "algo/groestl/sph_groestl.h"
#endif
static __thread uint32_t s_ntime = UINT32_MAX;
@@ -32,10 +31,10 @@ typedef struct {
cubehashParam cube;
sph_shavite512_context shavite;
hashState_sd simd;
#ifdef NO_AES_NI
sph_groestl512_context groestl;
#else
#ifdef __AES__
hashState_groestl groestl;
#else
sph_groestl512_context groestl;
#endif
} tt10_ctx_holder;
@@ -53,10 +52,10 @@ void init_tt10_ctx()
cubehashInit( &tt10_ctx.cube, 512, 16, 32 );
sph_shavite512_init( &tt10_ctx.shavite );
init_sd( &tt10_ctx.simd, 512 );
#ifdef NO_AES_NI
sph_groestl512_init( &tt10_ctx.groestl );
#else
#ifdef __AES__
init_groestl( &tt10_ctx.groestl, 64 );
#else
sph_groestl512_init( &tt10_ctx.groestl );
#endif
};
@@ -116,7 +115,10 @@ void timetravel10_hash(void *output, const void *input)
}
break;
case 2:
#ifdef NO_AES_NI
#ifdef __AES__
update_and_final_groestl( &ctx.groestl, (char*)hashB,
(char*)hashA, dataLen*8 );
#else
if ( i == 0 )
{
memcpy( &ctx.groestl, &tt10_mid.groestl, sizeof tt10_mid.groestl );
@@ -128,19 +130,6 @@ void timetravel10_hash(void *output, const void *input)
sph_groestl512( &ctx.groestl, hashA, dataLen );
sph_groestl512_close( &ctx.groestl, hashB );
}
#else
// groestl midstate is slower
// if ( i == 0 )
// {
// memcpy( &ctx.groestl, &tt10_mid.groestl, sizeof tt10_mid.groestl );
// update_and_final_groestl( &ctx.groestl, (char*)hashB,
// (char*)input + midlen, tail*8 );
// }
// else
// {
update_and_final_groestl( &ctx.groestl, (char*)hashB,
(char*)hashA, dataLen*8 );
// }
#endif
break;
case 3:
@@ -286,13 +275,9 @@ int scanhash_timetravel10( struct work *work, uint32_t max_nonce,
sph_bmw512( &tt10_mid.bmw, endiandata, 64 );
break;
case 2:
#ifdef NO_AES_NI
#ifndef __AES__
memcpy( &tt10_mid.groestl, &tt10_ctx.groestl, sizeof(tt10_mid.groestl ) );
sph_groestl512( &tt10_mid.groestl, endiandata, 64 );
#else
// groestl midstate is slower
// memcpy( &tt10_mid.groestl, &tt10_ctx.groestl, sizeof(tt10_mid.groestl ) );
// update_groestl( &tt10_mid.groestl, (char*)endiandata, 64*8 );
#endif
break;
case 3:

View File

@@ -124,7 +124,7 @@ int scanhash_tribus_8way( struct work *work, uint32_t max_nonce,
pdata[19] = n;
for ( int i = 0; i < 8; i++ )
if ( (hash+(i<<3))[7] < Htarg )
if ( (hash+(i<<3))[7] <= Htarg )
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
@@ -209,7 +209,7 @@ int scanhash_tribus_4way( struct work *work, uint32_t max_nonce,
pdata[19] = n;
for ( int i = 0; i < 4; i++ )
if ( (hash+(i<<3))[7] < Htarg )
if ( (hash+(i<<3))[7] <= Htarg )
if ( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;

View File

@@ -7,19 +7,19 @@
#include "algo/jh//sph_jh.h"
#include "algo/keccak/sph_keccak.h"
#ifdef NO_AES_NI
#include "algo/echo/sph_echo.h"
#else
#ifdef __AES__
#include "algo/echo/aes_ni/hash_api.h"
#else
#include "algo/echo/sph_echo.h"
#endif
typedef struct {
sph_jh512_context jh;
sph_keccak512_context keccak;
#ifdef NO_AES_NI
sph_echo512_context echo;
#else
#ifdef __AES__
hashState_echo echo;
#else
sph_echo512_context echo;
#endif
} tribus_ctx_holder;
@@ -29,10 +29,10 @@ bool tribus_thread_init()
{
sph_jh512_init( &tribus_ctx.jh );
sph_keccak512_init( &tribus_ctx.keccak );
#ifdef NO_AES_NI
sph_echo512_init( &tribus_ctx.echo );
#else
#ifdef __AES__
init_echo( &tribus_ctx.echo, 512 );
#else
sph_echo512_init( &tribus_ctx.echo );
#endif
return true;
}
@@ -49,12 +49,12 @@ void tribus_hash(void *state, const void *input)
sph_keccak512( &ctx.keccak, (const void*) hash, 64 );
sph_keccak512_close( &ctx.keccak, (void*) hash );
#ifdef NO_AES_NI
sph_echo512( &ctx.echo, hash, 64 );
sph_echo512_close (&ctx.echo, hash );
#else
#ifdef __AES__
update_final_echo( &ctx.echo, (BitSequence *) hash,
(const BitSequence *) hash, 512 );
#else
sph_echo512( &ctx.echo, hash, 64 );
sph_echo512_close (&ctx.echo, hash );
#endif
memcpy(state, hash, 32);

View File

@@ -275,7 +275,7 @@ int scanhash_x11_8way( struct work *work, uint32_t max_nonce,
pdata[19] = n;
for ( int i = 0; i < 8; i++ )
if ( ( hash+(i<<3) )[7] < Htarg
if ( ( hash+(i<<3) )[7] <= Htarg
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;

View File

@@ -1,13 +1,10 @@
#include "cpuminer-config.h"
#include "x11evo-gate.h"
#include <string.h>
#include <stdint.h>
#include <compat/portable_endian.h>
#include "algo/blake/sph_blake.h"
#include "algo/bmw/sph_bmw.h"
#include "algo/groestl/sph_groestl.h"
#include "algo/jh/sph_jh.h"
#include "algo/keccak/sph_keccak.h"
#include "algo/skein/sph_skein.h"
@@ -15,24 +12,24 @@
#include "algo/cubehash/sph_cubehash.h"
#include "algo/shavite/sph_shavite.h"
#include "algo/simd/sph_simd.h"
#include "algo/echo/sph_echo.h"
#ifndef NO_AES_NI
#ifdef __AES__
#include "algo/groestl/aes_ni/hash-groestl.h"
#include "algo/echo/aes_ni/hash_api.h"
#else
#include "algo/groestl/sph_groestl.h"
#include "algo/echo/sph_echo.h"
#endif
#include "algo/luffa/luffa_for_sse2.h"
#include "algo/cubehash/cubehash_sse2.h"
#include "algo/simd/nist.h"
typedef struct {
#ifdef NO_AES_NI
sph_groestl512_context groestl;
sph_echo512_context echo;
#else
#ifdef __AES__
hashState_echo echo;
hashState_groestl groestl;
#else
sph_groestl512_context groestl;
sph_echo512_context echo;
#endif
hashState_luffa luffa;
cubehashParam cube;
@@ -49,12 +46,12 @@ static x11evo_ctx_holder x11evo_ctx __attribute__ ((aligned (64)));
void init_x11evo_ctx()
{
#ifdef NO_AES_NI
sph_groestl512_init( &x11evo_ctx.groestl );
sph_echo512_init( &x11evo_ctx.echo );
#else
#ifdef __AES__
init_echo( &x11evo_ctx.echo, 512 );
init_groestl( &x11evo_ctx.groestl, 64 );
#else
sph_groestl512_init( &x11evo_ctx.groestl );
sph_echo512_init( &x11evo_ctx.echo );
#endif
init_luffa( &x11evo_ctx.luffa, 512 );
cubehashInit( &x11evo_ctx.cube, 512, 16, 32 );
@@ -106,12 +103,12 @@ void x11evo_hash( void *state, const void *input )
sph_bmw512_close( &ctx.bmw, (char*)hash );
break;
case 2:
#ifdef NO_AES_NI
#ifdef __AES__
update_and_final_groestl( &ctx.groestl, (char*)hash,
(const char*)hash, 512 );
#else
sph_groestl512( &ctx.groestl, (char*)hash, size );
sph_groestl512_close( &ctx.groestl, (char*)hash );
#else
update_and_final_groestl( &ctx.groestl, (char*)hash,
(const char*)hash, 512 );
#endif
break;
case 3:
@@ -142,12 +139,12 @@ void x11evo_hash( void *state, const void *input )
update_final_sd( &ctx.simd, (char*)hash, (const char*)hash, 512 );
break;
case 10:
#ifdef NO_AES_NI
#ifdef __AES__
update_final_echo( &ctx.echo, (char*)hash,
(const char*)hash, 512 );
#else
sph_echo512( &ctx.echo, (char*)hash, size );
sph_echo512_close( &ctx.echo, (char*)hash );
#else
update_final_echo( &ctx.echo, (char*)hash,
(const char*)hash, 512 );
#endif
break;
}

View File

@@ -308,7 +308,7 @@ int scanhash_x11gost_8way( struct work *work, uint32_t max_nonce,
pdata[19] = n;
for ( int i = 0; i < 8; i++ )
if ( ( hash+(i<<3) )[7] < Htarg
if ( ( hash+(i<<3) )[7] <= Htarg
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
@@ -482,37 +482,26 @@ int scanhash_x11gost_4way( struct work *work, uint32_t max_nonce,
int thr_id = mythr->id;
__m256i *noncev = (__m256i*)vdata + 9; // aligned
const uint32_t Htarg = ptarget[7];
uint64_t htmax[] = { 0, 0xF, 0xFF,
0xFFF, 0xFFFF, 0x10000000 };
uint32_t masks[] = { 0xFFFFFFFF, 0xFFFFFFF0, 0xFFFFFF00,
0xFFFFF000, 0xFFFF0000, 0 };
mm256_bswap32_intrlv80_4x64( vdata, pdata );
for (int m=0; m < 6; m++)
if (Htarg <= htmax[m])
{
uint32_t mask = masks[m];
do
{
*noncev = mm256_intrlv_blend_32( mm256_bswap_32(
_mm256_set_epi32( n+3, 0, n+2, 0, n+1, 0, n, 0 ) ), *noncev );
do
{
*noncev = mm256_intrlv_blend_32( mm256_bswap_32(
_mm256_set_epi32( n+3, 0, n+2, 0, n+1, 0, n, 0 ) ), *noncev );
x11gost_4way_hash( hash, vdata );
pdata[19] = n;
for ( int i = 0; i < 4; i++ )
if ( ( ( (hash+(i<<3))[7] & mask ) == 0 )
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
}
n += 4;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
break;
}
x11gost_4way_hash( hash, vdata );
pdata[19] = n;
for ( int i = 0; i < 4; i++ )
if ( ( hash+(i<<3) )[7] <= Htarg
&& fulltest( hash+(i<<3), ptarget ) && !opt_benchmark )
{
pdata[19] = n+i;
submit_lane_solution( work, hash+(i<<3), mythr, i );
}
n += 4;
} while ( ( n < max_nonce ) && !work_restart[thr_id].restart );
*hashes_done = n - first_nonce + 1;
return 0;
}

View File

@@ -114,12 +114,12 @@ void x11gost_hash(void *output, const void *input)
update_final_sd( &ctx.simd, (BitSequence *)hash,
(const BitSequence *)hash, 512 );
#ifdef NO_AES_NI
sph_echo512(&ctx.echo, hash, 64);
sph_echo512_close(&ctx.echo, hash);
#else
#if defined(__AES__)
update_final_echo ( &ctx.echo, (BitSequence *)hash,
(const BitSequence *)hash, 512 );
#else
sph_echo512(&ctx.echo, hash, 64);
sph_echo512_close(&ctx.echo, hash);
#endif
memcpy( output, hash, 32 );