[Openmp-commits] [openmp] 26b675d - [OpenMP][Tools][NFC] Make an Archer test more robust

Joachim Protze via Openmp-commits openmp-commits at lists.llvm.org
Fri Oct 15 08:35:24 PDT 2021


Author: Joachim Protze
Date: 2021-10-15T17:32:05+02:00
New Revision: 26b675d65eb2d1f117a39eee965652f590373232

URL: https://github.com/llvm/llvm-project/commit/26b675d65eb2d1f117a39eee965652f590373232
DIFF: https://github.com/llvm/llvm-project/commit/26b675d65eb2d1f117a39eee965652f590373232.diff

LOG: [OpenMP][Tools][NFC] Make an Archer test more robust

The execution order of the tasks is not fixed, so there is no ordering
for the write accesses. Enforce the ordering that is expected in the check.

Added: 
    

Modified: 
    openmp/tools/archer/tests/races/task-dependency.c

Removed: 
    


################################################################################
diff  --git a/openmp/tools/archer/tests/races/task-dependency.c b/openmp/tools/archer/tests/races/task-dependency.c
index 664dd49d28a32..f6496ac8596d8 100644
--- a/openmp/tools/archer/tests/races/task-dependency.c
+++ b/openmp/tools/archer/tests/races/task-dependency.c
@@ -19,15 +19,16 @@
 #include <unistd.h>
 
 int main(int argc, char *argv[]) {
-  int var = 0, a = 0;
+  int var = 0, a = 0, b = 0;
 
 #pragma omp parallel num_threads(8) shared(var, a)
 #pragma omp master
   {
-#pragma omp task shared(var, a) depend(out : var)
+#pragma omp task shared(var, a, b) depend(out : var)
     {
       OMPT_SIGNAL(a);
       var++;
+      OMPT_SIGNAL(b);
     }
 
 #pragma omp task shared(a) depend(in : var)
@@ -36,8 +37,9 @@ int main(int argc, char *argv[]) {
       OMPT_WAIT(a, 3);
     }
 
-#pragma omp task shared(var) // depend(in: var) is missing here!
+#pragma omp task shared(var, b) // depend(in: var) is missing here!
     {
+      OMPT_WAIT(b, 1);
       var++;
       OMPT_SIGNAL(a);
     }
@@ -53,7 +55,7 @@ int main(int argc, char *argv[]) {
 
 // CHECK: WARNING: ThreadSanitizer: data race
 // CHECK-NEXT:   {{(Write|Read)}} of size 4
-// CHECK-NEXT: #0 {{.*}}task-dependency.c:41
+// CHECK-NEXT: #0 {{.*}}task-dependency.c:43
 // CHECK:   Previous write of size 4
 // CHECK-NEXT: #0 {{.*}}task-dependency.c:30
 // CHECK: DONE


        


More information about the Openmp-commits mailing list