Fixed hf > 1 on Argon2 algos
This commit is contained in:
parent
161856b2b1
commit
0ad34f8746
3 changed files with 15 additions and 9 deletions
|
@ -70,8 +70,8 @@ ScratchPadMem Mem::create(ScratchPad** scratchPads, int threadId)
|
|||
}
|
||||
|
||||
ScratchPadMem scratchPadMem;
|
||||
scratchPadMem.realSize = Options::isCNAlgo(m_algo) ? scratchPadSize * getThreadHashFactor(threadId) : scratchPadSize;
|
||||
scratchPadMem.size = Options::isCNAlgo(m_algo) ? scratchPadSize * getThreadHashFactor(threadId) : scratchPadSize;
|
||||
scratchPadMem.realSize = scratchPadSize * getThreadHashFactor(threadId);
|
||||
scratchPadMem.size = scratchPadSize * getThreadHashFactor(threadId);
|
||||
scratchPadMem.pages = std::max(scratchPadMem.size / MEMORY, static_cast<size_t>(1));
|
||||
|
||||
allocate(scratchPadMem, m_useHugePages);
|
||||
|
@ -102,11 +102,9 @@ void Mem::release(ScratchPad** scratchPads, ScratchPadMem& scratchPadMem, int th
|
|||
m_totalPages -= scratchPadMem.pages;
|
||||
m_totalHugepages -= scratchPadMem.hugePages;
|
||||
|
||||
if (Options::isCNAlgo(m_algo)) {
|
||||
release(scratchPadMem);
|
||||
|
||||
for (size_t i = 0; i < getThreadHashFactor(threadId); ++i) {
|
||||
_mm_free(scratchPads[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,8 +81,12 @@ public:
|
|||
static inline size_t hashFactor() { return m_hashFactor; }
|
||||
static inline size_t getThreadHashFactor(int threadId)
|
||||
{
|
||||
return (m_multiHashThreadMask.all() ||
|
||||
m_multiHashThreadMask.test(threadId)) ? m_hashFactor : 1;
|
||||
size_t threadHashFactor = 1;
|
||||
if (Options::isCNAlgo(m_algo)) {
|
||||
threadHashFactor = (m_multiHashThreadMask.all() || m_multiHashThreadMask.test(threadId)) ? m_hashFactor : 1;
|
||||
}
|
||||
|
||||
return threadHashFactor;
|
||||
}
|
||||
|
||||
static inline bool isHugepagesAvailable() { return (m_flags & HugepagesAvailable) != 0; }
|
||||
|
|
|
@ -1401,6 +1401,10 @@ void Options::optimizeAlgorithmConfiguration()
|
|||
m_hashFactor = 3;
|
||||
}
|
||||
|
||||
if (m_algo == Options::ALGO_ARGON2_256 || m_algo == Options::ALGO_ARGON2_512) {
|
||||
m_hashFactor = 1;
|
||||
}
|
||||
|
||||
Cpu::optimizeParameters(m_threads, m_hashFactor, m_algo, m_powVariant, m_maxCpuUsage, m_safe);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue