My Project
Public Member Functions | Public Attributes | List of all members
mlir::MemRefRegion Struct Reference

#include <Utils.h>

Collaboration diagram for mlir::MemRefRegion:
Collaboration graph
[legend]

Public Member Functions

 MemRefRegion (Location loc)
 
LogicalResult compute (Operation *op, unsigned loopDepth, ComputationSliceState *sliceState=nullptr, bool addMemRefDimBounds=true)
 
FlatAffineConstraintsgetConstraints ()
 
const FlatAffineConstraintsgetConstraints () const
 
bool isWrite () const
 
void setWrite (bool flag)
 
Optional< int64_t > getConstantBoundingSizeAndShape (SmallVectorImpl< int64_t > *shape=nullptr, std::vector< SmallVector< int64_t, 4 >> *lbs=nullptr, SmallVectorImpl< int64_t > *lbDivisors=nullptr) const
 
Optional< int64_t > getConstantBoundOnDimSize (unsigned pos, SmallVectorImpl< int64_t > *lb=nullptr, int64_t *lbFloorDivisor=nullptr) const
 
Optional< int64_t > getRegionSize ()
 Returns the size of this MemRefRegion in bytes. More...
 
LogicalResult unionBoundingBox (const MemRefRegion &other)
 
unsigned getRank () const
 Returns the rank of the memref that this region corresponds to. More...
 

Public Attributes

Value memref
 Memref that this region corresponds to. More...
 
bool write
 Read or write. More...
 
Location loc
 
FlatAffineConstraints cst
 

Detailed Description

A region of a memref's data space; this is typically constructed by analyzing load/store op's on this memref and the index space of loops surrounding such op's.

Constructor & Destructor Documentation

◆ MemRefRegion()

mlir::MemRefRegion::MemRefRegion ( Location  loc)
inlineexplicit

Member Function Documentation

◆ compute()

LogicalResult MemRefRegion::compute ( Operation op,
unsigned  loopDepth,
ComputationSliceState sliceState = nullptr,
bool  addMemRefDimBounds = true 
)

Computes the memory region accessed by this memref with the region represented as constraints symbolic/parametric in 'loopDepth' loops surrounding opInst. The computed region's 'cst' field has exactly as many dimensional identifiers as the rank of the memref, and potentially additional symbolic identifiers which could include any of the loop IVs surrounding opInst up until 'loopDepth' and another additional Function symbols involved with the access (for eg., those appear in affine.apply's, loop bounds, etc.). If 'sliceState' is non-null, operands from 'sliceState' are added as symbols, and the following constraints are added to the system: *) Inequality constraints which represent loop bounds for 'sliceState' operands which are loop IVS (these represent the destination loop IVs of the slice, and are added as symbols to MemRefRegion's constraint system). *) Inequality constraints for the slice bounds in 'sliceState', which represent the bounds on the loop IVs in this constraint system w.r.t to slice operands (which correspond to symbols). If 'addMemRefDimBounds' is true, constant upper/lower bounds [0, memref.getDimSize(i)) are added for each MemRef dimension 'i'.

For example, the memref region for this operation at loopDepth = 1 will be:

affine.for i = 0 to 32 { affine.for ii = i to (d0) -> (d0 + 8) (i) { load A[ii] } }

{memref = A, write = false, {i <= m0 <= i + 7} } The last field is a 2-d FlatAffineConstraints symbolic in i.

Computes the memory region accessed by this memref with the region represented as constraints symbolic/parametric in 'loopDepth' loops surrounding opInst and any additional Function symbols.

◆ getConstantBoundingSizeAndShape()

Optional< int64_t > MemRefRegion::getConstantBoundingSizeAndShape ( SmallVectorImpl< int64_t > *  shape = nullptr,
std::vector< SmallVector< int64_t, 4 >> *  lbs = nullptr,
SmallVectorImpl< int64_t > *  lbDivisors = nullptr 
) const

Returns a constant upper bound on the number of elements in this region if bounded by a known constant (always possible for static shapes), None otherwise. Note that the symbols of the region are treated specially, i.e., the returned bounding constant holds for any given value of the symbol identifiers. The 'shape' vector is set to the corresponding dimension-wise bounds major to minor. We use int64_t instead of uint64_t since index types can be at most int64_t.

◆ getConstantBoundOnDimSize()

Optional<int64_t> mlir::MemRefRegion::getConstantBoundOnDimSize ( unsigned  pos,
SmallVectorImpl< int64_t > *  lb = nullptr,
int64_t *  lbFloorDivisor = nullptr 
) const
inline

A wrapper around FlatAffineConstraints::getConstantBoundOnDimSize(). 'pos' corresponds to the position of the memref shape's dimension (major to minor) which matches 1:1 with the dimensional identifier positions in

◆ getConstraints() [1/2]

FlatAffineConstraints* mlir::MemRefRegion::getConstraints ( )
inline

◆ getConstraints() [2/2]

const FlatAffineConstraints* mlir::MemRefRegion::getConstraints ( ) const
inline

◆ getRank()

unsigned MemRefRegion::getRank ( ) const

Returns the rank of the memref that this region corresponds to.

◆ getRegionSize()

Optional< int64_t > MemRefRegion::getRegionSize ( )

Returns the size of this MemRefRegion in bytes.

◆ isWrite()

bool mlir::MemRefRegion::isWrite ( ) const
inline

◆ setWrite()

void mlir::MemRefRegion::setWrite ( bool  flag)
inline

◆ unionBoundingBox()

LogicalResult MemRefRegion::unionBoundingBox ( const MemRefRegion other)

Member Data Documentation

◆ cst

FlatAffineConstraints mlir::MemRefRegion::cst

Region (data space) of the memref accessed. This set will thus have at least as many dimensional identifiers as the shape dimensionality of the memref, and these are the leading dimensions of the set appearing in that order (major to minor / outermost to innermost). There may be additional identifiers since getMemRefRegion() is called with a specific loop depth, and thus the region is symbolic in the outer surrounding loops at that depth.

◆ loc

Location mlir::MemRefRegion::loc

If there is more than one load/store op associated with the region, the location information would correspond to one of those op's.

◆ memref

Value mlir::MemRefRegion::memref

Memref that this region corresponds to.

◆ write

bool mlir::MemRefRegion::write

Read or write.


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