JayDDee / cpuminer-opt

Optimized multi algo CPU miner
Other
773 stars 545 forks source link

Reduce stale shares with low hash rate algorithms #253

Closed JayDDee closed 4 years ago

JayDDee commented 4 years ago

Algorithms with low hash rate are more susceptible to stale shares due to their longer hash cycle. This issue is opened to identify those algorithms an add intermediate polling for stale work within the hash cycle. This will reduce the window where work can go stale and the miner becomes aware of it.

JayDDee commented 4 years ago

The first phase in released in v3.12.6.1. It includes reductions for yespower, x25x, x22i, x21s, x16* as well as scryptn2 implemeted in a previous release.

More to come.

Lyra2z330 will be an exception. Although it is one of the slowest algos it is comprised of a single hash function. Adding intermediate tests for stale work would be in the hash function where it would affect performance.

The stale reduction changes don't eliminate state shares completely. No matter what there wil always be a race condition that can open a window to submitting a share after going stale. The changes will reduce the size of the window but it can't be completely closed. It shuould help reduce the number of stale shares for algos that are susceptible to them due to the length of time to execute one iteration of the hash loop.

JayDDee commented 4 years ago

The most susceptible algos, with the exception of lyra2z330, now have intermediate checking for new work to reduce the latency which contributes to stale shares. Other algos may implement it in the future on an indicual basis as needed, likely coordinated with other changes to the algo.