[Openmp-commits] [PATCH] D23990: Use 'critical' reduction method when 'atomic' is not available but requested.

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Fri Sep 2 11:38:04 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL280519: Use 'critical' reduction method when 'atomic' is not available but requested. (authored by jlpeyton).

Changed prior to commit:
  https://reviews.llvm.org/D23990?vs=69562&id=70198#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23990

Files:
  openmp/trunk/runtime/src/i18n/en_US.txt
  openmp/trunk/runtime/src/kmp_runtime.c

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
@@ -38,7 +38,7 @@
 Country  "USA"
 LangId   "1033"
 Version  "2"
-Revision "20160405"
+Revision "20160714"
 
 
 
@@ -410,6 +410,7 @@
 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."
 
 
 # --------------------------------------------------------------------------------------------------
Index: openmp/trunk/runtime/src/kmp_runtime.c
===================================================================
--- openmp/trunk/runtime/src/kmp_runtime.c
+++ openmp/trunk/runtime/src/kmp_runtime.c
@@ -7585,27 +7585,34 @@
     // 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:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23990.70198.patch
Type: text/x-patch
Size: 2825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20160902/9ca48e7e/attachment.bin>


More information about the Openmp-commits mailing list