[llvm] 60e643f - [OpenMP][Fix] Fix disable spmdization option

Giorgis Georgakoudis via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 12 17:59:21 PDT 2021


Author: Giorgis Georgakoudis
Date: 2021-08-12T17:59:14-07:00
New Revision: 60e643fe05f52fff829892f746c2785a86612722

URL: https://github.com/llvm/llvm-project/commit/60e643fe05f52fff829892f746c2785a86612722
DIFF: https://github.com/llvm/llvm-project/commit/60e643fe05f52fff829892f746c2785a86612722.diff

LOG: [OpenMP][Fix] Fix disable spmdization option

Besides SPMDization, other analysis and optimization for original, frontend-generated SPMD regions uses information from the AAKernelInfoFunction attribute. This fix makes sure disabling SPMDization through the corresponding option applies only to generic mode regions, which should not be SPMDized, while it leaves unaffected the attribute state of original SPMD regions.

Reviewed By: jdoerfert

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

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/OpenMPOpt.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index e0e661b088916..6c225118b7394 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -2834,10 +2834,6 @@ struct AAKernelInfoFunction : AAKernelInfo {
     // to avoid other parts using the current constant value for simpliication.
     auto &OMPInfoCache = static_cast<OMPInformationCache &>(A.getInfoCache());
 
-    // If we have disabled SPMD-ization, stop
-    if (DisableOpenMPOptSPMDization)
-      SPMDCompatibilityTracker.indicatePessimisticFixpoint();
-
     Function *Fn = getAnchorScope();
     if (!OMPInfoCache.Kernels.count(Fn))
       return;
@@ -2976,6 +2972,9 @@ struct AAKernelInfoFunction : AAKernelInfo {
         dyn_cast<ConstantInt>(KernelInitCB->getArgOperand(InitIsSPMDArgNo));
     if (IsSPMDArg && !IsSPMDArg->isZero())
       SPMDCompatibilityTracker.indicateOptimisticFixpoint();
+    // This is a generic region but SPMDization is disabled so stop tracking.
+    else if (DisableOpenMPOptSPMDization)
+      SPMDCompatibilityTracker.indicatePessimisticFixpoint();
   }
 
   /// Modify the IR based on the KernelInfoState as the fixpoint iteration is


        


More information about the llvm-commits mailing list