mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-09 06:18:06 +00:00
HW: error counter auto for all devices - ztex code not fixed
This commit is contained in:
parent
9950cff5ae
commit
307d8da034
24
cgminer.c
24
cgminer.c
@ -4141,7 +4141,7 @@ err_out:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool hashtest(const struct work *work)
|
||||
static bool hashtest(struct thr_info *thr, const struct work *work)
|
||||
{
|
||||
uint32_t *data32 = (uint32_t *)(work->data);
|
||||
unsigned char swap[128];
|
||||
@ -4162,11 +4162,22 @@ bool hashtest(const struct work *work)
|
||||
|
||||
memcpy((void*)work->hash, hash2, 32);
|
||||
|
||||
return fulltest(work->hash, work->target);
|
||||
if (hash2_32[7] != 0) {
|
||||
applog(LOG_WARNING, "%s%d: invalid nonce - HW error",
|
||||
thr->cgpu->api->name, thr->cgpu->device_id);
|
||||
hw_errors++;
|
||||
thr->cgpu->hw_errors++;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool test = fulltest(work->hash, work->target);
|
||||
if (!test)
|
||||
applog(LOG_INFO, "Share below target");
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
bool test_nonce(struct work *work, uint32_t nonce)
|
||||
static bool test_nonce(struct thr_info *thr, struct work *work, uint32_t nonce)
|
||||
{
|
||||
if (opt_scrypt) {
|
||||
uint32_t *work_nonce = (uint32_t *)(work->data + 64 + 12);
|
||||
@ -4180,7 +4191,7 @@ bool test_nonce(struct work *work, uint32_t nonce)
|
||||
work->data[64 + 12 + 2] = (nonce >> 16) & 0xff;
|
||||
work->data[64 + 12 + 3] = (nonce >> 24) & 0xff;
|
||||
|
||||
return hashtest(work);
|
||||
return hashtest(thr, work);
|
||||
}
|
||||
|
||||
bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce)
|
||||
@ -4191,10 +4202,9 @@ bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce)
|
||||
|
||||
/* Do one last check before attempting to submit the work */
|
||||
/* Side effect: sets work->data for us */
|
||||
if (!test_nonce(work, nonce)) {
|
||||
applog(LOG_INFO, "Share below target");
|
||||
if (!test_nonce(thr, work, nonce))
|
||||
return true;
|
||||
}
|
||||
|
||||
return submit_work_sync(thr, work);
|
||||
}
|
||||
|
||||
|
@ -405,6 +405,7 @@ modminer_process_results(struct thr_info*thr)
|
||||
uint32_t nonce;
|
||||
long iter;
|
||||
bool bad;
|
||||
int curr_hw_errors;
|
||||
cmd[0] = '\x0a';
|
||||
cmd[1] = fpgaid;
|
||||
|
||||
@ -441,12 +442,10 @@ modminer_process_results(struct thr_info*thr)
|
||||
mutex_unlock(&modminer->device_mutex);
|
||||
if (memcmp(&nonce, "\xff\xff\xff\xff", 4)) {
|
||||
state->no_nonce_counter = 0;
|
||||
bad = !test_nonce(work, nonce);
|
||||
if (!bad)
|
||||
submit_nonce(thr, work, nonce);
|
||||
else {
|
||||
++hw_errors;
|
||||
if (++modminer->hw_errors * 100 > 1000 + state->good_share_counter)
|
||||
curr_hw_errors = modminer->hw_errors;
|
||||
submit_nonce(thr, work, nonce);
|
||||
if (modminer->hw_errors > curr_hw_errors) {
|
||||
if (modminer->hw_errors * 100 > 1000 + state->good_share_counter)
|
||||
// Only reduce clocks if hardware errors are more than ~1% of results
|
||||
modminer_reduce_clock(thr, true);
|
||||
}
|
||||
|
16
findnonce.c
16
findnonce.c
@ -131,6 +131,8 @@ void precalc_hash(dev_blk_ctx *blk, uint32_t *state, uint32_t *data)
|
||||
blk->sevenA = blk->ctx_h + SHA256_K[7];
|
||||
}
|
||||
|
||||
#if 0 // not used any more
|
||||
|
||||
#define P(t) (W[(t)&0xF] = W[(t-16)&0xF] + (rotate(W[(t-15)&0xF], 25) ^ rotate(W[(t-15)&0xF], 14) ^ (W[(t-15)&0xF] >> 3)) + W[(t-7)&0xF] + (rotate(W[(t-2)&0xF], 15) ^ rotate(W[(t-2)&0xF], 13) ^ (W[(t-2)&0xF] >> 10)))
|
||||
|
||||
#define IR(u) \
|
||||
@ -167,6 +169,8 @@ void precalc_hash(dev_blk_ctx *blk, uint32_t *state, uint32_t *data)
|
||||
R(E, F, G, H, A, B, C, D, P(u+4), SHA256_K[u+4]); \
|
||||
R(D, E, F, G, H, A, B, C, P(u+5), SHA256_K[u+5])
|
||||
|
||||
#endif
|
||||
|
||||
struct pc_data {
|
||||
struct thr_info *thr;
|
||||
struct work *work;
|
||||
@ -175,6 +179,8 @@ struct pc_data {
|
||||
int found;
|
||||
};
|
||||
|
||||
#if 0 // not used any more
|
||||
|
||||
static void send_sha_nonce(struct pc_data *pcd, cl_uint nonce)
|
||||
{
|
||||
dev_blk_ctx *blk = &pcd->work->blk;
|
||||
@ -222,6 +228,8 @@ static void send_sha_nonce(struct pc_data *pcd, cl_uint nonce)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void send_scrypt_nonce(struct pc_data *pcd, uint32_t nonce)
|
||||
{
|
||||
struct thr_info *thr = pcd->thr;
|
||||
@ -238,6 +246,8 @@ static void send_scrypt_nonce(struct pc_data *pcd, uint32_t nonce)
|
||||
static void *postcalc_hash(void *userdata)
|
||||
{
|
||||
struct pc_data *pcd = (struct pc_data *)userdata;
|
||||
struct thr_info *thr = pcd->thr;
|
||||
struct work *work = pcd->work;
|
||||
unsigned int entry = 0;
|
||||
|
||||
pthread_detach(pthread_self());
|
||||
@ -248,8 +258,10 @@ static void *postcalc_hash(void *userdata)
|
||||
applog(LOG_DEBUG, "OCL NONCE %u found in slot %d", nonce, entry);
|
||||
if (opt_scrypt)
|
||||
send_scrypt_nonce(pcd, nonce);
|
||||
else
|
||||
send_sha_nonce(pcd, nonce);
|
||||
else {
|
||||
if (unlikely(submit_nonce(thr, work, nonce) == false))
|
||||
applog(LOG_ERR, "Failed to submit work, exiting");
|
||||
}
|
||||
}
|
||||
|
||||
free(pcd);
|
||||
|
1
miner.h
1
miner.h
@ -844,7 +844,6 @@ struct modminer_fpga_state {
|
||||
#endif
|
||||
|
||||
extern void get_datestamp(char *, struct timeval *);
|
||||
extern bool test_nonce(struct work *work, uint32_t nonce);
|
||||
bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce);
|
||||
extern void tailsprintf(char *f, const char *fmt, ...);
|
||||
extern void wlogprint(const char *f, ...);
|
||||
|
Loading…
Reference in New Issue
Block a user