Skip to content

Commit 7ed6385

Browse files
Upgrade BOLT to LLVM OpenMP 9.0
Merge commit 'c1b1ef1c009f285690b40a96f0853ec2b1573fbb'
1 parent 8adadb1 commit 7ed6385

File tree

251 files changed

+7735
-12820
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+7735
-12820
lines changed

LICENSE.txt

+237-50
Large diffs are not rendered by default.

README.rst

+2-6
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,6 @@ Options for ``libomp``
141141
Intel(R) Many Integrated Core Architecture (Intel(R) MIC Architecture) to
142142
build for. This value is ignored if **LIBOMP_ARCH** does not equal ``mic``.
143143

144-
**LIBOMP_OMP_VERSION** = ``50|45|40|30``
145-
OpenMP version to build for. Older versions will disable certain
146-
functionality and entry points.
147-
148144
**LIBOMP_LIB_TYPE** = ``normal|profile|stubs``
149145
Library type can be ``normal``, ``profile``, or ``stubs``.
150146

@@ -192,8 +188,8 @@ Optional Features
192188
multi-node systems where a small ``CACHE_LINE`` setting leads to false sharing.
193189

194190
**LIBOMP_OMPT_SUPPORT** = ``ON|OFF``
195-
Include support for the OpenMP Tools Interface (OMPT).
196-
This option is supported and ``ON`` by default for x86, x86_64, AArch64, and
191+
Include support for the OpenMP Tools Interface (OMPT).
192+
This option is supported and ``ON`` by default for x86, x86_64, AArch64, and
197193
PPC64 on Linux* and macOS*.
198194
This option is ``OFF`` if this feature is not supported for the platform.
199195

cmake/DetectTestCompiler/CMakeLists.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ if (NOT OpenMP_Found)
1818
set(OpenMP_CXX_FLAGS "-fopenmp")
1919
endif()
2020

