[Openmp-commits] [PATCH] D39890: [OMPT] Fix assertion for OpenMP code generated with outdated compilers

Phabricator via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Nov 10 13:07:48 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL317928: [OMPT] Fix assertion for OpenMP code generated with outdated compilers (authored by jprotze).

Changed prior to commit:
  https://reviews.llvm.org/D39890?vs=122445&id=122512#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39890

Files:
  openmp/trunk/runtime/src/i18n/en_US.txt
  openmp/trunk/runtime/src/kmp_csupport.cpp
  openmp/trunk/runtime/src/kmp_sched.cpp


Index: openmp/trunk/runtime/src/kmp_csupport.cpp
===================================================================
--- openmp/trunk/runtime/src/kmp_csupport.cpp
+++ openmp/trunk/runtime/src/kmp_csupport.cpp
@@ -1758,7 +1758,7 @@
 
 #if OMPT_SUPPORT && OMPT_OPTIONAL
   if (ompt_enabled.ompt_callback_work) {
-    ompt_work_type_t ompt_work_type;
+    ompt_work_type_t ompt_work_type = ompt_work_loop;
     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
@@ -1770,8 +1770,8 @@
       } else if ((loc->flags & KMP_IDENT_WORK_DISTRIBUTE) != 0) {
         ompt_work_type = ompt_work_distribute;
       } else {
-        KMP_ASSERT2(0,
-                    "__kmpc_for_static_fini: can't determine workshare type");
+        // use default set above.
+        // a warning about this case is provided in __kmpc_for_static_init
       }
       KMP_DEBUG_ASSERT(ompt_work_type);
     }
Index: openmp/trunk/runtime/src/i18n/en_US.txt
===================================================================
--- openmp/trunk/runtime/src/i18n/en_US.txt
+++ openmp/trunk/runtime/src/i18n/en_US.txt
@@ -325,6 +325,8 @@
                                  # %1, -- name of ignored variable, %2 -- name of variable with higher priority.
 OBSOLETE                     "%1$s: overrides %3$s specified before"
                                  # %1, %2 -- name and value of the overriding variable, %3 -- name of overriden variable.
+OmptOutdatedWorkshare        "OMPT: Cannot determine workshare type; using the default (loop) instead. "
+                             "This issue is fixed in an up-to-date compiler."
 
 # --- OpenMP errors detected at runtime ---
 #
Index: openmp/trunk/runtime/src/kmp_sched.cpp
===================================================================
--- openmp/trunk/runtime/src/kmp_sched.cpp
+++ openmp/trunk/runtime/src/kmp_sched.cpp
@@ -66,9 +66,11 @@
 #if OMPT_SUPPORT && OMPT_OPTIONAL
   ompt_team_info_t *team_info = NULL;
   ompt_task_info_t *task_info = NULL;
-  ompt_work_type_t ompt_work_type;
+  ompt_work_type_t ompt_work_type = ompt_work_loop;
 
-  if (ompt_enabled.enabled) {
+  static kmp_int8 warn = 0;
+
+  if (ompt_enabled.ompt_callback_work) {
     // Only fully initialize variables needed by OMPT if OMPT is enabled.
     team_info = __ompt_get_teaminfo(0, NULL);
     task_info = __ompt_get_task_info_object(0);
@@ -81,8 +83,10 @@
       } else if ((loc->flags & KMP_IDENT_WORK_DISTRIBUTE) != 0) {
         ompt_work_type = ompt_work_distribute;
       } else {
-        KMP_ASSERT2(0,
-                    "__kmpc_for_static_init: can't determine workshare type");
+        kmp_int8 bool_res =
+            KMP_COMPARE_AND_STORE_ACQ8(&warn, (kmp_int8)0, (kmp_int8)1);
+        if (bool_res)
+          KMP_WARNING(OmptOutdatedWorkshare);
       }
       KMP_DEBUG_ASSERT(ompt_work_type);
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39890.122512.patch
Type: text/x-patch
Size: 2940 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20171110/85bfc44f/attachment.bin>


More information about the Openmp-commits mailing list