[Openmp-commits] [openmp] 72552fc - [OpenMP][SystemZ] Compile __kmpc_omp_task_begin_if0() with backchain (#71834)

via Openmp-commits openmp-commits at lists.llvm.org
Thu Nov 9 14:54:20 PST 2023


Author: Ilya Leoshkevich
Date: 2023-11-09T23:54:16+01:00
New Revision: 72552fc5cbc0cf2f44508948a075d14f0d5aa2b3

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

LOG: [OpenMP][SystemZ] Compile __kmpc_omp_task_begin_if0() with backchain (#71834)

OpenMP runtime fails to build on SystemZ with clang with the following
error message:

    LLVM ERROR: Unsupported stack frame traversal count

__kmpc_omp_task_begin_if0() uses OMPT_GET_FRAME_ADDRESS(1), which
delegates to __builtin_frame_address(), which in turn works with nonzero
values on SystemZ only if backchain is in use. If backchain is not in
use, the above error is emitted.

Compile __kmpc_omp_task_begin_if0() with backchain. Note that this only
resolves the build error. If at runtime its caller is compiled without
backchain, __builtin_frame_address() will produce an incorrect value,
but will not cause a crash. Since the value is relevant only for OMPT,
this is acceptable.

Added: 
    

Modified: 
    openmp/runtime/src/kmp_tasking.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/src/kmp_tasking.cpp b/openmp/runtime/src/kmp_tasking.cpp
index f90ae9cabab79fa..6e8b948efa064fe 100644
--- a/openmp/runtime/src/kmp_tasking.cpp
+++ b/openmp/runtime/src/kmp_tasking.cpp
@@ -839,6 +839,14 @@ static void __kmpc_omp_task_begin_if0_ompt(ident_t *loc_ref, kmp_int32 gtid,
 // loc_ref: source location information; points to beginning of task block.
 // gtid: global thread number.
 // task: task thunk for the started task.
+#ifdef __s390x__
+// This is required for OMPT_GET_FRAME_ADDRESS(1) to compile on s390x.
+// In order for it to work correctly, the caller also needs to be compiled with
+// backchain. If a caller is compiled without backchain,
+// OMPT_GET_FRAME_ADDRESS(1) will produce an incorrect value, but will not
+// crash.
+__attribute__((target("backchain")))
+#endif
 void __kmpc_omp_task_begin_if0(ident_t *loc_ref, kmp_int32 gtid,
                                kmp_task_t *task) {
 #if OMPT_SUPPORT


        


More information about the Openmp-commits mailing list