mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-22 12:47:08 +00:00
Fix sloppy L3 cache detection code
Fixes https://github.com/official-stockfish/Stockfish/issues/6857 Many thanks to Andrew for the repro closes https://github.com/official-stockfish/Stockfish/pull/6858 No functional change
This commit is contained in:
committed by
Joost VandeVondele
parent
77a8f6ccf3
commit
564f9f9c85
+5
-10
@@ -1166,23 +1166,18 @@ class NumaConfig {
|
||||
#if defined(__linux__) && !defined(__ANDROID__)
|
||||
|
||||
std::set<CpuIndex> seenCpus;
|
||||
auto nextUnseenCpu = [&seenCpus]() {
|
||||
for (CpuIndex i = 0;; ++i)
|
||||
if (!seenCpus.count(i))
|
||||
return i;
|
||||
};
|
||||
|
||||
while (true)
|
||||
for (const auto& [next, _] : systemConfig.nodeByCpu)
|
||||
{
|
||||
CpuIndex next = nextUnseenCpu();
|
||||
if (seenCpus.count(next))
|
||||
continue;
|
||||
|
||||
auto siblingsStr =
|
||||
read_file_to_string("/sys/devices/system/cpu/cpu" + std::to_string(next)
|
||||
+ "/cache/index3/shared_cpu_list");
|
||||
|
||||
if (!siblingsStr.has_value() || siblingsStr->empty())
|
||||
{
|
||||
break; // we have read all available CPUs
|
||||
}
|
||||
continue;
|
||||
|
||||
L3Domain domain;
|
||||
for (size_t c : indices_from_shortened_string(*siblingsStr))
|
||||
|
||||
Reference in New Issue
Block a user