This commit is contained in:
Jay D Dee
2017-03-03 13:55:00 -05:00
parent 1b288b1209
commit 38c6f23b66
11 changed files with 222 additions and 13 deletions

View File

@@ -119,6 +119,7 @@ cpuminer_SOURCES = \
algo/scrypt.c \ algo/scrypt.c \
algo/scryptjane/scrypt-jane.c \ algo/scryptjane/scrypt-jane.c \
algo/sha2/sha2.c \ algo/sha2/sha2.c \
algo/sha2/sha256t.c \
algo/simd/sse2/nist.c \ algo/simd/sse2/nist.c \
algo/simd/sse2/vector.c \ algo/simd/sse2/vector.c \
algo/skein/skein.c \ algo/skein/skein.c \

View File

@@ -3,11 +3,17 @@ Compile instruction for Linux and Windows are at the bottom of this file.
Change Log Change Log
---------- ----------
v3.5.12
New algo sha256t for Onecoin (OC), 29% faster than ocminer version.
lyra2zoin algo renamed to lyra2z330, lyra2zoin and zoin still work
as aliases.
v3.5.11 v3.5.11
- fixed hmq1725 crash on Ubuntu 16.04 Fixed hmq1725 crash on Ubuntu 16.04
- fixed compile error in hodl.cpp with gcc 6.3 Fixed compile error in hodl.cpp with gcc 6.3
- fixed x11 crash on Windows with AVX2 Fixed x11 crash on Windows with AVX2
v3.5.10 v3.5.10

View File

@@ -179,7 +179,7 @@ bool register_algo_gate( int algo, algo_gate_t *gate )
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_LYRA2Z: register_zcoin_algo ( gate ); break; case ALGO_LYRA2Z: register_zcoin_algo ( gate ); break;
case ALGO_LYRA2ZOIN: register_zoin_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;
@@ -191,6 +191,7 @@ bool register_algo_gate( int algo, algo_gate_t *gate )
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_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;
@@ -281,13 +282,14 @@ const char* const algo_alias_map[][2] =
{ "jane", "scryptjane" }, { "jane", "scryptjane" },
{ "lyra2", "lyra2re" }, { "lyra2", "lyra2re" },
{ "lyra2v2", "lyra2rev2" }, { "lyra2v2", "lyra2rev2" },
{ "lyra2zoin", "lyra2z330" },
{ "myriad", "myr-gr" }, { "myriad", "myr-gr" },
{ "neo", "neoscrypt" }, { "neo", "neoscrypt" },
{ "sib", "x11gost" }, { "sib", "x11gost" },
{ "yes", "yescrypt" }, { "yes", "yescrypt" },
{ "ziftr", "zr5" }, { "ziftr", "zr5" },
{ "zcoin", "lyra2z" }, { "zcoin", "lyra2z" },
{ "zoin", "lyra2zoin" }, { "zoin", "lyra2z330" },
{ NULL, NULL } { NULL, NULL }
}; };

View File

@@ -130,7 +130,6 @@ void ( *build_extraheader ) ( struct work*, struct stratum_ctx* );
void ( *build_stratum_request ) ( char*, struct work*, struct stratum_ctx* ); void ( *build_stratum_request ) ( char*, struct work*, struct stratum_ctx* );
void ( *set_work_data_endian ) ( struct work* ); void ( *set_work_data_endian ) ( struct work* );
double ( *calc_network_diff ) ( struct work* ); double ( *calc_network_diff ) ( struct work* );
//bool ( *prevent_dupes ) ( struct work*, struct stratum_ctx*, int );
bool ( *ready_to_mine ) ( struct work*, struct stratum_ctx*, int ); bool ( *ready_to_mine ) ( struct work*, struct stratum_ctx*, int );
void ( *resync_threads ) ( struct work* ); void ( *resync_threads ) ( struct work* );
bool ( *do_this_thread ) ( int ); bool ( *do_this_thread ) ( int );

View File

