For Bounty Hunters: I am now willing to donate 1000 RIC for the person who fixes
this rieMiner issue elegantly. This offer will expire on October 8 2018 at 00:00 Zurich Timezone. It is currently about the price of one beer, but remember how much a pizza cost years ago... And who knows if this is just 2 lines to change, but I am currently too busy to look. After this deadline, the bounty will be reduced to 250 RIC and remain valid until the new wallet is officially updated, or until January 1 2019 at 00:00 Zurich Timezone if gatra never comes back.
Note that this bug is present since fastrie/xptMiner. Obviously, there must be no performance loss, you should benchmark before and after and compare before submitting the fix. And by elegantly, I mean, inter alia, a fix that is not just a workaround (you could for example compute 2 sieves and imitate the launching of 2 instances with less threads, but this is not worth any bounty).
The fix must also make Testnet mining work properly with any sieve size (in my 2700X, only about 25% of the CPU is used when mining at difficulty 304 using 16 threads!).