diff options
author | Bruce Cherniak <bruce.cherniak@intel.com> | 2017-01-19 15:44:52 -0600 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2017-03-14 00:13:12 +0000 |
commit | 59f76392a57d1e962b66320e1e1869021fdc9395 (patch) | |
tree | c03d8bcd329444eafc19da57844135ce8232b345 /src | |
parent | 77b794d85b58ba834c69b9f4ad0a796196e0177d (diff) |
swr: Prune empty nodes in CalculateProcessorTopology.
CalculateProcessorTopology tries to figure out system topology by
parsing /proc/cpuinfo to determine the number of threads, cores, and
NUMA nodes. There are some architectures where the "physical id" begins
with 1 rather than 0, which was creating and empty "0" node and causing a
crash in CreateThreadPool.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97102
Reviewed-By: George Kyriazis <george.kyriazis@intel.com>
CC: <mesa-stable@lists.freedesktop.org>
(cherry picked from commit b829206b0739925501bcc68233437d6d03b79795)
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/threads.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/threads.cpp b/src/gallium/drivers/swr/rasterizer/core/threads.cpp index ea5542ab332..8bbe7873601 100644 --- a/src/gallium/drivers/swr/rasterizer/core/threads.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/threads.cpp @@ -217,6 +217,15 @@ void CalculateProcessorTopology(CPUNumaNodes& out_nodes, uint32_t& out_numThread out_numThreadsPerProcGroup++; } + /* Prune empty numa nodes */ + for (auto it = out_nodes.begin(); it != out_nodes.end(); ) { + if ((*it).cores.size() == 0) + it = out_nodes.erase(it); + else + ++it; + } + + /* Prune empty core nodes */ for (uint32_t node = 0; node < out_nodes.size(); node++) { auto& numaNode = out_nodes[node]; auto it = numaNode.cores.begin(); |