MLIR  19.0.0git
Public Member Functions | Public Attributes | List of all members
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 *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
 
OperationopInst
 
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()

MemRefAccess::MemRefAccess ( Operation opInst)
explicit

Constructs a MemRefAccess from a load or store operation.

Definition at line 1823 of file Utils.cpp.

Member Function Documentation

◆ getAccessMap()

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 operator==().

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

References mlir::presburger::IntegerRelation::append(), mlir::presburger::IntegerRelation::appendVar(), mlir::presburger::IntegerRelation::convertVarKind(), mlir::failed(), mlir::failure(), 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(), mlir::success(), and mlir::presburger::IntegerRelation::swapVar().

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

◆ getRank()

unsigned MemRefAccess::getRank ( ) const

Definition at line 1838 of file Utils.cpp.

◆ isStore()

bool MemRefAccess::isStore ( ) const

Definition at line 1842 of file Utils.cpp.

◆ operator!=()

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

Definition at line 132 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 1864 of file Utils.cpp.

References mlir::affine::AffineValueMap::difference(), getAccessMap(), mlir::affine::AffineValueMap::getAffineMap(), mlir::AffineMap::getResults(), and memref.

Member Data Documentation

◆ indices

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

Definition at line 85 of file AffineAnalysis.h.

◆ memref

Value mlir::affine::MemRefAccess::memref

◆ opInst

Operation* mlir::affine::MemRefAccess::opInst

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