MLIR 22.0.0git
mlir::affine::MemRefAccess Struct Reference

Encapsulates a memref load or store access information. More...

#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"

Public Member Functions

 MemRefAccess (Operation *memOp)
 Constructs a MemRefAccess from an affine read/write operation.
 MemRefAccess ()=default
unsigned getRank () const
bool isStore () const
LogicalResult getAccessRelation (presburger::IntegerRelation &accessRel) const
 Creates an access relation for the access.
void getAccessMap (AffineValueMap *accessMap) const
 Populates 'accessMap' with composition of AffineApplyOps reachable from 'indices'.
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).
bool operator!= (const MemRefAccess &rhs) const
 operator bool () const

Public Attributes

Value memref
OperationopInst = nullptr
SmallVector< Value, 4 > indices

Detailed Description

Encapsulates a memref load or store access information.

Definition at line 82 of file AffineAnalysis.h.

Constructor & Destructor Documentation

◆ MemRefAccess() [1/2]

MemRefAccess::MemRefAccess ( Operation * memOp)
explicit

Constructs a MemRefAccess from an affine read/write operation.

Definition at line 2038 of file Utils.cpp.

References indices, memref, and opInst.

Referenced by MemRefAccess(), operator!=(), and operator==().

◆ MemRefAccess() [2/2]

mlir::affine::MemRefAccess::MemRefAccess ( )
default

References MemRefAccess(), and rhs.

Member Function Documentation

◆ getAccessMap()

void MemRefAccess::getAccessMap ( AffineValueMap * accessMap) const

◆ getAccessRelation()

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 458 of file AffineAnalysis.cpp.

References mlir::presburger::IntegerRelation::append(), mlir::presburger::IntegerRelation::appendVar(), mlir::presburger::IntegerRelation::convertVarKind(), getAccessMap(), 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(), opInst, mlir::presburger::IntegerRelation::resetIds(), mlir::presburger::IntegerRelation::setId(), success(), and mlir::presburger::IntegerRelation::swapVar().

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

◆ getRank()

unsigned MemRefAccess::getRank ( ) const

Definition at line 2053 of file Utils.cpp.

References memref.

Referenced by mlir::affine::MemRefRegion::compute().

◆ isStore()

bool MemRefAccess::isStore ( ) const

Definition at line 2057 of file Utils.cpp.

References opInst.

Referenced by mlir::affine::MemRefRegion::compute().

◆ operator bool()

mlir::affine::MemRefAccess::operator bool ( ) const
inlineexplicit

Definition at line 134 of file AffineAnalysis.h.

References memref.

◆ operator!=()

bool mlir::affine::MemRefAccess::operator!= ( const MemRefAccess & rhs) const
inline

Definition at line 132 of file AffineAnalysis.h.

References MemRefAccess(), and rhs.

◆ operator==()

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. This does not account for aliasing of memrefs.

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 2081 of file Utils.cpp.

References getAccessMap(), memref, MemRefAccess(), and rhs.

Member Data Documentation

◆ indices

SmallVector<Value, 4> mlir::affine::MemRefAccess::indices

Definition at line 85 of file AffineAnalysis.h.

Referenced by getAccessMap(), and MemRefAccess().

◆ memref

◆ opInst


The documentation for this struct was generated from the following files: