MLIR
20.0.0git
|
Encapsulates a memref load or store access information. More...
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
Public Member Functions | |
MemRefAccess (Operation *opInst) | |
Constructs a MemRefAccess from a load or store operation. More... | |
unsigned | getRank () const |
bool | isStore () const |
LogicalResult | getAccessRelation (presburger::IntegerRelation &accessRel) const |
Creates an access relation for the access. More... | |
void | getAccessMap (AffineValueMap *accessMap) const |
Populates 'accessMap' with composition of AffineApplyOps reachable from 'indices'. More... | |
bool | operator== (const MemRefAccess &rhs) const |
Equal if both affine accesses can be proved to be equivalent at compile time (considering the memrefs, their respective affine access maps and operands). More... | |
bool | operator!= (const MemRefAccess &rhs) const |
Public Attributes | |
Value | memref |
Operation * | opInst |
SmallVector< Value, 4 > | indices |
Encapsulates a memref load or store access information.
Definition at line 82 of file AffineAnalysis.h.
|
explicit |
Constructs a MemRefAccess from a load or store operation.
void MemRefAccess::getAccessMap | ( | AffineValueMap * | accessMap | ) | const |
Populates 'accessMap' with composition of AffineApplyOps reachable from 'indices'.
Definition at line 507 of file AffineAnalysis.cpp.
References mlir::affine::canonicalizeMapAndOperands(), mlir::affine::fullyComposeAffineMapAndOperands(), mlir::affine::AffineValueMap::reset(), and mlir::simplifyAffineMap().
Referenced by mlir::affine::MemRefRegion::compute(), and operator==().
LogicalResult MemRefAccess::getAccessRelation | ( | presburger::IntegerRelation & | accessRel | ) | const |
Creates an access relation for the access.
An access relation maps elements of an iteration domain to the element(s) of an array domain accessed by that iteration of the associated statement through some array reference. For example, given the MLIR code:
affine.for i0 = 0 to 10 { affine.for i1 = 0 to 10 { a = affine.load arr[i0 + i1, i0 + 2 * i1] : memref<100x100xf32> } }
The access relation, assuming that the memory locations for arr are represented as m0, m1 would be:
(i0, i1) -> (m0, m1) m0 = i0 + i1 m1 = i0 + 2 * i1 0 <= i0 < 10 0 <= i1 < 10
Returns failure for yet unimplemented/unsupported cases (see docs of mlir::getIndexSet and mlir::getRelationFromMap for these cases).
Definition at line 460 of file AffineAnalysis.cpp.
References mlir::presburger::IntegerRelation::append(), mlir::presburger::IntegerRelation::appendVar(), mlir::presburger::IntegerRelation::convertVarKind(), mlir::presburger::IntegerRelation::getIds(), mlir::affine::AffineValueMap::getNumDims(), mlir::presburger::IntegerRelation::getNumDimVars(), mlir::affine::AffineValueMap::getNumResults(), getOpIndexSet(), mlir::affine::getRelationFromMap(), mlir::presburger::IntegerRelation::getSpace(), mlir::FlatLinearValueConstraints::getValue(), mlir::presburger::IntegerRelation::insertVar(), mlir::presburger::PresburgerSpace::isUsingIds(), mlir::presburger::IntegerRelation::mergeAndAlignSymbols(), mlir::presburger::IntegerRelation::mergeLocalVars(), mlir::presburger::IntegerRelation::resetIds(), mlir::presburger::IntegerRelation::setId(), and mlir::presburger::IntegerRelation::swapVar().
Referenced by mlir::affine::checkMemrefAccessDependence().
unsigned MemRefAccess::getRank | ( | ) | const |
Definition at line 1838 of file Utils.cpp.
Referenced by mlir::affine::MemRefRegion::compute().
bool MemRefAccess::isStore | ( | ) | const |
Definition at line 1842 of file Utils.cpp.
Referenced by mlir::affine::MemRefRegion::compute().
|
inline |
Definition at line 132 of file AffineAnalysis.h.
bool MemRefAccess::operator== | ( | const MemRefAccess & | rhs | ) | const |
Equal if both affine accesses can be proved to be equivalent at compile time (considering the memrefs, their respective affine access maps and operands).
Equal if both affine accesses are provably equivalent (at compile time) when considering the memref, the affine maps and their respective operands.
The equality of access functions + operands is checked by subtracting fully composed value maps, and then simplifying the difference using the expression flattener. TODO: this does not account for aliasing of memrefs.
Definition at line 1864 of file Utils.cpp.
References mlir::affine::AffineValueMap::difference(), getAccessMap(), mlir::affine::AffineValueMap::getAffineMap(), mlir::AffineMap::getResults(), and memref.
SmallVector<Value, 4> mlir::affine::MemRefAccess::indices |
Definition at line 85 of file AffineAnalysis.h.
Value mlir::affine::MemRefAccess::memref |
Definition at line 83 of file AffineAnalysis.h.
Referenced by mlir::affine::checkMemrefAccessDependence(), mlir::affine::MemRefRegion::compute(), mlir::affine::computeSliceUnion(), mayHaveEffect(), and operator==().
Operation* mlir::affine::MemRefAccess::opInst |
Definition at line 84 of file AffineAnalysis.h.
Referenced by mlir::affine::checkMemrefAccessDependence(), mlir::affine::computeSliceUnion(), mlir::affine::isTilingValid(), mustReachAtInnermost(), and srcAppearsBeforeDstInAncestralBlock().