@@ -189,7 +189,7 @@ HashReturn_gr update_and_final_groestl( hashState_groestl* ctx, void* output,
int rem = ctx->rem_ptr; int rem = ctx->rem_ptr;
int blocks = len / SIZE512; int blocks = len / SIZE512;
__m128i* in = (__m128i*)input; __m128i* in = (__m128i*)input;
int i, i0; int i;
// --- update --- // --- update ---

View File

@@ -38,6 +38,15 @@
_mm256_set_epi32( 0, 0, 0, 0, 0, 0, 0, 0x00800800 ) ) ) _mm256_set_epi32( 0, 0, 0, 0, 0, 0, 0, 0x00800800 ) ) )
#endif // __AVX2__ #endif // __AVX2__
#define MULT2(a0,a1) do \
{ \
__m128i b = _mm_xor_si128( a0, _mm_shuffle_epi32( _mm_and_si128(a1,MASK), 16 ) ); \
a0 = _mm_or_si128( _mm_srli_si128(b,4), _mm_slli_si128(a1,12) ); \
a1 = _mm_or_si128( _mm_srli_si128(a1,4), _mm_slli_si128(b,12) ); \
} while(0)
/*
#define MULT2(a0,a1) do \ #define MULT2(a0,a1) do \
{ \ { \
__m128i b; \ __m128i b; \
@@ -46,6 +55,7 @@ _mm256_set_epi32( 0, 0, 0, 0, 0, 0, 0, 0x00800800 ) ) )
a0 = _mm_or_si128( _mm_srli_si128(a0,4), _mm_slli_si128(a1,12) ); \ a0 = _mm_or_si128( _mm_srli_si128(a0,4), _mm_slli_si128(a1,12) ); \
a1 = _mm_or_si128( _mm_srli_si128(a1,4), _mm_slli_si128(b,12) ); \ a1 = _mm_or_si128( _mm_srli_si128(a1,4), _mm_slli_si128(b,12) ); \
} while(0) } while(0)
*/
#define STEP_PART(x,c,t)\ #define STEP_PART(x,c,t)\
SUBCRUMB(*x,*(x+1),*(x+2),*(x+3),*t);\ SUBCRUMB(*x,*(x+1),*(x+2),*(x+3),*t);\

View File

