[flang-commits] [flang] 1301995 - [NFC][flang][OpenMP] Add comment for handling the data race problem in copyin clause

Peixin Qiao via flang-commits flang-commits at lists.llvm.org
Tue Jul 12 04:55:51 PDT 2022


Author: Peixin Qiao
Date: 2022-07-12T19:54:24+08:00
New Revision: 13019955bfac1706bebe8211ace773e44410730f

URL: https://github.com/llvm/llvm-project/commit/13019955bfac1706bebe8211ace773e44410730f
DIFF: https://github.com/llvm/llvm-project/commit/13019955bfac1706bebe8211ace773e44410730f.diff

LOG: [NFC][flang][OpenMP] Add comment for handling the data race problem in copyin clause

The reference and description is missed before.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D129437

Added: 
    

Modified: 
    flang/lib/Lower/OpenMP.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp
index 9ac78b537abfa..ed462d254861b 100644
--- a/flang/lib/Lower/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP.cpp
@@ -228,6 +228,11 @@ genCopyinClause(Fortran::lower::AbstractConverter &converter,
       }
     }
   }
+  // [OMP 5.0, 2.19.6.1] The copy is done after the team is formed and prior to
+  // the execution of the associated structured block. Emit implicit barrier to
+  // synchronize threads and avoid data races on propagation master's thread
+  // values of threadprivate variables to local instances of that variables of
+  // all other implicit threads.
   if (hasCopyin)
     firOpBuilder.create<mlir::omp::BarrierOp>(converter.getCurrentLocation());
   firOpBuilder.restoreInsertionPoint(insPt);


        


More information about the flang-commits mailing list