mirror of
https://codeberg.org/wownero/RandomWOW
synced 2026-03-05 22:27:33 -05:00
Optimized Argon2 (SSSE3/AVX2)
This commit is contained in:
@@ -37,6 +37,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "stopwatch.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "../randomx.h"
|
||||
#include "../dataset.hpp"
|
||||
#include "../blake2/endian.h"
|
||||
#include "../common.hpp"
|
||||
#ifdef _WIN32
|
||||
@@ -90,6 +91,8 @@ void printUsage(const char* executable) {
|
||||
std::cout << " --init Q initialize dataset with Q threads (default: 1)" << std::endl;
|
||||
std::cout << " --nonces N run N nonces (default: 1000)" << std::endl;
|
||||
std::cout << " --seed S seed for cache initialization (default: 0)" << std::endl;
|
||||
std::cout << " --sse3 use optimized Argon2 for SSSE3 CPUs" << std::endl;
|
||||
std::cout << " --avx2 use optimized Argon2 for AVX2 CPUs" << std::endl;
|
||||
}
|
||||
|
||||
struct MemoryException : public std::exception {
|
||||
@@ -127,7 +130,7 @@ void mine(randomx_vm* vm, std::atomic<uint32_t>& atomicNonce, AtomicHash& result
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
bool softAes, miningMode, verificationMode, help, largePages, jit, secure;
|
||||
bool softAes, miningMode, verificationMode, help, largePages, jit, secure, sse3, avx2;
|
||||
int noncesCount, threadCount, initThreadCount;
|
||||
uint64_t threadAffinity;
|
||||
int32_t seedValue;
|
||||
@@ -148,6 +151,8 @@ int main(int argc, char** argv) {
|
||||
readOption("--jit", argc, argv, jit);
|
||||
readOption("--help", argc, argv, help);
|
||||
readOption("--secure", argc, argv, secure);
|
||||
readOption("--sse3", argc, argv, sse3);
|
||||
readOption("--avx2", argc, argv, avx2);
|
||||
|
||||
store32(&seed, seedValue);
|
||||
|
||||
@@ -166,6 +171,16 @@ int main(int argc, char** argv) {
|
||||
randomx_cache* cache;
|
||||
randomx_flags flags = RANDOMX_FLAG_DEFAULT;
|
||||
|
||||
if (sse3) {
|
||||
flags = (randomx_flags)(flags | RANDOMX_FLAG_ARGON2_SSE3);
|
||||
std::cout << " - Argon2 implementation: SSE3" << std::endl;
|
||||
}
|
||||
|
||||
if (avx2) {
|
||||
flags = (randomx_flags)(flags | RANDOMX_FLAG_ARGON2_AVX2);
|
||||
std::cout << " - Argon2 implementation: AVX2" << std::endl;
|
||||
}
|
||||
|
||||
if (miningMode) {
|
||||
flags = (randomx_flags)(flags | RANDOMX_FLAG_FULL_MEM);
|
||||
std::cout << " - full memory mode (2080 MiB)" << std::endl;
|
||||
@@ -213,6 +228,7 @@ int main(int argc, char** argv) {
|
||||
std::cout << " ..." << std::endl;
|
||||
|
||||
try {
|
||||
randomx::selectArgonImpl(flags); //just to check if flags are valid
|
||||
if (jit && !RANDOMX_HAVE_COMPILER) {
|
||||
throw std::runtime_error("JIT compilation is not supported on this platform. Try without --jit");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user