@@ -84,7 +84,7 @@ bool zoin_thread_init()
return true; return true;
} }
bool register_zoin_algo( algo_gate_t* gate ) bool register_lyra2z330_algo( algo_gate_t* gate )
{ {
gate->optimizations = SSE2_OPT | AES_OPT | AVX_OPT | AVX2_OPT; gate->optimizations = SSE2_OPT | AES_OPT | AVX_OPT | AVX2_OPT;
gate->miner_thread_init = (void*)&zoin_thread_init; gate->miner_thread_init = (void*)&zoin_thread_init;

143
algo/sha2/sha256t.c Normal file
View File

@@ -0,0 +1,143 @@
#include "miner.h"
#include "algo-gate-api.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include "sph-sha2.h"
//#define DEBUG_ALGO
static sph_sha256_context sha256t_ctx __attribute__ ((aligned (64)));
static __thread sph_sha256_context sha256t_mid __attribute__ ((aligned (64)));
void sha256t_midstate( const void* input )
{
memcpy( &sha256t_mid, &sha256t_ctx, sizeof sha256t_mid );
sph_sha256( &sha256t_mid, input, 64 );
}
void sha256t_hash(void* output, const void* input, uint32_t len)
{
sph_sha256_context ctx_sha256 __attribute__ ((aligned (64)));
uint32_t _ALIGN(64) hashA[16];
const int midlen = 64; // bytes
const int tail = 80 - midlen; // 16
memcpy( &ctx_sha256, &sha256t_mid, sizeof sha256t_mid );
sph_sha256( &ctx_sha256, input + midlen, tail );
// sph_sha256_init(&ctx_sha256);
// sph_sha256 (&ctx_sha256, input, 80);
sph_sha256_close( &ctx_sha256, hashA );
// sph_sha256_init(&ctx_sha256);
memcpy( &ctx_sha256, &sha256t_ctx, sizeof sha256t_ctx );
sph_sha256( &ctx_sha256, hashA, 32 );
sph_sha256_close( &ctx_sha256, hashA );
// sph_sha256_init(&ctx_sha256);
memcpy( &ctx_sha256, &sha256t_ctx, sizeof sha256t_ctx );
sph_sha256( &ctx_sha256, hashA, 32 );
sph_sha256_close( &ctx_sha256, hashA );
memcpy( output, hashA, 32 );
}
int scanhash_sha256t(int thr_id, struct work *work,
uint32_t max_nonce, uint64_t *hashes_done)
{
uint32_t *pdata = work->data;
uint32_t *ptarget = work->target;
uint32_t len = 80;
uint32_t n = pdata[19] - 1;
const uint32_t first_nonce = pdata[19];
const uint32_t Htarg = ptarget[7];
#ifdef _MSC_VER
uint32_t __declspec(align(32)) hash64[8];
#else
uint32_t hash64[8] __attribute__((aligned(32)));
#endif
uint32_t endiandata[32];
uint64_t htmax[] = {
0,
0xF,
0xFF,
0xFFF,
0xFFFF,
0x10000000
};
uint32_t masks[] = {
0xFFFFFFFF,
0xFFFFFFF0,
0xFFFFFF00,
0xFFFFF000,
0xFFFF0000,
0
};
// we need bigendian data...
for (int k = 0; k < 19; k++)
be32enc(&endiandata[k], pdata[k]);
sha256t_midstate( endiandata );
#ifdef DEBUG_ALGO
if (Htarg != 0)
printf("[%d] Htarg=%X\n", thr_id, Htarg);
#endif
for (int m=0; m < 6; m++) {
if (Htarg <= htmax[m]) {
uint32_t mask = masks[m];
do {
pdata[19] = ++n;
be32enc(&endiandata[19], n);
sha256t_hash(hash64, endiandata, len);
#ifndef DEBUG_ALGO
if ((!(hash64[7] & mask)) && fulltest(hash64, ptarget)) {
*hashes_done = n - first_nonce + 1;
return true;
}
#else
if (!(n % 0x1000) && !thr_id) printf(".");
if (!(hash64[7] & mask)) {
printf("[%d]",thr_id);
if (fulltest(hash64, ptarget)) {
*hashes_done = n - first_nonce + 1;
return true;
}
}
#endif
} while (n < max_nonce && !work_restart[thr_id].restart);
// see blake.c if else to understand the loop on htmax => mask
break;
}
}
*hashes_done = n - first_nonce + 1;
pdata[19] = n;
return 0;
}
void sha256t_set_target( struct work* work, double job_diff )
{
work_set_target( work, job_diff / (256.0 * opt_diff_factor) );
}
bool register_sha256t_algo( algo_gate_t* gate )
{
sph_sha256_init( &sha256t_ctx );
gate->scanhash = (void*)&scanhash_sha256t;
gate->hash = (void*)&sha256t_hash;
gate->hash_alt = (void*)&sha256t_hash;
gate->set_target = (void*)&sha256t_set_target;
gate->get_max64 = (void*)&get_max64_0x3ffff;
return true;
}

View File

@@ -1,4 +1,4 @@
AC_INIT([cpuminer-opt], [3.5.11]) AC_INIT([cpuminer-opt], [3.5.12])
AC_PREREQ([2.59c]) AC_PREREQ([2.59c])
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM

11
miner.h
View File

@@ -499,7 +499,7 @@ enum algos {
ALGO_LYRA2RE, ALGO_LYRA2RE,
ALGO_LYRA2REV2, ALGO_LYRA2REV2,
ALGO_LYRA2Z, ALGO_LYRA2Z,
ALGO_LYRA2ZOIN, ALGO_LYRA2Z330,
ALGO_M7M, ALGO_M7M,
ALGO_MYR_GR, ALGO_MYR_GR,
ALGO_NEOSCRYPT, ALGO_NEOSCRYPT,
@@ -511,6 +511,7 @@ enum algos {
ALGO_SCRYPT, ALGO_SCRYPT,
ALGO_SCRYPTJANE, ALGO_SCRYPTJANE,
ALGO_SHA256D, ALGO_SHA256D,
ALGO_SHA256T,
ALGO_SHAVITE3, ALGO_SHAVITE3,
ALGO_SKEIN, ALGO_SKEIN,
ALGO_SKEIN2, ALGO_SKEIN2,
@@ -559,7 +560,7 @@ static const char* const algo_names[] = {
"lyra2re", "lyra2re",
"lyra2rev2", "lyra2rev2",
"lyra2z", "lyra2z",
"lyra2zoin", "lyra2z330",
"m7m", "m7m",
"myr-gr", "myr-gr",
"neoscrypt", "neoscrypt",
@@ -571,6 +572,7 @@ static const char* const algo_names[] = {
"scrypt", "scrypt",
"scryptjane", "scryptjane",
"sha256d", "sha256d",
"sha256t",
"shavite3", "shavite3",
"skein", "skein",
"skein2", "skein2",
@@ -674,7 +676,7 @@ Options:\n\
lyra2re lyra2\n\ lyra2re lyra2\n\
lyra2rev2 lyrav2, Vertcoin\n\ lyra2rev2 lyrav2, Vertcoin\n\
lyra2z Zcoin (XZC)\n\ lyra2z Zcoin (XZC)\n\
lyra2zoin Zoin (ZOI)\n\ lyra2z330 Zoin (ZOI)\n\
m7m Magi (XMG)\n\ m7m Magi (XMG)\n\
myr-gr Myriad-Groestl\n\ myr-gr Myriad-Groestl\n\
neoscrypt NeoScrypt(128, 2, 1)\n\ neoscrypt NeoScrypt(128, 2, 1)\n\
@@ -686,7 +688,8 @@ Options:\n\
scrypt scrypt(1024, 1, 1) (default)\n\ scrypt scrypt(1024, 1, 1) (default)\n\
scrypt:N scrypt(N, 1, 1)\n\ scrypt:N scrypt(N, 1, 1)\n\
scryptjane:nf\n\ scryptjane:nf\n\
sha256d SHA-256d\n\ sha256d Double SHA-256\n\
sha256t Triple SHA-256, Onecoin (OC)\n\
shavite3 Shavite3\n\ shavite3 Shavite3\n\
skein Skein+Sha (Skeincoin)\n\ skein Skein+Sha (Skeincoin)\n\
skein2 Double Skein (Woodcoin)\n\ skein2 Double Skein (Woodcoin)\n\

45
winbuild-allarch.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/bash
make distclean || echo clean
rm -f config.status
./autogen.sh || echo done
CFLAGS="-O3 -march=core-avx2 -Wall" CXXFLAGS="$CFLAGS -std=gnu++11 -fpermissive" ./configure --with-curl
make -j 4
strip -s cpuminer.exe
mv cpuminer.exe cpuminer-aes-avx2.exe
make clean || echo clean
rm -f config.status
./autogen.sh || echo done
CFLAGS="-O3 -march=corei7-avx -Wall" CXXFLAGS="$CFLAGS -std=gnu++11 -fpermissive" ./configure --with-curl
make -j 4
strip -s cpuminer.exe
mv cpuminer.exe cpuminer-aes-avx.exe
make clean || echo clean
rm -f config.status
./autogen.sh || echo done
CFLAGS="-O3 -maes -msse4.2 -Wall" CXXFLAGS="$CFLAGS -std=gnu++11 -fpermissive" ./configure --with-curl
make -j 4
strip -s cpuminer.exe
mv cpuminer.exe cpuminer-aes-sse42.exe
make clean || echo clean
rm -f config.status
./autogen.sh || echo done
CFLAGS="-O3 -march=corei7 -Wall" CXXFLAGS="$CFLAGS -std=gnu++11 -fpermissive" ./configure --with-curl
make -j 4
strip -s cpuminer.exe
mv cpuminer.exe cpuminer-sse42.exe
make clean || echo clean
rm -f config.status
./autogen.sh || echo done
CFLAGS="-O3 -march=core2 -Wall" CXXFLAGS="$CFLAGS -std=gnu++11 -fpermissive" ./configure --with-curl
make -j 4
strip -s cpuminer.exe
mv cpuminer.exe cpuminer-sse2.exe
make clean || echo done