| Issue |
234164
|
| Summary |
[OpenMP] Build failure if optional OMPT support is disabled
|
| Labels |
|
| Assignees |
|
| Reporter |
Thyre
|
When trying to build LLVM's OpenMP runtime with the optional OMPT support disabled, the build runs into a failure when building `kmp_barrier.cpp`. I'm using the Clang 23.1.3 provided by Arch Linux here, but assume that the same failure occurs with a trunk build.
**Build command:**
```console
$ cmake -S runtimes -B reprod -G Ninja -DLLVM_ENABLE_RUNTIMES=openmp -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DLIBOMP_OMPT_SUPPORT=ON -DLIBOMP_OMPT_OPTIONAL=OFF
[...]
$ ninja -C reprod omp
```
**Build failure:**
```
FAILED: [code=1] openmp/runtime/src/CMakeFiles/obj.omp.dir/kmp_barrier.cpp.o
/usr/bin/clang++ -DKMP_SPEC_DATE=201611 -DKMP_SPEC_VERSION=5.0 -D_GLIBCXX_NO_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/jreuter/Projects/Compilers/llvm-project/reprod/openmp/runtime/src -I/home/jreuter/Projects/Compilers/llvm-project/openmp/runtime/src -I/home/jreuter/Projects/Compilers/llvm-project/openmp/runtime/src/i18n -I/home/jreuter/Projects/Compilers/llvm-project/openmp/runtime/src/include -I/home/jreuter/Projects/Compilers/llvm-project/openmp/runtime/src/thirdparty/ittnotify -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Xclang -fno-pch-timestamp -Wall -fcolor-diagnostics -Wcast-qual -Wformat-pedantic -Wimplicit-fallthrough -Wsign-compare -Wno-extra -Wno-pedantic -fno-semantic-interposition -fdata-sections -O3 -DNDEBUG -std=c++17 -fPIC -D _GNU_SOURCE -D _REENTRANT -U_GLIBCXX_ASSERTIONS -fno-exceptions -fno-rtti -Wno-covered-switch-default -Wno-frame-address -Wno-strict-aliasing -Wno-switch -Wno-uninitialized -Wno-return-type-c-linkage -Wno-cast-qual -Wno-int-to-void-pointer-cast -MD -MT openmp/runtime/src/CMakeFiles/obj.omp.dir/kmp_barrier.cpp.o -MF openmp/runtime/src/CMakeFiles/obj.omp.dir/kmp_barrier.cpp.o.d -o openmp/runtime/src/CMakeFiles/obj.omp.dir/kmp_barrier.cpp.o -c /home/jreuter/Projects/Compilers/llvm-project/openmp/runtime/src/kmp_barrier.cpp
/home/jreuter/Projects/Compilers/llvm-project/openmp/runtime/src/kmp_barrier.cpp:1863:13: error: unknown type name 'barrier_kind'; did you mean 'barrier_type'?
1863 | switch (barrier_kind) {
| ^~~~~~~~~~~~
| barrier_type
/home/jreuter/Projects/Compilers/llvm-project/openmp/runtime/src/kmp.h:2152:6: note: 'barrier_type' declared here
2152 | enum barrier_type {
| ^
/home/jreuter/Projects/Compilers/llvm-project/openmp/runtime/src/kmp_barrier.cpp:1863:25: error: expected unqualified-id
1863 | switch (barrier_kind) {
| ^
/home/jreuter/Projects/Compilers/llvm-project/openmp/runtime/src/kmp_barrier.cpp:2309:43: error: use of undeclared identifier 'ompt_state'; did you mean 'ompd_state'?
2309 | this_thr->th.ompt_thread_info.state = ompt_state;
| ^~~~~~~~~~
| ompd_state
/home/jreuter/Projects/Compilers/llvm-project/openmp/runtime/src/ompd-specific.h:34:17: note: 'ompd_state' declared here
34 | extern uint64_t ompd_state;
| ^
/home/jreuter/Projects/Compilers/llvm-project/openmp/runtime/src/kmp_barrier.cpp:2309:43: error: assigning to 'ompt_state_t' (aka 'enum ompt_state_t') from incompatible type 'uint64_t' (aka 'unsigned long')
2309 | this_thr->th.ompt_thread_info.state = ompt_state;
| ^~~~~~~~~~
4 errors generated.
[35/41] Building CXX object openmp/runtime/src/CMakeFiles/obj.omp.dir/kmp_affinity.cpp.o
```
Looking into the failures, they were likely introduced in #95602 (7a72856af8b30f50e546b8368596fdc5f44cbca9). Here, a differentiation between different barrier types was implemented. The evaluation is only done if `OMPT_OPTIONAL` is set, but the result is also used without this macro being set, leading to the build failures above.
Depending on if the state changes should be reported even if `OMPT_OPTIONAL` is unset, the state change either needs to be moved into the `OMPT_OPTIONAL` block, or the state evaluation into the more general `OMPT_SUPPORT`.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs