[Openmp-commits] [openmp] [OpenMP][OMPT] Indicate loop schedule for worksharing-loop events (PR #97429)

via Openmp-commits openmp-commits at lists.llvm.org
Tue Jul 2 14:03:02 PDT 2024


https://github.com/jprotze updated https://github.com/llvm/llvm-project/pull/97429

>From 7f3c21946278b5483928c3c031a1c99fc4c8ce73 Mon Sep 17 00:00:00 2001
From: Joachim Jenke <jenke at itc.rwth-aachen.de>
Date: Tue, 2 Jul 2024 17:32:20 +0200
Subject: [PATCH 1/3] [OpenMP][OMPT] Indicate loop schedule for
 worksharing-loop events

Use more specific values from `ompt_work_t` to allow the tool identify the
schedule of a worksharing-loop. With this patch, the runtime will report the
schedule chosen by the runtime rather than necessarily the schedule literally
requested by the clause.
E.g., for guided + just one iteration per thread, the runtime would choose
static.

Fixes issue #63904
---
 openmp/runtime/src/kmp_csupport.cpp           |   4 +-
 openmp/runtime/src/kmp_dispatch.cpp           |   4 +-
 openmp/runtime/src/kmp_sched.cpp              |   4 +-
 openmp/runtime/src/ompt-specific.h            |  22 +++
 openmp/runtime/test/ompt/callback.h           | 174 +++++-------------
 .../synchronization/ordered_dependences.c     |  10 +-
 openmp/runtime/test/ompt/tasks/taskloop.c     |   4 +-
 .../test/ompt/tasks/taskloop_dispatch.c       |   2 +-
 .../test/ompt/teams/distribute_dispatch.c     |   8 +-
 .../runtime/test/ompt/worksharing/for/auto.c  |   3 +
 .../ompt/worksharing/for/auto_serialized.c    |   3 +
 .../test/ompt/worksharing/for/auto_split.c    |   3 +
 .../runtime/test/ompt/worksharing/for/base.h  |  28 ++-
 .../ompt/worksharing/for/base_serialized.h    |  15 +-
 .../test/ompt/worksharing/for/base_split.h    |  30 ++-
 .../ompt/worksharing/for/guided_serialized.c  |   3 +
 .../test/ompt/worksharing/for/loop_dispatch.c |  48 ++---
 .../test/ompt/worksharing/for/runtime.c       |   3 +
 .../ompt/worksharing/for/runtime_serialized.c |   3 +
 .../test/ompt/worksharing/for/runtime_split.c |   3 +
 .../runtime/test/ompt/worksharing/sections.c  |   4 +-
 .../test/ompt/worksharing/sections_dispatch.c |   4 +-
 openmp/runtime/test/ompt/worksharing/single.c |   2 +-
 23 files changed, 184 insertions(+), 200 deletions(-)

diff --git a/openmp/runtime/src/kmp_csupport.cpp b/openmp/runtime/src/kmp_csupport.cpp
index d638acd85116d..b33c16fa79a65 100644
--- a/openmp/runtime/src/kmp_csupport.cpp
+++ b/openmp/runtime/src/kmp_csupport.cpp
@@ -2006,13 +2006,13 @@ void __kmpc_for_static_fini(ident_t *loc, kmp_int32 global_tid) {
 
 #if OMPT_SUPPORT && OMPT_OPTIONAL
   if (ompt_enabled.ompt_callback_work) {
-    ompt_work_t ompt_work_type = ompt_work_loop;
+    ompt_work_t ompt_work_type = ompt_work_loop_static;
     ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
     ompt_task_info_t *task_info = __ompt_get_task_info_object(0);
     // Determine workshare type
     if (loc != NULL) {
       if ((loc->flags & KMP_IDENT_WORK_LOOP) != 0) {
-        ompt_work_type = ompt_work_loop;
+        ompt_work_type = ompt_work_loop_static;
       } else if ((loc->flags & KMP_IDENT_WORK_SECTIONS) != 0) {
         ompt_work_type = ompt_work_sections;
       } else if ((loc->flags & KMP_IDENT_WORK_DISTRIBUTE) != 0) {
diff --git a/openmp/runtime/src/kmp_dispatch.cpp b/openmp/runtime/src/kmp_dispatch.cpp
index 8475e80f0b02d..b538afc7916a1 100644
--- a/openmp/runtime/src/kmp_dispatch.cpp
+++ b/openmp/runtime/src/kmp_dispatch.cpp
@@ -1164,7 +1164,7 @@ __kmp_dispatch_init(ident_t *loc, int gtid, enum sched_type schedule, T lb,
     ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
     ompt_task_info_t *task_info = __ompt_get_task_info_object(0);
     ompt_callbacks.ompt_callback(ompt_callback_work)(
-        ompt_work_loop, ompt_scope_begin, &(team_info->parallel_data),
+        ompt_get_work_schedule(pr->schedule), ompt_scope_begin, &(team_info->parallel_data),
         &(task_info->task_data), pr->u.p.tc, OMPT_LOAD_RETURN_ADDRESS(gtid));
   }
 #endif
@@ -2121,7 +2121,7 @@ int __kmp_dispatch_next_algorithm(int gtid,
       ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);              \
       ompt_task_info_t *task_info = __ompt_get_task_info_object(0);            \
       ompt_callbacks.ompt_callback(ompt_callback_work)(                        \
-          ompt_work_loop, ompt_scope_end, &(team_info->parallel_data),         \
+          ompt_get_work_schedule(pr->schedule), ompt_scope_end, &(team_info->parallel_data),         \
           &(task_info->task_data), 0, codeptr);                                \
     }                                                                          \
   }
diff --git a/openmp/runtime/src/kmp_sched.cpp b/openmp/runtime/src/kmp_sched.cpp
index 4d764e441f283..2e0dfac6eeb3b 100644
--- a/openmp/runtime/src/kmp_sched.cpp
+++ b/openmp/runtime/src/kmp_sched.cpp
@@ -103,7 +103,7 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
 #if OMPT_SUPPORT && OMPT_OPTIONAL
   ompt_team_info_t *team_info = NULL;
   ompt_task_info_t *task_info = NULL;
-  ompt_work_t ompt_work_type = ompt_work_loop;
+  ompt_work_t ompt_work_type = ompt_work_loop_static;
 
   static kmp_int8 warn = 0;
 
@@ -114,7 +114,7 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
     // Determine workshare type
     if (loc != NULL) {
       if ((loc->flags & KMP_IDENT_WORK_LOOP) != 0) {
-        ompt_work_type = ompt_work_loop;
+        ompt_work_type = ompt_work_loop_static;
       } else if ((loc->flags & KMP_IDENT_WORK_SECTIONS) != 0) {
         ompt_work_type = ompt_work_sections;
       } else if ((loc->flags & KMP_IDENT_WORK_DISTRIBUTE) != 0) {
diff --git a/openmp/runtime/src/ompt-specific.h b/openmp/runtime/src/ompt-specific.h
index 63c59c3fb3984..84e84e5327cdc 100644
--- a/openmp/runtime/src/ompt-specific.h
+++ b/openmp/runtime/src/ompt-specific.h
@@ -130,6 +130,28 @@ inline const char *ompt_get_runtime_version() {
   return &__kmp_version_lib_ver[KMP_VERSION_MAGIC_LEN];
 }
 
+inline ompt_work_t ompt_get_work_schedule(enum sched_type schedule){
+  printf("Schedule val: %i\n", schedule);
+  switch (SCHEDULE_WITHOUT_MODIFIERS(schedule)) {
+  case kmp_sch_static_chunked:
+  case kmp_sch_static_balanced: // Chunk is calculated in the switch above
+  case kmp_sch_static_greedy:
+    return ompt_work_loop_static;
+  case kmp_sch_dynamic_chunked:
+  case kmp_sch_static_steal:
+    return ompt_work_loop_dynamic;
+  case kmp_sch_guided_iterative_chunked:
+  case kmp_sch_guided_analytical_chunked:
+  case kmp_sch_guided_chunked:
+  case kmp_sch_guided_simd:
+    return ompt_work_loop_guided;
+  default:
+    return ompt_work_loop_other;
+  }
+}
+
+
+
 class OmptReturnAddressGuard {
 private:
   bool SetAddress{false};
diff --git a/openmp/runtime/test/ompt/callback.h b/openmp/runtime/test/ompt/callback.h
index f07176cc5be66..64e7d448f0edf 100644
--- a/openmp/runtime/test/ompt/callback.h
+++ b/openmp/runtime/test/ompt/callback.h
@@ -47,6 +47,40 @@ static const char* ompt_cancel_flag_t_values[] = {
   "ompt_cancel_discarded_task"
 };
 
+static const char* ompt_work_t_values[] = {
+  "undefined",
+  "ompt_work_loop",
+  "ompt_work_sections",
+  "ompt_work_single_executor",
+  "ompt_work_single_other",
+  "ompt_work_workshare",
+  "ompt_work_distribute",
+  "ompt_work_taskloop",
+  "ompt_work_scope",
+  "ompt_work_workdistribute",
+  "ompt_work_loop_static",
+  "ompt_work_loop_dynamic",
+  "ompt_work_loop_guided",
+  "ompt_work_loop_other"
+};
+
+static const char* ompt_work_events_t_values[] = {
+  "undefined",
+  "ompt_event_loop",
+  "ompt_event_sections",
+  "ompt_event_single_in_block",
+  "ompt_event_single_others",
+  "ompt_event_workshare",
+  "ompt_event_distribute",
+  "ompt_event_taskloop",
+  "ompt_event_scope",
+  "ompt_event_workdistribute",
+  "ompt_event_loop_static",
+  "ompt_event_loop_dynamic",
+  "ompt_event_loop_guided",
+  "ompt_event_loop_other"
+};
+
 static const char *ompt_dependence_type_t_values[36] = {
     "ompt_dependence_type_UNDEFINED",
     "ompt_dependence_type_in", // 1
@@ -853,140 +887,20 @@ on_ompt_callback_work(
   switch(endpoint)
   {
     case ompt_scope_begin:
-      switch(wstype)
-      {
-        case ompt_work_loop:
-        case ompt_work_loop_static:
-        case ompt_work_loop_dynamic:
-        case ompt_work_loop_guided:
-        case ompt_work_loop_other:
-        // TODO: add schedule attribute for the different work_loop types.
-        // e.g., ", schedule=%s", ..., ompt_schedule_values[wstype]
-          printf("%" PRIu64 ":" _TOOL_PREFIX
-                 " ompt_event_loop_begin: parallel_id=%" PRIu64
-                 ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64
-                 "\n",
-                 ompt_get_thread_data()->value, parallel_data->value,
-                 task_data->value, codeptr_ra, count);
-          break;
-        case ompt_work_sections:
           printf("%" PRIu64 ":" _TOOL_PREFIX
-                 " ompt_event_sections_begin: parallel_id=%" PRIu64
-                 ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64
+                 " %s_begin: parallel_id=%" PRIu64
+                 ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64
                  "\n",
-                 ompt_get_thread_data()->value, parallel_data->value,
-                 task_data->value, codeptr_ra, count);
-          break;
-        case ompt_work_single_executor:
-          printf("%" PRIu64 ":" _TOOL_PREFIX
-                 " ompt_event_single_in_block_begin: parallel_id=%" PRIu64
-                 ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64
-                 "\n",
-                 ompt_get_thread_data()->value, parallel_data->value,
-                 task_data->value, codeptr_ra, count);
-          break;
-        case ompt_work_single_other:
-          printf("%" PRIu64 ":" _TOOL_PREFIX
-                 " ompt_event_single_others_begin: parallel_id=%" PRIu64
-                 ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n",
-                 ompt_get_thread_data()->value, parallel_data->value,
+                 ompt_get_thread_data()->value, ompt_work_events_t_values[wstype], parallel_data->value,
                  task_data->value, codeptr_ra, count);
-          break;
-        case ompt_work_workshare:
-          //impl
-          break;
-        case ompt_work_distribute:
-          printf("%" PRIu64 ":" _TOOL_PREFIX
-                 " ompt_event_distribute_begin: parallel_id=%" PRIu64
-                 ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64
-                 "\n",
-                 ompt_get_thread_data()->value, parallel_data->value,
-                 task_data->value, codeptr_ra, count);
-          break;
-        case ompt_work_taskloop:
-          //impl
-          printf("%" PRIu64 ":" _TOOL_PREFIX
-                 " ompt_event_taskloop_begin: parallel_id=%" PRIu64
-                 ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64
-                 "\n",
-                 ompt_get_thread_data()->value, parallel_data->value,
-                 task_data->value, codeptr_ra, count);
-          break;
-        case ompt_work_scope:
-          printf("%" PRIu64 ":" _TOOL_PREFIX
-                 " ompt_event_scope_begin: parallel_id=%" PRIu64
-                 ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64
-                 "\n",
-                 ompt_get_thread_data()->value, parallel_data->value,
-                 task_data->value, codeptr_ra, count);
-          break;
-      }
-      break;
+    break;
     case ompt_scope_end:
-      switch(wstype)
-      {
-        case ompt_work_loop:
-        case ompt_work_loop_static:
-        case ompt_work_loop_dynamic:
-        case ompt_work_loop_guided:
-        case ompt_work_loop_other:
-          printf("%" PRIu64 ":" _TOOL_PREFIX
-                 " ompt_event_loop_end: parallel_id=%" PRIu64
-                 ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n",
-                 ompt_get_thread_data()->value, parallel_data->value,
-                 task_data->value, codeptr_ra, count);
-          break;
-        case ompt_work_sections:
-          printf("%" PRIu64 ":" _TOOL_PREFIX
-                 " ompt_event_sections_end: parallel_id=%" PRIu64
-                 ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n",
-                 ompt_get_thread_data()->value, parallel_data->value,
-                 task_data->value, codeptr_ra, count);
-          break;
-        case ompt_work_single_executor:
-          printf("%" PRIu64 ":" _TOOL_PREFIX
-                 " ompt_event_single_in_block_end: parallel_id=%" PRIu64
-                 ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n",
-                 ompt_get_thread_data()->value, parallel_data->value,
-                 task_data->value, codeptr_ra, count);
-          break;
-        case ompt_work_single_other:
-          printf("%" PRIu64 ":" _TOOL_PREFIX
-                 " ompt_event_single_others_end: parallel_id=%" PRIu64
-                 ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n",
-                 ompt_get_thread_data()->value, parallel_data->value,
-                 task_data->value, codeptr_ra, count);
-          break;
-        case ompt_work_workshare:
-          //impl
-          break;
-        case ompt_work_distribute:
-          printf("%" PRIu64 ":" _TOOL_PREFIX
-                 " ompt_event_distribute_end: parallel_id=%" PRIu64
-                 ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64
-                 "\n",
-                 ompt_get_thread_data()->value, parallel_data->value,
-                 task_data->value, codeptr_ra, count);
-          break;
-        case ompt_work_taskloop:
-          //impl
-          printf("%" PRIu64 ":" _TOOL_PREFIX
-                 " ompt_event_taskloop_end: parallel_id=%" PRIu64
-                 ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64
-                 "\n",
-                 ompt_get_thread_data()->value, parallel_data->value,
-                 task_data->value, codeptr_ra, count);
-          break;
-        case ompt_work_scope:
-          printf("%" PRIu64 ":" _TOOL_PREFIX
-                 " ompt_event_scope_end: parallel_id=%" PRIu64
-                 ", parent_task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64
-                 "\n",
-                 ompt_get_thread_data()->value, parallel_data->value,
-                 task_data->value, codeptr_ra, count);
-          break;
-      }
-      break;
+    printf("%" PRIu64 ":" _TOOL_PREFIX
+            " %s_end: parallel_id=%" PRIu64
+            ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n",
+            ompt_get_thread_data()->value, ompt_work_events_t_values[wstype], parallel_data->value,
+            task_data->value, codeptr_ra, count);
+    break;
     case ompt_scope_beginend:
       printf("ompt_scope_beginend should never be passed to %s\n", __func__);
       exit(-1);
diff --git a/openmp/runtime/test/ompt/synchronization/ordered_dependences.c b/openmp/runtime/test/ompt/synchronization/ordered_dependences.c
index 5b7d56599f0e1..0eb64543d2a64 100644
--- a/openmp/runtime/test/ompt/synchronization/ordered_dependences.c
+++ b/openmp/runtime/test/ompt/synchronization/ordered_dependences.c
@@ -7,7 +7,7 @@
 int main() {
   int a[10][10];
 #pragma omp parallel num_threads(2)
-#pragma omp for ordered(2)
+#pragma omp for ordered(2) schedule(static)
   for (int i = 0; i < 2; i++)
     for (int j = 0; j < 2; j++) {
       a[i][j] = i + j + 1;
@@ -23,8 +23,8 @@ int main() {
 }
 // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
 
-// CHECK: {{^}}[[MASTER:[0-9]+]]: ompt_event_loop_begin:
-// CHECK-SAME: parallel_id={{[0-9]+}}, parent_task_id=[[ITASK:[0-9]+]],
+// CHECK: {{^}}[[MASTER:[0-9]+]]: ompt_event_loop_static_begin:
+// CHECK-SAME: parallel_id={{[0-9]+}}, task_id=[[ITASK:[0-9]+]],
 
 // CHECK: {{^}}[[MASTER]]: ompt_event_dependences: task_id=[[ITASK]],
 // CHECK-SAME: deps=[(0, ompt_dependence_type_source), (0,
@@ -38,8 +38,8 @@ int main() {
 // CHECK-SAME: deps=[(0, ompt_dependence_type_source), (1,
 // CHECK-SAME: ompt_dependence_type_source)], ndeps=2
 
-// CHECK: {{^}}[[WORKER:[0-9]+]]: ompt_event_loop_begin:
-// CHECK-SAME: parallel_id={{[0-9]+}}, parent_task_id=[[ITASK:[0-9]+]],
+// CHECK: {{^}}[[WORKER:[0-9]+]]: ompt_event_loop_static_begin:
+// CHECK-SAME: parallel_id={{[0-9]+}}, task_id=[[ITASK:[0-9]+]],
 
 // CHECK: {{^}}[[WORKER]]: ompt_event_dependences: task_id=[[ITASK]],
 // CHECK-SAME: deps=[(0, ompt_dependence_type_sink), (0,
diff --git a/openmp/runtime/test/ompt/tasks/taskloop.c b/openmp/runtime/test/ompt/tasks/taskloop.c
index af7f778c976ae..8489f8e0ed6dc 100644
--- a/openmp/runtime/test/ompt/tasks/taskloop.c
+++ b/openmp/runtime/test/ompt/tasks/taskloop.c
@@ -37,7 +37,7 @@ int main() {
   // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID1]]
   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_taskloop_begin:
   // CHECK-SAME: parallel_id=[[PARALLEL_ID]]
-  // CHECK-SAME: parent_task_id=[[IMPLICIT_TASK_ID1]]
+  // CHECK-SAME: task_id=[[IMPLICIT_TASK_ID1]]
   // CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]], count=2
   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create:
   // CHECK-SAME: parent_task_id=[[IMPLICIT_TASK_ID1]]
@@ -52,7 +52,7 @@ int main() {
   // CHECK-NOT: {{^}}[[MASTER_ID]]: ompt_event_task_create:
   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_taskloop_end:
   // CHECK-SAME: parallel_id=[[PARALLEL_ID]]
-  // CHECK-SAME: parent_task_id=[[IMPLICIT_TASK_ID1]]
+  // CHECK-SAME: task_id=[[IMPLICIT_TASK_ID1]]
   // CHECK-SAME: count=2
   // CHECK-DAG: {{^}}[[MASTER_ID]]: ompt_event_wait_taskgroup_begin:
   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_taskgroup_end:
diff --git a/openmp/runtime/test/ompt/tasks/taskloop_dispatch.c b/openmp/runtime/test/ompt/tasks/taskloop_dispatch.c
index d4ac609d0b3ed..84e8a71fc9933 100644
--- a/openmp/runtime/test/ompt/tasks/taskloop_dispatch.c
+++ b/openmp/runtime/test/ompt/tasks/taskloop_dispatch.c
@@ -32,7 +32,7 @@ int main() {
 
   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_taskloop_begin:
   // CHECK-SAME: parallel_id=[[PARALLEL_ID]]
-  // CHECK-SAME: parent_task_id=[[IMPLICIT_TASK_ID1]]
+  // CHECK-SAME: task_id=[[IMPLICIT_TASK_ID1]]
   // CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]], count=16
 
   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create:
diff --git a/openmp/runtime/test/ompt/teams/distribute_dispatch.c b/openmp/runtime/test/ompt/teams/distribute_dispatch.c
index 3254a287236fd..1dcede84f28ec 100644
--- a/openmp/runtime/test/ompt/teams/distribute_dispatch.c
+++ b/openmp/runtime/test/ompt/teams/distribute_dispatch.c
@@ -24,28 +24,28 @@ int main() {
 
 // CHECK: {{^}}[[THREAD_ID0:[0-9]+]]: ompt_event_distribute_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID0:[0-9]+]]
-// CHECK-SAME: parent_task_id=[[TASK_ID0:[0-9]+]]
+// CHECK-SAME: task_id=[[TASK_ID0:[0-9]+]]
 // CHECK: {{^}}[[THREAD_ID0]]: ompt_event_distribute_chunk_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID0]], task_id=[[TASK_ID0]]
 // CHECK-SAME: chunk_start={{[0-9]+}}, chunk_iterations=16
 
 // CHECK: {{^}}[[THREAD_ID1:[0-9]+]]: ompt_event_distribute_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID1:[0-9]+]]
-// CHECK-SAME: parent_task_id=[[TASK_ID1:[0-9]+]]
+// CHECK-SAME: task_id=[[TASK_ID1:[0-9]+]]
 // CHECK: {{^}}[[THREAD_ID1]]: ompt_event_distribute_chunk_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID1]], task_id=[[TASK_ID1]]
 // CHECK-SAME: chunk_start={{[0-9]+}}, chunk_iterations=16
 
 // CHECK: {{^}}[[THREAD_ID2:[0-9]+]]: ompt_event_distribute_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID2:[0-9]+]]
-// CHECK-SAME: parent_task_id=[[TASK_ID2:[0-9]+]]
+// CHECK-SAME: task_id=[[TASK_ID2:[0-9]+]]
 // CHECK: {{^}}[[THREAD_ID2]]: ompt_event_distribute_chunk_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID2]], task_id=[[TASK_ID2]]
 // CHECK-SAME: chunk_start={{[0-9]+}}, chunk_iterations=16
 
 // CHECK: {{^}}[[THREAD_ID3:[0-9]+]]: ompt_event_distribute_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID3:[0-9]+]]
-// CHECK-SAME: parent_task_id=[[TASK_ID3:[0-9]+]]
+// CHECK-SAME: task_id=[[TASK_ID3:[0-9]+]]
 // CHECK: {{^}}[[THREAD_ID3]]: ompt_event_distribute_chunk_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID3]], task_id=[[TASK_ID3]]
 // CHECK-SAME: chunk_start={{[0-9]+}}, chunk_iterations=16
diff --git a/openmp/runtime/test/ompt/worksharing/for/auto.c b/openmp/runtime/test/ompt/worksharing/for/auto.c
index 17d26f5e996b7..ff5bbfc37905e 100644
--- a/openmp/runtime/test/ompt/worksharing/for/auto.c
+++ b/openmp/runtime/test/ompt/worksharing/for/auto.c
@@ -4,4 +4,7 @@
 // XFAIL: gcc
 
 #define SCHEDULE auto
+// The runtime uses guided schedule for auto, 
+// which is a reason choice
+#define SCHED_OUTPUT "guided"
 #include "base.h"
diff --git a/openmp/runtime/test/ompt/worksharing/for/auto_serialized.c b/openmp/runtime/test/ompt/worksharing/for/auto_serialized.c
index f756166fe9826..8fe7551d23b5b 100644
--- a/openmp/runtime/test/ompt/worksharing/for/auto_serialized.c
+++ b/openmp/runtime/test/ompt/worksharing/for/auto_serialized.c
@@ -4,4 +4,7 @@
 // XFAIL: gcc
 
 #define SCHEDULE auto
+// The runtime uses static schedule for serialized loop, 
+// which is a reason choice
+#define SCHED_OUTPUT "static"
 #include "base_serialized.h"
diff --git a/openmp/runtime/test/ompt/worksharing/for/auto_split.c b/openmp/runtime/test/ompt/worksharing/for/auto_split.c
index d82e3fd1ef62a..96b975b57903b 100644
--- a/openmp/runtime/test/ompt/worksharing/for/auto_split.c
+++ b/openmp/runtime/test/ompt/worksharing/for/auto_split.c
@@ -5,4 +5,7 @@
 // XFAIL: gcc
 
 #define SCHEDULE auto
+// The runtime uses guided schedule for auto, 
+// which is a reason choice
+#define SCHED_OUTPUT "guided"
 #include "base_split.h"
diff --git a/openmp/runtime/test/ompt/worksharing/for/base.h b/openmp/runtime/test/ompt/worksharing/for/base.h
index 8a496d92083de..6429cad038045 100644
--- a/openmp/runtime/test/ompt/worksharing/for/base.h
+++ b/openmp/runtime/test/ompt/worksharing/for/base.h
@@ -1,12 +1,20 @@
 #include "callback.h"
 #include <omp.h>
+#include <stdio.h>
+
+#define STRINGIFY(x) #x
+#define STR(x) STRINGIFY(x)
+#ifndef SCHED_OUTPUT
+#define SCHED_OUTPUT STR(SCHEDULE)
+#endif
 
 int main()
 {
   unsigned int i;
+  printf("0: Schedule: " SCHED_OUTPUT "\n");
 
   #pragma omp parallel for num_threads(4) schedule(SCHEDULE)
-  for (i = 0; i < 4; i++) {
+  for (i = 0; i < 100; i++) {
   }
 
   // Check if libomp supports the callbacks for this test.
@@ -15,28 +23,28 @@ int main()
   // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task'
   // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_work'
 
-
   // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
+  // CHECK: 0: Schedule: [[SCHED:[a-z]+]]
   // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id={{[0-9]+}}, parent_task_frame.exit=[[NULL]], parent_task_frame.reenter={{0x[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=4, codeptr_ra=0x{{[0-f]+}}, invoker={{[0-9]+}}
 
   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
-  // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], codeptr_ra=
-  // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+  // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_[[SCHED]]_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], codeptr_ra=
+  // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_[[SCHED]]_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]]
 
   // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
-  // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], codeptr_ra=
-  // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+  // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_[[SCHED]]_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], codeptr_ra=
+  // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_[[SCHED]]_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
   // CHECK: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]]
 
   // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
-  // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], codeptr_ra=
-  // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+  // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_[[SCHED]]_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], codeptr_ra=
+  // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_[[SCHED]]_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
   // CHECK: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]]
 
   // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
-  // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], codeptr_ra=
-  // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+  // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_[[SCHED]]_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], codeptr_ra=
+  // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_[[SCHED]]_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
   // CHECK: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]]
 
   return 0;
diff --git a/openmp/runtime/test/ompt/worksharing/for/base_serialized.h b/openmp/runtime/test/ompt/worksharing/for/base_serialized.h
index 3376b3702eae4..bd47dcc045d3b 100644
--- a/openmp/runtime/test/ompt/worksharing/for/base_serialized.h
+++ b/openmp/runtime/test/ompt/worksharing/for/base_serialized.h
@@ -1,12 +1,20 @@
 #include "callback.h"
 #include <omp.h>
+#include <stdio.h>
+
+#define STRINGIFY(x) #x
+#define STR(x) STRINGIFY(x)
+#ifndef SCHED_OUTPUT
+#define SCHED_OUTPUT STR(SCHEDULE)
+#endif
 
 int main()
 {
   unsigned int i;
+  printf("0: Schedule: " SCHED_OUTPUT "\n");
 
   #pragma omp parallel for num_threads(1) schedule(SCHEDULE)
-  for (i = 0; i < 1; i++) {
+  for (i = 0; i < 100; i++) {
   }
   
   // Check if libomp supports the callbacks for this test.
@@ -17,11 +25,12 @@ int main()
 
 
   // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
+  // CHECK: 0: Schedule: [[SCHED:[a-z]+]]
   // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id=[[PARENT_TASK_ID:[0-9]+]], parent_task_frame.exit=[[NULL]], parent_task_frame.reenter={{0x[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=1, codeptr_ra=0x{{[0-f]+}}, invoker={{[0-9]+}}
 
   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
-  // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], codeptr_ra=0x{{[0-f]+}}
-  // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+  // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_[[SCHED]]_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], codeptr_ra=0x{{[0-f]+}}
+  // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_[[SCHED]]_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id={{[PARALLEL_ID,0]}}, task_id=[[IMPLICIT_TASK_ID]]
 
   return 0;
diff --git a/openmp/runtime/test/ompt/worksharing/for/base_split.h b/openmp/runtime/test/ompt/worksharing/for/base_split.h
index 0f1fed3c44940..d73c99c983e3b 100644
--- a/openmp/runtime/test/ompt/worksharing/for/base_split.h
+++ b/openmp/runtime/test/ompt/worksharing/for/base_split.h
@@ -1,5 +1,12 @@
 #include "callback.h"
 #include <omp.h>
+#include <stdio.h>
+
+#define STRINGIFY(x) #x
+#define STR(x) STRINGIFY(x)
+#ifndef SCHED_OUTPUT
+#define SCHED_OUTPUT STR(SCHEDULE)
+#endif
 
 /* With the combined parallel-for construct (base.h), the return-addresses are hard to compare.
    With the separate parallel and for-nowait construct, the addresses become more predictable,
@@ -10,12 +17,13 @@
 int main()
 {
   unsigned int i;
+  printf("0: Schedule: " SCHED_OUTPUT "\n");
 
   #pragma omp parallel num_threads(4) 
   {
     print_current_address(0);
     #pragma omp for schedule(SCHEDULE) nowait
-    for (i = 0; i < 4; i++) {
+    for (i = 0; i < 100; i++) {
       print_fuzzy_address(1);
     }
     print_fuzzy_address(2);
@@ -30,32 +38,34 @@ int main()
 
 
   // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
+  // CHECK: 0: Schedule: [[SCHED:[a-z]+]]
   // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id={{[0-9]+}}, parent_task_frame.exit=[[NULL]], parent_task_frame.reenter={{0x[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=4, codeptr_ra=[[PARALLEL_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}, invoker={{[0-9]+}}
 
-  // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id={{[0-9]+}}, codeptr_ra=[[LOOP_BEGIN_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
-  // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[LOOP_END_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
+  // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_[[SCHED]]_begin: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[LOOP_BEGIN_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
+  // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_[[SCHED]]_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[LOOP_END_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
   // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[LOOP_END_RETURN_ADDRESS]]
 
   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, invoker={{[0-9]+}}, codeptr_ra=[[PARALLEL_RETURN_ADDRESS]]
   // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[PARALLEL_RETURN_ADDRESS]]
   
-  // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id={{[0-9]+}}, codeptr_ra=0x{{[0-f]+}}
-  // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[LOOP_END_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
+  // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_loop_[[SCHED]]_begin: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=0x{{[0-f]+}}
+  // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_[[SCHED]]_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[LOOP_END_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
   // CHECK: {{^}}[[THREAD_ID]]: fuzzy_address={{.*}}[[LOOP_END_RETURN_ADDRESS]]
 
-  // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id={{[0-9]+}}, codeptr_ra=0x{{[0-f]+}}
-  // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[LOOP_END_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
+  // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_loop_[[SCHED]]_begin: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=0x{{[0-f]+}}
+  // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_[[SCHED]]_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[LOOP_END_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
   // CHECK: {{^}}[[THREAD_ID]]: fuzzy_address={{.*}}[[LOOP_END_RETURN_ADDRESS]]
 
-  // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id={{[0-9]+}}, codeptr_ra=0x{{[0-f]+}}
-  // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[LOOP_END_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
+  // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_loop_[[SCHED]]_begin: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=0x{{[0-f]+}}
+  // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_[[SCHED]]_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[LOOP_END_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
   // CHECK: {{^}}[[THREAD_ID]]: fuzzy_address={{.*}}[[LOOP_END_RETURN_ADDRESS]]
 
 
   // CHECK-LOOP: 0: NULL_POINTER=[[NULL:.*$]]
+  // CHECK-LOOP: 0: Schedule: [[SCHED:[a-z]+]]
   // CHECK-LOOP: 0: ompt_event_runtime_shutdown
   // CHECK-LOOP: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id={{[0-9]+}}, parent_task_frame.exit=[[NULL]], parent_task_frame.reenter={{0x[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=4, codeptr_ra={{0x[0-f]+}}, invoker={{[0-9]+}}
-  // CHECK-LOOP: {{^}}[[MASTER_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id={{[0-9]+}}, codeptr_ra=[[LOOP_BEGIN_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
+  // CHECK-LOOP: {{^}}[[MASTER_ID]]: ompt_event_loop_[[SCHED]]_begin: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[LOOP_BEGIN_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
   // CHECK-LOOP: {{^}}{{[0-9]+}}: fuzzy_address={{.*}}[[LOOP_BEGIN_RETURN_ADDRESS]]
   // CHECK-LOOP: {{^}}{{[0-9]+}}: fuzzy_address={{.*}}[[LOOP_BEGIN_RETURN_ADDRESS]]
   // CHECK-LOOP: {{^}}{{[0-9]+}}: fuzzy_address={{.*}}[[LOOP_BEGIN_RETURN_ADDRESS]]
diff --git a/openmp/runtime/test/ompt/worksharing/for/guided_serialized.c b/openmp/runtime/test/ompt/worksharing/for/guided_serialized.c
index 4b5096d5679ce..c0d2f4ee8d6c6 100644
--- a/openmp/runtime/test/ompt/worksharing/for/guided_serialized.c
+++ b/openmp/runtime/test/ompt/worksharing/for/guided_serialized.c
@@ -2,4 +2,7 @@
 // REQUIRES: ompt
 
 #define SCHEDULE guided
+// The runtime uses static schedule for serialized loop, 
+// which is a reason choice
+#define SCHED_OUTPUT "static"
 #include "base_serialized.h"
diff --git a/openmp/runtime/test/ompt/worksharing/for/loop_dispatch.c b/openmp/runtime/test/ompt/worksharing/for/loop_dispatch.c
index 2bd8af427f61d..4f10a67bcabb4 100644
--- a/openmp/runtime/test/ompt/worksharing/for/loop_dispatch.c
+++ b/openmp/runtime/test/ompt/worksharing/for/loop_dispatch.c
@@ -56,72 +56,72 @@ int main() {
 
 // CHECK: {{^}}[[THREAD_ID0]]: ompt_event_implicit_task_begin:
 // CHECK-SAME: task_id=[[TASK_ID0:[0-9]+]]
-// CHECK: {{^}}[[THREAD_ID0]]: ompt_event_loop_begin:
-// CHECK-SAME: parallel_id=[[PARALLEL_ID]], parent_task_id=[[TASK_ID0]]
+// CHECK: {{^}}[[THREAD_ID0]]: ompt_event_loop_static_begin:
+// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID0]]
 // CHECK: {{^}}[[THREAD_ID0]]: ompt_event_ws_loop_chunk_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID0]]
 // CHECK-SAME: chunk_start={{[0-9]+}}, chunk_iterations=16
-// CHECK: {{^}}[[THREAD_ID0]]: ompt_event_loop_begin:
-// CHECK-SAME: parallel_id=[[PARALLEL_ID]], parent_task_id=[[TASK_ID0]]
+// CHECK: {{^}}[[THREAD_ID0]]: ompt_event_loop_dynamic_begin:
+// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID0]]
 // CHECK: {{^}}[[THREAD_ID0]]: ompt_event_ws_loop_chunk_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID0]]
 // CHECK-SAME: chunk_start={{[0-9]+}}, chunk_iterations=1
-// CHECK: {{^}}[[THREAD_ID0]]: ompt_event_loop_begin:
-// CHECK-SAME: parallel_id=[[PARALLEL_ID]], parent_task_id=[[TASK_ID0]]
+// CHECK: {{^}}[[THREAD_ID0]]: ompt_event_loop_guided_begin:
+// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID0]]
 // CHECK: {{^}}[[THREAD_ID0]]: ompt_event_ws_loop_chunk_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID0]]
 // CHECK-SAME: chunk_start={{[0-9]+}}, chunk_iterations={{[1-9][0-9]*}}
 
 // CHECK: {{^}}[[THREAD_ID1:[0-9]+]]: ompt_event_implicit_task_begin:
 // CHECK-SAME: task_id=[[TASK_ID1:[0-9]+]]
-// CHECK: {{^}}[[THREAD_ID1]]: ompt_event_loop_begin:
-// CHECK-SAME: parallel_id=[[PARALLEL_ID]], parent_task_id=[[TASK_ID1]]
+// CHECK: {{^}}[[THREAD_ID1]]: ompt_event_loop_static_begin:
+// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID1]]
 // CHECK: {{^}}[[THREAD_ID1]]: ompt_event_ws_loop_chunk_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID1]]
 // CHECK-SAME: chunk_start={{[0-9]+}}, chunk_iterations=16
-// CHECK: {{^}}[[THREAD_ID1]]: ompt_event_loop_begin:
-// CHECK-SAME: parallel_id=[[PARALLEL_ID]], parent_task_id=[[TASK_ID1]]
+// CHECK: {{^}}[[THREAD_ID1]]: ompt_event_loop_dynamic_begin:
+// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID1]]
 // CHECK: {{^}}[[THREAD_ID1]]: ompt_event_ws_loop_chunk_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID1]]
 // CHECK-SAME: chunk_start={{[0-9]+}}, chunk_iterations=1
-// CHECK: {{^}}[[THREAD_ID1]]: ompt_event_loop_begin:
-// CHECK-SAME: parallel_id=[[PARALLEL_ID]], parent_task_id=[[TASK_ID1]]
+// CHECK: {{^}}[[THREAD_ID1]]: ompt_event_loop_guided_begin:
+// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID1]]
 // CHECK: {{^}}[[THREAD_ID1]]: ompt_event_ws_loop_chunk_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID1]]
 // CHECK-SAME: chunk_start={{[0-9]+}}, chunk_iterations={{[1-9][0-9]*}}
 
 // CHECK: {{^}}[[THREAD_ID2:[0-9]+]]: ompt_event_implicit_task_begin:
 // CHECK-SAME: task_id=[[TASK_ID2:[0-9]+]]
-// CHECK: {{^}}[[THREAD_ID2]]: ompt_event_loop_begin:
-// CHECK-SAME: parallel_id=[[PARALLEL_ID]], parent_task_id=[[TASK_ID2]]
+// CHECK: {{^}}[[THREAD_ID2]]: ompt_event_loop_static_begin:
+// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID2]]
 // CHECK: {{^}}[[THREAD_ID2]]: ompt_event_ws_loop_chunk_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID2]]
 // CHECK-SAME: chunk_start={{[0-9]+}}, chunk_iterations=16
-// CHECK: {{^}}[[THREAD_ID2]]: ompt_event_loop_begin:
-// CHECK-SAME: parallel_id=[[PARALLEL_ID]], parent_task_id=[[TASK_ID2]]
+// CHECK: {{^}}[[THREAD_ID2]]: ompt_event_loop_dynamic_begin:
+// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID2]]
 // CHECK: {{^}}[[THREAD_ID2]]: ompt_event_ws_loop_chunk_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID2]]
 // CHECK-SAME: chunk_start={{[0-9]+}}, chunk_iterations=1
-// CHECK: {{^}}[[THREAD_ID2]]: ompt_event_loop_begin:
-// CHECK-SAME: parallel_id=[[PARALLEL_ID]], parent_task_id=[[TASK_ID2]]
+// CHECK: {{^}}[[THREAD_ID2]]: ompt_event_loop_guided_begin:
+// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID2]]
 // CHECK: {{^}}[[THREAD_ID2]]: ompt_event_ws_loop_chunk_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID2]]
 // CHECK-SAME: chunk_start={{[0-9]+}}, chunk_iterations={{[1-9][0-9]*}}
 
 // CHECK: {{^}}[[THREAD_ID3:[0-9]+]]: ompt_event_implicit_task_begin:
 // CHECK-SAME: task_id=[[TASK_ID3:[0-9]+]]
-// CHECK: {{^}}[[THREAD_ID3]]: ompt_event_loop_begin:
-// CHECK-SAME: parallel_id=[[PARALLEL_ID]], parent_task_id=[[TASK_ID3]]
+// CHECK: {{^}}[[THREAD_ID3]]: ompt_event_loop_static_begin:
+// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID3]]
 // CHECK: {{^}}[[THREAD_ID3]]: ompt_event_ws_loop_chunk_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID3]]
 // CHECK-SAME: chunk_start={{[0-9]+}}, chunk_iterations=16
-// CHECK: {{^}}[[THREAD_ID3]]: ompt_event_loop_begin:
-// CHECK-SAME: parallel_id=[[PARALLEL_ID]], parent_task_id=[[TASK_ID3]]
+// CHECK: {{^}}[[THREAD_ID3]]: ompt_event_loop_dynamic_begin:
+// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID3]]
 // CHECK: {{^}}[[THREAD_ID3]]: ompt_event_ws_loop_chunk_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID3]]
 // CHECK-SAME: chunk_start={{[0-9]+}}, chunk_iterations=1
-// CHECK: {{^}}[[THREAD_ID3]]: ompt_event_loop_begin:
-// CHECK-SAME: parallel_id=[[PARALLEL_ID]], parent_task_id=[[TASK_ID3]]
+// CHECK: {{^}}[[THREAD_ID3]]: ompt_event_loop_guided_begin:
+// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID3]]
 // CHECK: {{^}}[[THREAD_ID3]]: ompt_event_ws_loop_chunk_begin:
 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID3]]
 // CHECK-SAME: chunk_start={{[0-9]+}}, chunk_iterations={{[1-9][0-9]*}}
diff --git a/openmp/runtime/test/ompt/worksharing/for/runtime.c b/openmp/runtime/test/ompt/worksharing/for/runtime.c
index bcf160faeb898..8c71c8b336246 100644
--- a/openmp/runtime/test/ompt/worksharing/for/runtime.c
+++ b/openmp/runtime/test/ompt/worksharing/for/runtime.c
@@ -2,4 +2,7 @@
 // REQUIRES: ompt
 
 #define SCHEDULE runtime
+// Without any schedule specified, the runtime uses static schedule,
+// which is a reason choice
+#define SCHED_OUTPUT "static"
 #include "base.h"
diff --git a/openmp/runtime/test/ompt/worksharing/for/runtime_serialized.c b/openmp/runtime/test/ompt/worksharing/for/runtime_serialized.c
index 231d67d91aa9e..38e3a3ca7521c 100644
--- a/openmp/runtime/test/ompt/worksharing/for/runtime_serialized.c
+++ b/openmp/runtime/test/ompt/worksharing/for/runtime_serialized.c
@@ -2,4 +2,7 @@
 // REQUIRES: ompt
 
 #define SCHEDULE runtime
+// Without any schedule specified, the runtime uses static schedule,
+// which is a reason choice
+#define SCHED_OUTPUT "static"
 #include "base_serialized.h"
diff --git a/openmp/runtime/test/ompt/worksharing/for/runtime_split.c b/openmp/runtime/test/ompt/worksharing/for/runtime_split.c
index 7a677edbfd0e3..5c70908862d7f 100644
--- a/openmp/runtime/test/ompt/worksharing/for/runtime_split.c
+++ b/openmp/runtime/test/ompt/worksharing/for/runtime_split.c
@@ -4,4 +4,7 @@
 // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7
 
 #define SCHEDULE runtime
+// Without any schedule specified, the runtime uses static schedule,
+// which is a reason choice
+#define SCHED_OUTPUT "static"
 #include "base_split.h"
diff --git a/openmp/runtime/test/ompt/worksharing/sections.c b/openmp/runtime/test/ompt/worksharing/sections.c
index bafb74312ff45..4a9696debfc51 100644
--- a/openmp/runtime/test/ompt/worksharing/sections.c
+++ b/openmp/runtime/test/ompt/worksharing/sections.c
@@ -26,10 +26,10 @@ int main()
 
   // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
 
-  // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_sections_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], parent_task_id=[[TASK_ID:[0-9]+]], codeptr_ra=[[SECT_BEGIN:0x[0-f]+]], count=2
+  // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_sections_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], task_id=[[TASK_ID:[0-9]+]], codeptr_ra=[[SECT_BEGIN:0x[0-f]+]], count=2
   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_sections_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[SECT_END:0x[0-f]+]]
 
-  // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_sections_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[TASK_ID:[0-9]+]], codeptr_ra=[[SECT_BEGIN]], count=2
+  // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_sections_begin: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID:[0-9]+]], codeptr_ra=[[SECT_BEGIN]], count=2
   // CHECK: {{^}}[[THREAD_ID]]: ompt_event_sections_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[SECT_END]]
 
   return 0;
diff --git a/openmp/runtime/test/ompt/worksharing/sections_dispatch.c b/openmp/runtime/test/ompt/worksharing/sections_dispatch.c
index bcf0bd0cde673..ae225ce17d456 100644
--- a/openmp/runtime/test/ompt/worksharing/sections_dispatch.c
+++ b/openmp/runtime/test/ompt/worksharing/sections_dispatch.c
@@ -29,7 +29,7 @@ int main()
 
   // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_sections_begin:
   // CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-9]+]],
-  // CHECK-SAME: parent_task_id=[[TASK_ID:[0-9]+]],
+  // CHECK-SAME: task_id=[[TASK_ID:[0-9]+]],
   // CHECK-SAME: codeptr_ra=[[SECT_BEGIN:0x[0-f]+]], count=2
   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_section_begin:
   // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]]
@@ -39,7 +39,7 @@ int main()
   // CHECK-SAME: codeptr_ra=[[SECT_END:0x[0-f]+]]
 
   // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_sections_begin:
-  // CHECK-SAME: parallel_id=[[PARALLEL_ID]], parent_task_id=[[TASK_ID:[0-9]+]],
+  // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID:[0-9]+]],
   // CHECK-SAME: codeptr_ra=[[SECT_BEGIN]], count=2
   // CHECK: {{^}}[[THREAD_ID]]: ompt_event_section_begin:
   // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]]
diff --git a/openmp/runtime/test/ompt/worksharing/single.c b/openmp/runtime/test/ompt/worksharing/single.c
index 6b24f2d9398fe..49db57769baa6 100644
--- a/openmp/runtime/test/ompt/worksharing/single.c
+++ b/openmp/runtime/test/ompt/worksharing/single.c
@@ -25,7 +25,7 @@ int main()
 
   // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
 
-  // CHECK-DAG: {{^}}[[THREAD_ID_1:[0-9]+]]: ompt_event_single_in_block_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], parent_task_id=[[TASK_ID:[0-9]+]], codeptr_ra={{0x[0-f]+}}, count=1
+  // CHECK-DAG: {{^}}[[THREAD_ID_1:[0-9]+]]: ompt_event_single_in_block_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], task_id=[[TASK_ID:[0-9]+]], codeptr_ra={{0x[0-f]+}}, count=1
   // CHECK-DAG: {{^}}[[THREAD_ID_1]]: in single
   // CHECK-DAG: {{^}}[[THREAD_ID_1]]: ompt_event_single_in_block_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra={{0x[0-f]+}}, count=1
 

>From a70071d08bd2502877de6b3a65a22422a7f7e843 Mon Sep 17 00:00:00 2001
From: Joachim Jenke <jenke at itc.rwth-aachen.de>
Date: Tue, 2 Jul 2024 22:58:22 +0200
Subject: [PATCH 2/3] Clang-format and remove superflous printf

---
 openmp/runtime/src/kmp_dispatch.cpp           |  9 +-
 openmp/runtime/src/ompt-specific.h            |  5 +-
 openmp/runtime/test/ompt/callback.h           | 89 +++++++++----------
 .../runtime/test/ompt/worksharing/for/auto.c  |  2 +-
 .../ompt/worksharing/for/auto_serialized.c    |  2 +-
 .../test/ompt/worksharing/for/auto_split.c    |  2 +-
 .../runtime/test/ompt/worksharing/for/base.h  |  6 +-
 .../ompt/worksharing/for/base_serialized.h    |  8 +-
 .../test/ompt/worksharing/for/base_split.h    |  7 +-
 .../ompt/worksharing/for/guided_serialized.c  |  2 +-
 .../runtime/test/ompt/worksharing/sections.c  |  2 +
 openmp/runtime/test/ompt/worksharing/single.c |  2 +
 12 files changed, 68 insertions(+), 68 deletions(-)

diff --git a/openmp/runtime/src/kmp_dispatch.cpp b/openmp/runtime/src/kmp_dispatch.cpp
index b538afc7916a1..3b4a1f34df040 100644
--- a/openmp/runtime/src/kmp_dispatch.cpp
+++ b/openmp/runtime/src/kmp_dispatch.cpp
@@ -1164,8 +1164,9 @@ __kmp_dispatch_init(ident_t *loc, int gtid, enum sched_type schedule, T lb,
     ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
     ompt_task_info_t *task_info = __ompt_get_task_info_object(0);
     ompt_callbacks.ompt_callback(ompt_callback_work)(
-        ompt_get_work_schedule(pr->schedule), ompt_scope_begin, &(team_info->parallel_data),
-        &(task_info->task_data), pr->u.p.tc, OMPT_LOAD_RETURN_ADDRESS(gtid));
+        ompt_get_work_schedule(pr->schedule), ompt_scope_begin,
+        &(team_info->parallel_data), &(task_info->task_data), pr->u.p.tc,
+        OMPT_LOAD_RETURN_ADDRESS(gtid));
   }
 #endif
   KMP_PUSH_PARTITIONED_TIMER(OMP_loop_dynamic);
@@ -2121,8 +2122,8 @@ int __kmp_dispatch_next_algorithm(int gtid,
       ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);              \
       ompt_task_info_t *task_info = __ompt_get_task_info_object(0);            \
       ompt_callbacks.ompt_callback(ompt_callback_work)(                        \
-          ompt_get_work_schedule(pr->schedule), ompt_scope_end, &(team_info->parallel_data),         \
-          &(task_info->task_data), 0, codeptr);                                \
+          ompt_get_work_schedule(pr->schedule), ompt_scope_end,                \
+          &(team_info->parallel_data), &(task_info->task_data), 0, codeptr);   \
     }                                                                          \
   }
 #define OMPT_LOOP_DISPATCH(lb, ub, st, status)                                 \
diff --git a/openmp/runtime/src/ompt-specific.h b/openmp/runtime/src/ompt-specific.h
index 84e84e5327cdc..0bf973fa1db00 100644
--- a/openmp/runtime/src/ompt-specific.h
+++ b/openmp/runtime/src/ompt-specific.h
@@ -130,8 +130,7 @@ inline const char *ompt_get_runtime_version() {
   return &__kmp_version_lib_ver[KMP_VERSION_MAGIC_LEN];
 }
 
-inline ompt_work_t ompt_get_work_schedule(enum sched_type schedule){
-  printf("Schedule val: %i\n", schedule);
+inline ompt_work_t ompt_get_work_schedule(enum sched_type schedule) {
   switch (SCHEDULE_WITHOUT_MODIFIERS(schedule)) {
   case kmp_sch_static_chunked:
   case kmp_sch_static_balanced: // Chunk is calculated in the switch above
@@ -150,8 +149,6 @@ inline ompt_work_t ompt_get_work_schedule(enum sched_type schedule){
   }
 }
 
-
-
 class OmptReturnAddressGuard {
 private:
   bool SetAddress{false};
diff --git a/openmp/runtime/test/ompt/callback.h b/openmp/runtime/test/ompt/callback.h
index 64e7d448f0edf..c1093141e9126 100644
--- a/openmp/runtime/test/ompt/callback.h
+++ b/openmp/runtime/test/ompt/callback.h
@@ -47,39 +47,35 @@ static const char* ompt_cancel_flag_t_values[] = {
   "ompt_cancel_discarded_task"
 };
 
-static const char* ompt_work_t_values[] = {
-  "undefined",
-  "ompt_work_loop",
-  "ompt_work_sections",
-  "ompt_work_single_executor",
-  "ompt_work_single_other",
-  "ompt_work_workshare",
-  "ompt_work_distribute",
-  "ompt_work_taskloop",
-  "ompt_work_scope",
-  "ompt_work_workdistribute",
-  "ompt_work_loop_static",
-  "ompt_work_loop_dynamic",
-  "ompt_work_loop_guided",
-  "ompt_work_loop_other"
-};
+static const char *ompt_work_t_values[] = {"undefined",
+                                           "ompt_work_loop",
+                                           "ompt_work_sections",
+                                           "ompt_work_single_executor",
+                                           "ompt_work_single_other",
+                                           "ompt_work_workshare",
+                                           "ompt_work_distribute",
+                                           "ompt_work_taskloop",
+                                           "ompt_work_scope",
+                                           "ompt_work_workdistribute",
+                                           "ompt_work_loop_static",
+                                           "ompt_work_loop_dynamic",
+                                           "ompt_work_loop_guided",
+                                           "ompt_work_loop_other"};
 
-static const char* ompt_work_events_t_values[] = {
-  "undefined",
-  "ompt_event_loop",
-  "ompt_event_sections",
-  "ompt_event_single_in_block",
-  "ompt_event_single_others",
-  "ompt_event_workshare",
-  "ompt_event_distribute",
-  "ompt_event_taskloop",
-  "ompt_event_scope",
-  "ompt_event_workdistribute",
-  "ompt_event_loop_static",
-  "ompt_event_loop_dynamic",
-  "ompt_event_loop_guided",
-  "ompt_event_loop_other"
-};
+static const char *ompt_work_events_t_values[] = {"undefined",
+                                                  "ompt_event_loop",
+                                                  "ompt_event_sections",
+                                                  "ompt_event_single_in_block",
+                                                  "ompt_event_single_others",
+                                                  "ompt_event_workshare",
+                                                  "ompt_event_distribute",
+                                                  "ompt_event_taskloop",
+                                                  "ompt_event_scope",
+                                                  "ompt_event_workdistribute",
+                                                  "ompt_event_loop_static",
+                                                  "ompt_event_loop_dynamic",
+                                                  "ompt_event_loop_guided",
+                                                  "ompt_event_loop_other"};
 
 static const char *ompt_dependence_type_t_values[36] = {
     "ompt_dependence_type_UNDEFINED",
@@ -886,24 +882,21 @@ on_ompt_callback_work(
 {
   switch(endpoint)
   {
-    case ompt_scope_begin:
-          printf("%" PRIu64 ":" _TOOL_PREFIX
-                 " %s_begin: parallel_id=%" PRIu64
-                 ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64
-                 "\n",
-                 ompt_get_thread_data()->value, ompt_work_events_t_values[wstype], parallel_data->value,
-                 task_data->value, codeptr_ra, count);
+  case ompt_scope_begin:
+    printf("%" PRIu64 ":" _TOOL_PREFIX " %s_begin: parallel_id=%" PRIu64
+           ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n",
+           ompt_get_thread_data()->value, ompt_work_events_t_values[wstype],
+           parallel_data->value, task_data->value, codeptr_ra, count);
     break;
-    case ompt_scope_end:
-    printf("%" PRIu64 ":" _TOOL_PREFIX
-            " %s_end: parallel_id=%" PRIu64
-            ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n",
-            ompt_get_thread_data()->value, ompt_work_events_t_values[wstype], parallel_data->value,
-            task_data->value, codeptr_ra, count);
+  case ompt_scope_end:
+    printf("%" PRIu64 ":" _TOOL_PREFIX " %s_end: parallel_id=%" PRIu64
+           ", task_id=%" PRIu64 ", codeptr_ra=%p, count=%" PRIu64 "\n",
+           ompt_get_thread_data()->value, ompt_work_events_t_values[wstype],
+           parallel_data->value, task_data->value, codeptr_ra, count);
     break;
-    case ompt_scope_beginend:
-      printf("ompt_scope_beginend should never be passed to %s\n", __func__);
-      exit(-1);
+  case ompt_scope_beginend:
+    printf("ompt_scope_beginend should never be passed to %s\n", __func__);
+    exit(-1);
   }
 }
 
diff --git a/openmp/runtime/test/ompt/worksharing/for/auto.c b/openmp/runtime/test/ompt/worksharing/for/auto.c
index ff5bbfc37905e..3ce66d511ab3c 100644
--- a/openmp/runtime/test/ompt/worksharing/for/auto.c
+++ b/openmp/runtime/test/ompt/worksharing/for/auto.c
@@ -4,7 +4,7 @@
 // XFAIL: gcc
 
 #define SCHEDULE auto
-// The runtime uses guided schedule for auto, 
+// The runtime uses guided schedule for auto,
 // which is a reason choice
 #define SCHED_OUTPUT "guided"
 #include "base.h"
diff --git a/openmp/runtime/test/ompt/worksharing/for/auto_serialized.c b/openmp/runtime/test/ompt/worksharing/for/auto_serialized.c
index 8fe7551d23b5b..400fcc8f3a78f 100644
--- a/openmp/runtime/test/ompt/worksharing/for/auto_serialized.c
+++ b/openmp/runtime/test/ompt/worksharing/for/auto_serialized.c
@@ -4,7 +4,7 @@
 // XFAIL: gcc
 
 #define SCHEDULE auto
-// The runtime uses static schedule for serialized loop, 
+// The runtime uses static schedule for serialized loop,
 // which is a reason choice
 #define SCHED_OUTPUT "static"
 #include "base_serialized.h"
diff --git a/openmp/runtime/test/ompt/worksharing/for/auto_split.c b/openmp/runtime/test/ompt/worksharing/for/auto_split.c
index 96b975b57903b..c7b07d7407bad 100644
--- a/openmp/runtime/test/ompt/worksharing/for/auto_split.c
+++ b/openmp/runtime/test/ompt/worksharing/for/auto_split.c
@@ -5,7 +5,7 @@
 // XFAIL: gcc
 
 #define SCHEDULE auto
-// The runtime uses guided schedule for auto, 
+// The runtime uses guided schedule for auto,
 // which is a reason choice
 #define SCHED_OUTPUT "guided"
 #include "base_split.h"
diff --git a/openmp/runtime/test/ompt/worksharing/for/base.h b/openmp/runtime/test/ompt/worksharing/for/base.h
index 6429cad038045..8edc894162f20 100644
--- a/openmp/runtime/test/ompt/worksharing/for/base.h
+++ b/openmp/runtime/test/ompt/worksharing/for/base.h
@@ -13,10 +13,11 @@ int main()
   unsigned int i;
   printf("0: Schedule: " SCHED_OUTPUT "\n");
 
-  #pragma omp parallel for num_threads(4) schedule(SCHEDULE)
-  for (i = 0; i < 100; i++) {
+#pragma omp parallel for num_threads(4) schedule(SCHEDULE)
+  for (i = 0; i < 64; i++) {
   }
 
+  // clang-format off
   // Check if libomp supports the callbacks for this test.
   // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_begin'
   // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_end'
@@ -46,6 +47,7 @@ int main()
   // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_[[SCHED]]_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], codeptr_ra=
   // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_[[SCHED]]_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
   // CHECK: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]]
+  // clang-format on
 
   return 0;
 }
diff --git a/openmp/runtime/test/ompt/worksharing/for/base_serialized.h b/openmp/runtime/test/ompt/worksharing/for/base_serialized.h
index bd47dcc045d3b..93d6a348553bb 100644
--- a/openmp/runtime/test/ompt/worksharing/for/base_serialized.h
+++ b/openmp/runtime/test/ompt/worksharing/for/base_serialized.h
@@ -13,10 +13,11 @@ int main()
   unsigned int i;
   printf("0: Schedule: " SCHED_OUTPUT "\n");
 
-  #pragma omp parallel for num_threads(1) schedule(SCHEDULE)
-  for (i = 0; i < 100; i++) {
+#pragma omp parallel for num_threads(1) schedule(SCHEDULE)
+  for (i = 0; i < 64; i++) {
   }
-  
+
+  // clang-format off
   // Check if libomp supports the callbacks for this test.
   // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_begin'
   // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_end'
@@ -32,6 +33,7 @@ int main()
   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_[[SCHED]]_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], codeptr_ra=0x{{[0-f]+}}
   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_[[SCHED]]_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id={{[PARALLEL_ID,0]}}, task_id=[[IMPLICIT_TASK_ID]]
+  // clang-format on
 
   return 0;
 }
diff --git a/openmp/runtime/test/ompt/worksharing/for/base_split.h b/openmp/runtime/test/ompt/worksharing/for/base_split.h
index d73c99c983e3b..5ba59afc04ab0 100644
--- a/openmp/runtime/test/ompt/worksharing/for/base_split.h
+++ b/openmp/runtime/test/ompt/worksharing/for/base_split.h
@@ -19,17 +19,18 @@ int main()
   unsigned int i;
   printf("0: Schedule: " SCHED_OUTPUT "\n");
 
-  #pragma omp parallel num_threads(4) 
+#pragma omp parallel num_threads(4)
   {
     print_current_address(0);
     #pragma omp for schedule(SCHEDULE) nowait
-    for (i = 0; i < 100; i++) {
+    for (i = 0; i < 64; i++) {
       print_fuzzy_address(1);
     }
     print_fuzzy_address(2);
   }
   print_fuzzy_address(3);
 
+  // clang-format off
   // Check if libomp supports the callbacks for this test.
   // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_begin'
   // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_end'
@@ -70,7 +71,7 @@ int main()
   // CHECK-LOOP: {{^}}{{[0-9]+}}: fuzzy_address={{.*}}[[LOOP_BEGIN_RETURN_ADDRESS]]
   // CHECK-LOOP: {{^}}{{[0-9]+}}: fuzzy_address={{.*}}[[LOOP_BEGIN_RETURN_ADDRESS]]
   // CHECK-LOOP: {{^}}{{[0-9]+}}: fuzzy_address={{.*}}[[LOOP_BEGIN_RETURN_ADDRESS]]
-
+  // clang-format on
 
   return 0;
 }
diff --git a/openmp/runtime/test/ompt/worksharing/for/guided_serialized.c b/openmp/runtime/test/ompt/worksharing/for/guided_serialized.c
index c0d2f4ee8d6c6..a1e239e081d88 100644
--- a/openmp/runtime/test/ompt/worksharing/for/guided_serialized.c
+++ b/openmp/runtime/test/ompt/worksharing/for/guided_serialized.c
@@ -2,7 +2,7 @@
 // REQUIRES: ompt
 
 #define SCHEDULE guided
-// The runtime uses static schedule for serialized loop, 
+// The runtime uses static schedule for serialized loop,
 // which is a reason choice
 #define SCHED_OUTPUT "static"
 #include "base_serialized.h"
diff --git a/openmp/runtime/test/ompt/worksharing/sections.c b/openmp/runtime/test/ompt/worksharing/sections.c
index 4a9696debfc51..ec4cfdf5f082d 100644
--- a/openmp/runtime/test/ompt/worksharing/sections.c
+++ b/openmp/runtime/test/ompt/worksharing/sections.c
@@ -21,6 +21,7 @@ int main()
     }
   }
 
+  // clang-format off
   // Check if libomp supports the callbacks for this test.
   // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_work'
 
@@ -31,6 +32,7 @@ int main()
 
   // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_sections_begin: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID:[0-9]+]], codeptr_ra=[[SECT_BEGIN]], count=2
   // CHECK: {{^}}[[THREAD_ID]]: ompt_event_sections_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[SECT_END]]
+  // clang-format on
 
   return 0;
 }
diff --git a/openmp/runtime/test/ompt/worksharing/single.c b/openmp/runtime/test/ompt/worksharing/single.c
index 49db57769baa6..b3b67d6539966 100644
--- a/openmp/runtime/test/ompt/worksharing/single.c
+++ b/openmp/runtime/test/ompt/worksharing/single.c
@@ -20,6 +20,7 @@ int main()
 
   printf("x=%d\n", x);
 
+  // clang-format off
   // Check if libomp supports the callbacks for this test.
   // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_work'
 
@@ -31,6 +32,7 @@ int main()
 
   // CHECK-DAG: {{^}}[[THREAD_ID_2:[0-9]+]]: ompt_event_single_others_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], task_id=[[TASK_ID:[0-9]+]], codeptr_ra={{0x[0-f]+}}, count=1
   // CHECK-DAG: {{^}}[[THREAD_ID_2]]: ompt_event_single_others_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra={{0x[0-f]+}}, count=1
+  // clang-format on
 
   return 0;
 }

>From e40f0ef4eda28dc03ea66ef82c52e54ea9aec1ca Mon Sep 17 00:00:00 2001
From: Joachim Jenke <jenke at itc.rwth-aachen.de>
Date: Tue, 2 Jul 2024 23:02:49 +0200
Subject: [PATCH 3/3] Remove missleading comment

---
 openmp/runtime/src/ompt-specific.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/openmp/runtime/src/ompt-specific.h b/openmp/runtime/src/ompt-specific.h
index 0bf973fa1db00..7864ed6126c70 100644
--- a/openmp/runtime/src/ompt-specific.h
+++ b/openmp/runtime/src/ompt-specific.h
@@ -133,7 +133,7 @@ inline const char *ompt_get_runtime_version() {
 inline ompt_work_t ompt_get_work_schedule(enum sched_type schedule) {
   switch (SCHEDULE_WITHOUT_MODIFIERS(schedule)) {
   case kmp_sch_static_chunked:
-  case kmp_sch_static_balanced: // Chunk is calculated in the switch above
+  case kmp_sch_static_balanced:
   case kmp_sch_static_greedy:
     return ompt_work_loop_static;
   case kmp_sch_dynamic_chunked:



More information about the Openmp-commits mailing list