Skip to content

Commit

Permalink
hmq1725 algo
Browse files Browse the repository at this point in the history
Signed-off-by: Tanguy Pruvot <[email protected]>
  • Loading branch information
tpruvot committed Mar 7, 2017
1 parent 4d95ef4 commit 3d70026
Show file tree
Hide file tree
Showing 14 changed files with 589 additions and 40 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ ccminer_SOURCES = elist.h miner.h compat.h \
x13/x13.cu x13/cuda_x13_hamsi512.cu x13/cuda_x13_fugue512.cu \
x15/x14.cu x15/x15.cu x15/cuda_x14_shabal512.cu x15/cuda_x15_whirlpool.cu \
x15/whirlpool.cu \
x17/x17.cu x17/cuda_x17_haval256.cu x17/cuda_x17_sha512.cu \
x17/x17.cu x17/hmq17.cu x17/cuda_x17_haval256.cu x17/cuda_x17_sha512.cu \
x11/c11.cu x11/s3.cu x11/sib.cu x11/veltor.cu x11/cuda_streebog.cu

# scrypt
Expand Down
4 changes: 4 additions & 0 deletions algos.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum sha_algos {
ALGO_FUGUE256, /* Fugue256 */
ALGO_GROESTL,
ALGO_HEAVY, /* Heavycoin hash */
ALGO_HMQ1725,
ALGO_KECCAK,
ALGO_JACKPOT,
ALGO_LBRY,
Expand Down Expand Up @@ -73,6 +74,7 @@ static const char *algo_names[] = {
"fugue256",
"groestl",
"heavy",
"hmq1725",
"keccak",
"jackpot",
"lbry",
Expand Down Expand Up @@ -135,6 +137,8 @@ static inline int algo_to_int(char* arg)
i = ALGO_DMD_GR;
else if (!strcasecmp("doom", arg))
i = ALGO_LUFFA;
else if (!strcasecmp("hmq17", arg))
i = ALGO_HMQ1725;
else if (!strcasecmp("lyra2re", arg))
i = ALGO_LYRA2;
else if (!strcasecmp("lyra2rev2", arg))
Expand Down
1 change: 1 addition & 0 deletions bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ void algo_free_all(int thr_id)
free_fugue256(thr_id);
free_groestlcoin(thr_id);
free_heavy(thr_id);
free_hmq17(thr_id);
free_jackpot(thr_id);
free_lbry(thr_id);
free_luffa(thr_id);
Expand Down
7 changes: 7 additions & 0 deletions ccminer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ Options:\n\
fugue256 Fuguecoin\n\
groestl Groestlcoin\n\
heavy Heavycoin\n\
hmq1725 Doubloons / Espers\n\
jackpot Jackpot\n\
keccak Keccak-256 (Maxcoin)\n\
lbry LBRY Credits (Sha/Ripemd)\n\
Expand Down Expand Up @@ -1600,6 +1601,7 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work)
opt_difficulty = 1.;

switch (opt_algo) {
case ALGO_HMQ1725: // should be 256 but... suprnova...
case ALGO_JACKPOT:
case ALGO_NEOSCRYPT:
case ALGO_SCRYPT:
Expand Down Expand Up @@ -2232,12 +2234,17 @@ static void *miner_thread(void *userdata)
rc = scanhash_myriad(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_HMQ1725:
rc = scanhash_hmq17(thr_id, &work, max_nonce, &hashes_done);
break;

case ALGO_HEAVY:
rc = scanhash_heavy(thr_id, &work, max_nonce, &hashes_done, work.maxvote, HEAVYCOIN_BLKHDR_SZ);
break;
case ALGO_MJOLLNIR:
rc = scanhash_heavy(thr_id, &work, max_nonce, &hashes_done, 0, MNR_BLKHDR_SZ);
break;

case ALGO_KECCAK:
rc = scanhash_keccak256(thr_id, &work, max_nonce, &hashes_done);
break;
Expand Down
1 change: 1 addition & 0 deletions ccminer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@
</CudaCompile>
<CudaCompile Include="x15\cuda_x14_shabal512.cu" />
<CudaCompile Include="x15\cuda_x15_whirlpool.cu" />
<CudaCompile Include="x17\hmq17.cu"/>
<CudaCompile Include="x15\x15.cu" />
<CudaCompile Include="x15\whirlpool.cu" />
<CudaCompile Include="x17\x17.cu">
Expand Down
3 changes: 3 additions & 0 deletions ccminer.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,9 @@
<CudaCompile Include="x17\cuda_x17_sha512.cu">
<Filter>Source Files\CUDA\x17</Filter>
</CudaCompile>
<CudaCompile Include="x17\hmq17.cu">
<Filter>Source Files\CUDA\x17</Filter>
</CudaCompile>
<CudaCompile Include="x17\x17.cu">
<Filter>Source Files\CUDA\x17</Filter>
</CudaCompile>
Expand Down
3 changes: 3 additions & 0 deletions miner.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ extern int scanhash_keccak256(int thr_id, struct work* work, uint32_t max_nonce,
extern int scanhash_fresh(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done);
extern int scanhash_fugue256(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done);
extern int scanhash_groestlcoin(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done);
extern int scanhash_hmq17(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done);
extern int scanhash_heavy(int thr_id,struct work *work, uint32_t max_nonce, unsigned long *hashes_done, uint32_t maxvote, int blocklen);
extern int scanhash_jackpot(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done);
extern int scanhash_lbry(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done);
Expand Down Expand Up @@ -336,6 +337,7 @@ extern void free_fresh(int thr_id);
extern void free_fugue256(int thr_id);
extern void free_groestlcoin(int thr_id);
extern void free_heavy(int thr_id);
extern void free_hmq17(int thr_id);
extern void free_jackpot(int thr_id);
extern void free_lbry(int thr_id);
extern void free_luffa(int thr_id);
Expand Down Expand Up @@ -852,6 +854,7 @@ void luffa_hash(void *state, const void *input);
void fresh_hash(void *state, const void *input);
void fugue256_hash(unsigned char* output, const unsigned char* input, int len);
void heavycoin_hash(unsigned char* output, const unsigned char* input, int len);
void hmq17hash(void *output, const void *input);
void keccak256_hash(void *state, const void *input);
unsigned int jackpothash(void *state, const void *input);
void groestlhash(void *state, const void *input);
Expand Down
8 changes: 1 addition & 7 deletions quark/cuda_bmw512.cu
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#include <stdio.h>
#include <memory.h>

#undef WANT_BMW512_80
#define WANT_BMW512_80

#include "cuda_helper.h"

#ifdef WANT_BMW512_80
__constant__ uint64_t c_PaddedMessage80[16]; // padded message (80 bytes + padding)
#endif

#include "cuda_bmw512_sm3.cuh"

Expand Down Expand Up @@ -390,8 +388,6 @@ void quark_bmw512_gpu_hash_64(uint32_t threads, uint32_t startNounce, uint64_t *
}
}

#ifdef WANT_BMW512_80

__global__ __launch_bounds__(256, 2)
void quark_bmw512_gpu_hash_80(uint32_t threads, uint32_t startNounce, uint64_t *g_hash)
{
Expand Down Expand Up @@ -474,8 +470,6 @@ void quark_bmw512_cpu_hash_80(int thr_id, uint32_t threads, uint32_t startNounce
quark_bmw512_gpu_hash_80_30<<<grid, block>>>(threads, startNounce, (uint64_t*)d_hash);
}

#endif

__host__
void quark_bmw512_cpu_init(int thr_id, uint32_t threads)
{
Expand Down
4 changes: 0 additions & 4 deletions quark/cuda_bmw512_sm3.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ void quark_bmw512_gpu_hash_64_30(uint32_t threads, uint32_t startNounce, uint64_
}
}

#ifdef WANT_BMW512_80

__global__
void quark_bmw512_gpu_hash_80_30(uint32_t threads, uint32_t startNounce, uint64_t *g_hash)
{
Expand Down Expand Up @@ -266,8 +264,6 @@ void quark_bmw512_gpu_hash_80_30(uint32_t threads, uint32_t startNounce, uint64_
}
}

#endif

#else /* stripped stubs for other archs */
__global__ void quark_bmw512_gpu_hash_64_30(uint32_t threads, uint32_t startNounce, uint64_t *g_hash, uint32_t *g_nonceVector) {}
__global__ void quark_bmw512_gpu_hash_80_30(uint32_t threads, uint32_t startNounce, uint64_t *g_hash) {}
Expand Down
5 changes: 4 additions & 1 deletion util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2116,7 +2116,7 @@ void do_gpu_tests(void)

memset(work.data, 0, sizeof(work.data));
work.data[0] = 0;
scanhash_lbry(0, &work, 1, &done);
scanhash_hmq17(0, &work, 1, &done);

free(work_restart);
work_restart = NULL;
Expand Down Expand Up @@ -2179,6 +2179,9 @@ void print_hash_tests(void)
heavycoin_hash(&hash[0], &buf[0], 32);
printpfx("heavy", hash);

hmq17hash(&hash[0], &buf[0]);
printpfx("hmq1725", hash);

jackpothash(&hash[0], &buf[0]);
printpfx("jackpot", hash);

Expand Down
30 changes: 14 additions & 16 deletions x17/cuda_x17_haval256.cu
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,13 @@
}

__global__ /* __launch_bounds__(256, 6) */
void x17_haval256_gpu_hash_64(const uint32_t threads, uint32_t startNounce, uint64_t *g_hash, uint32_t *g_nonceVector)
void x17_haval256_gpu_hash_64(const uint32_t threads, uint64_t *g_hash, const int outlen)
{
uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x);
const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x);
if (thread < threads)
{
uint32_t nounce = (g_nonceVector != NULL) ? g_nonceVector[thread] : (startNounce + thread);
uint64_t hashPosition = nounce - startNounce;
uint64_t *pHash = &g_hash[hashPosition*8U];
const uint64_t hashPosition = thread*8U;
uint64_t *pHash = &g_hash[hashPosition];

uint32_t s0, s1, s2, s3, s4, s5, s6, s7;
const uint32_t u0 = s0 = 0x243F6A88;
Expand All @@ -288,7 +287,7 @@ void x17_haval256_gpu_hash_64(const uint32_t threads, uint32_t startNounce, uint
hash.h8[i] = pHash[i];
}

///////// input big /////////////////////
///////// input big /////////////////////

uint32_t buf[32];

Expand Down Expand Up @@ -325,12 +324,13 @@ void x17_haval256_gpu_hash_64(const uint32_t threads, uint32_t startNounce, uint
pHash[1] = hash.h8[1];
pHash[2] = hash.h8[2];
pHash[3] = hash.h8[3];
#ifdef NEED_HASH_512
pHash[4] = hash.h8[4];
pHash[5] = hash.h8[5];
pHash[6] = hash.h8[6];
pHash[7] = hash.h8[7];
#endif

if (outlen == 512) {
pHash[4] = 0; //hash.h8[4];
pHash[5] = 0; //hash.h8[5];
pHash[6] = 0; //hash.h8[6];
pHash[7] = 0; //hash.h8[7];
}
}
}

Expand All @@ -340,14 +340,12 @@ void x17_haval256_cpu_init(int thr_id, uint32_t threads)
}

__host__
void x17_haval256_cpu_hash_64(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_nonceVector, uint32_t *d_hash, int order)
void x17_haval256_cpu_hash_64(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_hash, const int outlen)
{
const uint32_t threadsperblock = 256;

dim3 grid((threads + threadsperblock-1)/threadsperblock);
dim3 block(threadsperblock);

x17_haval256_gpu_hash_64 <<<grid, block>>> (threads, startNounce, (uint64_t*)d_hash, d_nonceVector);

//MyStreamSynchronize(NULL, order, thr_id);
x17_haval256_gpu_hash_64 <<<grid, block>>> (threads, (uint64_t*)d_hash, outlen);
}
11 changes: 4 additions & 7 deletions x17/cuda_x17_sha512.cu
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,12 @@ uint64_t Tone(uint64_t* K, uint64_t* r, uint64_t* W, const int a, const int i)

__global__
/*__launch_bounds__(256, 4)*/
void x17_sha512_gpu_hash_64(const uint32_t threads, uint32_t startNounce, uint64_t *g_hash, uint32_t *g_nonceVector)
void x17_sha512_gpu_hash_64(const uint32_t threads, uint64_t *g_hash)
{
const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x);
if (thread < threads)
{
uint32_t nounce = (g_nonceVector != NULL) ? g_nonceVector[thread] : (startNounce + thread);
uint64_t hashPosition = nounce - startNounce;
const uint64_t hashPosition = thread;
uint64_t *pHash = &g_hash[hashPosition*8U];

uint64_t W[80];
Expand Down Expand Up @@ -161,14 +160,12 @@ void x17_sha512_cpu_init(int thr_id, uint32_t threads)
}

__host__
void x17_sha512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_nonceVector, uint32_t *d_hash, int order)
void x17_sha512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_hash)
{
const uint32_t threadsperblock = 256;

dim3 grid((threads + threadsperblock-1)/threadsperblock);
dim3 block(threadsperblock);

x17_sha512_gpu_hash_64 <<<grid, block>>> (threads, startNounce, (uint64_t*)d_hash, d_nonceVector);

//MyStreamSynchronize(NULL, order, thr_id);
x17_sha512_gpu_hash_64 <<<grid, block>>> (threads, (uint64_t*)d_hash);
}
Loading

0 comments on commit 3d70026

Please sign in to comment.