AVX2 optimized code for AstroBWT

Added "astrobwt-avx2" parameter in config.json, it's turned off ("false") by default.

4-5% speedup on CPUs with proper AVX2 support (AMD Ryzen starting with Zen2, Intel Core starting with Haswell).

There will be no speedup on the following CPUs:

- Intel Pentium/Celeron don't support AVX2
- AMD Zen/Zen+ have only half-speed AVX

GCC compiled version is faster without AVX2, MSVC compiled version is faster with AVX2
This commit is contained in:
SChernykh 2020-03-10 22:03:16 +01:00
parent 8698b73036
commit e22f798085
14 changed files with 563 additions and 15 deletions

View file

@ -41,6 +41,7 @@
#include "core/Miner.h"
#include "crypto/common/Nonce.h"
#include "crypto/rx/Rx.h"
#include "crypto/astrobwt/AstroBWT.h"
#include "rapidjson/document.h"
#include "version.h"
@ -242,6 +243,10 @@ public:
# endif
# ifdef XMRIG_ALGO_ASTROBWT
inline bool initAstroBWT() { return astrobwt::init(job); }
# endif
Algorithm algorithm;
Algorithms algorithms;
bool active = false;
@ -454,10 +459,14 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
d_ptr->userJobId = job.id();
}
bool ready = true;
# ifdef XMRIG_ALGO_RANDOMX
const bool ready = d_ptr->initRX();
# else
constexpr const bool ready = true;
ready &= d_ptr->initRX();
# endif
# ifdef XMRIG_ALGO_ASTROBWT
ready &= d_ptr->initAstroBWT();
# endif
mutex.unlock();