21-
set(C_FLAGS ${flags} ${OpenMP_C_FLAGS})
22-
set(CXX_FLAGS ${flags} ${OpenMP_CXX_FLAGS})
21+
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
22+
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
23+
find_package(Threads REQUIRED)
24+
25+
set(C_FLAGS "${OpenMP_C_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
26+
set(CXX_FLAGS "${OpenMP_CXX_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
2327

2428
# TODO: Implement blockaddress in GlobalISel and remove this flag!
2529
if (CMAKE_C_COMPILER_ID STREQUAL "Clang")

cmake/OpenMPTesting.cmake

+10-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,16 @@ else()
120120
set(OPENMP_TEST_COMPILER_VERSION "${LLVM_VERSION}")
121121
set(OPENMP_TEST_COMPILER_VERSION_MAJOR "${LLVM_MAJOR_VERSION}")
122122
set(OPENMP_TEST_COMPILER_VERSION_MAJOR_MINOR "${LLVM_MAJOR_VERSION}.${LLVM_MINOR_VERSION}")
123+
# Unfortunately the top-level cmake/config-ix.cmake file mangles CMake's
124+
# CMAKE_THREAD_LIBS_INIT variable from the FindThreads package, so work
125+
# around that, until it is fixed there.
126+
if("${CMAKE_THREAD_LIBS_INIT}" STREQUAL "-lpthread")
127+
set(OPENMP_TEST_COMPILER_THREAD_FLAGS "-pthread")
128+
else()
129+
set(OPENMP_TEST_COMPILER_THREAD_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
130+
endif()
123131
# TODO: Implement blockaddress in GlobalISel and remove this flag!
124-
set(OPENMP_TEST_COMPILER_OPENMP_FLAGS "-fopenmp -fno-experimental-isel")
132+
set(OPENMP_TEST_COMPILER_OPENMP_FLAGS "-fopenmp ${OPENMP_TEST_COMPILER_THREAD_FLAGS} -fno-experimental-isel")
125133
endif()
126134

127135
# Function to set compiler features for use in lit.
@@ -167,7 +175,7 @@ function(add_openmp_testsuite target comment)
167175
add_lit_testsuite(${target}
168176
${comment}
169177
${ARG_UNPARSED_ARGUMENTS}
170-
DEPENDS clang clang-headers FileCheck ${ARG_DEPENDS}
178+
DEPENDS clang clang-resource-headers FileCheck ${ARG_DEPENDS}
171179
ARGS ${ARG_ARGS}
172180
)
173181
endif()

libomptarget/CMakeLists.txt

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
##===----------------------------------------------------------------------===##
22
#
3-
# The LLVM Compiler Infrastructure
4-
#
5-
# This file is dual licensed under the MIT and the University of Illinois Open
6-
# Source Licenses. See LICENSE.txt for details.
3+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76
#
87
##===----------------------------------------------------------------------===##
98
#
@@ -41,13 +40,17 @@ set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} nvptx64-nvidia-cuda")
4140
# the list of supported targets in the current system.
4241
set (LIBOMPTARGET_SYSTEM_TARGETS "")
4342

44-
# If building this library in debug mode, we define a macro to enable
45-
# dumping progress messages at runtime.
43+
# Check whether using debug mode. In debug mode, allow dumping progress
44+
# messages at runtime by default. Otherwise, it can be enabled
45+
# independently using the LIBOMPTARGET_ENABLE_DEBUG option.
4646
string( TOLOWER "${CMAKE_BUILD_TYPE}" LIBOMPTARGET_CMAKE_BUILD_TYPE)
4747
if(LIBOMPTARGET_CMAKE_BUILD_TYPE MATCHES debug)
48+
option(LIBOMPTARGET_ENABLE_DEBUG "Allow debug output with the environment variable LIBOMPTARGET_DEBUG=1" ON)
49+
else()
50+
option(LIBOMPTARGET_ENABLE_DEBUG "Allow debug output with the environment variable LIBOMPTARGET_DEBUG=1" OFF)
51+
endif()
52+
if(LIBOMPTARGET_ENABLE_DEBUG)
4853
add_definitions(-DOMPTARGET_DEBUG)
49-
add_definitions(-g)
50-
add_definitions(-O0)
5154
endif()
5255

5356
include_directories(include)

libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#
22
#//===----------------------------------------------------------------------===//
33
#//
4-
#// The LLVM Compiler Infrastructure
5-
#//
6-
#// This file is dual licensed under the MIT and the University of Illinois Open
7-
#// Source Licenses. See LICENSE.txt for details.
4+
#// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5+
#// See https://llvm.org/LICENSE.txt for license information.
6+
#// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87
#//
98
#//===----------------------------------------------------------------------===//
109
#

libomptarget/cmake/Modules/LibomptargetNVPTXBitcodeLibrary.cmake

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#
22
#//===----------------------------------------------------------------------===//
33
#//
4-
#// The LLVM Compiler Infrastructure
5-
#//
6-
#// This file is dual licensed under the MIT and the University of Illinois Open
7-
#// Source Licenses. See LICENSE.txt for details.
4+
#// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5+
#// See https://llvm.org/LICENSE.txt for license information.
6+
#// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87
#//
98
#//===----------------------------------------------------------------------===//
109
#

libomptarget/cmake/Modules/LibomptargetUtils.cmake

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#
22
#//===----------------------------------------------------------------------===//
33
#//
4-
#// The LLVM Compiler Infrastructure
5-
#//
6-
#// This file is dual licensed under the MIT and the University of Illinois Open
7-
#// Source Licenses. See LICENSE.txt for details.
4+
#// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5+
#// See https://llvm.org/LICENSE.txt for license information.
6+
#// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87
#//
98
#//===----------------------------------------------------------------------===//
109
#

libomptarget/deviceRTLs/CMakeLists.txt

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
##===----------------------------------------------------------------------===##
22
#
3-
# The LLVM Compiler Infrastructure
4-
#
5-
# This file is dual licensed under the MIT and the University of Illinois Open
6-
# Source Licenses. See LICENSE.txt for details.
3+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76
#
87
# ##===----------------------------------------------------------------------===##
98
#

libomptarget/deviceRTLs/nvptx/CMakeLists.txt

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
##===----------------------------------------------------------------------===##
22
#
3-
# The LLVM Compiler Infrastructure
4-
#
5-
# This file is dual licensed under the MIT and the University of Illinois Open
6-
# Source Licenses. See LICENSE.txt for details.
3+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76
#
87
##===----------------------------------------------------------------------===##
98
#

libomptarget/deviceRTLs/nvptx/src/cancel.cu

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//===------ cancel.cu - NVPTX OpenMP cancel interface ------------ CUDA -*-===//
22
//
3-
// The LLVM Compiler Infrastructure
4-
//
5-
// This file is dual licensed under the MIT and the University of Illinois Open
6-
// Source Licenses. See LICENSE.txt for details.
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76
//
87
//===----------------------------------------------------------------------===//
98
//

libomptarget/deviceRTLs/nvptx/src/critical.cu

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//===------ critical.cu - NVPTX OpenMP critical ------------------ CUDA -*-===//
22
//
3-
// The LLVM Compiler Infrastructure
4-
//
5-
// This file is dual licensed under the MIT and the University of Illinois Open
6-
// Source Licenses. See LICENSE.txt for details.
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76
//
87
//===----------------------------------------------------------------------===//
98
//

libomptarget/deviceRTLs/nvptx/src/data_sharing.cu

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//===----- data_sharing.cu - NVPTX OpenMP debug utilities -------- CUDA -*-===//
22
//
3-
// The LLVM Compiler Infrastructure
4-
//
5-
// This file is dual licensed under the MIT and the University of Illinois Open
6-
// Source Licenses. See LICENSE.txt for details.
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76
//
87
//===----------------------------------------------------------------------===//
98
//

libomptarget/deviceRTLs/nvptx/src/debug.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//===------------- debug.h - NVPTX OpenMP debug macros ----------- CUDA -*-===//
22
//
3-
// The LLVM Compiler Infrastructure
4-
//
5-
// This file is dual licensed under the MIT and the University of Illinois Open
6-
// Source Licenses. See LICENSE.txt for details.
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76
//
87
//===----------------------------------------------------------------------===//
98
//

libomptarget/deviceRTLs/nvptx/src/interface.h

+11-43
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
//===------- interface.h - NVPTX OpenMP interface definitions ---- CUDA -*-===//
22
//
3-
// The LLVM Compiler Infrastructure
4-
//
5-
// This file is dual licensed under the MIT and the University of Illinois Open
6-
// Source Licenses. See LICENSE.txt for details.
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76
//
87
//===----------------------------------------------------------------------===//
98
//
109
// This file contains debug macros to be used in the application.
1110
//
1211
// This file contains all the definitions that are relevant to
1312
// the interface. The first section contains the interface as
14-
// declared by OpenMP. A second section includes library private calls
15-
// (mostly debug, temporary?) The third section includes the compiler
13+
// declared by OpenMP. The second section includes the compiler
1614
// specific interfaces.
1715
//
1816
//===----------------------------------------------------------------------===//
@@ -201,6 +199,7 @@ typedef void (*kmp_CopyToScratchpadFctPtr)(void *reduceData, void *scratchpad,
201199
typedef void (*kmp_LoadReduceFctPtr)(void *reduceData, void *scratchpad,
202200
int32_t index, int32_t width,
203201
int32_t reduce);
202+
typedef void (*kmp_ListGlobalFctPtr)(void *buffer, int idx, void *reduce_data);
204203

205204
// task defs
206205
typedef struct kmp_TaskDescr kmp_TaskDescr;
@@ -211,51 +210,14 @@ typedef struct kmp_TaskDescr {
211210
int32_t partId; // unused
212211
kmp_TaskFctPtr destructors; // destructor of c++ first private
213212
} kmp_TaskDescr;
214-
// task dep defs
215-
#define KMP_TASKDEP_IN 0x1u
216-
#define KMP_TASKDEP_OUT 0x2u
217-
typedef struct kmp_TaskDep_Public {
218-
void *addr;
219-
size_t len;
220-
uint8_t flags; // bit 0: in, bit 1: out
221-
} kmp_TaskDep_Public;
222-
223-
// flags that interpret the interface part of tasking flags
224-
#define KMP_TASK_IS_TIED 0x1
225-
#define KMP_TASK_FINAL 0x2
226-
#define KMP_TASK_MERGED_IF0 0x4 /* unused */
227-
#define KMP_TASK_DESTRUCTOR_THUNK 0x8
228-
229-
// flags for task setup return
230-
#define KMP_CURRENT_TASK_NOT_SUSPENDED 0
231-
#define KMP_CURRENT_TASK_SUSPENDED 1
232213

233214
// sync defs
234215
typedef int32_t kmp_CriticalName[8];
235216

236-
////////////////////////////////////////////////////////////////////////////////
237-
// flags for kstate (all bits initially off)
238-
////////////////////////////////////////////////////////////////////////////////
239-
240-
// first 2 bits used by kmp_Reduction (defined in kmp_reduction.cpp)
241-
#define KMP_REDUCTION_MASK 0x3
242-
#define KMP_SKIP_NEXT_CALL 0x4
243-
#define KMP_SKIP_NEXT_CANCEL_BARRIER 0x8
244-
245-
////////////////////////////////////////////////////////////////////////////////
246-
// data
247-
////////////////////////////////////////////////////////////////////////////////
248-
249217
////////////////////////////////////////////////////////////////////////////////
250218
// external interface
251219
////////////////////////////////////////////////////////////////////////////////
252220

253-
// query
254-
EXTERN int32_t __kmpc_global_num_threads(kmp_Ident *loc); // missing
255-
EXTERN int32_t __kmpc_bound_thread_num(kmp_Ident *loc); // missing
256-
EXTERN int32_t __kmpc_bound_num_threads(kmp_Ident *loc); // missing
257-
EXTERN int32_t __kmpc_in_parallel(kmp_Ident *loc); // missing
258-
259221
// parallel
260222
EXTERN int32_t __kmpc_global_thread_num(kmp_Ident *loc);
261223
EXTERN void __kmpc_push_num_threads(kmp_Ident *loc, int32_t global_tid,
@@ -411,6 +373,12 @@ EXTERN int32_t __kmpc_nvptx_parallel_reduce_nowait_simple_generic(
411373
EXTERN int32_t __kmpc_nvptx_simd_reduce_nowait(
412374
int32_t global_tid, int32_t num_vars, size_t reduce_size, void *reduce_data,
413375
kmp_ShuffleReductFctPtr shflFct, kmp_InterWarpCopyFctPtr cpyFct);
376+
EXTERN int32_t __kmpc_nvptx_teams_reduce_nowait_v2(
377+
kmp_Ident *loc, int32_t global_tid, void *global_buffer,
378+
int32_t num_of_records, void *reduce_data, kmp_ShuffleReductFctPtr shflFct,
379+
kmp_InterWarpCopyFctPtr cpyFct, kmp_ListGlobalFctPtr lgcpyFct,
380+
kmp_ListGlobalFctPtr lgredFct, kmp_ListGlobalFctPtr glcpyFct,
381+
kmp_ListGlobalFctPtr glredFct);
414382
EXTERN int32_t __kmpc_nvptx_teams_reduce_nowait(
415383
int32_t global_tid, int32_t num_vars, size_t reduce_size, void *reduce_data,
416384
kmp_ShuffleReductFctPtr shflFct, kmp_InterWarpCopyFctPtr cpyFct,

0 commit comments

Comments
 (0)