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

ComputationSliceState aggregates loop IVs, loop bound AffineMaps and their associated operands for a set of loops within a loop nest (typically the set of loops surrounding a store operation). More...

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

+ Collaboration diagram for mlir::ComputationSliceState:

Public Member Functions

LogicalResult getAsConstraints (FlatAffineValueConstraints *cst)
 
LogicalResult getSourceAsConstraints (FlatAffineValueConstraints &cst)
 Adds to 'cst' constraints which represent the original loop bounds on 'ivs' in 'this'. More...
 
void clearBounds ()
 
bool isEmpty () const
 Returns true if the computation slice is empty. More...
 
Optional< bool > isMaximal () const
 Returns true if the computation slice encloses all the iterations of the sliced loop nest. More...
 
Optional< bool > isSliceValid ()
 Checks the validity of the slice computed. More...
 
void dump () const
 

Public Attributes

SmallVector< Value, 4 > ivs
 
SmallVector< AffineMap, 4 > lbs
 
SmallVector< AffineMap, 4 > ubs
 
std::vector< SmallVector< Value, 4 > > lbOperands
 
std::vector< SmallVector< Value, 4 > > ubOperands
 
Block::iterator insertPoint
 

Detailed Description

ComputationSliceState aggregates loop IVs, loop bound AffineMaps and their associated operands for a set of loops within a loop nest (typically the set of loops surrounding a store operation).

Loop bound AffineMaps which are non-null represent slices of that loop's iteration space.

Definition at line 75 of file Utils.h.

Member Function Documentation

◆ clearBounds()

void ComputationSliceState::clearBounds ( )

Definition at line 119 of file Utils.cpp.

Referenced by mlir::computeSliceUnion().

◆ dump()

void ComputationSliceState::dump ( ) const

◆ getAsConstraints()

LogicalResult ComputationSliceState::getAsConstraints ( FlatAffineValueConstraints cst)

◆ getSourceAsConstraints()

LogicalResult ComputationSliceState::getSourceAsConstraints ( FlatAffineValueConstraints cst)

Adds to 'cst' constraints which represent the original loop bounds on 'ivs' in 'this'.

This corresponds to the original domain of the loop nest from which the slice is being computed. Returns failure if we cannot add loop bounds because of unsupported cases.

Definition at line 69 of file Utils.cpp.

References mlir::FlatAffineValueConstraints::addAffineForOpDomain(), mlir::failed(), mlir::failure(), mlir::getForInductionVarOwner(), mlir::FlatAffineValueConstraints::reset(), and mlir::success().

◆ isEmpty()

bool mlir::ComputationSliceState::isEmpty ( ) const
inline

◆ isMaximal()

Optional< bool > ComputationSliceState::isMaximal ( ) const

◆ isSliceValid()

Optional< bool > ComputationSliceState::isSliceValid ( )

Checks the validity of the slice computed.

Returns true if it is deterministically verified that the original iteration space of the slice is contained within the new iteration space that is created after fusing 'this' slice into its destination.

This is done using the following steps:

  1. Get the new domain of the slice that would be created if fusion succeeds. This domain gets constructed with source loop IVS and destination loop IVS as dimensions.
  2. Project out the dimensions of the destination loop from the domain above calculated in step(1) to express it purely in terms of the source loop IVs.
  3. Calculate a set difference between the iterations of the new domain and the original domain of the source loop. If this difference is empty, the slice is declared to be valid. Otherwise, return false as it implies that the effective fusion results in at least one iteration of the slice that was not originally in the source's domain. If the validity cannot be determined, returns llvm:None.

Definition at line 221 of file Utils.cpp.

References mlir::presburger::IntegerRelation::dump(), mlir::failed(), mlir::presburger::IntegerRelation::getNumLocalVars(), mlir::presburger::IntegerRelation::getNumSymbolVars(), mlir::presburger::IntegerRelation::getNumVars(), mlir::presburger::PresburgerRelation::isIntegerEmpty(), mlir::presburger::None, mlir::FlatAffineValueConstraints::projectOut(), and mlir::presburger::PresburgerSet::subtract().

Referenced by mlir::computeSliceUnion().

Member Data Documentation

◆ insertPoint

Block::iterator mlir::ComputationSliceState::insertPoint

◆ ivs

SmallVector<Value, 4> mlir::ComputationSliceState::ivs

◆ lbOperands

std::vector<SmallVector<Value, 4> > mlir::ComputationSliceState::lbOperands

◆ lbs

SmallVector<AffineMap, 4> mlir::ComputationSliceState::lbs

◆ ubOperands

std::vector<SmallVector<Value, 4> > mlir::ComputationSliceState::ubOperands

◆ ubs

SmallVector<AffineMap, 4> mlir::ComputationSliceState::ubs

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