[Openmp-commits] [openmp] Add openmp support to System z (PR #66081)

Ulrich Weigand via Openmp-commits openmp-commits at lists.llvm.org
Wed Oct 25 06:04:22 PDT 2023


uweigand wrote:

> I went over my work branch, and noticed two more things that would be good to have in this PR. The following makes unwinding work in testcases; we already have similar definitions for sanitizers:
> 
> ```
> diff --git a/openmp/runtime/test/lit.cfg b/openmp/runtime/test/lit.cfg
> index 650d3853e851..27ff057c85f6 100644
> --- a/openmp/runtime/test/lit.cfg
> +++ b/openmp/runtime/test/lit.cfg
> @@ -51,6 +51,8 @@ flags = " -I " + config.test_source_root + \
>      " " + config.test_extra_flags
>  if config.has_omit_frame_pointer_flag:
>      flags += " -fno-omit-frame-pointer"
> +if config.target_arch == "s390x":
> +    flags += " -mbackchain"
>  
>  config.test_flags = " -I " + config.omp_header_directory + flags
>  config.test_flags_use_compiler_omp_h = flags
> ```

This should definitely go in.

> The second one is more questionable:
> 
> ```
> --- a/openmp/runtime/src/kmp_tasking.cpp
> +++ b/openmp/runtime/src/kmp_tasking.cpp
> @@ -1737,6 +1737,9 @@ __kmpc_omp_reg_task_with_affinity(ident_t *loc_ref, kmp_int32 gtid,
>  // gtid: global thread ID of caller
>  // task: the task to invoke
>  // current_task: the task to resume after task invocation
> +#ifdef __s390x__
> +__attribute__((target("backchain")))
> +#endif
>  static void __kmp_invoke_task(kmp_int32 gtid, kmp_task_t *task,
>                                kmp_taskdata_t *current_task) {
>    kmp_taskdata_t *taskdata = KMP_TASK_TO_TASKDATA(task);
> ```
> 
> In order for unwinding to work, all the code involved in the call chain must store backchain on the stack. In 99% of the cases this is test code, which is covered by the first diff. However, in one particular case there is library code involved. Building the whole library with backchain support would be an overkill, hence this solution. I understand that I'm proposing to add code that is relevant only to testing to the main logic, so I'm open to different approaches here.

So I'm wondering: why is this then working on Intel, where the frame pointer is also omitted by default.  Also, why just this one function and not its callers?
 


https://github.com/llvm/llvm-project/pull/66081


More information about the Openmp-commits mailing list