MLIR
22.0.0git
|
#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Analysis/Presburger/PresburgerRelation.h"
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/Utils/StaticValueUtils.h"
#include "mlir/IR/IntegerSet.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/DebugLog.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "analysis-utils" |
Typedefs | |
using | Node = MemRefDependenceGraph::Node |
Functions | |
template<typename... EffectTys> | |
static void | getEffectedValues (Operation *op, SmallVectorImpl< Value > &values) |
Returns the values that this op has a memref effect of type EffectTys on, not considering recursive effects. More... | |
static Node * | addNodeToMDG (Operation *nodeOp, MemRefDependenceGraph &mdg, DenseMap< Value, SetVector< unsigned >> &memrefAccesses) |
Add op to MDG creating a new node and adding its memory accesses (affine or non-affine to memrefAccesses (memref -> list of nodes with accesses) map. More... | |
static Value | getMemRef (Operation *memOp) |
Returns the memref being read/written by a memref/affine load/store op. More... | |
static bool | mayDependence (const Node &srcNode, const Node &dstNode, Value memref) |
Returns true if there may be a dependence on memref from srcNode's memory ops to dstNode's memory ops, while using the affine memory dependence analysis checks. More... | |
static void | findInstPosition (Operation *op, Block *limitBlock, SmallVectorImpl< unsigned > *positions) |
static Operation * | getInstAtPosition (ArrayRef< unsigned > positions, unsigned level, Block *block) |
static LogicalResult | addMissingLoopIVBounds (SmallPtrSet< Value, 8 > &ivs, FlatAffineValueConstraints *cst) |
static std::optional< uint64_t > | getConstDifference (AffineMap lbMap, AffineMap ubMap) |
static std::optional< int64_t > | getMemoryFootprintBytes (Block &block, Block::iterator start, Block::iterator end, int memorySpace) |
static void | unpackOptionalValues (ArrayRef< std::optional< Value >> source, SmallVector< Value > &target) |
static LogicalResult | alignAndAddBound (FlatAffineValueConstraints &constraints, BoundType type, unsigned pos, AffineMap map, ValueRange operands) |
Bound an identifier pos in a given FlatAffineValueConstraints with constraints drawn from an affine map. More... | |
static AffineMap | addConstToResults (AffineMap map, int64_t val) |
Add val to each result of map . More... | |
Variables | |
const char *const | kSliceFusionBarrierAttrName = "slice_fusion_barrier" |
using Node = MemRefDependenceGraph::Node |
Add val
to each result of map
.
Definition at line 2241 of file Utils.cpp.
References mlir::AffineMap::get(), mlir::AffineMap::getContext(), mlir::AffineMap::getNumDims(), mlir::AffineMap::getNumSymbols(), and mlir::AffineMap::getResults().
Referenced by mlir::affine::simplifyConstrainedMinMaxOp().
|
static |
Definition at line 1585 of file Utils.cpp.
References mlir::affine::FlatAffineValueConstraints::addAffineForOpDomain(), mlir::remark::failed(), mlir::affine::getForInductionVarOwner(), mlir::presburger::IntegerRelation::getNumDimVars(), mlir::FlatLinearValueConstraints::getValue(), and mlir::affine::isAffineForInductionVar().
Referenced by mlir::affine::computeSliceUnion().
|
static |
Add op
to MDG creating a new node and adding its memory accesses (affine or non-affine to memrefAccesses (memref -> list of nodes with accesses) map.
Definition at line 191 of file Utils.cpp.
References mlir::affine::LoopNestStateCollector::collect(), mlir::affine::LoopNestStateCollector::loadOpInsts, mlir::affine::MemRefDependenceGraph::Node::loads, mlir::affine::LoopNestStateCollector::memrefFrees, mlir::affine::LoopNestStateCollector::memrefLoads, mlir::affine::LoopNestStateCollector::memrefStores, mlir::affine::MemRefDependenceGraph::nextNodeId, mlir::affine::MemRefDependenceGraph::nodes, and mlir::affine::LoopNestStateCollector::storeOpInsts.
Referenced by mlir::affine::MemRefDependenceGraph::init().
|
static |
Bound an identifier pos
in a given FlatAffineValueConstraints with constraints drawn from an affine map.
Before adding the constraint, the dimensions/symbols of the affine map are aligned with constraints
. operands
are the SSA Value operands used with the affine map. Note: This function adds a new symbol column to the constraints
for each dimension/symbol that exists in the affine map but not in constraints
.
Definition at line 2226 of file Utils.cpp.
References mlir::affine::FlatAffineValueConstraints::addBound(), mlir::alignAffineMapWithValues(), mlir::FlatLinearValueConstraints::appendSymbolVar(), mlir::FlatLinearValueConstraints::getMaybeValues(), and unpackOptionalValues().
Referenced by mlir::affine::simplifyConstrainedMinMaxOp().
|
static |
Definition at line 1543 of file Utils.cpp.
References mlir::Block::begin(), mlir::Operation::getBlock(), and mlir::Block::getParentOp().
Referenced by mlir::affine::insertBackwardComputationSlice().
Definition at line 1798 of file Utils.cpp.
References mlir::AffineMap::getNumDims(), mlir::AffineMap::getNumResults(), mlir::AffineMap::getNumSymbols(), mlir::AffineMap::getResult(), and mlir::simplifyAffineExpr().
Referenced by mlir::affine::buildSliceTripCountMap().
|
static |
Returns the values that this op has a memref effect of type EffectTys
on, not considering recursive effects.
Definition at line 165 of file Utils.cpp.
References mlir::Operation::getOperands(), mlir::Value::getType(), and mlir::Operation::hasTrait().
|
static |
Definition at line 1560 of file Utils.cpp.
References mlir::Operation::getRegions().
Referenced by mlir::affine::insertBackwardComputationSlice().
|
static |
Definition at line 2124 of file Utils.cpp.
References mlir::WalkResult::advance(), mlir::Block::begin(), mlir::Operation::emitError(), mlir::Operation::emitWarning(), mlir::remark::failed(), mlir::Operation::getLoc(), mlir::affine::getNestingDepth(), and mlir::Block::walk().
Referenced by mlir::affine::getMemoryFootprintBytes().
Returns the memref being read/written by a memref/affine load/store op.
Definition at line 246 of file Utils.cpp.
Referenced by mlir::affine::MemRefDependenceGraph::Node::getLoadAndStoreMemrefSet(), mlir::affine::MemRefDependenceGraph::Node::getLoadOpsForMemref(), getProducerCandidates(), mlir::affine::MemRefDependenceGraph::Node::getStoreOpsForMemref(), and mayDependence().
Returns true if there may be a dependence on memref
from srcNode's memory ops to dstNode's memory ops, while using the affine memory dependence analysis checks.
The method assumes that there is at least one memory op in srcNode's loads and stores on memref
, and similarly for dstNode
. srcNode.op
and destNode.op
are expected to be nested in the same block and so the dependences are tested at the depth of that block.
Definition at line 264 of file Utils.cpp.
References mlir::affine::checkMemrefAccessDependence(), getMemRef(), mlir::affine::getNestingDepth(), mlir::affine::MemRefAccess::memref, and mlir::affine::noDependence().
Referenced by mlir::affine::MemRefDependenceGraph::init().
|
static |
Definition at line 2212 of file Utils.cpp.
Referenced by alignAndAddBound(), and mlir::affine::simplifyConstrainedMinMaxOp().
const char* const kSliceFusionBarrierAttrName = "slice_fusion_barrier" |
Definition at line 1865 of file Utils.cpp.
Referenced by mlir::affine::getComputationSliceState().