[Openmp-commits] [openmp] [OpenMP][SystemZ] Compile __kmpc_omp_task_begin_if0() with backchain (PR #71834)
Ilya Leoshkevich via Openmp-commits
openmp-commits at lists.llvm.org
Thu Nov 9 10:00:05 PST 2023
https://github.com/iii-i created https://github.com/llvm/llvm-project/pull/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.
>From b0cc4258ef4662e3139b3c5e4a92918d85cfcbd8 Mon Sep 17 00:00:00 2001
From: Ilya Leoshkevich <iii at linux.ibm.com>
Date: Thu, 9 Nov 2023 18:53:03 +0100
Subject: [PATCH] [OpenMP][SystemZ] Compile __kmpc_omp_task_begin_if0() with
backchain
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.
---
openmp/runtime/src/kmp_tasking.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
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