mirror of
https://codeberg.org/wownero/RandomWOW
synced 2026-03-04 21:57:36 -05:00
use SSSE3 consistently as opposed to SSE3
This commit is contained in:
@@ -253,7 +253,7 @@ extern "C" {
|
||||
void randomx_argon2_fill_segment_ref(const argon2_instance_t* instance,
|
||||
argon2_position_t position);
|
||||
|
||||
randomx_argon2_impl *randomx_argon2_impl_sse3();
|
||||
randomx_argon2_impl *randomx_argon2_impl_ssse3();
|
||||
randomx_argon2_impl *randomx_argon2_impl_avx2();
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
@@ -42,12 +42,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define __SSSE3__
|
||||
#endif
|
||||
|
||||
void randomx_argon2_fill_segment_sse3(const argon2_instance_t* instance,
|
||||
void randomx_argon2_fill_segment_ssse3(const argon2_instance_t* instance,
|
||||
argon2_position_t position);
|
||||
|
||||
randomx_argon2_impl* randomx_argon2_impl_sse3() {
|
||||
randomx_argon2_impl* randomx_argon2_impl_ssse3() {
|
||||
#if defined(__SSSE3__)
|
||||
return &randomx_argon2_fill_segment_sse3;
|
||||
return &randomx_argon2_fill_segment_ssse3;
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ randomx_argon2_impl* randomx_argon2_impl_sse3() {
|
||||
|
||||
#include "argon2_core.h"
|
||||
|
||||
#include "blake2/blamka-round-sse3.h"
|
||||
#include "blake2/blamka-round-ssse3.h"
|
||||
#include "blake2/blake2-impl.h"
|
||||
#include "blake2/blake2.h"
|
||||
|
||||
@@ -100,7 +100,7 @@ static void fill_block(__m128i* state, const block* ref_block,
|
||||
}
|
||||
}
|
||||
|
||||
void randomx_argon2_fill_segment_sse3(const argon2_instance_t* instance,
|
||||
void randomx_argon2_fill_segment_ssse3(const argon2_instance_t* instance,
|
||||
argon2_position_t position) {
|
||||
block* ref_block = NULL, * curr_block = NULL;
|
||||
block address_block, input_block;
|
||||
@@ -87,8 +87,8 @@ namespace randomx {
|
||||
return &randomx_argon2_fill_segment_ref;
|
||||
}
|
||||
randomx_argon2_impl* impl = nullptr;
|
||||
if ((flags & RANDOMX_FLAG_ARGON2) == RANDOMX_FLAG_ARGON2_SSE3) {
|
||||
impl = randomx_argon2_impl_sse3();
|
||||
if ((flags & RANDOMX_FLAG_ARGON2) == RANDOMX_FLAG_ARGON2_SSSE3) {
|
||||
impl = randomx_argon2_impl_ssse3();
|
||||
}
|
||||
if ((flags & RANDOMX_FLAG_ARGON2) == RANDOMX_FLAG_ARGON2_AVX2) {
|
||||
impl = randomx_argon2_impl_avx2();
|
||||
|
||||
@@ -45,7 +45,7 @@ typedef enum {
|
||||
RANDOMX_FLAG_FULL_MEM = 4,
|
||||
RANDOMX_FLAG_JIT = 8,
|
||||
RANDOMX_FLAG_SECURE = 16,
|
||||
RANDOMX_FLAG_ARGON2_SSE3 = 32,
|
||||
RANDOMX_FLAG_ARGON2_SSSE3 = 32,
|
||||
RANDOMX_FLAG_ARGON2_AVX2 = 64,
|
||||
RANDOMX_FLAG_ARGON2 = 96
|
||||
} randomx_flags;
|
||||
@@ -66,7 +66,7 @@ extern "C" {
|
||||
* RANDOMX_FLAG_JIT - create cache structure with JIT compilation support; this makes
|
||||
* subsequent Dataset initialization faster
|
||||
* Optionally, one of these two flags may be selected:
|
||||
* RANDOMX_FLAG_ARGON2_SSE3 - optimized Argon2 for CPUs with the SSSE3 instruction set
|
||||
* RANDOMX_FLAG_ARGON2_SSSE3 - optimized Argon2 for CPUs with the SSSE3 instruction set
|
||||
* makes subsequent cache initialization faster
|
||||
* RANDOMX_FLAG_ARGON2_AVX2 - optimized Argon2 for CPUs with the AVX2 instruction set
|
||||
* makes subsequent cache initialization faster
|
||||
|
||||
@@ -91,7 +91,7 @@ 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 << " --ssse3 use optimized Argon2 for SSSE3 CPUs" << std::endl;
|
||||
std::cout << " --avx2 use optimized Argon2 for AVX2 CPUs" << std::endl;
|
||||
}
|
||||
|
||||
@@ -130,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, sse3, avx2;
|
||||
bool softAes, miningMode, verificationMode, help, largePages, jit, secure, ssse3, avx2;
|
||||
int noncesCount, threadCount, initThreadCount;
|
||||
uint64_t threadAffinity;
|
||||
int32_t seedValue;
|
||||
@@ -151,7 +151,7 @@ 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("--ssse3", argc, argv, ssse3);
|
||||
readOption("--avx2", argc, argv, avx2);
|
||||
|
||||
store32(&seed, seedValue);
|
||||
@@ -171,9 +171,9 @@ 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 (ssse3) {
|
||||
flags = (randomx_flags)(flags | RANDOMX_FLAG_ARGON2_SSSE3);
|
||||
std::cout << " - Argon2 implementation: SSSE3" << std::endl;
|
||||
}
|
||||
|
||||
if (avx2) {
|
||||
|
||||
@@ -1018,7 +1018,7 @@ int main() {
|
||||
vm = nullptr;
|
||||
|
||||
randomx_release_cache(cache);
|
||||
cache = randomx_alloc_cache(RANDOMX_FLAG_ARGON2_SSE3);
|
||||
cache = randomx_alloc_cache(RANDOMX_FLAG_ARGON2_SSSE3);
|
||||
|
||||
runTest("Cache initialization: SSSE3", cache != nullptr && RANDOMX_ARGON_ITERATIONS == 3 && RANDOMX_ARGON_LANES == 1 && RANDOMX_ARGON_MEMORY == 262144 && stringsEqual(RANDOMX_ARGON_SALT, "RandomX\x03"), []() {
|
||||
initCache("test key 000");
|
||||
|
||||
Reference in New Issue
Block a user