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

Olga Malysheva via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Nov 10 07:28:32 PST 2017


omalyshe added inline comments.


================
Comment at: runtime/src/kmp_sched.cpp:85
+        ompt_work_type = ompt_work_loop;
+        KMP_WARNING(OmptOutdatedWorkshare);
       }
----------------
For a single warning something like this should work


```
@@ -68,6 +68,10 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
   ompt_task_info_t *task_info = NULL;
   ompt_work_type_t ompt_work_type;

+  static kmp_int8 warn = 0;
+
   if (ompt_enabled.enabled) {
     // Only fully initialize variables needed by OMPT if OMPT is enabled.
     team_info = __ompt_get_teaminfo(0, NULL);
@@ -81,8 +85,12 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
       } 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"); 
+        ompt_work_type = ompt_work_loop;
+       kmp_int8 bool_res = KMP_COMPARE_AND_STORE_ACQ8(&warn, (kmp_int8)0, (kmp_int8)1);
+       if(bool_res)
+           KMP_WARNING(...)
       }

```


https://reviews.llvm.org/D39890





More information about the Openmp-commits mailing list