diff options
| author | Joachim Protze <protze@itc.rwth-aachen.de> | 2017-11-10 21:07:01 +0000 |
|---|---|---|
| committer | Joachim Protze <protze@itc.rwth-aachen.de> | 2017-11-10 21:07:01 +0000 |
| commit | 91732475a648b4f1303dbdf3f96b08a6b810143b (patch) | |
| tree | 0beb3d9f947cc45663aaf313e2fe3ea4feab71bc /openmp/runtime/src | |
| parent | 3b9ea32ef83247090205891af305d98a3aa5c975 (diff) | |
| download | bcm5719-llvm-91732475a648b4f1303dbdf3f96b08a6b810143b.tar.gz bcm5719-llvm-91732475a648b4f1303dbdf3f96b08a6b810143b.zip | |
[OMPT] Fix assertion for OpenMP code generated with outdated compilers
For up-to-date compilers, this assertion is reasonable, but it breaks
compatibility with the typical compiler installed on most systems.
This patch changes the default value to what we had when there was no
compiler support. A warning about the outdated compiler is printed during
runtime, when this point is reached.
Differential Revision: https://reviews.llvm.org/D39890
llvm-svn: 317928
Diffstat (limited to 'openmp/runtime/src')
| -rw-r--r-- | openmp/runtime/src/i18n/en_US.txt | 2 | ||||
| -rw-r--r-- | openmp/runtime/src/kmp_csupport.cpp | 6 | ||||
| -rw-r--r-- | openmp/runtime/src/kmp_sched.cpp | 12 |
3 files changed, 13 insertions, 7 deletions
diff --git a/openmp/runtime/src/i18n/en_US.txt b/openmp/runtime/src/i18n/en_US.txt index 3878f1e1450..40d0263ab6e 100644 --- a/openmp/runtime/src/i18n/en_US.txt +++ b/openmp/runtime/src/i18n/en_US.txt @@ -325,6 +325,8 @@ StgIgnored "%1$s: ignored because %2$s has been defined" # %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 --- # diff --git a/openmp/runtime/src/kmp_csupport.cpp b/openmp/runtime/src/kmp_csupport.cpp index d39d9f01a68..15dc72eae57 100644 --- a/openmp/runtime/src/kmp_csupport.cpp +++ b/openmp/runtime/src/kmp_csupport.cpp @@ -1758,7 +1758,7 @@ void __kmpc_for_static_fini(ident_t *loc, kmp_int32 global_tid) { #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 @@ void __kmpc_for_static_fini(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_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); } diff --git a/openmp/runtime/src/kmp_sched.cpp b/openmp/runtime/src/kmp_sched.cpp index 9960859eda4..003f66112bf 100644 --- a/openmp/runtime/src/kmp_sched.cpp +++ b/openmp/runtime/src/kmp_sched.cpp @@ -66,9 +66,11 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid, #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 @@ 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"); + 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); } |

