Skip to content

Commit f932710

Browse files
committed
Disable AVX2 Primality Test as it is not working for non integer Difficulties.
I don't have any idea how to fix this, assembly optimizations are black boxes for me and the contributor who wrote them is no longer active :| ... Signed-off-by: Pttn <28868425+Pttn@users.noreply.github.com>
1 parent 23a47f7 commit f932710

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Miner.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,8 @@ void Miner::_doCheckTask(Task task) {
742742
candidateStart += _works[workIndex].primorialMultipleStart;
743743
candidateStart += _primorialOffsets[task.check.offsetId];
744744

745-
bool firstTestDone(false);
745+
// AVX2 Primality Test is broken for non integer Difficulties
746+
/*bool firstTestDone(false);
746747
if (_parameters.useAvx2 && task.check.nCandidates == maxCandidatesPerCheckTask) { // Test candidates + 0 primality with assembly optimizations if possible.
747748
uint32_t isPrime[maxCandidatesPerCheckTask];
748749
firstTestDone = _testPrimesIspc(task.check.factorOffsets, isPrime, candidateStart, candidate);
@@ -756,17 +757,17 @@ void Miner::_doCheckTask(Task task) {
756757
}
757758
}
758759
}
759-
}
760+
}*/
760761

761762
for (uint32_t i(0) ; i < task.check.nCandidates ; i++) {
762763
if (_works[workIndex].job.height != _client->currentHeight()) break;
763764
candidate = candidateStart + _primorial*task.check.factorOffsets[i];
764765

765-
if (!firstTestDone) { // Test candidate + 0 primality without optimizations if not done before.
766+
//if (!firstTestDone) { // Test candidate + 0 primality without optimizations if not done before.
766767
tupleCounts[0]++;
767768
if (!isPrimeFermat(candidate)) continue;
768769
tupleCounts[1]++;
769-
}
770+
//}
770771

771772
uint32_t primeCount(1), offsetSum(0);
772773
// Test primality of the other elements of the tuple if candidate + 0 is prime.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ It is also possible to use custom configuration file paths, examples:
187187
They can be useful to get better performance depending on your computer.
188188

189189
* PrimeTableLimit: the prime table used for mining will contain primes up to the given number. Set to 0 to automatically calculate according to the current Difficulty. You can try a bigger limit as this will reduce the ratio between the n-tuple and (n + 1)-tuple counts, but also the candidates/s rate. Reduce if you want to lower memory usage. Default: 0;
190-
* EnableAVX2: by default, AVX2 is disabled, as it may increase the power consumption more than the performance improvements. If your processor supports AVX2, you can choose to take advantage of this instruction set if you wish by setting this option to `Yes`. Do your own testing to find out if it is worth it. AVX2 is known to degrade performance for AMD Ryzens and similar before Zen2 (e. g. 1800X, 1950X, 2700X) and should be left disabled in these cases;
190+
* EnableAVX2: by default, AVX2 is disabled, as it may increase the power consumption more than the performance improvements. If your processor supports AVX2, you can choose to take advantage of this instruction set if you wish by setting this option to `Yes`. Do your own testing to find out if it is worth it. AVX2 is known to degrade performance for AMD Ryzens and similar before Zen2 (e. g. 1800X, 1950X, 2700X) and should be left disabled in these cases. Note: a good part of the AVX2 optimizations is currently broken and disabled regardless of this setting, so the description does not apply until the bug is fixed: enabling or disabling AVX2 does not seem to have noticeable effects currently;
191191
* SieveBits: the size of the primorial factors table for the sieve is 2^SieveBits bits. 25 seems to be an optimal value, or 24 if there are many SieveWorkers. Though, if you have less than 8 MiB of L3 cache, you can try to decrement this value. Default: 25 if SieveWorkers <= 4, 24 otherwise;
192192
* SieveIterations: how many times the primorial factors table is reused for sieving. Increasing will decrease the frequency of new jobs, so less time would be "lost" in sieving, while increasing will also increase the memory usage. It is not clear however how this actually plays performance wise, 16 seems to be a good value. Default: 16;
193193
* SieveWorkers: the number of threads to use for sieving. Increasing it may solve some CPU underuse problems, but will use more memory. 0 for choosing automatically. Default: 0.

0 commit comments

Comments
 (0)