Added generic Argon2 implementation (conflicts with RandomX).
This commit is contained in:
parent
df58821655
commit
0c25424a3e
53 changed files with 5140 additions and 126 deletions
|
@ -116,30 +116,17 @@ static AlgoName const algorithm_names[] = {
|
|||
{ "randomx/loki", "rx/loki", Algorithm::RX_LOKI },
|
||||
{ "RandomXL", nullptr, Algorithm::RX_LOKI },
|
||||
# endif
|
||||
# ifdef XMRIG_ALGO_ARGON2
|
||||
{ "argon2/chukwa", nullptr, Algorithm::AR2_CHUKWA },
|
||||
{ "chukwa", nullptr, Algorithm::AR2_CHUKWA },
|
||||
{ "argon2/wrkz", nullptr, Algorithm::AR2_WRKZ },
|
||||
# endif
|
||||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
int xmrig::Algorithm::maxIntensity() const
|
||||
{
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
if (family() == RANDOM_X) {
|
||||
return 1;
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_CN_GPU
|
||||
if (m_id == CN_GPU) {
|
||||
return 1;
|
||||
}
|
||||
# endif
|
||||
|
||||
return 5;
|
||||
}
|
||||
|
||||
|
||||
rapidjson::Value xmrig::Algorithm::toJSON() const
|
||||
{
|
||||
using namespace rapidjson;
|
||||
|
@ -170,6 +157,8 @@ size_t xmrig::Algorithm::l2() const
|
|||
|
||||
size_t xmrig::Algorithm::l3() const
|
||||
{
|
||||
constexpr size_t oneMiB = 0x100000;
|
||||
|
||||
const Family f = family();
|
||||
assert(f != UNKNOWN);
|
||||
|
||||
|
@ -179,8 +168,6 @@ size_t xmrig::Algorithm::l3() const
|
|||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
if (f == RANDOM_X) {
|
||||
constexpr size_t oneMiB = 0x100000;
|
||||
|
||||
switch (m_id) {
|
||||
case RX_0:
|
||||
case RX_LOKI:
|
||||
|
@ -195,10 +182,49 @@ size_t xmrig::Algorithm::l3() const
|
|||
}
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_ARGON2
|
||||
if (f == ARGON2) {
|
||||
switch (m_id) {
|
||||
case AR2_CHUKWA:
|
||||
return oneMiB / 2;
|
||||
|
||||
case AR2_WRKZ:
|
||||
return oneMiB / 4;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
uint32_t xmrig::Algorithm::maxIntensity() const
|
||||
{
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
if (family() == RANDOM_X) {
|
||||
return 1;
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_ARGON2
|
||||
if (family() == ARGON2) {
|
||||
return 1;
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_CN_GPU
|
||||
if (m_id == CN_GPU) {
|
||||
return 1;
|
||||
}
|
||||
# endif
|
||||
|
||||
return 5;
|
||||
}
|
||||
|
||||
|
||||
xmrig::Algorithm::Family xmrig::Algorithm::family(Id id)
|
||||
{
|
||||
switch (id) {
|
||||
|
@ -244,6 +270,12 @@ xmrig::Algorithm::Family xmrig::Algorithm::family(Id id)
|
|||
return RANDOM_X;
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_ARGON2
|
||||
case AR2_CHUKWA:
|
||||
case AR2_WRKZ:
|
||||
return ARGON2;
|
||||
# endif
|
||||
|
||||
case INVALID:
|
||||
case MAX:
|
||||
return UNKNOWN;
|
||||
|
@ -273,7 +305,7 @@ const char *xmrig::Algorithm::name(bool shortName) const
|
|||
{
|
||||
for (size_t i = 0; i < ARRAY_SIZE(algorithm_names); i++) {
|
||||
if (algorithm_names[i].id == m_id) {
|
||||
return shortName ? algorithm_names[i].shortName : algorithm_names[i].name;
|
||||
return (shortName && algorithm_names[i].shortName) ? algorithm_names[i].shortName : algorithm_names[i].name;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue