Browse Source

zr5: some pok cleanup...

rename the var and only show warnings with --debug
2upstream
Tanguy Pruvot 10 years ago
parent
commit
79ee0ec264
  1. 2
      JHA/cuda_jha_keccak512.cu
  2. 14
      ccminer.cpp
  3. 6
      miner.h
  4. 6
      zr5.cu

2
JHA/cuda_jha_keccak512.cu

@ -655,7 +655,7 @@ __host__
void zr5_keccak512_cpu_hash_pok(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t* pdata, uint32_t *d_hash, uint16_t *d_poks) void zr5_keccak512_cpu_hash_pok(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t* pdata, uint32_t *d_hash, uint16_t *d_poks)
{ {
const uint32_t threadsperblock = 256; const uint32_t threadsperblock = 256;
const uint32_t version = (pdata[0] & (~POK_DATA_MASK)) | (usepok ? POK_BOOL_MASK : 0); const uint32_t version = (pdata[0] & (~POK_DATA_MASK)) | (use_pok ? POK_BOOL_MASK : 0);
dim3 grid((threads + threadsperblock-1)/threadsperblock); dim3 grid((threads + threadsperblock-1)/threadsperblock);
dim3 block(threadsperblock); dim3 block(threadsperblock);

14
ccminer.cpp

@ -172,6 +172,7 @@ bool check_dups = false;
static bool submit_old = false; static bool submit_old = false;
bool use_syslog = false; bool use_syslog = false;
bool use_colors = true; bool use_colors = true;
int use_pok = 0;
static bool opt_background = false; static bool opt_background = false;
bool opt_quiet = false; bool opt_quiet = false;
static int opt_retries = -1; static int opt_retries = -1;
@ -246,7 +247,6 @@ bool stratum_need_reset = false;
volatile bool abort_flag = false; volatile bool abort_flag = false;
struct work_restart *work_restart = NULL; struct work_restart *work_restart = NULL;
static int app_exit_code = EXIT_CODE_OK; static int app_exit_code = EXIT_CODE_OK;
int usepok = 0;
pthread_mutex_t applog_lock; pthread_mutex_t applog_lock;
static pthread_mutex_t stats_lock; static pthread_mutex_t stats_lock;
@ -685,9 +685,9 @@ static bool work_decode(const json_t *val, struct work *work)
calc_network_diff(work); calc_network_diff(work);
work->tx_count = usepok = 0; work->tx_count = use_pok = 0;
if (work->data[0] & POK_BOOL_MASK) { if (work->data[0] & POK_BOOL_MASK) {
usepok = 1; use_pok = 1;
json_t *txs = json_object_get(val, "txs"); json_t *txs = json_object_get(val, "txs");
if (txs && json_is_array(txs)) { if (txs && json_is_array(txs)) {
size_t idx, totlen = 0; size_t idx, totlen = 0;
@ -699,10 +699,10 @@ static bool work_decode(const json_t *val, struct work *work)
size_t txlen = strlen(hexstr)/2; size_t txlen = strlen(hexstr)/2;
work->tx_count++; work->tx_count++;
if (work->tx_count > POK_MAX_TXS || txlen >= POK_MAX_TX_SZ) { if (work->tx_count > POK_MAX_TXS || txlen >= POK_MAX_TX_SZ) {
// when tx is too big, just reset usepok for the bloc // when tx is too big, just reset use_pok for the bloc
usepok = 0; use_pok = 0;
applog(LOG_WARNING, "large bloc ignored, txs > %d, len: %u", if (opt_debug) applog(LOG_WARNING,
POK_MAX_TXS, txlen); "pok: large bloc ignored, tx len: %u", txlen);
work->tx_count = 0; work->tx_count = 0;
break; break;
} }

6
miner.h

@ -486,7 +486,7 @@ extern char *opt_proxy;
extern long opt_proxy_type; extern long opt_proxy_type;
extern bool use_syslog; extern bool use_syslog;
extern bool use_colors; extern bool use_colors;
extern int usepok; extern int use_pok;
extern pthread_mutex_t applog_lock; extern pthread_mutex_t applog_lock;
extern struct thr_info *thr_info; extern struct thr_info *thr_info;
extern int longpoll_thr_id; extern int longpoll_thr_id;
@ -599,8 +599,8 @@ struct stratum_ctx {
int srvtime_diff; int srvtime_diff;
}; };
#define POK_MAX_TXS 8 #define POK_MAX_TXS 4
#define POK_MAX_TX_SZ 8192U #define POK_MAX_TX_SZ 16384U
struct tx { struct tx {
uint8_t data[POK_MAX_TX_SZ]; uint8_t data[POK_MAX_TX_SZ];
uint32_t len; uint32_t len;

6
zr5.cu

@ -116,7 +116,7 @@ extern "C" void zr5hash(void *output, const void *input)
extern "C" void zr5hash_pok(void *output, uint32_t *pdata) extern "C" void zr5hash_pok(void *output, uint32_t *pdata)
{ {
uint32_t _ALIGN(64) hash[8]; uint32_t _ALIGN(64) hash[8];
const uint32_t version = (pdata[0] & (~POK_DATA_MASK)) | (usepok ? POK_BOOL_MASK : 0); const uint32_t version = (pdata[0] & (~POK_DATA_MASK)) | (use_pok ? POK_BOOL_MASK : 0);
pdata[0] = version; pdata[0] = version;
zr5hash(hash, pdata); zr5hash(hash, pdata);
@ -254,7 +254,7 @@ void zr5_get_poks(int thr_id, uint32_t threads, uint16_t* d_poks, struct work* w
uint8_t txs = (uint8_t) work->tx_count; uint8_t txs = (uint8_t) work->tx_count;
if (txs && usepok) if (txs && use_pok)
{ {
uint32_t txlens[POK_MAX_TXS]; uint32_t txlens[POK_MAX_TXS];
uint8_t* txdata = (uint8_t*) calloc(POK_MAX_TXS, POK_MAX_TX_SZ); uint8_t* txdata = (uint8_t*) calloc(POK_MAX_TXS, POK_MAX_TX_SZ);
@ -335,7 +335,7 @@ extern "C" int scanhash_zr5(int thr_id, struct work *work,
uint32_t *pdata = work->data; uint32_t *pdata = work->data;
uint32_t *ptarget = work->target; uint32_t *ptarget = work->target;
const uint32_t oldp0 = pdata[0]; const uint32_t oldp0 = pdata[0];
const uint32_t version = (oldp0 & (~POK_DATA_MASK)) | (usepok ? POK_BOOL_MASK : 0); const uint32_t version = (oldp0 & (~POK_DATA_MASK)) | (use_pok ? POK_BOOL_MASK : 0);
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
uint32_t throughput = device_intensity(thr_id, __func__, 1U << 18); uint32_t throughput = device_intensity(thr_id, __func__, 1U << 18);
throughput = min(throughput, (1U << 20)-1024); throughput = min(throughput, (1U << 20)-1024);

Loading…
Cancel
Save