mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-09 14:28:12 +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;
|
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);
|
uint32_t *data32 = (uint32_t *)(work->data);
|
||||||
unsigned char swap[128];
|
unsigned char swap[128];
|
||||||
@ -4162,11 +4162,22 @@ bool hashtest(const struct work *work)
|
|||||||
|
|
||||||
memcpy((void*)work->hash, hash2, 32);
|
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) {
|
if (opt_scrypt) {
|
||||||
uint32_t *work_nonce = (uint32_t *)(work->data + 64 + 12);
|
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 + 2] = (nonce >> 16) & 0xff;
|
||||||
work->data[64 + 12 + 3] = (nonce >> 24) & 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)
|
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 */
|
/* Do one last check before attempting to submit the work */
|
||||||
/* Side effect: sets work->data for us */
|
/* Side effect: sets work->data for us */
|
||||||
if (!test_nonce(work, nonce)) {
|
if (!test_nonce(thr, work, nonce))
|
||||||
applog(LOG_INFO, "Share below target");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
return submit_work_sync(thr, work);
|
return submit_work_sync(thr, work);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,6 +405,7 @@ modminer_process_results(struct thr_info*thr)
|
|||||||
uint32_t nonce;
|
uint32_t nonce;
|
||||||
long iter;
|
long iter;
|
||||||
bool bad;
|
bool bad;
|
||||||
|
int curr_hw_errors;
|
||||||
cmd[0] = '\x0a';
|
cmd[0] = '\x0a';
|
||||||
cmd[1] = fpgaid;
|
cmd[1] = fpgaid;
|
||||||
|
|
||||||
@ -441,12 +442,10 @@ modminer_process_results(struct thr_info*thr)
|
|||||||
mutex_unlock(&modminer->device_mutex);
|
mutex_unlock(&modminer->device_mutex);
|
||||||
if (memcmp(&nonce, "\xff\xff\xff\xff", 4)) {
|
if (memcmp(&nonce, "\xff\xff\xff\xff", 4)) {
|
||||||
state->no_nonce_counter = 0;
|
state->no_nonce_counter = 0;
|
||||||
bad = !test_nonce(work, nonce);
|
curr_hw_errors = modminer->hw_errors;
|
||||||
if (!bad)
|
submit_nonce(thr, work, nonce);
|
||||||
submit_nonce(thr, work, nonce);
|
if (modminer->hw_errors > curr_hw_errors) {
|
||||||
else {
|
if (modminer->hw_errors * 100 > 1000 + state->good_share_counter)
|
||||||
++hw_errors;
|
|
||||||
if (++modminer->hw_errors * 100 > 1000 + state->good_share_counter)
|
|
||||||
// Only reduce clocks if hardware errors are more than ~1% of results
|
// Only reduce clocks if hardware errors are more than ~1% of results
|
||||||
modminer_reduce_clock(thr, true);
|
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];
|
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 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) \
|
#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(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])
|
R(D, E, F, G, H, A, B, C, P(u+5), SHA256_K[u+5])
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
struct pc_data {
|
struct pc_data {
|
||||||
struct thr_info *thr;
|
struct thr_info *thr;
|
||||||
struct work *work;
|
struct work *work;
|
||||||
@ -175,6 +179,8 @@ struct pc_data {
|
|||||||
int found;
|
int found;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 0 // not used any more
|
||||||
|
|
||||||
static void send_sha_nonce(struct pc_data *pcd, cl_uint nonce)
|
static void send_sha_nonce(struct pc_data *pcd, cl_uint nonce)
|
||||||
{
|
{
|
||||||
dev_blk_ctx *blk = &pcd->work->blk;
|
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)
|
static void send_scrypt_nonce(struct pc_data *pcd, uint32_t nonce)
|
||||||
{
|
{
|
||||||
struct thr_info *thr = pcd->thr;
|
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)
|
static void *postcalc_hash(void *userdata)
|
||||||
{
|
{
|
||||||
struct pc_data *pcd = (struct pc_data *)userdata;
|
struct pc_data *pcd = (struct pc_data *)userdata;
|
||||||
|
struct thr_info *thr = pcd->thr;
|
||||||
|
struct work *work = pcd->work;
|
||||||
unsigned int entry = 0;
|
unsigned int entry = 0;
|
||||||
|
|
||||||
pthread_detach(pthread_self());
|
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);
|
applog(LOG_DEBUG, "OCL NONCE %u found in slot %d", nonce, entry);
|
||||||
if (opt_scrypt)
|
if (opt_scrypt)
|
||||||
send_scrypt_nonce(pcd, nonce);
|
send_scrypt_nonce(pcd, nonce);
|
||||||
else
|
else {
|
||||||
send_sha_nonce(pcd, nonce);
|
if (unlikely(submit_nonce(thr, work, nonce) == false))
|
||||||
|
applog(LOG_ERR, "Failed to submit work, exiting");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(pcd);
|
free(pcd);
|
||||||
|
1
miner.h
1
miner.h
@ -844,7 +844,6 @@ struct modminer_fpga_state {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void get_datestamp(char *, struct timeval *);
|
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);
|
bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce);
|
||||||
extern void tailsprintf(char *f, const char *fmt, ...);
|
extern void tailsprintf(char *f, const char *fmt, ...);
|
||||||
extern void wlogprint(const char *f, ...);
|
extern void wlogprint(const char *f, ...);
|
||||||
|
Loading…
Reference in New Issue
Block a user