[x265] [PATCH] Performance: Prevent small thread-pools if NUMA disabled and # CPUs > MAX_POOL_THREADS

pradeep at multicorewareinc.com pradeep at multicorewareinc.com
Tue Aug 25 06:18:50 CEST 2015


# HG changeset patch
# User pradeep
# Date 1440476198 -19800
#      Tue Aug 25 09:46:38 2015 +0530
# Node ID ba08fde2e66bb66f0410fd5bb7a28f62df0043e0
# Parent  a28a863393994d8fb1d58c721352d9b4ec8c46ee
Performance: Prevent small thread-pools if NUMA disabled and # CPUs > MAX_POOL_THREADS

When NUMA is disabled and if # CPUs is > MAX_POOL_THREADS (64 or 32 depending on 64-bit
or 32-bit builds), the last pool may have few threads. This patch allows the last pool to
exist only if it has > MAX_POOL_THREADS/2 threads; the 50% number is a heurstic.

Feature gains performance of 5% on Intel Xeon E5-2699v3 measured in slower preset with 4K video.

diff -r a28a86339399 -r ba08fde2e66b source/common/threadpool.cpp
--- a/source/common/threadpool.cpp	Mon Aug 24 14:04:32 2015 +0530
+++ b/source/common/threadpool.cpp	Tue Aug 25 09:46:38 2015 +0530
@@ -289,6 +289,11 @@
         }
     }
 
+    // In the case that numa is disabled and we have more CPUs than 64,
+    // spawn the last pool only if the # threads in that pool is > 1/2 max (heuristic)
+    if ((numNumaNodes == 1) && (cpusPerNode[0] % MAX_POOL_THREADS < (MAX_POOL_THREADS / 2)))
+        cpusPerNode[0] = ((int)(cpusPerNode[0] / MAX_POOL_THREADS)) * MAX_POOL_THREADS ;
+
     numPools = 0;
     for (int i = 0; i < numNumaNodes; i++)
     {


More information about the x265-devel mailing list