mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-23 13:04:29 +00:00
small fixes and cleanup
This commit is contained in:
parent
5bbce4c42c
commit
56ec31270a
@ -3,3 +3,4 @@
|
|||||||
- read actual bitstream
|
- read actual bitstream
|
||||||
- HS fpga config
|
- HS fpga config
|
||||||
- allow configuring LIBZTEX_OVERHEATTHRESHOLD
|
- allow configuring LIBZTEX_OVERHEATTHRESHOLD
|
||||||
|
- hotplug support?
|
||||||
|
38
ztex.c
38
ztex.c
@ -74,7 +74,6 @@ static bool ztex_updateFreq (struct libztex_device* ztex)
|
|||||||
maxM = 0;
|
maxM = 0;
|
||||||
while (maxM<ztex->freqMDefault && ztex->maxErrorRate[maxM+1]<LIBZTEX_MAXMAXERRORRATE)
|
while (maxM<ztex->freqMDefault && ztex->maxErrorRate[maxM+1]<LIBZTEX_MAXMAXERRORRATE)
|
||||||
maxM++;
|
maxM++;
|
||||||
//applog(LOG_WARNING, "maxM:%d freqMaxM:%d errorWeight:%f maxErrorRate:%f maxMax:%f", maxM, ztex->freqMaxM, ztex->errorWeight[maxM], ztex->maxErrorRate[maxM+1], LIBZTEX_MAXMAXERRORRATE);
|
|
||||||
while (maxM<ztex->freqMaxM && ztex->errorWeight[maxM]>150 && ztex->maxErrorRate[maxM+1]<LIBZTEX_MAXMAXERRORRATE)
|
while (maxM<ztex->freqMaxM && ztex->errorWeight[maxM]>150 && ztex->maxErrorRate[maxM+1]<LIBZTEX_MAXMAXERRORRATE)
|
||||||
maxM++;
|
maxM++;
|
||||||
|
|
||||||
@ -88,9 +87,6 @@ static bool ztex_updateFreq (struct libztex_device* ztex)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//applog(LOG_WARNING, "maxM:%d bestM:%d bestR:%f freqM:%d", maxM, bestM, bestR, ztex->freqM);
|
|
||||||
|
|
||||||
|
|
||||||
if (bestM != ztex->freqM) {
|
if (bestM != ztex->freqM) {
|
||||||
libztex_setFreq(ztex, bestM);
|
libztex_setFreq(ztex, bestM);
|
||||||
}
|
}
|
||||||
@ -132,7 +128,7 @@ static bool ztex_checkNonce (struct libztex_device *ztex,
|
|||||||
|
|
||||||
if (swab32(hash2_32[7]) != ((hdata->hash7 + 0x5be0cd19) & 0xFFFFFFFF)) {
|
if (swab32(hash2_32[7]) != ((hdata->hash7 + 0x5be0cd19) & 0xFFFFFFFF)) {
|
||||||
ztex->errorCount[ztex->freqM] += 1.0/ztex->numNonces;
|
ztex->errorCount[ztex->freqM] += 1.0/ztex->numNonces;
|
||||||
applog(LOG_ERR, "%s: checkNonce failed for %0.8X", ztex->repr, hdata->nonce);
|
applog(LOG_DEBUG, "%s: checkNonce failed for %0.8X", ztex->repr, hdata->nonce);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -162,9 +158,16 @@ static uint64_t ztex_scanhash(struct thr_info *thr, struct work *work,
|
|||||||
lastnonce[i] = 0;
|
lastnonce[i] = 0;
|
||||||
}
|
}
|
||||||
overflow = false;
|
overflow = false;
|
||||||
|
|
||||||
while (!(overflow || work_restart[thr->id].restart)) {
|
while (!(overflow || work_restart[thr->id].restart)) {
|
||||||
usleep(250000);
|
usleep(250000);
|
||||||
|
if (work_restart[thr->id].restart) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
libztex_readHashData(ztex, &hdata[0]);
|
libztex_readHashData(ztex, &hdata[0]);
|
||||||
|
if (work_restart[thr->id].restart) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
ztex->errorCount[ztex->freqM] *= 0.995;
|
ztex->errorCount[ztex->freqM] *= 0.995;
|
||||||
ztex->errorWeight[ztex->freqM] = ztex->errorWeight[ztex->freqM] * 0.995 + 1.0;
|
ztex->errorWeight[ztex->freqM] = ztex->errorWeight[ztex->freqM] * 0.995 + 1.0;
|
||||||
@ -179,6 +182,7 @@ static uint64_t ztex_scanhash(struct thr_info *thr, struct work *work,
|
|||||||
lastnonce[i] = nonce;
|
lastnonce[i] = nonce;
|
||||||
}
|
}
|
||||||
if (!ztex_checkNonce(ztex, work, &hdata[i])) {
|
if (!ztex_checkNonce(ztex, work, &hdata[i])) {
|
||||||
|
thr->cgpu->hw_errors++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
nonce = hdata[i].goldenNonce;
|
nonce = hdata[i].goldenNonce;
|
||||||
@ -208,17 +212,20 @@ static uint64_t ztex_scanhash(struct thr_info *thr, struct work *work,
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
ztex->errorRate[ztex->freqM] = ztex->errorCount[ztex->freqM] / ztex->errorWeight[ztex->freqM] * (ztex->errorWeight[ztex->freqM]<100 ? ztex->errorWeight[ztex->freqM]*0.01 : 1.0);
|
|
||||||
if (ztex->errorRate[ztex->freqM] > ztex->maxErrorRate[ztex->freqM]) {
|
|
||||||
ztex->maxErrorRate[ztex->freqM] = ztex->errorRate[ztex->freqM];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ztex_updateFreq(ztex)) {
|
ztex->errorRate[ztex->freqM] = ztex->errorCount[ztex->freqM] / ztex->errorWeight[ztex->freqM] * (ztex->errorWeight[ztex->freqM]<100 ? ztex->errorWeight[ztex->freqM]*0.01 : 1.0);
|
||||||
// Something really serious happened, so mark this thread as dead!
|
if (ztex->errorRate[ztex->freqM] > ztex->maxErrorRate[ztex->freqM]) {
|
||||||
thr->cgpu->status = LIFE_DEAD;
|
ztex->maxErrorRate[ztex->freqM] = ztex->errorRate[ztex->freqM];
|
||||||
}
|
}
|
||||||
applog(LOG_WARNING, "freqM:%d errorRate:%0.3f errorCount:%d", ztex->freqM, ztex->errorRate[ztex->freqM], ztex->errorCount[ztex->freqM]);
|
|
||||||
applog(LOG_DEBUG, "exit %0.8X", noncecnt);
|
if (!ztex_updateFreq(ztex)) {
|
||||||
|
// Something really serious happened, so mark this thread as dead!
|
||||||
|
thr->cgpu->status = LIFE_DEAD;
|
||||||
|
}
|
||||||
|
applog(LOG_DEBUG, "exit %1.8X", noncecnt);
|
||||||
|
|
||||||
|
work->blk.nonce = 0xffffffff;
|
||||||
|
|
||||||
return noncecnt;
|
return noncecnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,6 +242,7 @@ static bool ztex_prepare(struct thr_info *thr)
|
|||||||
}
|
}
|
||||||
ztex->device->freqM = -1;
|
ztex->device->freqM = -1;
|
||||||
ztex_updateFreq(ztex->device);
|
ztex_updateFreq(ztex->device);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user