mirror of
https://github.com/GOSTSec/ccminer
synced 2025-01-11 15:27:56 +00:00
blake: change dynamic round system
blakecoin was conflicting with lyra2, set the rounds more properly
This commit is contained in:
parent
c7cfe0e2ca
commit
8db5a0bc9e
@ -17,16 +17,13 @@ extern "C" {
|
||||
/* threads per block and throughput (intensity) */
|
||||
#define TPB 128
|
||||
|
||||
/* added in sph_blake.c */
|
||||
extern "C" int blake256_rounds = 14;
|
||||
|
||||
/* hash by cpu with blake 256 */
|
||||
extern "C" void blake256hash(void *output, const void *input, int8_t rounds = 14)
|
||||
{
|
||||
uchar hash[64];
|
||||
sph_blake256_context ctx;
|
||||
|
||||
blake256_rounds = rounds;
|
||||
sph_blake256_set_rounds(rounds);
|
||||
|
||||
sph_blake256_init(&ctx);
|
||||
sph_blake256(&ctx, input, 80);
|
||||
@ -356,8 +353,7 @@ static void blake256mid(uint32_t *output, const uint32_t *input, int8_t rounds =
|
||||
{
|
||||
sph_blake256_context ctx;
|
||||
|
||||
/* in sph_blake.c */
|
||||
blake256_rounds = rounds;
|
||||
sph_blake256_set_rounds(rounds);
|
||||
|
||||
sph_blake256_init(&ctx);
|
||||
sph_blake256(&ctx, input, 64);
|
||||
@ -392,14 +388,14 @@ extern "C" int scanhash_blake256(int thr_id, struct work* work, uint32_t max_non
|
||||
const uint32_t first_nonce = pdata[19];
|
||||
uint64_t targetHigh = ((uint64_t*)ptarget)[3];
|
||||
int intensity = (device_sm[device_map[thr_id]] > 500) ? 22 : 20;
|
||||
uint32_t throughput = device_intensity(thr_id, __func__, 1U << intensity);
|
||||
throughput = min(throughput, max_nonce - first_nonce);
|
||||
uint32_t throughput = cuda_default_throughput(thr_id, 1U << intensity, max_nonce - first_nonce);
|
||||
|
||||
int rc = 0;
|
||||
|
||||
if (opt_benchmark) {
|
||||
targetHigh = 0x1ULL << 32;
|
||||
((uint32_t*)ptarget)[6] = swab32(0xff);
|
||||
ptarget[7] = 0;
|
||||
ptarget[6] = swab32(0xff);
|
||||
targetHigh = 0xffULL << 32;
|
||||
}
|
||||
|
||||
if (opt_tracegpu) {
|
||||
|
@ -46,7 +46,7 @@ extern "C" int scanhash_keccak256(int thr_id, struct work* work, uint32_t max_no
|
||||
throughput = min(throughput, max_nonce - first_nonce);
|
||||
|
||||
if (opt_benchmark)
|
||||
((uint32_t*)ptarget)[7] = 0x0005;
|
||||
ptarget[7] = 0x00ff;
|
||||
|
||||
if (!init[thr_id]) {
|
||||
cudaSetDevice(device_map[thr_id]);
|
||||
|
14
algos.h
14
algos.h
@ -2,10 +2,8 @@
|
||||
#define ALGOS_H
|
||||
|
||||
enum sha_algos {
|
||||
ALGO_BLAKE = 0,
|
||||
ALGO_LYRA2, /* moved first for benchs */
|
||||
ALGO_LYRA2v2,
|
||||
ALGO_BLAKECOIN,
|
||||
ALGO_BLAKECOIN = 0,
|
||||
ALGO_BLAKE,
|
||||
ALGO_BMW,
|
||||
ALGO_C11,
|
||||
ALGO_DEEP,
|
||||
@ -17,6 +15,8 @@ enum sha_algos {
|
||||
ALGO_KECCAK,
|
||||
ALGO_JACKPOT,
|
||||
ALGO_LUFFA,
|
||||
ALGO_LYRA2,
|
||||
ALGO_LYRA2v2,
|
||||
ALGO_MJOLLNIR, /* Hefty hash */
|
||||
ALGO_MYR_GR,
|
||||
ALGO_NEOSCRYPT,
|
||||
@ -43,10 +43,8 @@ enum sha_algos {
|
||||
};
|
||||
|
||||
static const char *algo_names[] = {
|
||||
"blake",
|
||||
"lyra2",
|
||||
"lyra2v2",
|
||||
"blakecoin",
|
||||
"blake",
|
||||
"bmw",
|
||||
"c11",
|
||||
"deep",
|
||||
@ -58,6 +56,8 @@ static const char *algo_names[] = {
|
||||
"keccak",
|
||||
"jackpot",
|
||||
"luffa",
|
||||
"lyra2",
|
||||
"lyra2v2",
|
||||
"mjollnir",
|
||||
"myr-gr",
|
||||
"neoscrypt",
|
||||
|
@ -1738,10 +1738,8 @@ static void *miner_thread(void *userdata)
|
||||
minmax = 0x80000000U;
|
||||
break;
|
||||
case ALGO_BMW:
|
||||
case ALGO_KECCAK:
|
||||
minmax = 0x40000000U;
|
||||
break;
|
||||
case ALGO_JACKPOT:
|
||||
case ALGO_LUFFA:
|
||||
minmax = 0x2000000;
|
||||
break;
|
||||
@ -1755,6 +1753,8 @@ static void *miner_thread(void *userdata)
|
||||
case ALGO_WHIRLPOOL:
|
||||
minmax = 0x400000;
|
||||
break;
|
||||
case ALGO_KECCAK:
|
||||
case ALGO_JACKPOT:
|
||||
case ALGO_NEOSCRYPT:
|
||||
case ALGO_X15:
|
||||
minmax = 0x300000;
|
||||
|
@ -47,12 +47,14 @@ extern uint32_t groestl256_getSecNonce(int thr_id, int num);
|
||||
|
||||
extern "C" void lyra2re_hash(void *state, const void *input)
|
||||
{
|
||||
uint32_t hashA[8], hashB[8];
|
||||
|
||||
sph_blake256_context ctx_blake;
|
||||
sph_keccak256_context ctx_keccak;
|
||||
sph_skein256_context ctx_skein;
|
||||
sph_groestl256_context ctx_groestl;
|
||||
|
||||
uint32_t hashA[8], hashB[8];
|
||||
sph_blake256_set_rounds(14);
|
||||
|
||||
sph_blake256_init(&ctx_blake);
|
||||
sph_blake256(&ctx_blake, input, 80);
|
||||
|
@ -42,6 +42,8 @@ void lyra2v2_hash(void *state, const void *input)
|
||||
sph_bmw256_context ctx_bmw;
|
||||
sph_cubehash256_context ctx_cube;
|
||||
|
||||
sph_blake256_set_rounds(14);
|
||||
|
||||
sph_blake256_init(&ctx_blake);
|
||||
sph_blake256(&ctx_blake, input, 80);
|
||||
sph_blake256_close(&ctx_blake, hashA);
|
||||
|
@ -36,6 +36,8 @@
|
||||
|
||||
#include "sph_blake.h"
|
||||
|
||||
int blake256_rounds = 14;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
@ -1055,6 +1057,13 @@ sph_blake256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
|
||||
sph_blake256_init(cc);
|
||||
}
|
||||
|
||||
/* see sph_blake.h */
|
||||
void
|
||||
sph_blake256_set_rounds(int rounds)
|
||||
{
|
||||
blake256_rounds = rounds;
|
||||
}
|
||||
|
||||
#if SPH_64
|
||||
|
||||
/* see sph_blake.h */
|
||||
|
@ -231,6 +231,11 @@ void sph_blake256_close(void *cc, void *dst);
|
||||
void sph_blake256_addbits_and_close(
|
||||
void *cc, unsigned ub, unsigned n, void *dst);
|
||||
|
||||
/**
|
||||
* Allow blakecoin and blake variants
|
||||
*/
|
||||
void sph_blake256_set_rounds(int rounds);
|
||||
|
||||
#if SPH_64
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user