[Openmp-commits] [PATCH] D151138: [OpenMP] Insert missing variable update inside loop

Jonathan Peyton via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue May 23 07:19:40 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGd67c91b5e728: [OpenMP] Insert missing variable update inside loop (authored by jlpeyton).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151138/new/

https://reviews.llvm.org/D151138

Files:
  openmp/runtime/src/kmp_tasking.cpp
  openmp/runtime/test/tasking/omp_task_priority3.c


Index: openmp/runtime/test/tasking/omp_task_priority3.c
===================================================================
--- /dev/null
+++ openmp/runtime/test/tasking/omp_task_priority3.c
@@ -0,0 +1,33 @@
+// RUN: %libomp-compile && env OMP_MAX_TASK_PRIORITY=42 %libomp-run
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <omp.h>
+
+int a = 0;
+
+int main(void) {
+  int i;
+  int max_task_priority = omp_get_max_task_priority();
+  if (max_task_priority != 42) {
+    fprintf(stderr,
+            "error: omp_get_max_task_priority() returned %d instead of 42\n",
+            max_task_priority);
+    exit(EXIT_FAILURE);
+  }
+
+  for (i = 0; i < 250; ++i) {
+    #pragma omp parallel
+    {
+      #pragma omp task priority(42)
+      {
+        #pragma omp atomic
+        a++;
+      }
+    }
+  }
+
+  printf("a = %d\n", a);
+
+  return EXIT_SUCCESS;
+}
Index: openmp/runtime/src/kmp_tasking.cpp
===================================================================
--- openmp/runtime/src/kmp_tasking.cpp
+++ openmp/runtime/src/kmp_tasking.cpp
@@ -3048,6 +3048,7 @@
     if (__kmp_atomic_compare_store(&task_team->tt.tt_num_task_pri, ntasks,
                                    ntasks - 1))
       break;
+    ntasks = task_team->tt.tt_num_task_pri;
   } while (ntasks > 0);
   if (ntasks == 0) {
     KA_TRACE(20, ("__kmp_get_priority_task(exit #2): T#%d No tasks to get\n",


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151138.524700.patch
Type: text/x-patch
Size: 1387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230523/81debd3b/attachment.bin>


More information about the Openmp-commits mailing list