diff options
| author | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2016-09-02 18:29:45 +0000 |
|---|---|---|
| committer | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2016-09-02 18:29:45 +0000 |
| commit | 5c32d5ef0d6cdb92666f75fe7b44b8f74c362564 (patch) | |
| tree | 347c3c164077c835bd310ac73b4316c08bb47877 /openmp/runtime/src | |
| parent | e31cc842902c5e0a3b5e250249532e180f6374a2 (diff) | |
| download | bcm5719-llvm-5c32d5ef0d6cdb92666f75fe7b44b8f74c362564.tar.gz bcm5719-llvm-5c32d5ef0d6cdb92666f75fe7b44b8f74c362564.zip | |
Use 'critical' reduction method when 'atomic' is not available but requested.
In case atomic reduction method is not available (the compiler can't generate
it) the assertion failure occurred if KMP_FORCE_REDUCTION=atomic was specified.
This change replaces the assertion with a warning and sets the reduction method
to the default one - 'critical'.
Patch by Olga Malysheva
Differential Revision: https://reviews.llvm.org/D23990
llvm-svn: 280519
Diffstat (limited to 'openmp/runtime/src')
| -rw-r--r-- | openmp/runtime/src/i18n/en_US.txt | 3 | ||||
| -rw-r--r-- | openmp/runtime/src/kmp_runtime.c | 21 |
2 files changed, 16 insertions, 8 deletions
diff --git a/openmp/runtime/src/i18n/en_US.txt b/openmp/runtime/src/i18n/en_US.txt index ffa2a6b603e..ce09e162956 100644 --- a/openmp/runtime/src/i18n/en_US.txt +++ b/openmp/runtime/src/i18n/en_US.txt @@ -38,7 +38,7 @@ Language "English" Country "USA" LangId "1033" Version "2" -Revision "20160405" +Revision "20160714" @@ -410,6 +410,7 @@ AffIgnoringHwloc "%1$s: Ignoring hwloc mechanism." AffHwlocErrorOccurred "%1$s: Hwloc failed in %2$s. Relying on internal affinity mechanisms." EnvSerialWarn "%1$s must be set prior to OpenMP runtime library initialization; ignored." EnvVarDeprecated "%1$s variable deprecated, please use %2$s instead." +RedMethodNotSupported "KMP_FORCE_REDUCTION: %1$s method is not supported; using critical." # -------------------------------------------------------------------------------------------------- diff --git a/openmp/runtime/src/kmp_runtime.c b/openmp/runtime/src/kmp_runtime.c index 7b2ef06444a..0e20e7bdcd7 100644 --- a/openmp/runtime/src/kmp_runtime.c +++ b/openmp/runtime/src/kmp_runtime.c @@ -7585,27 +7585,34 @@ __kmp_determine_reduction_method( ident_t *loc, kmp_int32 global_tid, // method and stay with the unsynchronized method (empty_reduce_block) if( __kmp_force_reduction_method != reduction_method_not_defined && team_size != 1) { - PACKED_REDUCTION_METHOD_T forced_retval; + PACKED_REDUCTION_METHOD_T forced_retval = critical_reduce_block; int atomic_available, tree_available; switch( ( forced_retval = __kmp_force_reduction_method ) ) { - case critical_reduce_block: + case critical_reduce_block: KMP_ASSERT( lck ); // lck should be != 0 break; case atomic_reduce_block: atomic_available = FAST_REDUCTION_ATOMIC_METHOD_GENERATED; - KMP_ASSERT( atomic_available ); // atomic_available should be != 0 + if( ! atomic_available ) { + KMP_WARNING(RedMethodNotSupported, "atomic"); + forced_retval = critical_reduce_block; + } break; case tree_reduce_block: tree_available = FAST_REDUCTION_TREE_METHOD_GENERATED; - KMP_ASSERT( tree_available ); // tree_available should be != 0 - #if KMP_FAST_REDUCTION_BARRIER - forced_retval = TREE_REDUCE_BLOCK_WITH_REDUCTION_BARRIER; - #endif + if( ! tree_available ) { + KMP_WARNING(RedMethodNotSupported, "tree"); + forced_retval = critical_reduce_block; + } else { + #if KMP_FAST_REDUCTION_BARRIER + forced_retval = TREE_REDUCE_BLOCK_WITH_REDUCTION_BARRIER; + #endif + } break; default: |

