[compiler-rt] a5228bc - [Darwin] Limit parallelism for sanitizer tests that use shadow memory on AS

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 14:43:34 PDT 2022


Author: Julian Lettner
Date: 2022-03-31T14:43:28-07:00
New Revision: a5228bcaad9c57e7ede95d900a730c59f5243d35

URL: https://github.com/llvm/llvm-project/commit/a5228bcaad9c57e7ede95d900a730c59f5243d35
DIFF: https://github.com/llvm/llvm-project/commit/a5228bcaad9c57e7ede95d900a730c59f5243d35.diff

LOG: [Darwin] Limit parallelism for sanitizer tests that use shadow memory on AS

On Darwin, we want to limit the parallelism during test execution for
sanitizer tests that use shadow memory.  The reason is explained by this
existing comment:

> Only run up to 3 processes that require shadow memory simultaneously
> on 64-bit Darwin. Using more scales badly and hogs the system due to
> inefficient handling of large mmap'd regions (terabytes) by the
> kernel.

Previously we detected 3 cases:
* on-device: limit to 1 process
* 64-bit: macOS & simulators, limit to 3 processes
* others (32-bit): no limitation

We checked for the 64-bit case like this: `if arch in ['x86_64',
'x86_64h']` which misses macOS running on AS. Additionally, we don't
care about 32-bit anymore, so I've simplified this to 2 cases: on-device
and everything else.

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

Added: 
    

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

Removed: 
    compiler-rt/unittests/lit_unittest_cfg_utils.py


################################################################################
diff  --git a/compiler-rt/test/asan/Unit/lit.site.cfg.py.in b/compiler-rt/test/asan/Unit/lit.site.cfg.py.in
index 28f654a560e96..8a469546734a7 100644
--- a/compiler-rt/test/asan/Unit/lit.site.cfg.py.in
+++ b/compiler-rt/test/asan/Unit/lit.site.cfg.py.in
@@ -62,5 +62,5 @@ if config.enable_per_target_runtime_dir and config.target_arch != config.host_ar
 # Set LD_LIBRARY_PATH to pick dynamic runtime up properly.
 push_ld_library_path(config, config.compiler_rt_libdir)
 
-if config.host_os == 'Darwin':
-  config.parallelism_group = config.darwin_sanitizer_parallelism_group_func
+if not config.parallelism_group:
+  config.parallelism_group = 'shadow-memory'

diff  --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py
index e71e6d40ec882..940614cb3b993 100644
--- a/compiler-rt/test/lit.common.cfg.py
+++ b/compiler-rt/test/lit.common.cfg.py
@@ -613,8 +613,8 @@ def is_windows_lto_supported():
   # Only run up to 3 processes that require shadow memory simultaneously on
   # 64-bit Darwin. Using more scales badly and hogs the system due to
   # inefficient handling of large mmap'd regions (terabytes) by the kernel.
-  elif config.target_arch in ['x86_64', 'x86_64h']:
-    lit_config.warning('Throttling sanitizer tests that require shadow memory on Darwin 64bit')
+  else:
+    lit_config.warning('Throttling sanitizer tests that require shadow memory on Darwin')
     lit_config.parallelism_groups['shadow-memory'] = 3
 
 # Multiple substitutions are necessary to support multiple shared objects used

diff  --git a/compiler-rt/test/sanitizer_common/Unit/lit.site.cfg.py.in b/compiler-rt/test/sanitizer_common/Unit/lit.site.cfg.py.in
index 46855d9e85456..a5177a6886708 100644
--- a/compiler-rt/test/sanitizer_common/Unit/lit.site.cfg.py.in
+++ b/compiler-rt/test/sanitizer_common/Unit/lit.site.cfg.py.in
@@ -13,5 +13,5 @@ config.test_exec_root = os.path.join("@COMPILER_RT_BINARY_DIR@", "lib",
                                      "sanitizer_common", "tests")
 config.test_source_root = config.test_exec_root
 
-if config.host_os == 'Darwin':
-  config.parallelism_group = config.darwin_sanitizer_parallelism_group_func
+if not config.parallelism_group:
+  config.parallelism_group = 'shadow-memory'

diff  --git a/compiler-rt/test/tsan/Unit/lit.site.cfg.py.in b/compiler-rt/test/tsan/Unit/lit.site.cfg.py.in
index 714501a0d76de..a9c6261ba48d4 100644
--- a/compiler-rt/test/tsan/Unit/lit.site.cfg.py.in
+++ b/compiler-rt/test/tsan/Unit/lit.site.cfg.py.in
@@ -12,9 +12,10 @@ config.name = 'ThreadSanitizer-Unit'
 config.test_exec_root = "@COMPILER_RT_BINARY_DIR@/lib/tsan/tests"
 config.test_source_root = config.test_exec_root
 
-if config.host_os == 'Darwin':
-  config.parallelism_group = config.darwin_sanitizer_parallelism_group_func
+if not config.parallelism_group:
+  config.parallelism_group = 'shadow-memory'
 
+if config.host_os == 'Darwin':
   # On Darwin, we default to ignore_noninstrumented_modules=1, which also
   # suppresses some races the tests are supposed to find.  See tsan/lit.cfg.py.
   if 'TSAN_OPTIONS' in config.environment:

diff  --git a/compiler-rt/unittests/lit.common.unit.cfg.py b/compiler-rt/unittests/lit.common.unit.cfg.py
index 11d99980f8412..c72b06d6b5f31 100644
--- a/compiler-rt/unittests/lit.common.unit.cfg.py
+++ b/compiler-rt/unittests/lit.common.unit.cfg.py
@@ -50,13 +50,3 @@ def get_lit_conf(name, default=None):
   #
   # rdar://80086125
   config.environment['MallocNanoZone'] = '0'
-
-  # The test config gets pickled and sent to multiprocessing workers, and that
-  # only works for code if it is stored at the top level of some module.
-  # Therefore, we have to put the code in a .py file, add it to path, and import
-  # it to store it in the config.
-  import site
-  site.addsitedir(os.path.dirname(__file__))
-  import lit_unittest_cfg_utils
-  config.darwin_sanitizer_parallelism_group_func = \
-    lit_unittest_cfg_utils.darwin_sanitizer_parallelism_group_func

diff  --git a/compiler-rt/unittests/lit_unittest_cfg_utils.py b/compiler-rt/unittests/lit_unittest_cfg_utils.py
deleted file mode 100644
index 16281f0b48e1c..0000000000000
--- a/compiler-rt/unittests/lit_unittest_cfg_utils.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# Put all 64-bit tests in the shadow-memory parallelism group. We throttle those
-# in our common lit config (lit.common.unit.cfg.py).
-def darwin_sanitizer_parallelism_group_func(test):
-  return "shadow-memory" if "x86_64" in test.file_path else None


        


More information about the llvm-commits mailing list