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

Ilya Leoshkevich via Openmp-commits openmp-commits at lists.llvm.org
Tue Oct 17 18:01:36 PDT 2023


iii-i wrote:

I now have two fixups for the existing "Add openmp support to System z" commit; please consider making an update. The number of failures that I'm seeing locally is down from 45 to 24.

First, apparently there is an additional possiblity for `print_possible_return_addresses()`:

```
--- a/openmp/runtime/test/ompt/callback.h
+++ b/openmp/runtime/test/ompt/callback.h
@@ -232,10 +232,18 @@ ompt_label_##id:
 // On s390x the NOP instruction is 2 bytes long. For non-void runtime
 // functions Clang inserts a STY instruction (but only if compiling under
 // -fno-PIC which will be the default with Clang 8.0, another 6 bytes).
+//
+// Another possibility is:
+//
+//                brasl %r14,__kmpc_end_master at plt
+//   a7 f4 00 02  j 0f
+//   47 00 00 00  0: nop
+//   a7 f4 00 02  j addr
+//                addr:
 #define print_possible_return_addresses(addr)                                  \
-  printf("%" PRIu64 ": current_address=%p or %p\n",                            \
+  printf("%" PRIu64 ": current_address=%p or %p or %p\n",                      \
          ompt_get_thread_data()->value, ((char *)addr) - 2,                    \
-         ((char *)addr) - 8)
+         ((char *)addr) - 8, ((char *)addr) - 12)
 #else
 #error Unsupported target architecture, cannot determine address offset!
 #endif
```

Second:

```
--- a/openmp/runtime/src/z_Linux_asm.S
+++ b/openmp/runtime/src/z_Linux_asm.S
@@ -2310,9 +2310,18 @@ __kmp_invoke_microtask:
        .cfi_startproc
 
        stmg    %r6,%r14,48(%r15)
+       .cfi_offset %r6, -112
+       .cfi_offset %r7, -104
+       .cfi_offset %r8, -96
+       .cfi_offset %r9, -88
+       .cfi_offset %r10, -80
+       .cfi_offset %r11, -72
+       .cfi_offset %r12, -64
+       .cfi_offset %r13, -56
+       .cfi_offset %r14, -48
+       .cfi_offset %r15, -40
        lgr     %r11,%r15
-       .cfi_def_cfa    %r15, 0
-       .cfi_offset     %r15, 0
+       .cfi_def_cfa %r11, 160
 
        // Compute the dynamic stack size:
        //
@@ -2342,7 +2351,7 @@ __kmp_invoke_microtask:
 #if OMPT_SUPPORT
        // Save frame pointer into exit_frame
        lg      %r8,160(%r11)
-       stg     %r15,0(%r8)
+       stg     %r11,0(%r8)
 #endif
 
        // Prepare arguments for the pkfn function (first 5 using r2-r6 registers)
```

The first part fixes unwinding (GDB could not unwind past this function). The second part fixes several tests; the problem is that `OMPT_GET_FRAME_ADDRESS(0)` is supposed to return the value of the stack pointer at entry, and not the current one.

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


More information about the Openmp-commits mailing list