forked from OSchip/llvm-project
[lit] Limit parallelism of sanitizer tests on Darwin [compiler-rt part, take 2]
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 llvm-svn: 292549
This commit is contained in:
parent
30881272e1
commit
245318cb05
|
@ -27,3 +27,6 @@ config.test_source_root = config.test_exec_root
|
|||
|
||||
# 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
|
||||
|
|
|
@ -241,3 +241,6 @@ 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' and config.target_arch in ["x86_64", "x86_64h"]:
|
||||
config.parallelism_group = "darwin-64bit-sanitizer"
|
||||
|
|
|
@ -216,3 +216,9 @@ llvm_config_cmd.wait()
|
|||
# retries. We don't do this on otther platforms because it's slower.
|
||||
if platform.system() == 'Windows':
|
||||
config.test_retry_attempts = 2
|
||||
|
||||
# Only run up to 3 64-bit sanitized processes simultaneously on Darwin.
|
||||
# Using more scales badly and hogs the system due to inefficient handling
|
||||
# of large mmap'd regions (terabytes) by the kernel.
|
||||
if platform.system() == 'Darwin':
|
||||
lit_config.parallelism_groups["darwin-64bit-sanitizer"] = 3
|
||||
|
|
|
@ -11,3 +11,6 @@ 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
|
||||
|
||||
if config.host_os == 'Darwin':
|
||||
config.parallelism_group = config.darwin_sanitizer_parallelism_group_func
|
||||
|
|
|
@ -83,3 +83,6 @@ if config.host_os not in ['FreeBSD', 'Linux', 'Darwin']:
|
|||
# because the test hangs.
|
||||
if config.target_arch != 'aarch64':
|
||||
config.available_features.add('stable-runtime')
|
||||
|
||||
if config.host_os == 'Darwin' and config.target_arch in ["x86_64", "x86_64h"]:
|
||||
config.parallelism_group = "darwin-64bit-sanitizer"
|
||||
|
|
|
@ -28,3 +28,13 @@ if 'TMP' in os.environ:
|
|||
config.environment['TMP'] = os.environ['TMP']
|
||||
if 'TEMP' in os.environ:
|
||||
config.environment['TEMP'] = os.environ['TEMP']
|
||||
|
||||
if config.host_os == 'Darwin':
|
||||
# Only run up to 3 64-bit sanitized processes simultaneously on Darwin.
|
||||
# Using more scales badly and hogs the system due to inefficient handling
|
||||
# of large mmap'd regions (terabytes) by the kernel.
|
||||
lit_config.parallelism_groups["darwin-64bit-sanitizer"] = 3
|
||||
|
||||
def darwin_sanitizer_parallelism_group_func(test):
|
||||
return "darwin-64bit-sanitizer" if "x86_64" in test.file_path else ""
|
||||
config.darwin_sanitizer_parallelism_group_func = darwin_sanitizer_parallelism_group_func
|
||||
|
|
Loading…
Reference in New Issue