MLIR  20.0.0git
Macros | Functions
AffineAnalysis.cpp File Reference
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
#include "mlir/Analysis/Presburger/IntegerRelation.h"
#include "mlir/Analysis/Presburger/PresburgerSpace.h"
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/IR/AffineExprVisitor.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/IntegerSet.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Interfaces/ViewLikeInterface.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "affine-analysis"
 

Functions

static Value getSupportedReduction (AffineForOp forOp, unsigned pos, arith::AtomicRMWKind &kind)
 Get the value that is being reduced by pos-th reduction in the loop if such a reduction can be performed by affine parallel loops. More...
 
static bool isLocallyDefined (Value v, Operation *enclosingOp)
 Returns true if v is allocated locally to enclosingOp – i.e., it is allocated by an operation nested within enclosingOp. More...
 
static LogicalResult getOpIndexSet (Operation *op, FlatAffineValueConstraints *indexSet)
 Computes the iteration domain for 'op' and populates 'indexSet', which encapsulates the constraints involving loops surrounding 'op' and potentially involving any Function symbols. More...
 
static unsigned getNumCommonLoops (const FlatAffineValueConstraints &srcDomain, const FlatAffineValueConstraints &dstDomain, SmallVectorImpl< AffineForOp > *commonLoops=nullptr)
 
static BlockgetCommonBlockInAffineScope (Operation *opA, Operation *opB)
 Returns the closest surrounding block common to opA and opB. More...
 
static bool srcAppearsBeforeDstInAncestralBlock (const MemRefAccess &srcAccess, const MemRefAccess &dstAccess)
 Returns true if the ancestor operation of 'srcAccess' appears before the ancestor operation of 'dstAccess' in their common ancestral block. More...
 
static void addOrderingConstraints (const FlatAffineValueConstraints &srcDomain, const FlatAffineValueConstraints &dstDomain, unsigned loopDepth, IntegerRelation *dependenceDomain)
 
static void computeDirectionVector (const FlatAffineValueConstraints &srcDomain, const FlatAffineValueConstraints &dstDomain, unsigned loopDepth, IntegerPolyhedron *dependenceDomain, SmallVector< DependenceComponent, 2 > *dependenceComponents)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "affine-analysis"

Definition at line 32 of file AffineAnalysis.cpp.

Function Documentation

◆ addOrderingConstraints()

static void addOrderingConstraints ( const FlatAffineValueConstraints srcDomain,
const FlatAffineValueConstraints dstDomain,
unsigned  loopDepth,
IntegerRelation dependenceDomain 
)
static

◆ computeDirectionVector()

static void computeDirectionVector ( const FlatAffineValueConstraints srcDomain,
const FlatAffineValueConstraints dstDomain,
unsigned  loopDepth,
IntegerPolyhedron dependenceDomain,
SmallVector< DependenceComponent, 2 > *  dependenceComponents 
)
static

◆ getCommonBlockInAffineScope()

static Block* getCommonBlockInAffineScope ( Operation opA,
Operation opB 
)
static

Returns the closest surrounding block common to opA and opB.

opA and opB should be in the same affine scope. Returns nullptr if such a block does not exist (when the two ops are in different blocks of an op starting an AffineScope).

Definition at line 322 of file AffineAnalysis.cpp.

References mlir::Operation::getBlock(), mlir::Block::getParentOp(), mlir::Operation::hasTrait(), and mlir::Block::push_back().

Referenced by mlir::affine::checkMemrefAccessDependence(), and srcAppearsBeforeDstInAncestralBlock().

◆ getNumCommonLoops()

static unsigned getNumCommonLoops ( const FlatAffineValueConstraints srcDomain,
const FlatAffineValueConstraints dstDomain,
SmallVectorImpl< AffineForOp > *  commonLoops = nullptr 
)
static

◆ getOpIndexSet()

static LogicalResult getOpIndexSet ( Operation op,
FlatAffineValueConstraints indexSet 
)
static

Computes the iteration domain for 'op' and populates 'indexSet', which encapsulates the constraints involving loops surrounding 'op' and potentially involving any Function symbols.

The dimensional variables in 'indexSet' correspond to the loops surrounding 'op' from outermost to innermost.

Definition at line 285 of file AffineAnalysis.cpp.

References mlir::affine::getEnclosingAffineOps(), and mlir::affine::getIndexSet().

Referenced by mlir::affine::MemRefAccess::getAccessRelation().

◆ getSupportedReduction()

static Value getSupportedReduction ( AffineForOp  forOp,
unsigned  pos,
arith::AtomicRMWKind &  kind 
)
static

Get the value that is being reduced by pos-th reduction in the loop if such a reduction can be performed by affine parallel loops.

This assumes floating-point operations are commutative. On success, kind will be the reduction kind suitable for use in affine parallel loop builder. If the reduction is not supported, returns null.

Definition at line 43 of file AffineAnalysis.cpp.

References mlir::matchReduction().

Referenced by mlir::affine::getSupportedReductions().

◆ isLocallyDefined()

static bool isLocallyDefined ( Value  v,
Operation enclosingOp 
)
static

Returns true if v is allocated locally to enclosingOp – i.e., it is allocated by an operation nested within enclosingOp.

Definition at line 125 of file AffineAnalysis.cpp.

References mlir::Value::getDefiningOp(), and mlir::Operation::isProperAncestor().

Referenced by mlir::affine::isLoopMemoryParallel().

◆ srcAppearsBeforeDstInAncestralBlock()

static bool srcAppearsBeforeDstInAncestralBlock ( const MemRefAccess srcAccess,
const MemRefAccess dstAccess 
)
static

Returns true if the ancestor operation of 'srcAccess' appears before the ancestor operation of 'dstAccess' in their common ancestral block.

The operations for srcAccess and dstAccess are expected to be in the same affine scope and have a common surrounding block within it.

Definition at line 358 of file AffineAnalysis.cpp.

References mlir::Block::findAncestorOpInBlock(), getCommonBlockInAffineScope(), mlir::Operation::isBeforeInBlock(), and mlir::affine::MemRefAccess::opInst.

Referenced by mlir::affine::checkMemrefAccessDependence().