Skip to content

Commit 8fa6bd7

Browse files
committed
Skip openmp tests when builder uses 5-level page tables
A large number of openmp tests using tsan fail when we hit certain machines on the rhel8-beefy channel in brew, because they appear to the use 5-level page tables. This results in memory being mapped in places where tsan does not expect it. See llvm/llvm-project#111492 for more context. Work around this by disabling the openmp tests that use tsan if the cpu has the la57 feature.
1 parent 025b6c7 commit 8fa6bd7

File tree

2 files changed

+76
-1
lines changed

2 files changed

+76
-1
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
From b2edeb58b8cb3268acee425cd52b406eb60a8095 Mon Sep 17 00:00:00 2001
2+
From: Nikita Popov <[email protected]>
3+
Date: Wed, 9 Oct 2024 11:29:30 +0200
4+
Subject: [PATCH] [openmp] Add option to disable tsan tests (#111548)
5+
6+
This adds a OPENMP_TEST_ENABLE_TSAN option that allows to override
7+
whether tests using tsan will be enabled. The option defaults to the
8+
existing auto-detection.
9+
10+
The background here is
11+
https://github.com/llvm/llvm-project/issues/111492, where we have some
12+
systems where tsan doesn't work, but we do still want to build it and
13+
run tests that don't use tsan.
14+
---
15+
openmp/cmake/OpenMPTesting.cmake | 3 +++
16+
openmp/tools/archer/tests/CMakeLists.txt | 2 +-
17+
openmp/tools/archer/tests/lit.site.cfg.in | 2 +-
18+
3 files changed, 5 insertions(+), 2 deletions(-)
19+
20+
diff --git a/openmp/cmake/OpenMPTesting.cmake b/openmp/cmake/OpenMPTesting.cmake
21+
index c67ad8b1cbd9..14cc5c67d84c 100644
22+
--- a/openmp/cmake/OpenMPTesting.cmake
23+
+++ b/openmp/cmake/OpenMPTesting.cmake
24+
@@ -163,6 +163,9 @@ else()
25+
set(OPENMP_TEST_COMPILER_HAS_OMIT_FRAME_POINTER_FLAGS 1)
26+
endif()
27+
28+
+set(OPENMP_TEST_ENABLE_TSAN "${OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS}" CACHE BOOL
29+
+ "Whether to enable tests using tsan")
30+
+
31+
# Function to set compiler features for use in lit.
32+
function(update_test_compiler_features)
33+
set(FEATURES "[")
34+
diff --git a/openmp/tools/archer/tests/CMakeLists.txt b/openmp/tools/archer/tests/CMakeLists.txt
35+
index 5de91148fa4b..412c7d63725e 100644
36+
--- a/openmp/tools/archer/tests/CMakeLists.txt
37+
+++ b/openmp/tools/archer/tests/CMakeLists.txt
38+
@@ -28,7 +28,7 @@ macro(pythonize_bool var)
39+
endmacro()
40+
41+
pythonize_bool(LIBARCHER_HAVE_LIBATOMIC)
42+
-pythonize_bool(OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS)
43+
+pythonize_bool(OPENMP_TEST_ENABLE_TSAN)
44+
45+
set(ARCHER_TSAN_TEST_DEPENDENCE "")
46+
if(TARGET tsan)
47+
diff --git a/openmp/tools/archer/tests/lit.site.cfg.in b/openmp/tools/archer/tests/lit.site.cfg.in
48+
index 55edfde9738e..ddcb7b8bc3a5 100644
49+
--- a/openmp/tools/archer/tests/lit.site.cfg.in
50+
+++ b/openmp/tools/archer/tests/lit.site.cfg.in
51+
@@ -12,7 +12,7 @@ config.omp_library_dir = "@LIBOMP_LIBRARY_DIR@"
52+
config.omp_header_dir = "@LIBOMP_INCLUDE_DIR@"
53+
config.operating_system = "@CMAKE_SYSTEM_NAME@"
54+
config.has_libatomic = @LIBARCHER_HAVE_LIBATOMIC@
55+
-config.has_tsan = @OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS@
56+
+config.has_tsan = @OPENMP_TEST_ENABLE_TSAN@
57+
58+
config.test_archer_flags = "@LIBARCHER_TEST_FLAGS@"
59+
config.libarcher_obj_root = "@CMAKE_CURRENT_BINARY_DIR@"
60+
--
61+
2.46.0
62+

llvm.spec

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,12 @@ Source3001: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{com
206206
Source1000: version.spec.inc
207207
%endif
208208

209+
#region LLVM patches
210+
%if %{maj_ver} < 20
211+
Patch1001: 0001-openmp-Add-option-to-disable-tsan-tests-111548.patch
212+
%endif
213+
#endregion
214+
209215
#region CLANG patches
210216
Patch2001: 0001-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
211217
Patch2002: 0003-PATCH-clang-Don-t-install-static-libraries.patch
@@ -990,9 +996,16 @@ popd
990996
%global cmake_config_args %{cmake_config_args} -DLLVM_RAM_PER_COMPILE_JOB=2048
991997
%endif
992998
#endregion misc options
999+
1000+
extra_cmake_args=''
1001+
# TSan does not support 5-level page tables (https://github.com/llvm/llvm-project/issues/111492)
1002+
# so do not run tests using tsan on systems that potentially use 5-level page tables.
1003+
if grep 'flags.*la57' /proc/cpuinfo; then
1004+
extra_cmake_args="$extra_cmake_args -DOPENMP_TEST_ENABLE_TSAN=OFF"
1005+
fi
9931006
#endregion cmake options
9941007

995-
%cmake -G Ninja %cmake_config_args
1008+
%cmake -G Ninja %cmake_config_args $extra_cmake_args
9961009

9971010
# Build libLLVM.so first. This ensures that when libLLVM.so is linking, there
9981011
# are no other compile jobs running. This will help reduce OOM errors on the

0 commit comments

Comments
 (0)