[Openmp-commits] [compiler-rt] [openmp] [OpenMP][Archer][TSan] Use TSan fibers to implement task-centric analysis for OpenMP tasks (PR #74646)

via Openmp-commits openmp-commits at lists.llvm.org
Wed Dec 6 11:21:15 PST 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 5baf66f3c2ee90d2de03f7ba3a558b1ad2632c2f dc6034ec517ea1188e803a5651f2e2f497ee508a -- openmp/tools/archer/tests/races/DRB027b-taskdependmissing-orig-yes.c openmp/tools/archer/tests/races/DRB131b-taskdep4-orig-omp45-yes.c openmp/tools/archer/tests/races/DRB134b-taskdep5-orig-omp45-yes.c openmp/tools/archer/tests/races/DRB136b-taskdep-mutexinoutset-orig-yes.c openmp/tools/archer/tests/races/DRB165b-taskdep4-orig-omp50-yes.c openmp/tools/archer/tests/races/DRB168b-taskdep5-orig-omp50-yes.c openmp/tools/archer/tests/races/DRB173b-non-sibling-taskdep-yes.c openmp/tools/archer/tests/races/DRB175b-non-sibling-taskdep2-yes.c openmp/tools/archer/tests/races/DRB177b-fib-taskdep-yes.c openmp/tools/archer/tests/task/DRB132b-taskdep4-orig-omp45-no.c openmp/tools/archer/tests/task/DRB133b-taskdep5-orig-omp45-no.c compiler-rt/lib/tsan/rtl/tsan_rtl.h compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp openmp/runtime/src/ompt-specific.cpp openmp/tools/archer/ompt-tsan.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/openmp/runtime/src/ompt-specific.cpp b/openmp/runtime/src/ompt-specific.cpp
index 28f9f82397..df4804c1c3 100644
--- a/openmp/runtime/src/ompt-specific.cpp
+++ b/openmp/runtime/src/ompt-specific.cpp
@@ -482,7 +482,6 @@ int __ompt_get_task_memory_internal(void **addr, size_t *size, int blocknum) {
   *addr = taskdata;
   *size = taskdata->td_size_alloc;
   return 0;
-
 }
 
 //----------------------------------------------------------
diff --git a/openmp/tools/archer/ompt-tsan.cpp b/openmp/tools/archer/ompt-tsan.cpp
index ab5dccfb39..870f01d148 100644
--- a/openmp/tools/archer/ompt-tsan.cpp
+++ b/openmp/tools/archer/ompt-tsan.cpp
@@ -30,7 +30,6 @@
 #include <unistd.h>
 #include <unordered_map>
 #include <vector>
-#include <dlfcn.h>
 
 #include "omp-tools.h"
 
@@ -661,8 +660,8 @@ static void ompt_tsan_thread_begin(ompt_thread_t thread_type,
   TsanNewMemory(DependencyDataPool::ThreadDataPool,
                 sizeof(DependencyDataPool::ThreadDataPool));
   if (archer_flags->tasking) {
-      TsanGetCurrentFiber();
-   }
+    TsanGetCurrentFiber();
+  }
 
   thread_data->value = my_next_id();
 }
