Polly 19.0.0git
Namespaces | Macros | Functions
ScheduleOptimizer.cpp File Reference
#include "polly/ScheduleOptimizer.h"
#include "polly/CodeGen/CodeGeneration.h"
#include "polly/DependenceInfo.h"
#include "polly/ManualOptimizer.h"
#include "polly/MatmulOptimizer.h"
#include "polly/Options.h"
#include "polly/ScheduleTreeTransform.h"
#include "polly/Support/ISLOStream.h"
#include "polly/Support/ISLTools.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/CommandLine.h"
#include "isl/options.h"
#include "polly/Support/PollyDebug.h"

Go to the source code of this file.

Namespaces

namespace  llvm
 This file contains the declaration of the PolyhedralInfo class, which will provide an interface to expose polyhedral analysis information of Polly.
 

Macros

#define DEBUG_TYPE   "polly-opt-isl"
 
#define THREE_STATISTICS(VARNAME, DESC)
 

Functions

static cl::opt< std::string > OptimizeDeps ("polly-opt-optimize-only", cl::desc("Only a certain kind of dependences (all/raw)"), cl::Hidden, cl::init("all"), cl::cat(PollyCategory))
 
static cl::opt< std::string > SimplifyDeps ("polly-opt-simplify-deps", cl::desc("Dependences should be simplified (yes/no)"), cl::Hidden, cl::init("yes"), cl::cat(PollyCategory))
 
static cl::opt< int > MaxConstantTerm ("polly-opt-max-constant-term", cl::desc("The maximal constant term allowed (-1 is unlimited)"), cl::Hidden, cl::init(20), cl::cat(PollyCategory))
 
static cl::opt< int > MaxCoefficient ("polly-opt-max-coefficient", cl::desc("The maximal coefficient allowed (-1 is unlimited)"), cl::Hidden, cl::init(20), cl::cat(PollyCategory))
 
static cl::opt< std::string > MaximizeBandDepth ("polly-opt-maximize-bands", cl::desc("Maximize the band depth (yes/no)"), cl::Hidden, cl::init("yes"), cl::cat(PollyCategory))
 
static cl::opt< int > ScheduleComputeOut ("polly-schedule-computeout", cl::desc("Bound the scheduler by maximal amount" "of computational steps. "), cl::Hidden, cl::init(300000), cl::ZeroOrMore, cl::cat(PollyCategory))
 
static cl::opt< bool > GreedyFusion ("polly-loopfusion-greedy", cl::desc("Aggressively try to fuse everything"), cl::Hidden, cl::cat(PollyCategory))
 
static cl::opt< std::string > OuterCoincidence ("polly-opt-outer-coincidence", cl::desc("Try to construct schedules where the outer member of each band " "satisfies the coincidence constraints (yes/no)"), cl::Hidden, cl::init("no"), cl::cat(PollyCategory))
 
static cl::opt< int > PrevectorWidth ("polly-prevect-width", cl::desc("The number of loop iterations to strip-mine for pre-vectorization"), cl::Hidden, cl::init(4), cl::cat(PollyCategory))
 
static cl::opt< bool > FirstLevelTiling ("polly-tiling", cl::desc("Enable loop tiling"), cl::init(true), cl::cat(PollyCategory))
 
static cl::opt< int > FirstLevelDefaultTileSize ("polly-default-tile-size", cl::desc("The default tile size (if not enough were provided by" " --polly-tile-sizes)"), cl::Hidden, cl::init(32), cl::cat(PollyCategory))
 
static cl::list< int > FirstLevelTileSizes ("polly-tile-sizes", cl::desc("A tile size for each loop dimension, filled " "with --polly-default-tile-size"), cl::Hidden, cl::CommaSeparated, cl::cat(PollyCategory))
 
static cl::opt< bool > SecondLevelTiling ("polly-2nd-level-tiling", cl::desc("Enable a 2nd level loop of loop tiling"), cl::cat(PollyCategory))
 
static cl::opt< int > SecondLevelDefaultTileSize ("polly-2nd-level-default-tile-size", cl::desc("The default 2nd-level tile size (if not enough were provided by" " --polly-2nd-level-tile-sizes)"), cl::Hidden, cl::init(16), cl::cat(PollyCategory))
 
static cl::list< int > SecondLevelTileSizes ("polly-2nd-level-tile-sizes", cl::desc("A tile size for each loop dimension, filled " "with --polly-default-tile-size"), cl::Hidden, cl::CommaSeparated, cl::cat(PollyCategory))
 
static cl::opt< bool > RegisterTiling ("polly-register-tiling", cl::desc("Enable register tiling"), cl::cat(PollyCategory))
 
static cl::opt< int > RegisterDefaultTileSize ("polly-register-tiling-default-tile-size", cl::desc("The default register tile size (if not enough were provided by" " --polly-register-tile-sizes)"), cl::Hidden, cl::init(2), cl::cat(PollyCategory))
 
static cl::list< int > RegisterTileSizes ("polly-register-tile-sizes", cl::desc("A tile size for each loop dimension, filled " "with --polly-register-tile-size"), cl::Hidden, cl::CommaSeparated, cl::cat(PollyCategory))
 
static cl::opt< bool > PragmaBasedOpts ("polly-pragma-based-opts", cl::desc("Apply user-directed transformation from metadata"), cl::init(true), cl::cat(PollyCategory))
 
static cl::opt< bool > EnableReschedule ("polly-reschedule", cl::desc("Optimize SCoPs using ISL"), cl::init(true), cl::cat(PollyCategory))
 
static cl::opt< bool > PMBasedOpts ("polly-pattern-matching-based-opts", cl::desc("Perform optimizations based on pattern matching"), cl::init(true), cl::cat(PollyCategory))
 
static cl::opt< bool > EnablePostopts ("polly-postopts", cl::desc("Apply post-rescheduling optimizations such as " "tiling (requires -polly-reschedule)"), cl::init(true), cl::cat(PollyCategory))
 
static cl::opt< bool > OptimizedScops ("polly-optimized-scops", cl::desc("Polly - Dump polyhedral description of Scops optimized with " "the isl scheduling optimizer and the set of post-scheduling " "transformations is applied on the schedule tree"), cl::cat(PollyCategory))
 
 STATISTIC (ScopsProcessed, "Number of scops processed")
 
 STATISTIC (ScopsRescheduled, "Number of scops rescheduled")
 
 STATISTIC (ScopsOptimized, "Number of scops optimized")
 
 STATISTIC (NumAffineLoopsOptimized, "Number of affine loops optimized")
 
 STATISTIC (NumBoxedLoopsOptimized, "Number of boxed loops optimized")
 
 THREE_STATISTICS (NumBands, "Number of bands")
 
 THREE_STATISTICS (NumBandMembers, "Number of band members")
 
 THREE_STATISTICS (NumCoincident, "Number of coincident band members")
 
 THREE_STATISTICS (NumPermutable, "Number of permutable bands")
 
 THREE_STATISTICS (NumFilters, "Number of filter nodes")
 
 THREE_STATISTICS (NumExtension, "Number of extension nodes")
 
 STATISTIC (FirstLevelTileOpts, "Number of first level tiling applied")
 
 STATISTIC (SecondLevelTileOpts, "Number of second level tiling applied")
 
 STATISTIC (RegisterTileOpts, "Number of register tiling applied")
 
 STATISTIC (PrevectOpts, "Number of strip-mining for prevectorization applied")
 
 STATISTIC (MatMulOpts, "Number of matrix multiplication patterns detected and optimized")
 
 INITIALIZE_PASS_BEGIN (IslScheduleOptimizerWrapperPass, "polly-opt-isl", "Polly - Optimize schedule of SCoP", false, false)
 
 INITIALIZE_PASS_DEPENDENCY (DependenceInfo)
 
 INITIALIZE_PASS_DEPENDENCY (ScopInfoRegionPass)
 
 INITIALIZE_PASS_DEPENDENCY (TargetTransformInfoWrapperPass)
 
 INITIALIZE_PASS_DEPENDENCY (OptimizationRemarkEmitterWrapperPass)
 
 INITIALIZE_PASS_END (IslScheduleOptimizerWrapperPass, "polly-opt-isl", "Polly - Optimize schedule of SCoP", false, false) static llvm
 
 INITIALIZE_PASS_BEGIN (IslScheduleOptimizerPrinterLegacyPass, "polly-print-opt-isl", "Polly - Print optimizer schedule of SCoP", false, false)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "polly-opt-isl"

Definition at line 73 of file ScheduleOptimizer.cpp.

◆ THREE_STATISTICS

#define THREE_STATISTICS (   VARNAME,
  DESC 
)
Value:
static Statistic VARNAME[3] = { \
{DEBUG_TYPE, #VARNAME "0", DESC " (original)"}, \
{DEBUG_TYPE, #VARNAME "1", DESC " (after scheduler)"}, \
{DEBUG_TYPE, #VARNAME "2", DESC " (after optimizer)"}}
#define DEBUG_TYPE

Definition at line 208 of file ScheduleOptimizer.cpp.

Function Documentation

◆ EnablePostopts()

static cl::opt< bool > EnablePostopts ( "polly-postopts"  ,
cl::desc("Apply post-rescheduling optimizations such as " "tiling (requires -polly-reschedule)")  ,
cl::init(true)  ,
cl::cat(PollyCategory  
)
static

◆ EnableReschedule()

static cl::opt< bool > EnableReschedule ( "polly-reschedule"  ,
cl::desc("Optimize SCoPs using ISL")  ,
cl::init(true)  ,
cl::cat(PollyCategory  
)
static

◆ FirstLevelDefaultTileSize()

static cl::opt< int > FirstLevelDefaultTileSize ( "polly-default-tile-size"  ,
cl::desc("The default tile size (if not enough were provided by" " --polly-tile-sizes)")  ,
cl::Hidden  ,
cl::init(32)  ,
cl::cat(PollyCategory  
)
static

◆ FirstLevelTileSizes()

static cl::list< int > FirstLevelTileSizes ( "polly-tile-sizes"  ,
cl::desc("A tile size for each loop dimension, filled " "with --polly-default-tile-size")  ,
cl::Hidden  ,
cl::CommaSeparated  ,
cl::cat(PollyCategory  
)
static

◆ FirstLevelTiling()

static cl::opt< bool > FirstLevelTiling ( "polly-tiling"  ,
cl::desc("Enable loop tiling")  ,
cl::init(true)  ,
cl::cat(PollyCategory  
)
static

◆ GreedyFusion()

static cl::opt< bool > GreedyFusion ( "polly-loopfusion-greedy"  ,
cl::desc("Aggressively try to fuse everything")  ,
cl::Hidden  ,
cl::cat(PollyCategory  
)
static

◆ INITIALIZE_PASS_BEGIN() [1/2]

INITIALIZE_PASS_BEGIN ( IslScheduleOptimizerPrinterLegacyPass  ,
"polly-print-opt-isl"  ,
"Polly - Print optimizer schedule of SCoP"  ,
false  ,
false   
)

◆ INITIALIZE_PASS_BEGIN() [2/2]

INITIALIZE_PASS_BEGIN ( IslScheduleOptimizerWrapperPass  ,
"polly-opt-isl"  ,
"Polly - Optimize schedule of SCoP"  ,
false  ,
false   
)

◆ INITIALIZE_PASS_DEPENDENCY() [1/4]

INITIALIZE_PASS_DEPENDENCY ( DependenceInfo  )

◆ INITIALIZE_PASS_DEPENDENCY() [2/4]

INITIALIZE_PASS_DEPENDENCY ( OptimizationRemarkEmitterWrapperPass  )

◆ INITIALIZE_PASS_DEPENDENCY() [3/4]

INITIALIZE_PASS_DEPENDENCY ( ScopInfoRegionPass  )

◆ INITIALIZE_PASS_DEPENDENCY() [4/4]

INITIALIZE_PASS_DEPENDENCY ( TargetTransformInfoWrapperPass  )

◆ INITIALIZE_PASS_END()

INITIALIZE_PASS_END ( IslScheduleOptimizerWrapperPass  ,
"polly-opt-isl"  ,
"Polly - Optimize schedule of SCoP"  ,
false  ,
false   
)

◆ MaxCoefficient()

static cl::opt< int > MaxCoefficient ( "polly-opt-max-coefficient"  ,
cl::desc("The maximal coefficient allowed (-1 is unlimited)")  ,
cl::Hidden  ,
cl::init(20)  ,
cl::cat(PollyCategory  
)
static

◆ MaxConstantTerm()

static cl::opt< int > MaxConstantTerm ( "polly-opt-max-constant-term"  ,
cl::desc("The maximal constant term allowed (-1 is unlimited)")  ,
cl::Hidden  ,
cl::init(20)  ,
cl::cat(PollyCategory  
)
static

◆ MaximizeBandDepth()

static cl::opt< std::string > MaximizeBandDepth ( "polly-opt-maximize-bands"  ,
cl::desc("Maximize the band depth (yes/no)")  ,
cl::Hidden  ,
cl::init("yes")  ,
cl::cat(PollyCategory  
)
static

◆ OptimizeDeps()

static cl::opt< std::string > OptimizeDeps ( "polly-opt-optimize-only"  ,
cl::desc("Only a certain kind of dependences (all/raw)")  ,
cl::Hidden  ,
cl::init("all")  ,
cl::cat(PollyCategory  
)
static

◆ OptimizedScops()

static cl::opt< bool > OptimizedScops ( "polly-optimized-scops"  ,
cl::desc("Polly - Dump polyhedral description of Scops optimized with " "the isl scheduling optimizer and the set of post-scheduling " "transformations is applied on the schedule tree")  ,
cl::cat(PollyCategory  
)
static

◆ OuterCoincidence()

static cl::opt< std::string > OuterCoincidence ( "polly-opt-outer-coincidence"  ,
cl::desc("Try to construct schedules where the outer member of each band " "satisfies the coincidence constraints (yes/no)")  ,
cl::Hidden  ,
cl::init("no")  ,
cl::cat(PollyCategory  
)
static

◆ PMBasedOpts()

static cl::opt< bool > PMBasedOpts ( "polly-pattern-matching-based-opts"  ,
cl::desc("Perform optimizations based on pattern matching")  ,
cl::init(true)  ,
cl::cat(PollyCategory  
)
static

◆ PragmaBasedOpts()

static cl::opt< bool > PragmaBasedOpts ( "polly-pragma-based-opts"  ,
cl::desc("Apply user-directed transformation from metadata")  ,
cl::init(true)  ,
cl::cat(PollyCategory  
)
static

◆ PrevectorWidth()

static cl::opt< int > PrevectorWidth ( "polly-prevect-width"  ,
cl::desc("The number of loop iterations to strip-mine for pre-vectorization")  ,
cl::Hidden  ,
cl::init(4)  ,
cl::cat(PollyCategory  
)
static

◆ RegisterDefaultTileSize()

static cl::opt< int > RegisterDefaultTileSize ( "polly-register-tiling-default-tile-size"  ,
cl::desc("The default register tile size (if not enough were provided by" " --polly-register-tile-sizes)")  ,
cl::Hidden  ,
cl::init(2)  ,
cl::cat(PollyCategory  
)
static

◆ RegisterTileSizes()

static cl::list< int > RegisterTileSizes ( "polly-register-tile-sizes"  ,
cl::desc("A tile size for each loop dimension, filled " "with --polly-register-tile-size")  ,
cl::Hidden  ,
cl::CommaSeparated  ,
cl::cat(PollyCategory  
)
static

◆ RegisterTiling()

static cl::opt< bool > RegisterTiling ( "polly-register-tiling"  ,
cl::desc("Enable register tiling")  ,
cl::cat(PollyCategory  
)
static

◆ ScheduleComputeOut()

static cl::opt< int > ScheduleComputeOut ( "polly-schedule-computeout"  ,
cl::desc("Bound the scheduler by maximal amount" "of computational steps. ")  ,
cl::Hidden  ,
cl::init(300000)  ,
cl::ZeroOrMore  ,
cl::cat(PollyCategory  
)
static

◆ SecondLevelDefaultTileSize()

static cl::opt< int > SecondLevelDefaultTileSize ( "polly-2nd-level-default-tile-size"  ,
cl::desc("The default 2nd-level tile size (if not enough were provided by" " --polly-2nd-level-tile-sizes)")  ,
cl::Hidden  ,
cl::init(16)  ,
cl::cat(PollyCategory  
)
static

◆ SecondLevelTileSizes()

static cl::list< int > SecondLevelTileSizes ( "polly-2nd-level-tile-sizes"  ,
cl::desc("A tile size for each loop dimension, filled " "with --polly-default-tile-size")  ,
cl::Hidden  ,
cl::CommaSeparated  ,
cl::cat(PollyCategory  
)
static

◆ SecondLevelTiling()

static cl::opt< bool > SecondLevelTiling ( "polly-2nd-level-tiling"  ,
cl::desc("Enable a 2nd level loop of loop tiling")  ,
cl::cat(PollyCategory  
)
static

◆ SimplifyDeps()

static cl::opt< std::string > SimplifyDeps ( "polly-opt-simplify-deps"  ,
cl::desc("Dependences should be simplified (yes/no)")  ,
cl::Hidden  ,
cl::init("yes")  ,
cl::cat(PollyCategory  
)
static

◆ STATISTIC() [1/10]

STATISTIC ( FirstLevelTileOpts  ,
"Number of first level tiling applied"   
)

◆ STATISTIC() [2/10]

STATISTIC ( MatMulOpts  ,
"Number of matrix multiplication patterns detected and optimized"   
)

◆ STATISTIC() [3/10]

STATISTIC ( NumAffineLoopsOptimized  ,
"Number of affine loops optimized"   
)

◆ STATISTIC() [4/10]

STATISTIC ( NumBoxedLoopsOptimized  ,
"Number of boxed loops optimized"   
)

◆ STATISTIC() [5/10]

STATISTIC ( PrevectOpts  ,
"Number of strip-mining for prevectorization applied"   
)

◆ STATISTIC() [6/10]

STATISTIC ( RegisterTileOpts  ,
"Number of register tiling applied"   
)

◆ STATISTIC() [7/10]

STATISTIC ( ScopsOptimized  ,
"Number of scops optimized"   
)

◆ STATISTIC() [8/10]

STATISTIC ( ScopsProcessed  ,
"Number of scops processed"   
)

◆ STATISTIC() [9/10]

STATISTIC ( ScopsRescheduled  ,
"Number of scops rescheduled"   
)

◆ STATISTIC() [10/10]

STATISTIC ( SecondLevelTileOpts  ,
"Number of second level tiling applied"   
)

◆ THREE_STATISTICS() [1/6]

THREE_STATISTICS ( NumBandMembers  ,
"Number of band members"   
)

◆ THREE_STATISTICS() [2/6]

THREE_STATISTICS ( NumBands  ,
"Number of bands"   
)

◆ THREE_STATISTICS() [3/6]

THREE_STATISTICS ( NumCoincident  ,
"Number of coincident band members"   
)

◆ THREE_STATISTICS() [4/6]

THREE_STATISTICS ( NumExtension  ,
"Number of extension nodes"   
)

◆ THREE_STATISTICS() [5/6]

THREE_STATISTICS ( NumFilters  ,
"Number of filter nodes"   
)

◆ THREE_STATISTICS() [6/6]

THREE_STATISTICS ( NumPermutable  ,
"Number of permutable bands"   
)