From 79ee0ec2649f2e255b69eafb60fffa7b113c89c0 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sat, 13 Jun 2015 04:34:03 +0200 Subject: [PATCH] zr5: some pok cleanup... rename the var and only show warnings with --debug --- JHA/cuda_jha_keccak512.cu | 2 +- ccminer.cpp | 14 +++++++------- miner.h | 6 +++--- zr5.cu | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/JHA/cuda_jha_keccak512.cu b/JHA/cuda_jha_keccak512.cu index 9f91568..9192a8a 100644 --- a/JHA/cuda_jha_keccak512.cu +++ b/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) { 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 block(threadsperblock); diff --git a/ccminer.cpp b/ccminer.cpp index 97ebfb8..2129101 100644 --- a/ccminer.cpp +++ b/ccminer.cpp @@ -172,6 +172,7 @@ bool check_dups = false; static bool submit_old = false; bool use_syslog = false; bool use_colors = true; +int use_pok = 0; static bool opt_background = false; bool opt_quiet = false; static int opt_retries = -1; @@ -246,7 +247,6 @@ bool stratum_need_reset = false; volatile bool abort_flag = false; struct work_restart *work_restart = NULL; static int app_exit_code = EXIT_CODE_OK; -int usepok = 0; pthread_mutex_t applog_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); - work->tx_count = usepok = 0; + work->tx_count = use_pok = 0; if (work->data[0] & POK_BOOL_MASK) { - usepok = 1; + use_pok = 1; json_t *txs = json_object_get(val, "txs"); if (txs && json_is_array(txs)) { 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; work->tx_count++; if (work->tx_count > POK_MAX_TXS || txlen >= POK_MAX_TX_SZ) { - // when tx is too big, just reset usepok for the bloc - usepok = 0; - applog(LOG_WARNING, "large bloc ignored, txs > %d, len: %u", - POK_MAX_TXS, txlen); + // when tx is too big, just reset use_pok for the bloc + use_pok = 0; + if (opt_debug) applog(LOG_WARNING, + "pok: large bloc ignored, tx len: %u", txlen); work->tx_count = 0; break; } diff --git a/miner.h b/miner.h index b2e225e..47a8e9c 100644 --- a/miner.h +++ b/miner.h @@ -486,7 +486,7 @@ extern char *opt_proxy; extern long opt_proxy_type; extern bool use_syslog; extern bool use_colors; -extern int usepok; +extern int use_pok; extern pthread_mutex_t applog_lock; extern struct thr_info *thr_info; extern int longpoll_thr_id; @@ -599,8 +599,8 @@ struct stratum_ctx { int srvtime_diff; }; -#define POK_MAX_TXS 8 -#define POK_MAX_TX_SZ 8192U +#define POK_MAX_TXS 4 +#define POK_MAX_TX_SZ 16384U struct tx { uint8_t data[POK_MAX_TX_SZ]; uint32_t len; diff --git a/zr5.cu b/zr5.cu index 299ee91..d298c8f 100644 --- a/zr5.cu +++ b/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) { 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; 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; - if (txs && usepok) + if (txs && use_pok) { uint32_t txlens[POK_MAX_TXS]; 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 *ptarget = work->target; 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]; uint32_t throughput = device_intensity(thr_id, __func__, 1U << 18); throughput = min(throughput, (1U << 20)-1024);