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
+6
-11
@@ -1166,23 +1166,18 @@ class NumaConfig {
|
|||||||
#if defined(__linux__) && !defined(__ANDROID__)
|
#if defined(__linux__) && !defined(__ANDROID__)
|
||||||
|
|
||||||
std::set<CpuIndex> seenCpus;
|
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))
|
||||||
auto siblingsStr =
|
continue;
|
||||||
|
|
||||||
|
auto siblingsStr =
|
||||||
read_file_to_string("/sys/devices/system/cpu/cpu" + std::to_string(next)
|
read_file_to_string("/sys/devices/system/cpu/cpu" + std::to_string(next)
|
||||||
+ "/cache/index3/shared_cpu_list");
|
+ "/cache/index3/shared_cpu_list");
|
||||||
|
|
||||||
if (!siblingsStr.has_value() || siblingsStr->empty())
|
if (!siblingsStr.has_value() || siblingsStr->empty())
|
||||||
{
|
continue;
|
||||||
break; // we have read all available CPUs
|
|
||||||
}
|
|
||||||
|
|
||||||
L3Domain domain;
|
L3Domain domain;
|
||||||
for (size_t c : indices_from_shortened_string(*siblingsStr))
|
for (size_t c : indices_from_shortened_string(*siblingsStr))
|
||||||
|
|||||||
Reference in New Issue
Block a user