Always use all available threads on ARM.

This commit is contained in:
XMRig 2020-08-16 17:36:38 +07:00
parent 00b4ae9c36
commit 206b675892
No known key found for this signature in database
GPG key ID: 446A53638BE94409
2 changed files with 28 additions and 1 deletions

View file

@ -218,10 +218,11 @@ xmrig::CpuThreads xmrig::HwlocCpuInfo::threads(const Algorithm &algorithm, uint3
{ {
# ifdef XMRIG_ALGO_ASTROBWT # ifdef XMRIG_ALGO_ASTROBWT
if (algorithm == Algorithm::ASTROBWT_DERO) { if (algorithm == Algorithm::ASTROBWT_DERO) {
return BasicCpuInfo::threads(algorithm, limit); return allThreads(algorithm, limit);
} }
# endif # endif
# ifndef XMRIG_ARM
if (L2() == 0 && L3() == 0) { if (L2() == 0 && L3() == 0) {
return BasicCpuInfo::threads(algorithm, limit); return BasicCpuInfo::threads(algorithm, limit);
} }
@ -263,11 +264,35 @@ xmrig::CpuThreads xmrig::HwlocCpuInfo::threads(const Algorithm &algorithm, uint3
} }
return threads; return threads;
# else
return allThreads(algorithm, limit);
# endif
} }
xmrig::CpuThreads xmrig::HwlocCpuInfo::allThreads(const Algorithm &algorithm, uint32_t limit) const
{
CpuThreads threads;
threads.reserve(m_threads);
hwloc_obj_t pu = nullptr;
while ((pu = hwloc_get_next_obj_by_type(m_topology, HWLOC_OBJ_PU, pu)) != nullptr) {
threads.add(pu->os_index, 0);
}
if (threads.isEmpty()) {
return BasicCpuInfo::threads(algorithm, limit);
}
return threads;
}
void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorithm &algorithm, CpuThreads &threads, size_t limit) const void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorithm &algorithm, CpuThreads &threads, size_t limit) const
{ {
# ifndef XMRIG_ARM
constexpr size_t oneMiB = 1024U * 1024U; constexpr size_t oneMiB = 1024U * 1024U;
size_t PUs = countByType(cache, HWLOC_OBJ_PU); size_t PUs = countByType(cache, HWLOC_OBJ_PU);
@ -366,4 +391,5 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
pu_id++; pu_id++;
} }
# endif
} }

View file

@ -70,6 +70,7 @@ protected:
inline size_t packages() const override { return m_packages; } inline size_t packages() const override { return m_packages; }
private: private:
CpuThreads allThreads(const Algorithm &algorithm, uint32_t limit) const;
void processTopLevelCache(hwloc_obj_t obj, const Algorithm &algorithm, CpuThreads &threads, size_t limit) const; void processTopLevelCache(hwloc_obj_t obj, const Algorithm &algorithm, CpuThreads &threads, size_t limit) const;