MLIR
16.0.0git
|
ComputationSliceState aggregates loop IVs, loop bound AffineMaps and their associated operands for a set of loops within a loop nest (typically the set of loops surrounding a store operation). More...
#include "mlir/Dialect/Affine/Analysis/Utils.h"
Public Member Functions | |
LogicalResult | getAsConstraints (FlatAffineValueConstraints *cst) |
LogicalResult | getSourceAsConstraints (FlatAffineValueConstraints &cst) |
Adds to 'cst' constraints which represent the original loop bounds on 'ivs' in 'this'. More... | |
void | clearBounds () |
bool | isEmpty () const |
Returns true if the computation slice is empty. More... | |
Optional< bool > | isMaximal () const |
Returns true if the computation slice encloses all the iterations of the sliced loop nest. More... | |
Optional< bool > | isSliceValid () |
Checks the validity of the slice computed. More... | |
void | dump () const |
Public Attributes | |
SmallVector< Value, 4 > | ivs |
SmallVector< AffineMap, 4 > | lbs |
SmallVector< AffineMap, 4 > | ubs |
std::vector< SmallVector< Value, 4 > > | lbOperands |
std::vector< SmallVector< Value, 4 > > | ubOperands |
Block::iterator | insertPoint |
ComputationSliceState aggregates loop IVs, loop bound AffineMaps and their associated operands for a set of loops within a loop nest (typically the set of loops surrounding a store operation).
Loop bound AffineMaps which are non-null represent slices of that loop's iteration space.
void ComputationSliceState::clearBounds | ( | ) |
Definition at line 119 of file Utils.cpp.
Referenced by mlir::computeSliceUnion().
void ComputationSliceState::dump | ( | ) | const |
Definition at line 126 of file Utils.cpp.
References mlir::AffineExpr::dyn_cast(), mlir::detail::enumerate(), mlir::getForInductionVarOwner(), mlir::AffineMap::getNumResults(), mlir::AffineDimExpr::getPosition(), mlir::AffineMap::getResult(), mlir::AffineExpr::isa(), and mlir::presburger::None.
LogicalResult ComputationSliceState::getAsConstraints | ( | FlatAffineValueConstraints * | cst | ) |
Definition at line 83 of file Utils.cpp.
References mlir::FlatAffineValueConstraints::addAffineForOpDomain(), mlir::FlatAffineValueConstraints::addBound(), mlir::FlatAffineValueConstraints::addSliceBounds(), mlir::FlatAffineValueConstraints::containsVar(), mlir::presburger::IntegerRelation::EQ, mlir::failed(), mlir::failure(), mlir::Value::getDefiningOp(), mlir::getForInductionVarOwner(), mlir::isValidSymbol(), mlir::FlatAffineValueConstraints::reset(), mlir::succeeded(), mlir::success(), and value.
Referenced by mlir::computeSliceUnion().
LogicalResult ComputationSliceState::getSourceAsConstraints | ( | FlatAffineValueConstraints & | cst | ) |
Adds to 'cst' constraints which represent the original loop bounds on 'ivs' in 'this'.
This corresponds to the original domain of the loop nest from which the slice is being computed. Returns failure if we cannot add loop bounds because of unsupported cases.
Definition at line 69 of file Utils.cpp.
References mlir::FlatAffineValueConstraints::addAffineForOpDomain(), mlir::failed(), mlir::failure(), mlir::getForInductionVarOwner(), mlir::FlatAffineValueConstraints::reset(), and mlir::success().
|
inline |
Returns true if the computation slice is empty.
Definition at line 107 of file Utils.h.
References mlir::buildSliceTripCountMap(), mlir::computeSliceUnion(), mlir::getComputationSliceState(), mlir::getSliceIterationCount(), and mlir::insertBackwardComputationSlice().
Referenced by isFusionProfitable().
Optional< bool > ComputationSliceState::isMaximal | ( | ) | const |
Returns true if the computation slice encloses all the iterations of the sliced loop nest.
Returns false if it does not. Returns llvm::None if it cannot determine if the slice is maximal or not.
Definition at line 291 of file Utils.cpp.
References mlir::FlatAffineValueConstraints::addAffineForOpDomain(), mlir::FlatAffineValueConstraints::addDomainFromSliceMaps(), mlir::failed(), mlir::getForInductionVarOwner(), mlir::presburger::IntegerRelation::getNumDimVars(), mlir::presburger::PresburgerRelation::isIntegerEmpty(), mlir::presburger::None, mlir::FlatAffineValueConstraints::reset(), and mlir::presburger::PresburgerSet::subtract().
Referenced by mlir::createLoopFusionPass(), and mlir::getComputationSliceState().
Optional< bool > ComputationSliceState::isSliceValid | ( | ) |
Checks the validity of the slice computed.
Returns true if it is deterministically verified that the original iteration space of the slice is contained within the new iteration space that is created after fusing 'this' slice into its destination.
This is done using the following steps:
Definition at line 221 of file Utils.cpp.
References mlir::presburger::IntegerRelation::dump(), mlir::failed(), mlir::presburger::IntegerRelation::getNumLocalVars(), mlir::presburger::IntegerRelation::getNumSymbolVars(), mlir::presburger::IntegerRelation::getNumVars(), mlir::presburger::PresburgerRelation::isIntegerEmpty(), mlir::presburger::None, mlir::FlatAffineValueConstraints::projectOut(), and mlir::presburger::PresburgerSet::subtract().
Referenced by mlir::computeSliceUnion().
Block::iterator mlir::ComputationSliceState::insertPoint |
Definition at line 88 of file Utils.h.
Referenced by mlir::computeSliceUnion(), mlir::fuseLoops(), mlir::getComputationSliceState(), and mlir::getFusionComputeCost().
SmallVector<Value, 4> mlir::ComputationSliceState::ivs |
Definition at line 78 of file Utils.h.
Referenced by mlir::buildSliceTripCountMap(), mlir::MemRefRegion::compute(), mlir::computeSliceUnion(), mlir::fuseLoops(), and mlir::getComputationSliceState().
std::vector<SmallVector<Value, 4> > mlir::ComputationSliceState::lbOperands |
Definition at line 84 of file Utils.h.
Referenced by mlir::MemRefRegion::compute(), mlir::computeSliceUnion(), mlir::fuseLoops(), mlir::getComputationSliceState(), and mlir::insertBackwardComputationSlice().
SmallVector<AffineMap, 4> mlir::ComputationSliceState::lbs |
Definition at line 80 of file Utils.h.
Referenced by mlir::buildSliceTripCountMap(), mlir::MemRefRegion::compute(), mlir::computeSliceUnion(), mlir::fuseLoops(), mlir::getComputationSliceState(), and mlir::insertBackwardComputationSlice().
std::vector<SmallVector<Value, 4> > mlir::ComputationSliceState::ubOperands |
Definition at line 86 of file Utils.h.
Referenced by mlir::computeSliceUnion(), mlir::fuseLoops(), mlir::getComputationSliceState(), and mlir::insertBackwardComputationSlice().
SmallVector<AffineMap, 4> mlir::ComputationSliceState::ubs |
Definition at line 82 of file Utils.h.
Referenced by mlir::buildSliceTripCountMap(), mlir::MemRefRegion::compute(), mlir::computeSliceUnion(), mlir::fuseLoops(), mlir::getComputationSliceState(), and mlir::insertBackwardComputationSlice().