[compiler-rt] r292232 - [lit] Limit parallelism of sanitizer tests on Darwin [compiler-rt part]

Kuba Mracek via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 09:18:19 PST 2017


Author: kuba.brecka
Date: Tue Jan 17 11:18:18 2017
New Revision: 292232

URL: http://llvm.org/viewvc/llvm-project?rev=292232&view=rev
Log:
[lit] Limit parallelism of sanitizer tests on Darwin [compiler-rt part]

Running lit tests and unit tests of ASan and TSan on macOS has very bad performance when running with a high number of threads. This is caused by xnu (the macOS kernel), which currently doesn't handle mapping and unmapping of sanitizer shadow regions (reserved VM which are several terabytes large) very well. The situation is so bad that increasing the number of threads actually makes the total testing time larger. The macOS buildbots are affected by this. Note that we can't easily limit the number of sanitizer testing threads without affecting the rest of the tests.

This patch adds a special "group" into lit, and limits the number of concurrently running tests in this group. This helps solve the contention problem, while still allowing other tests to run in full, that means running lit with -j8 will still with 8 threads, and parallelism is only limited in sanitizer tests.

Differential Revision: https://reviews.llvm.org/D28420


Modified:
    compiler-rt/trunk/test/asan/Unit/lit.site.cfg.in
    compiler-rt/trunk/test/asan/lit.cfg
    compiler-rt/trunk/test/tsan/Unit/lit.site.cfg.in
    compiler-rt/trunk/test/tsan/lit.cfg
    compiler-rt/trunk/unittests/lit.common.unit.cfg

Modified: compiler-rt/trunk/test/asan/Unit/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/Unit/lit.site.cfg.in?rev=292232&r1=292231&r2=292232&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/Unit/lit.site.cfg.in (original)
+++ compiler-rt/trunk/test/asan/Unit/lit.site.cfg.in Tue Jan 17 11:18:18 2017
@@ -27,3 +27,5 @@ config.test_source_root = config.test_ex
 
 # Set LD_LIBRARY_PATH to pick dynamic runtime up properly.
 push_ld_library_path(config, config.compiler_rt_libdir)
+
+config.parallelism_group = config.darwin_sanitizer_parallelism_group_func

Modified: compiler-rt/trunk/test/asan/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/lit.cfg?rev=292232&r1=292231&r2=292232&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/lit.cfg (original)
+++ compiler-rt/trunk/test/asan/lit.cfg Tue Jan 17 11:18:18 2017
@@ -241,3 +241,7 @@ else:
 # Only run the tests on supported OSs.
 if config.host_os not in ['Linux', 'Darwin', 'FreeBSD', 'Windows']:
   config.unsupported = True
+
+if config.host_os == 'Darwin':
+  if config.target_arch in ["x86_64", "x86_64h"]:
+    config.parallelism_group = "darwin-64bit-sanitizer"

Modified: compiler-rt/trunk/test/tsan/Unit/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Unit/lit.site.cfg.in?rev=292232&r1=292231&r2=292232&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Unit/lit.site.cfg.in (original)
+++ compiler-rt/trunk/test/tsan/Unit/lit.site.cfg.in Tue Jan 17 11:18:18 2017
@@ -11,3 +11,5 @@ config.name = 'ThreadSanitizer-Unit'
 # FIXME: De-hardcode this path.
 config.test_exec_root = "@COMPILER_RT_BINARY_DIR@/lib/tsan/tests"
 config.test_source_root = config.test_exec_root
+
+config.parallelism_group = config.darwin_sanitizer_parallelism_group_func

Modified: compiler-rt/trunk/test/tsan/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/lit.cfg?rev=292232&r1=292231&r2=292232&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/lit.cfg (original)
+++ compiler-rt/trunk/test/tsan/lit.cfg Tue Jan 17 11:18:18 2017
@@ -83,3 +83,7 @@ if config.host_os not in ['FreeBSD', 'Li
 # because the test hangs.
 if config.target_arch != 'aarch64':
   config.available_features.add('stable-runtime')
+
+if config.host_os == 'Darwin':
+  if config.target_arch in ["x86_64", "x86_64h"]:
+    config.parallelism_group = "darwin-64bit-sanitizer"

Modified: compiler-rt/trunk/unittests/lit.common.unit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/unittests/lit.common.unit.cfg?rev=292232&r1=292231&r2=292232&view=diff
==============================================================================
--- compiler-rt/trunk/unittests/lit.common.unit.cfg (original)
+++ compiler-rt/trunk/unittests/lit.common.unit.cfg Tue Jan 17 11:18:18 2017
@@ -28,3 +28,10 @@ if 'TMP' in os.environ:
     config.environment['TMP'] = os.environ['TMP']
 if 'TEMP' in os.environ:
     config.environment['TEMP'] = os.environ['TEMP']
+
+def darwin_sanitizer_parallelism_group_func(test):
+  if test.config.host_os == "Darwin":
+    if test.file_path.find("x86_64") != -1:
+      return "darwin-64bit-sanitizer"
+  return ""
+config.darwin_sanitizer_parallelism_group_func = darwin_sanitizer_parallelism_group_func




More information about the llvm-commits mailing list