MLIR  16.0.0git
Public Member Functions | Public Attributes | List of all members
mlir::MemRefAccess Struct Reference

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

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

+ Collaboration diagram for mlir::MemRefAccess:

Public Member Functions

 MemRefAccess (Operation *opInst)
 Constructs a MemRefAccess from a load or store operation. More...
 
unsigned getRank () const
 
bool isStore () const
 
LogicalResult getAccessRelation (FlatAffineRelation &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
 
OperationopInst
 
SmallVector< Value, 4 > indices
 

Detailed Description

Encapsulates a memref load or store access information.

Definition at line 80 of file AffineAnalysis.h.

Constructor & Destructor Documentation

◆ MemRefAccess()

MemRefAccess::MemRefAccess ( Operation opInst)
explicit

Member Function Documentation

◆ getAccessMap()

void MemRefAccess::getAccessMap ( AffineValueMap accessMap) const

Populates 'accessMap' with composition of AffineApplyOps reachable from 'indices'.

Definition at line 483 of file AffineAnalysis.cpp.

References mlir::canonicalizeMapAndOperands(), mlir::fullyComposeAffineMapAndOperands(), mlir::AffineValueMap::reset(), and mlir::simplifyAffineMap().

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

◆ getAccessRelation()

LogicalResult MemRefAccess::getAccessRelation ( FlatAffineRelation 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 444 of file AffineAnalysis.cpp.

References mlir::presburger::IntegerRelation::append(), mlir::failed(), mlir::failure(), mlir::FlatAffineValueConstraints::findVar(), mlir::presburger::IntegerRelation::getNumDimVars(), mlir::FlatAffineRelation::getNumDomainDims(), mlir::FlatAffineRelation::getNumRangeDims(), getOpIndexSet(), mlir::getRelationFromMap(), mlir::FlatAffineValueConstraints::getValue(), mlir::FlatAffineRelation::insertDomainVar(), mlir::FlatAffineValueConstraints::setValue(), mlir::success(), and mlir::FlatAffineValueConstraints::swapVar().

Referenced by mlir::checkMemrefAccessDependence().

◆ getRank()

unsigned MemRefAccess::getRank ( ) const

Definition at line 1228 of file Utils.cpp.

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

◆ isStore()

bool MemRefAccess::isStore ( ) const

Definition at line 1232 of file Utils.cpp.

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

◆ operator!=()

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

Definition at line 130 of file AffineAnalysis.h.

◆ 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. TODO: this does not account for aliasing of memrefs.

Definition at line 1254 of file Utils.cpp.

Member Data Documentation

◆ indices

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

Definition at line 83 of file AffineAnalysis.h.

◆ memref

Value mlir::MemRefAccess::memref

◆ opInst

Operation* mlir::MemRefAccess::opInst

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