This commit is contained in:
Jay D Dee
2017-01-22 21:06:41 -05:00
parent badc80f071
commit f6be9dcb9e
4 changed files with 59 additions and 19 deletions

View File

@@ -1,6 +1,12 @@
Change Log Change Log
---------- ----------
v3.5.1
Bastion 9% faster with AES, benchkmark still not working.
Worked around git automatically removing m4 directory.
Fixed occasional compile error in algo-gate.h.
v3.5.0 v3.5.0
Fixed blakecoin and vanilla increasing rejects with number of threads. Fixed blakecoin and vanilla increasing rejects with number of threads.

View File

@@ -123,7 +123,7 @@ uint32_t *( *get_nonceptr ) ( uint32_t* );
void ( *display_extra_data ) ( struct work*, uint64_t* ); void ( *display_extra_data ) ( struct work*, uint64_t* );
void ( *wait_for_diff ) ( struct stratum_ctx* ); void ( *wait_for_diff ) ( struct stratum_ctx* );
int64_t ( *get_max64 ) (); int64_t ( *get_max64 ) ();
bool ( *work_decode ) ( const struct json_t*, struct work* ); bool ( *work_decode ) ( const json_t*, struct work* );
void ( *set_target) ( struct work*, double ); void ( *set_target) ( struct work*, double );
bool ( *submit_getwork_result ) ( CURL*, struct work* ); bool ( *submit_getwork_result ) ( CURL*, struct work* );
void ( *gen_merkle_root ) ( char*, struct stratum_ctx* ); void ( *gen_merkle_root ) ( char*, struct stratum_ctx* );

View File

@@ -1,4 +1,5 @@
#include "miner.h" #include "miner.h"
#include "algo-gate-api.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -15,25 +16,39 @@
#include "algo/shabal/sph_shabal.h" #include "algo/shabal/sph_shabal.h"
#include "algo/echo/sph_echo.h" #include "algo/echo/sph_echo.h"
#include "algo/hamsi/sph_hamsi.h" #include "algo/hamsi/sph_hamsi.h"
#include "algo-gate-api.h" #include "algo/luffa/sse2/luffa_for_sse2.h"
#include "algo/skein/sse2/skein.c"
#ifndef NO_AES_NI
#include "algo/echo/aes_ni/hash_api.h"
#endif
void bastionhash(void *output, const void *input) void bastionhash(void *output, const void *input)
{ {
unsigned char _ALIGN(128) hash[64] = { 0 }; unsigned char _ALIGN(128) hash[64] = { 0 };
#ifdef NO_AES_NI
sph_echo512_context ctx_echo; sph_echo512_context ctx_echo;
sph_luffa512_context ctx_luffa; #else
hashState_echo ctx_echo;
#endif
hashState_luffa ctx_luffa;
sph_fugue512_context ctx_fugue; sph_fugue512_context ctx_fugue;
sph_whirlpool_context ctx_whirlpool; sph_whirlpool_context ctx_whirlpool;
sph_shabal512_context ctx_shabal; sph_shabal512_context ctx_shabal;
sph_skein512_context ctx_skein; sph_skein512_context ctx_skein;
sph_hamsi512_context ctx_hamsi; sph_hamsi512_context ctx_hamsi;
unsigned char hashbuf[128] __attribute__ ((aligned (16)));
sph_u64 hashctA;
sph_u64 hashctB;
size_t hashptr;
HEFTY1(input, 80, hash); HEFTY1(input, 80, hash);
sph_luffa512_init(&ctx_luffa); init_luffa( &ctx_luffa, 512 );
sph_luffa512(&ctx_luffa, hash, 64); update_luffa( &ctx_luffa, hash, 512 );
sph_luffa512_close(&ctx_luffa, hash); final_luffa( &ctx_luffa, hash );
if (hash[0] & 0x8) if (hash[0] & 0x8)
{ {
@@ -41,9 +56,13 @@ void bastionhash(void *output, const void *input)
sph_fugue512(&ctx_fugue, hash, 64); sph_fugue512(&ctx_fugue, hash, 64);
sph_fugue512_close(&ctx_fugue, hash); sph_fugue512_close(&ctx_fugue, hash);
} else { } else {
sph_skein512_init(&ctx_skein); DECL_SKN;
sph_skein512(&ctx_skein, hash, 64); SKN_I;
sph_skein512_close(&ctx_skein, hash); SKN_U;
SKN_C;
// sph_skein512_init(&ctx_skein);
// sph_skein512(&ctx_skein, hash, 64);
// sph_skein512_close(&ctx_skein, hash);
} }
sph_whirlpool_init(&ctx_whirlpool); sph_whirlpool_init(&ctx_whirlpool);
@@ -56,22 +75,32 @@ void bastionhash(void *output, const void *input)
if (hash[0] & 0x8) if (hash[0] & 0x8)
{ {
#ifdef NO_AES_NI
sph_echo512_init(&ctx_echo); sph_echo512_init(&ctx_echo);
sph_echo512(&ctx_echo, hash, 64); sph_echo512(&ctx_echo, hash, 64);
sph_echo512_close(&ctx_echo, hash); sph_echo512_close(&ctx_echo, hash);
#else
init_echo( &ctx_echo, 512 );
update_echo ( &ctx_echo, hash, 512 );
final_echo( &ctx_echo, hash );
#endif
} else { } else {
sph_luffa512_init(&ctx_luffa); init_luffa( &ctx_luffa, 512 );
sph_luffa512(&ctx_luffa, hash, 64); update_luffa( &ctx_luffa, hash, 512 );
sph_luffa512_close(&ctx_luffa, hash); final_luffa( &ctx_luffa, hash );
} }
sph_shabal512_init(&ctx_shabal); sph_shabal512_init(&ctx_shabal);
sph_shabal512(&ctx_shabal, hash, 64); sph_shabal512(&ctx_shabal, hash, 64);
sph_shabal512_close(&ctx_shabal, hash); sph_shabal512_close(&ctx_shabal, hash);
sph_skein512_init(&ctx_skein); DECL_SKN;
sph_skein512(&ctx_skein, hash, 64); SKN_I;
sph_skein512_close(&ctx_skein, hash); SKN_U;
SKN_C;
// sph_skein512_init(&ctx_skein);
// sph_skein512(&ctx_skein, hash, 64);
// sph_skein512_close(&ctx_skein, hash);
if (hash[0] & 0x8) if (hash[0] & 0x8)
{ {
@@ -94,9 +123,9 @@ void bastionhash(void *output, const void *input)
sph_hamsi512(&ctx_hamsi, hash, 64); sph_hamsi512(&ctx_hamsi, hash, 64);
sph_hamsi512_close(&ctx_hamsi, hash); sph_hamsi512_close(&ctx_hamsi, hash);
} else { } else {
sph_luffa512_init(&ctx_luffa); init_luffa( &ctx_luffa, 512 );
sph_luffa512(&ctx_luffa, hash, 64); update_luffa( &ctx_luffa, hash, 512 );
sph_luffa512_close(&ctx_luffa, hash); final_luffa( &ctx_luffa, hash );
} }
memcpy(output, hash, 32); memcpy(output, hash, 32);
@@ -138,6 +167,7 @@ int scanhash_bastion(int thr_id, struct work *work, uint32_t max_nonce, uint64_t
bool register_bastion_algo( algo_gate_t* gate ) bool register_bastion_algo( algo_gate_t* gate )
{ {
gate->optimizations = SSE2_OPT | AES_OPT;
gate->scanhash = (void*)&scanhash_bastion; gate->scanhash = (void*)&scanhash_bastion;
gate->hash = (void*)&bastionhash; gate->hash = (void*)&bastionhash;
gate->hash_alt = (void*)&bastionhash; gate->hash_alt = (void*)&bastionhash;

4
m4/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore