summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTim Rowley <[email protected]>2016-04-04 12:42:00 -0600
committerTim Rowley <[email protected]>2016-04-22 18:47:59 -0500
commite42f00ee39acf6e88200c36b5ea6a8da6b69dd0f (patch)
tree9d9f8a3492511c533b5af4b97a454693967c496e /src
parentcd21f90ecfeec322ebbe326848c4862f014e3ef1 (diff)
swr: [rasterizer core] Fix thread binding for 32-bit windows
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/threads.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/threads.cpp b/src/gallium/drivers/swr/rasterizer/core/threads.cpp
index 4b7a207f366..21bff4ec082 100644
--- a/src/gallium/drivers/swr/rasterizer/core/threads.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/threads.cpp
@@ -120,7 +120,7 @@ void CalculateProcessorTopology(CPUNumaNodes& out_nodes, uint32_t& out_numThread
pCore->procGroup = procGroup;
#if !defined(_WIN64)
coreId = (uint32_t)numaNode.cores.size();
- if ((coreId * numThreads) >= 32)
+ if ((coreId * numThreads) > 32)
{
// Windows doesn't return threadIds >= 32 for a processor group correctly
// when running a 32-bit application.
@@ -234,6 +234,9 @@ void bindThread(uint32_t threadId, uint32_t procGroupId = 0, bool bindProcGroup=
#if !defined(_WIN64)
if (threadId >= 32)
{
+ // Hopefully we don't get here. Logic in CreateThreadPool should prevent this.
+ SWR_REL_ASSERT(false, "Shouldn't get here");
+
// In a 32-bit process on Windows it is impossible to bind
// to logical processors 32-63 within a processor group.
// In this case set the mask to 0 and let the system assign
@@ -731,6 +734,17 @@ void CreateThreadPool(SWR_CONTEXT *pContext, THREAD_POOL *pPool)
numHyperThreads = std::min(numHyperThreads, KNOB_MAX_THREADS_PER_CORE);
}
+#if defined(_WIN32) && !defined(_WIN64)
+ if (!KNOB_MAX_WORKER_THREADS)
+ {
+ // Limit 32-bit windows to bindable HW threads only
+ if ((numCoresPerNode * numHWHyperThreads) > 32)
+ {
+ numCoresPerNode = 32 / numHWHyperThreads;
+ }
+ }
+#endif
+
if (numHyperThreads < 2)
{
SET_KNOB(HYPERTHREADED_FE, false);