@@ -1272,9 +1271,9 @@ static int ompt_tsan_initialize(ompt_function_lookup_t lookup, int device_num,
   findTsanFunction(__tsan_func_entry, (void (*)(const void *)));
   findTsanFunction(__tsan_func_exit, (void (*)(void)));
   findTsanFunction(__tsan_create_fiber, (void *(*)(unsigned int)));
-  findTsanFunction(__tsan_destroy_fiber, (void (*)(void*)));
+  findTsanFunction(__tsan_destroy_fiber, (void (*)(void *)));
   findTsanFunction(__tsan_get_current_fiber, (void *(*)()));
-  findTsanFunction(__tsan_switch_to_fiber, (void (*)(void*, unsigned int)));
+  findTsanFunction(__tsan_switch_to_fiber, (void (*)(void *, unsigned int)));
 
   SET_CALLBACK(thread_begin);
   SET_CALLBACK(thread_end);
diff --git a/openmp/tools/archer/tests/races/DRB027b-taskdependmissing-orig-yes.c b/openmp/tools/archer/tests/races/DRB027b-taskdependmissing-orig-yes.c
index cd1fec9ec6..d616e80991 100644
--- a/openmp/tools/archer/tests/races/DRB027b-taskdependmissing-orig-yes.c
+++ b/openmp/tools/archer/tests/races/DRB027b-taskdependmissing-orig-yes.c
@@ -10,37 +10,36 @@
 //
 //===----------------------------------------------------------------------===//
 
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run-race | FileCheck %s
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run-race | FileCheck %s
+// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run-race |
+// FileCheck %s RUN: %libarcher-compile && env
+// ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run-race | FileCheck %s
 // REQUIRES: tsan
-#include <assert.h> 
-#include <stdio.h> 
 #include "ompt/ompt-signal.h"
+#include <assert.h>
+#include <stdio.h>
 
-int main()
-{
-  int i=0, sem=0;
+int main() {
+  int i = 0, sem = 0;
 #pragma omp parallel shared(sem) num_threads(2)
-{
-#pragma omp masked
   {
+#pragma omp masked
+    {
 #pragma omp task
-   {
-    OMPT_SIGNAL(sem);
+        {OMPT_SIGNAL(sem);
     i = 1;
-   }
+  }
 #pragma omp task
-   {
+  {
     OMPT_SIGNAL(sem);
-    i = 2;    
-   }
-   #pragma omp taskwait
+    i = 2;
   }
-  OMPT_WAIT(sem, 2);
+#pragma omp taskwait
+}
+OMPT_WAIT(sem, 2);
+}
+printf("i=%d\n", i);
+return 0;
 }
-  printf ("i=%d\n",i);
-  return 0;
-} 
 
 // CHECK: WARNING: ThreadSanitizer: data race
 // CHECK: ThreadSanitizer: reported {{[0-9]+}} warnings
diff --git a/openmp/tools/archer/tests/races/DRB131b-taskdep4-orig-omp45-yes.c b/openmp/tools/archer/tests/races/DRB131b-taskdep4-orig-omp45-yes.c
index 01535a696b..71d38f8b3f 100644
--- a/openmp/tools/archer/tests/races/DRB131b-taskdep4-orig-omp45-yes.c
+++ b/openmp/tools/archer/tests/races/DRB131b-taskdep4-orig-omp45-yes.c
@@ -10,45 +10,45 @@
 //
 //===----------------------------------------------------------------------===//
 
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run-race | FileCheck %s
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run-race | FileCheck %s
+// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run-race |
+// FileCheck %s RUN: %libarcher-compile && env
+// ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run-race | FileCheck %s
 // REQUIRES: tsan
-#include <stdio.h>
-#include <omp.h>
 #include "ompt/ompt-signal.h"
+#include <omp.h>
+#include <stdio.h>
 
 int sem = 0;
 
-void foo(){
+void foo() {
 
   int x = 0, y = 2;
 
-  #pragma omp task depend(inout: x) shared(x, sem)
+#pragma omp task depend(inout : x) shared(x, sem)
   {
     OMPT_SIGNAL(sem);
-    x++;                                                //1st Child Task
+    x++; // 1st Child Task
   }
 
-  #pragma omp task shared(y, sem)
+#pragma omp task shared(y, sem)
   {
     OMPT_SIGNAL(sem);
-    y--;                                                // 2nd child task
+    y--; // 2nd child task
   }
 
-  #pragma omp task depend(in: x) if(0)                // 1st taskwait
+#pragma omp task depend(in : x) if (0) // 1st taskwait
   {}
 
-  printf("x=%d\n",x);
-  printf("y=%d\n",y);
-  #pragma omp taskwait                                // 2nd taskwait
+  printf("x=%d\n", x);
+  printf("y=%d\n", y);
+#pragma omp taskwait // 2nd taskwait
 }
 
-
-int main(){
-  #pragma omp parallel
+int main() {
+#pragma omp parallel
   {
-    #pragma omp masked
-      foo();
+#pragma omp masked
+    foo();
     OMPT_WAIT(sem, 2);
   }
 
diff --git a/openmp/tools/archer/tests/races/DRB134b-taskdep5-orig-omp45-yes.c b/openmp/tools/archer/tests/races/DRB134b-taskdep5-orig-omp45-yes.c
index d18ad43c25..bb911fcc05 100644
--- a/openmp/tools/archer/tests/races/DRB134b-taskdep5-orig-omp45-yes.c
+++ b/openmp/tools/archer/tests/races/DRB134b-taskdep5-orig-omp45-yes.c
@@ -10,53 +10,50 @@
 //
 //===----------------------------------------------------------------------===//
 
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run-race | FileCheck %s
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run-race | FileCheck %s
+// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run-race |
+// FileCheck %s RUN: %libarcher-compile && env
+// ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run-race | FileCheck %s
 // REQUIRES: tsan
-#include <stdio.h>
-#include <omp.h>
 #include "ompt/ompt-signal.h"
+#include <omp.h>
+#include <stdio.h>
 
-int sem=0;
+int sem = 0;
 
-void foo(){
+void foo() {
   int x = 0, y = 2;
 
-  #pragma omp task depend(inout: x) shared(x, sem)
-  { 
+#pragma omp task depend(inout : x) shared(x, sem)
+  {
     OMPT_SIGNAL(sem);
-    x++;                                                             // 1st child task
+    x++; // 1st child task
   }
 
-  #pragma omp task depend(in: x) depend(inout: y) shared(x, y, sem)
+#pragma omp task depend(in : x) depend(inout : y) shared(x, y, sem)
   {
     OMPT_SIGNAL(sem);
-    y -= x;                                                         //2nd child task
+    y -= x; // 2nd child task
   }
 
-  #pragma omp task depend(in: x) if(0)                             // 1st taskwait
+#pragma omp task depend(in : x) if (0) // 1st taskwait
   {}
 
-  printf("x=%d\n",x);
-  printf("y=%d\n",y);
-
-  #pragma omp taskwait		                                         // 2nd taskwait
+  printf("x=%d\n", x);
+  printf("y=%d\n", y);
 
+#pragma omp taskwait // 2nd taskwait
 }
 
-int main(){
-  #pragma omp parallel num_threads(2)
+int main() {
+#pragma omp parallel num_threads(2)
   {
-    #pragma omp masked
-    {
-  foo();
-    }
+#pragma omp masked
+    { foo(); }
     OMPT_WAIT(sem, 2);
   }
 
   return 0;
 }
 
-
 // CHECK: WARNING: ThreadSanitizer: data race
 // CHECK: ThreadSanitizer: reported {{[0-9]+}} warnings
diff --git a/openmp/tools/archer/tests/races/DRB136b-taskdep-mutexinoutset-orig-yes.c b/openmp/tools/archer/tests/races/DRB136b-taskdep-mutexinoutset-orig-yes.c
index 39d991c18b..0fd58cb473 100644
--- a/openmp/tools/archer/tests/races/DRB136b-taskdep-mutexinoutset-orig-yes.c
+++ b/openmp/tools/archer/tests/races/DRB136b-taskdep-mutexinoutset-orig-yes.c
@@ -10,57 +10,57 @@
 //
 //===----------------------------------------------------------------------===//
 
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run-race | FileCheck %s
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run-race | FileCheck %s
+// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run-race |
+// FileCheck %s RUN: %libarcher-compile && env
+// ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run-race | FileCheck %s
 // REQUIRES: tsan
-#include <stdio.h>
-#include <omp.h>
 #include "ompt/ompt-signal.h"
+#include <omp.h>
+#include <stdio.h>
 
-int main(){
+int main() {
   int a, b, c, d, sem = 0;
 
-  #pragma omp parallel num_threads(2)
-  {
-  #pragma omp masked
+#pragma omp parallel num_threads(2)
   {
-    #pragma omp task depend(out: c)
-    {
-      OMPT_SIGNAL(sem);
-      c = 1;
-    }
-    #pragma omp task depend(out: a)
+#pragma omp masked
     {
-      OMPT_SIGNAL(sem);
-      a = 2;
-    }
-    #pragma omp task depend(out: b)
-    {
-      OMPT_SIGNAL(sem);
-      b = 3;
-    }
-    #pragma omp task depend(in: a)
-    {
-      OMPT_SIGNAL(sem);
-      c += a;
-    }
-    #pragma omp task depend(in: b)
-    {
-      OMPT_SIGNAL(sem);
-      c += b;
-    }
-    #pragma omp task depend(in: c)
-    {
-      OMPT_SIGNAL(sem);
-      d = c;
-    }
-    #pragma omp taskwait
+#pragma omp task depend(out : c)
+        {OMPT_SIGNAL(sem);
+    c = 1;
   }
-  OMPT_WAIT(sem, 6);
+#pragma omp task depend(out : a)
+  {
+    OMPT_SIGNAL(sem);
+    a = 2;
   }
+#pragma omp task depend(out : b)
+  {
+    OMPT_SIGNAL(sem);
+    b = 3;
+  }
+#pragma omp task depend(in : a)
+  {
+    OMPT_SIGNAL(sem);
+    c += a;
+  }
+#pragma omp task depend(in : b)
+  {
+    OMPT_SIGNAL(sem);
+    c += b;
+  }
+#pragma omp task depend(in : c)
+  {
+    OMPT_SIGNAL(sem);
+    d = c;
+  }
+#pragma omp taskwait
+}
+OMPT_WAIT(sem, 6);
+}
 
-  printf("%d\n",d);
-  return 0;
+printf("%d\n", d);
+return 0;
 }
 
 // CHECK: WARNING: ThreadSanitizer: data race
diff --git a/openmp/tools/archer/tests/races/DRB165b-taskdep4-orig-omp50-yes.c b/openmp/tools/archer/tests/races/DRB165b-taskdep4-orig-omp50-yes.c
index d2b14aee4b..97eb3a6f6a 100644
--- a/openmp/tools/archer/tests/races/DRB165b-taskdep4-orig-omp50-yes.c
+++ b/openmp/tools/archer/tests/races/DRB165b-taskdep4-orig-omp50-yes.c
@@ -10,44 +10,44 @@
 //
 //===----------------------------------------------------------------------===//
 
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run-race | FileCheck %s
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run-race | FileCheck %s
+// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run-race |
+// FileCheck %s RUN: %libarcher-compile && env
+// ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run-race | FileCheck %s
 // REQUIRES: tsan
-#include <stdio.h>
-#include <omp.h>
 #include "ompt/ompt-signal.h"
+#include <omp.h>
+#include <stdio.h>
 
 int sem = 0;
 
-void foo(){
+void foo() {
 
   int x = 0, y = 2;
 
-  #pragma omp task depend(inout: x) shared(x, sem)
+#pragma omp task depend(inout : x) shared(x, sem)
   {
     OMPT_SIGNAL(sem);
-  x++;                                                //1st Child Task
+    x++; // 1st Child Task
   }
 
-  #pragma omp task shared(y, sem)
+#pragma omp task shared(y, sem)
   {
     OMPT_SIGNAL(sem);
-    y--;                                                // 2nd child task
+    y--; // 2nd child task
   }
 
-  #pragma omp taskwait depend(in: x)                  // 1st taskwait
+#pragma omp taskwait depend(in : x) // 1st taskwait
 
-  printf("x=%d\n",x);
-  printf("y=%d\n",y);
-  #pragma omp taskwait                                // 2nd taskwait
+  printf("x=%d\n", x);
+  printf("y=%d\n", y);
+#pragma omp taskwait // 2nd taskwait
 }
 
-
-int main(){
-  #pragma omp parallel
+int main() {
+#pragma omp parallel
   {
-    #pragma omp masked
-  foo();
+#pragma omp masked
+    foo();
     OMPT_WAIT(sem, 2);
   }
 
diff --git a/openmp/tools/archer/tests/races/DRB168b-taskdep5-orig-omp50-yes.c b/openmp/tools/archer/tests/races/DRB168b-taskdep5-orig-omp50-yes.c
index 67db4aa942..7b9e81778a 100644
--- a/openmp/tools/archer/tests/races/DRB168b-taskdep5-orig-omp50-yes.c
+++ b/openmp/tools/archer/tests/races/DRB168b-taskdep5-orig-omp50-yes.c
@@ -10,51 +10,48 @@
 //
 //===----------------------------------------------------------------------===//
 
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run-race | FileCheck %s
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run-race | FileCheck %s
+// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run-race |
+// FileCheck %s RUN: %libarcher-compile && env
+// ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run-race | FileCheck %s
 // REQUIRES: tsan
-#include <stdio.h>
-#include <omp.h>
 #include "ompt/ompt-signal.h"
+#include <omp.h>
+#include <stdio.h>
 
-int sem=0;
+int sem = 0;
 
-void foo(){
+void foo() {
   int x = 0, y = 2;
 
-  #pragma omp task depend(inout: x) shared(x, sem)
-  { 
+#pragma omp task depend(inout : x) shared(x, sem)
+  {
     OMPT_SIGNAL(sem);
-    x++;                                                             // 1st child task
+    x++; // 1st child task
   }
 
-  #pragma omp task depend(in: x) depend(inout: y) shared(x, y, sem)
+#pragma omp task depend(in : x) depend(inout : y) shared(x, y, sem)
   {
     OMPT_SIGNAL(sem);
-    y -= x;                                                         //2nd child task
+    y -= x; // 2nd child task
   }
 
-  #pragma omp taskwait depend(in: x)                               // 1st taskwait
-
-  printf("x=%d\n",x);
-  printf("y=%d\n",y);
-  #pragma omp taskwait		                                         // 2nd taskwait
+#pragma omp taskwait depend(in : x) // 1st taskwait
 
+  printf("x=%d\n", x);
+  printf("y=%d\n", y);
+#pragma omp taskwait // 2nd taskwait
 }
 
-int main(){
-  #pragma omp parallel num_threads(2)
+int main() {
+#pragma omp parallel num_threads(2)
   {
-    #pragma omp masked
-    {
-      foo();
-    }
+#pragma omp masked
+    { foo(); }
     OMPT_WAIT(sem, 2);
   }
 
   return 0;
 }
 
-
 // CHECK: WARNING: ThreadSanitizer: data race
 // CHECK: ThreadSanitizer: reported {{[0-9]+}} warnings
diff --git a/openmp/tools/archer/tests/races/DRB173b-non-sibling-taskdep-yes.c b/openmp/tools/archer/tests/races/DRB173b-non-sibling-taskdep-yes.c
index a5651ae741..cb2bbe2e6f 100644
--- a/openmp/tools/archer/tests/races/DRB173b-non-sibling-taskdep-yes.c
+++ b/openmp/tools/archer/tests/races/DRB173b-non-sibling-taskdep-yes.c
@@ -10,38 +10,39 @@
 //
 //===----------------------------------------------------------------------===//
 
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run-race | FileCheck %s
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run-race | FileCheck %s
+// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run-race |
+// FileCheck %s RUN: %libarcher-compile && env
+// ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run-race | FileCheck %s
 // REQUIRES: tsan
 // XFAIL: *
+#include "ompt/ompt-signal.h"
 #include <omp.h>
 #include <stdio.h>
-#include "ompt/ompt-signal.h"
 
 void foo() {
   int a = 0, sem = 0;
 
 #pragma omp parallel num_threads(2)
-{
+  {
 #pragma omp masked
 #pragma omp taskgroup
-  {
-#pragma omp task depend(inout : a) shared(a)
     {
 #pragma omp task depend(inout : a) shared(a)
-      OMPT_SIGNAL(sem);
-      a++;
-    }
+      {
+#pragma omp task depend(inout : a) shared(a)
+        OMPT_SIGNAL(sem);
+        a++;
+      }
 
 #pragma omp task depend(inout : a) shared(a)
-    {
+      {
 #pragma omp task depend(inout : a) shared(a)
-      OMPT_SIGNAL(sem);
-      a++;
+        OMPT_SIGNAL(sem);
+        a++;
+      }
     }
+    OMPT_WAIT(sem, 2);
   }
-  OMPT_WAIT(sem,2);
-}
   printf("a=%d\n", a);
 }
 
diff --git a/openmp/tools/archer/tests/races/DRB175b-non-sibling-taskdep2-yes.c b/openmp/tools/archer/tests/races/DRB175b-non-sibling-taskdep2-yes.c
index f38b916cea..53c59c1e00 100644
--- a/openmp/tools/archer/tests/races/DRB175b-non-sibling-taskdep2-yes.c
+++ b/openmp/tools/archer/tests/races/DRB175b-non-sibling-taskdep2-yes.c
@@ -10,12 +10,13 @@
 //
 //===----------------------------------------------------------------------===//
 
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run-race | FileCheck %s
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run-race | FileCheck %s
+// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run-race |
+// FileCheck %s RUN: %libarcher-compile && env
+// ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run-race | FileCheck %s
 // REQUIRES: tsan
+#include "ompt/ompt-signal.h"
 #include <omp.h>
 #include <stdio.h>
-#include "ompt/ompt-signal.h"
 
 void foo() {
   int a = 0, sem = 0;
diff --git a/openmp/tools/archer/tests/races/DRB177b-fib-taskdep-yes.c b/openmp/tools/archer/tests/races/DRB177b-fib-taskdep-yes.c
index a6a49018bb..8e6cf75581 100644
--- a/openmp/tools/archer/tests/races/DRB177b-fib-taskdep-yes.c
+++ b/openmp/tools/archer/tests/races/DRB177b-fib-taskdep-yes.c
@@ -10,12 +10,13 @@
 //
 //===----------------------------------------------------------------------===//
 
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run-race | FileCheck %s
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run-race | FileCheck %s
+// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run-race |
+// FileCheck %s RUN: %libarcher-compile && env
+// ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run-race | FileCheck %s
 // REQUIRES: tsan
+#include "ompt/ompt-signal.h"
 #include <stdio.h>
 #include <stdlib.h>
-#include "ompt/ompt-signal.h"
 
 int sem = 0;
 
@@ -24,17 +25,11 @@ int fib(int n) {
   if (n < 2)
     return n;
 #pragma omp task shared(i, sem) depend(out : i)
-  {
-    i = fib(n - 1);
-  }
+  { i = fib(n - 1); }
 #pragma omp task shared(j, sem) depend(out : j)
-  {
-    j = fib(n - 2);
-  }
+  { j = fib(n - 2); }
 #pragma omp task shared(i, j, s, sem) depend(in : j)
-  {
-    s = i + j;
-  }
+  { s = i + j; }
 #pragma omp taskwait
   return s;
 }
@@ -44,13 +39,13 @@ int main(int argc, char **argv) {
   if (argc > 1)
     n = atoi(argv[1]);
 #pragma omp parallel
-  { 
+  {
 #pragma omp masked
-  { 
-    printf("fib(%i) = %i\n", n, fib(n)); 
-    OMPT_SIGNAL(sem);
-  }
-  OMPT_WAIT(sem, 1);
+    {
+      printf("fib(%i) = %i\n", n, fib(n));
+      OMPT_SIGNAL(sem);
+    }
+    OMPT_WAIT(sem, 1);
   }
   return 0;
 }
diff --git a/openmp/tools/archer/tests/task/DRB132b-taskdep4-orig-omp45-no.c b/openmp/tools/archer/tests/task/DRB132b-taskdep4-orig-omp45-no.c
index 0aa2546615..51503815a5 100644
--- a/openmp/tools/archer/tests/task/DRB132b-taskdep4-orig-omp45-no.c
+++ b/openmp/tools/archer/tests/task/DRB132b-taskdep4-orig-omp45-no.c
@@ -10,47 +10,47 @@
 //
 //===----------------------------------------------------------------------===//
 
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run | FileCheck %s
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run | FileCheck %s
+// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run |
+// FileCheck %s RUN: %libarcher-compile && env
+// ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run | FileCheck %s
 // REQUIRES: tsan
-#include <stdio.h>
-#include <omp.h>
 #include "ompt/ompt-signal.h"
+#include <omp.h>
+#include <stdio.h>
 
 int sem = 0;
 
-void foo(){
+void foo() {
 
   int x = 0, y = 2;
 
-  #pragma omp task depend(inout: x) shared(x, sem)
+#pragma omp task depend(inout : x) shared(x, sem)
   {
     OMPT_SIGNAL(sem);
-    x++;                                                //1st Child Task
+    x++; // 1st Child Task
   }
 
-  #pragma omp task shared(y, sem)
+#pragma omp task shared(y, sem)
   {
     OMPT_SIGNAL(sem);
-    y--;                                                // 2nd child task
+    y--; // 2nd child task
   }
 
-  #pragma omp task depend(in: x) if(0)                // 1st taskwait
+#pragma omp task depend(in : x) if (0) // 1st taskwait
   {}
 
-  printf("x=%d\n",x);
+  printf("x=%d\n", x);
 
-  #pragma omp taskwait                                // 2nd taskwait
+#pragma omp taskwait // 2nd taskwait
 
-  printf("y=%d\n",y);
+  printf("y=%d\n", y);
 }
 
-
-int main(){
-  #pragma omp parallel
+int main() {
+#pragma omp parallel
   {
-    #pragma omp masked
-  foo();
+#pragma omp masked
+    foo();
     OMPT_WAIT(sem, 2);
   }
 
diff --git a/openmp/tools/archer/tests/task/DRB133b-taskdep5-orig-omp45-no.c b/openmp/tools/archer/tests/task/DRB133b-taskdep5-orig-omp45-no.c
index 4745fa1b32..a59a12f269 100644
--- a/openmp/tools/archer/tests/task/DRB133b-taskdep5-orig-omp45-no.c
+++ b/openmp/tools/archer/tests/task/DRB133b-taskdep5-orig-omp45-no.c
@@ -10,47 +10,46 @@
 //
 //===----------------------------------------------------------------------===//
 
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run | FileCheck %s
-// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run | FileCheck %s
+// RUN: %libarcher-compile && env ARCHER_OPTIONS=tasking=1 %libarcher-run |
+// FileCheck %s RUN: %libarcher-compile && env
+// ARCHER_OPTIONS=tasking=1:ignore_serial=1 %libarcher-run | FileCheck %s
 // REQUIRES: tsan
-#include <stdio.h>
-#include <omp.h>
 #include "ompt/ompt-signal.h"
+#include <omp.h>
+#include <stdio.h>
 
-int sem=0;
+int sem = 0;
 
-void foo(){
+void foo() {
   int x = 0, y = 2;
 
-  #pragma omp task depend(inout: x) shared(x, sem)
-  { 
+#pragma omp task depend(inout : x) shared(x, sem)
+  {
     OMPT_SIGNAL(sem);
-  x++;                                                                  // 1st child task
+    x++; // 1st child task
   }
 
-  #pragma omp task depend(in: x) depend(inout: y) shared(x, y, sem)
+#pragma omp task depend(in : x) depend(inout : y) shared(x, y, sem)
   {
     OMPT_SIGNAL(sem);
-    y -= x;                                                         //2nd child task
+    y -= x; // 2nd child task
   }
 
-  #pragma omp task depend(in: x) if(0)                                  // 1st taskwait
+#pragma omp task depend(in : x) if (0) // 1st taskwait
   {}
 
-  printf("x=%d\n",x);
+  printf("x=%d\n", x);
 
-  #pragma omp taskwait                                                  // 2nd taskwait
+#pragma omp taskwait // 2nd taskwait
 
-  printf("y=%d\n",y);
+  printf("y=%d\n", y);
 }
 
-int main(){
-  #pragma omp parallel num_threads(2)
+int main() {
+#pragma omp parallel num_threads(2)
   {
-    #pragma omp masked
-    {
-  foo();
-    }
+#pragma omp masked
+    { foo(); }
     OMPT_WAIT(sem, 2);
   }
 

``````````

</details>


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


More information about the Openmp-commits mailing list