My Project
Public Types | Public Member Functions | List of all members
mlir::FlatAffineConstraints Class Reference

#include <AffineStructures.h>

Public Types

enum  IdKind { Dimension, Symbol, Local }
 

Public Member Functions

 FlatAffineConstraints (unsigned numReservedInequalities, unsigned numReservedEqualities, unsigned numReservedCols, unsigned numDims=0, unsigned numSymbols=0, unsigned numLocals=0, ArrayRef< Optional< Value >> idArgs={})
 
 FlatAffineConstraints (unsigned numDims=0, unsigned numSymbols=0, unsigned numLocals=0, ArrayRef< Optional< Value >> idArgs={})
 
 FlatAffineConstraints (const HyperRectangularSet &set)
 
 FlatAffineConstraints (const AffineValueMap &avm)
 
 FlatAffineConstraints (ArrayRef< const AffineValueMap *> avmRef)
 
 FlatAffineConstraints (IntegerSet set)
 Creates an affine constraint system from an IntegerSet. More...
 
 FlatAffineConstraints (const IntegerValueSet &set)
 Create an affine constraint system from an IntegerValueSet. More...
 
 FlatAffineConstraints (const FlatAffineConstraints &other)
 
 FlatAffineConstraints (ArrayRef< const AffineValueMap *> avmRef, IntegerSet set)
 
 FlatAffineConstraints (const MutableAffineMap &map)
 
 ~FlatAffineConstraints ()
 
void reset (unsigned numReservedInequalities, unsigned numReservedEqualities, unsigned numReservedCols, unsigned numDims, unsigned numSymbols, unsigned numLocals=0, ArrayRef< Value > idArgs={})
 
void reset (unsigned numDims=0, unsigned numSymbols=0, unsigned numLocals=0, ArrayRef< Value > idArgs={})
 
void append (const FlatAffineConstraints &other)
 
bool isEmpty () const
 
bool isEmptyByGCDTest () const
 
std::unique_ptr< FlatAffineConstraintsclone () const
 
int64_t atEq (unsigned i, unsigned j) const
 Returns the value at the specified equality row and column. More...
 
int64_t & atEq (unsigned i, unsigned j)
 
int64_t atIneq (unsigned i, unsigned j) const
 
int64_t & atIneq (unsigned i, unsigned j)
 
unsigned getNumCols () const
 Returns the number of columns in the constraint system. More...
 
unsigned getNumEqualities () const
 
unsigned getNumInequalities () const
 
unsigned getNumReservedEqualities () const
 
unsigned getNumReservedInequalities () const
 
ArrayRef< int64_t > getEquality (unsigned idx) const
 
ArrayRef< int64_t > getInequality (unsigned idx) const
 
AffineExpr toAffineExpr (unsigned idx, MLIRContext *context)
 
LogicalResult addAffineForOpDomain (AffineForOp forOp)
 
LogicalResult addLowerOrUpperBound (unsigned pos, AffineMap boundMap, ArrayRef< Value > operands, bool eq, bool lower=true)
 
void getSliceBounds (unsigned offset, unsigned num, MLIRContext *context, SmallVectorImpl< AffineMap > *lbMaps, SmallVectorImpl< AffineMap > *ubMaps)
 
LogicalResult addSliceBounds (ArrayRef< Value > values, ArrayRef< AffineMap > lbMaps, ArrayRef< AffineMap > ubMaps, ArrayRef< Value > operands)
 
void addInequality (ArrayRef< int64_t > inEq)
 
void addEquality (ArrayRef< int64_t > eq)
 
void addConstantLowerBound (unsigned pos, int64_t lb)
 Adds a constant lower bound constraint for the specified identifier. More...
 
void addConstantUpperBound (unsigned pos, int64_t ub)
 Adds a constant upper bound constraint for the specified identifier. More...
 
void addLocalFloorDiv (ArrayRef< int64_t > dividend, int64_t divisor)
 
void addConstantLowerBound (ArrayRef< int64_t > expr, int64_t lb)
 Adds a constant lower bound constraint for the specified expression. More...
 
void addConstantUpperBound (ArrayRef< int64_t > expr, int64_t ub)
 Adds a constant upper bound constraint for the specified expression. More...
 
void setIdToConstant (unsigned pos, int64_t val)
 Sets the identifier at the specified position to a constant. More...
 
void setIdToConstant (Value id, int64_t val)
 
bool findId (Value id, unsigned *pos) const
 
bool containsId (Value id) const
 
void addDimId (unsigned pos, Value id=nullptr)
 
void addSymbolId (unsigned pos, Value id=nullptr)
 
void addLocalId (unsigned pos)
 
void addId (IdKind kind, unsigned pos, Value id=nullptr)
 
void addInductionVarOrTerminalSymbol (Value id)
 
LogicalResult composeMap (const AffineValueMap *vMap)
 
LogicalResult composeMatchingMap (AffineMap other)
 
void projectOut (unsigned pos, unsigned num)
 
void projectOut (unsigned pos)
 
void projectOut (Value id)
 Projects out the identifier that is associate with Value . More...
 
void removeId (IdKind idKind, unsigned pos)
 
void removeId (unsigned pos)
 
void removeDim (unsigned pos)
 
void removeEquality (unsigned pos)
 
void removeInequality (unsigned pos)
 
void setDimSymbolSeparation (unsigned newSymbolCount)
 
void convertLoopIVSymbolsToDims ()
 Changes all symbol identifiers which are loop IVs to dim identifiers. More...
 
void setAndEliminate (unsigned pos, int64_t constVal)
 Sets the specified identifier to a constant and removes it. More...
 
LogicalResult constantFoldId (unsigned pos)
 
void constantFoldIdRange (unsigned pos, unsigned num)
 
LogicalResult unionBoundingBox (const FlatAffineConstraints &other)
 
bool areIdsAlignedWithOther (const FlatAffineConstraints &other)
 
void mergeAndAlignIdsWithOther (unsigned offset, FlatAffineConstraints *other)
 
unsigned getNumConstraints () const
 
unsigned getNumIds () const
 
unsigned getNumDimIds () const
 
unsigned getNumSymbolIds () const
 
unsigned getNumDimAndSymbolIds () const
 
unsigned getNumLocalIds () const
 
ArrayRef< Optional< Value > > getIds () const
 
MutableArrayRef< Optional< Value > > getIds ()
 
Optional< ValuegetId (unsigned pos) const
 Returns the optional Value corresponding to the pos^th identifier. More...
 
Optional< Value > & getId (unsigned pos)
 
Value getIdValue (unsigned pos) const
 
void getIdValues (unsigned start, unsigned end, SmallVectorImpl< Value > *values) const
 
void getAllIdValues (SmallVectorImpl< Value > *values) const
 
void setIdValue (unsigned pos, Value val)
 Sets Value associated with the pos^th identifier. More...
 
void setIdValues (unsigned start, unsigned end, ArrayRef< Value > values)
 Sets Values associated with identifiers in the range [start, end). More...
 
void clearAndCopyFrom (const FlatAffineConstraints &other)
 Clears this list of constraints and copies other into it. More...
 
Optional< int64_t > getConstantBoundOnDimSize (unsigned pos, SmallVectorImpl< int64_t > *lb=nullptr, int64_t *lbFloorDivisor=nullptr, SmallVectorImpl< int64_t > *ub=nullptr) const
 
Optional< int64_t > getConstantLowerBound (unsigned pos) const
 
Optional< int64_t > getConstantUpperBound (unsigned pos) const
 
std::pair< AffineMap, AffineMapgetLowerAndUpperBound (unsigned pos, unsigned offset, unsigned num, unsigned symStartPos, ArrayRef< AffineExpr > localExprs, MLIRContext *context) const
 
bool isHyperRectangular (unsigned pos, unsigned num) const
 
void removeTrivialRedundancy ()
 
void removeRedundantInequalities ()
 
void clearConstraints ()
 
void print (raw_ostream &os) const
 
void dump () const
 

Detailed Description

A flat list of affine equalities and inequalities in the form. Inequality: c_0*x_0 + c_1*x_1 + .... + c_{n-1}*x_{n-1} >= 0 Equality: c_0*x_0 + c_1*x_1 + .... + c_{n-1}*x_{n-1} == 0

FlatAffineConstraints stores coefficients in a contiguous buffer (one buffer for equalities and one for inequalities). The size of each buffer is numReservedCols * number of inequalities (or equalities). The reserved size is numReservedCols * numReservedInequalities (or numReservedEqualities). A coefficient (r, c) lives at the location numReservedCols * r + c in the buffer. The extra space between getNumCols() and numReservedCols exists to prevent frequent movement of data when adding columns, especially at the end.

The identifiers x_0, x_1, ... appear in the order: dimensional identifiers, symbolic identifiers, and local identifiers. The local identifiers correspond to local/internal variables created when converting from AffineExpr's containing mod's and div's; they are thus needed to increase representational power. Each local identifier is always (by construction) a floordiv of a pure add/mul affine function of dimensional, symbolic, and other local identifiers, in a non-mutually recursive way. Hence, every local identifier can ultimately always be recovered as an affine function of dimensional and symbolic identifiers (involving floordiv's); note however that some floordiv combinations are converted to mod's by AffineExpr construction.

Member Enumeration Documentation

◆ IdKind

Enumerator
Dimension 
Symbol 
Local 

Constructor & Destructor Documentation

◆ FlatAffineConstraints() [1/10]

mlir::FlatAffineConstraints::FlatAffineConstraints ( unsigned  numReservedInequalities,
unsigned  numReservedEqualities,
unsigned  numReservedCols,
unsigned  numDims = 0,
unsigned  numSymbols = 0,
unsigned  numLocals = 0,
ArrayRef< Optional< Value >>  idArgs = {} 
)
inline

Constructs a constraint system reserving memory for the specified number of constraints and identifiers..

◆ FlatAffineConstraints() [2/10]

mlir::FlatAffineConstraints::FlatAffineConstraints ( unsigned  numDims = 0,
unsigned  numSymbols = 0,
unsigned  numLocals = 0,
ArrayRef< Optional< Value >>  idArgs = {} 
)
inline

Constructs a constraint system with the specified number of dimensions and symbols.

◆ FlatAffineConstraints() [3/10]

mlir::FlatAffineConstraints::FlatAffineConstraints ( const HyperRectangularSet &  set)
explicit

◆ FlatAffineConstraints() [4/10]

mlir::FlatAffineConstraints::FlatAffineConstraints ( const AffineValueMap avm)
explicit

Create a flat affine constraint system from an AffineValueMap or a list of these. The constructed system will only include equalities.

◆ FlatAffineConstraints() [5/10]

mlir::FlatAffineConstraints::FlatAffineConstraints ( ArrayRef< const AffineValueMap *>  avmRef)
explicit

◆ FlatAffineConstraints() [6/10]

FlatAffineConstraints::FlatAffineConstraints ( IntegerSet  set)
explicit

Creates an affine constraint system from an IntegerSet.

◆ FlatAffineConstraints() [7/10]

mlir::FlatAffineConstraints::FlatAffineConstraints ( const IntegerValueSet set)
explicit

Create an affine constraint system from an IntegerValueSet.

◆ FlatAffineConstraints() [8/10]

FlatAffineConstraints::FlatAffineConstraints ( const FlatAffineConstraints other)

◆ FlatAffineConstraints() [9/10]

mlir::FlatAffineConstraints::FlatAffineConstraints ( ArrayRef< const AffineValueMap *>  avmRef,
IntegerSet  set 
)

◆ FlatAffineConstraints() [10/10]

mlir::FlatAffineConstraints::FlatAffineConstraints ( const MutableAffineMap map)

◆ ~FlatAffineConstraints()

mlir::FlatAffineConstraints::~FlatAffineConstraints ( )
inline

Member Function Documentation

◆ addAffineForOpDomain()

LogicalResult FlatAffineConstraints::addAffineForOpDomain ( AffineForOp  forOp)

Adds constraints (lower and upper bounds) for the specified 'affine.for' operation's Value using IR information stored in its bound maps. The right identifier is first looked up using forOp's Value. Asserts if the Value corresponding to the 'affine.for' operation isn't found in the constraint system. Returns failure for the yet unimplemented/unsupported cases. Any new identifiers that are found in the bound operands of the 'affine.for' operation are added as trailing identifiers (either dimensional or symbolic depending on whether the operand is a valid symbol).

◆ addConstantLowerBound() [1/2]

void FlatAffineConstraints::addConstantLowerBound ( unsigned  pos,
int64_t  lb 
)

Adds a constant lower bound constraint for the specified identifier.

◆ addConstantLowerBound() [2/2]

void FlatAffineConstraints::addConstantLowerBound ( ArrayRef< int64_t >  expr,
int64_t  lb 
)

Adds a constant lower bound constraint for the specified expression.

◆ addConstantUpperBound() [1/2]

void FlatAffineConstraints::addConstantUpperBound ( unsigned  pos,
int64_t  ub 
)

Adds a constant upper bound constraint for the specified identifier.

◆ addConstantUpperBound() [2/2]

void FlatAffineConstraints::addConstantUpperBound ( ArrayRef< int64_t >  expr,
int64_t  ub 
)

Adds a constant upper bound constraint for the specified expression.

◆ addDimId()

void FlatAffineConstraints::addDimId ( unsigned  pos,
Value  id = nullptr 
)

◆ addEquality()

void FlatAffineConstraints::addEquality ( ArrayRef< int64_t >  eq)

◆ addId()

void FlatAffineConstraints::addId ( IdKind  kind,
unsigned  pos,
Value  id = nullptr 
)

Adds a dimensional identifier. The added column is initialized to zero.

◆ addInductionVarOrTerminalSymbol()

void FlatAffineConstraints::addInductionVarOrTerminalSymbol ( Value  id)

Add the specified values as a dim or symbol id depending on its nature, if it already doesn't exist in the system. `id' has to be either a terminal symbol or a loop IV, i.e., it cannot be the result affine.apply of any symbols or loop IVs. The identifier is added to the end of the existing dims or symbols. Additional information on the identifier is extracted from the IR and added to the constraint system.

◆ addInequality()

void FlatAffineConstraints::addInequality ( ArrayRef< int64_t >  inEq)

◆ addLocalFloorDiv()

void FlatAffineConstraints::addLocalFloorDiv ( ArrayRef< int64_t >  dividend,
int64_t  divisor 
)

Adds a new local identifier as the floordiv of an affine function of other identifiers, the coefficients of which are provided in 'dividend' and with respect to a positive constant 'divisor'. Two constraints are added to the system to capture equivalence with the floordiv: q = dividend floordiv c <=> c*q <= dividend <= c*q + c - 1.

Adds a new local identifier as the floordiv of an affine function of other identifiers, the coefficients of which are provided in 'dividend' and with respect to a positive constant 'divisor'. Two constraints are added to the system to capture equivalence with the floordiv. q = expr floordiv c <=> c*q <= expr <= c*q + c - 1.

◆ addLocalId()

void FlatAffineConstraints::addLocalId ( unsigned  pos)

◆ addLowerOrUpperBound()

LogicalResult FlatAffineConstraints::addLowerOrUpperBound ( unsigned  pos,
AffineMap  boundMap,
ArrayRef< Value operands,
bool  eq,
bool  lower = true 
)

Adds a lower or an upper bound for the identifier at the specified position with constraints being drawn from the specified bound map and operands. If eq is true, add a single equality equal to the bound map's first result expr.

◆ addSliceBounds()

LogicalResult FlatAffineConstraints::addSliceBounds ( ArrayRef< Value values,
ArrayRef< AffineMap lbMaps,
ArrayRef< AffineMap ubMaps,
ArrayRef< Value operands 
)

Adds slice lower bounds represented by lower bounds in 'lbMaps' and upper bounds in 'ubMaps' to each identifier in the constraint system which has a value in 'values'. Note that both lower/upper bounds share the same operand list 'operands'. This function assumes 'values.size' == 'lbMaps.size' == 'ubMaps.size'. Note that both lower/upper bounds use operands from 'operands'.

◆ addSymbolId()

void FlatAffineConstraints::addSymbolId ( unsigned  pos,
Value  id = nullptr 
)

◆ append()

void FlatAffineConstraints::append ( const FlatAffineConstraints other)

Appends constraints from 'other' into this. This is equivalent to an intersection with no simplification of any sort attempted.

◆ areIdsAlignedWithOther()

bool FlatAffineConstraints::areIdsAlignedWithOther ( const FlatAffineConstraints other)

Returns 'true' if this constraint system and 'other' are in the same space, i.e., if they are associated with the same set of identifiers, appearing in the same order. Returns 'false' otherwise.

Calls areIdsAligned to check if two constraint systems have the same set of identifiers in the same order.

◆ atEq() [1/2]

int64_t mlir::FlatAffineConstraints::atEq ( unsigned  i,
unsigned  j 
) const
inline

Returns the value at the specified equality row and column.

◆ atEq() [2/2]

int64_t& mlir::FlatAffineConstraints::atEq ( unsigned  i,
unsigned  j 
)
inline

◆ atIneq() [1/2]

int64_t mlir::FlatAffineConstraints::atIneq ( unsigned  i,
unsigned  j 
) const
inline

◆ atIneq() [2/2]

int64_t& mlir::FlatAffineConstraints::atIneq ( unsigned  i,
unsigned  j 
)
inline

◆ clearAndCopyFrom()

void FlatAffineConstraints::clearAndCopyFrom ( const FlatAffineConstraints other)

Clears this list of constraints and copies other into it.

◆ clearConstraints()

void FlatAffineConstraints::clearConstraints ( )

◆ clone()

std::unique_ptr< FlatAffineConstraints > FlatAffineConstraints::clone ( ) const

◆ composeMap()

LogicalResult FlatAffineConstraints::composeMap ( const AffineValueMap vMap)

Composes the affine value map with this FlatAffineConstrains, adding the results of the map as dimensions at the front [0, vMap->getNumResults()) and with the dimensions set to the equalities specified by the value map. Returns failure if the composition fails (when vMap is a semi-affine map). The vMap's operand Value's are used to look up the right positions in the FlatAffineConstraints with which to associate. The dimensional and symbolic operands of vMap should match 1:1 (in the same order) with those of this constraint system, but the latter could have additional trailing operands.

◆ composeMatchingMap()

LogicalResult FlatAffineConstraints::composeMatchingMap ( AffineMap  other)

Composes an affine map whose dimensions match one to one to the dimensions of this FlatAffineConstraints. The results of the map 'other' are added as the leading dimensions of this constraint system. Returns failure if 'other' is a semi-affine map.

◆ constantFoldId()

LogicalResult FlatAffineConstraints::constantFoldId ( unsigned  pos)

Tries to fold the specified identifier to a constant using a trivial equality detection; if successful, the constant is substituted for the identifier everywhere in the constraint system and then removed from the system.

◆ constantFoldIdRange()

void FlatAffineConstraints::constantFoldIdRange ( unsigned  pos,
unsigned  num 
)

This method calls constantFoldId for the specified range of identifiers, 'num' identifiers starting at position 'pos'.

◆ containsId()

bool FlatAffineConstraints::containsId ( Value  id) const

Returns true if an identifier with the specified Value exists, false otherwise.

◆ convertLoopIVSymbolsToDims()

void FlatAffineConstraints::convertLoopIVSymbolsToDims ( )

Changes all symbol identifiers which are loop IVs to dim identifiers.

◆ dump()

void FlatAffineConstraints::dump ( ) const

◆ findId()

bool FlatAffineConstraints::findId ( Value  id,
unsigned *  pos 
) const

Looks up the position of the identifier with the specified Value. Returns true if found (false otherwise). `pos' is set to the (column) position of the identifier.

◆ getAllIdValues()

void mlir::FlatAffineConstraints::getAllIdValues ( SmallVectorImpl< Value > *  values) const
inline

◆ getConstantBoundOnDimSize()

Optional< int64_t > FlatAffineConstraints::getConstantBoundOnDimSize ( unsigned  pos,
SmallVectorImpl< int64_t > *  lb = nullptr,
int64_t *  lbFloorDivisor = nullptr,
SmallVectorImpl< int64_t > *  ub = nullptr 
) const

Returns the smallest known constant bound for the extent of the specified identifier (pos^th), i.e., the smallest known constant that is greater than or equal to 'exclusive upper bound' - 'lower bound' of the identifier. Returns None if it's not a constant. This method employs trivial (low complexity / cost) checks and detection. Symbolic identifiers are treated specially, i.e., it looks for constant differences between affine expressions involving only the symbolic identifiers. See comments at function definition for examples. 'lb' and 'lbDivisor', if provided, are used to express the lower bound associated with the constant difference: 'lb' has the coefficients and lbDivisor, the divisor. For eg., if the lower bound is [(s0 + s2 - 1) floordiv 32] for a system with three symbolic identifiers, *lb = [1, 0, 1], lbDivisor = 32.

Returns the extent (upper bound - lower bound) of the specified identifier if it is found to be a constant; returns None if it's not a constant. This methods treats symbolic identifiers specially, i.e., it looks for constant differences between affine expressions involving only the symbolic identifiers. See comments at function definition for example. 'lb', if provided, is set to the lower bound associated with the constant difference. Note that 'lb' is purely symbolic and thus will contain the coefficients of the symbolic identifiers and the constant coefficient.

◆ getConstantLowerBound()

Optional< int64_t > FlatAffineConstraints::getConstantLowerBound ( unsigned  pos) const

Returns the constant lower bound for the pos^th identifier if there is one; None otherwise.

◆ getConstantUpperBound()

Optional< int64_t > FlatAffineConstraints::getConstantUpperBound ( unsigned  pos) const

Returns the constant upper bound for the pos^th identifier if there is one; None otherwise.

◆ getEquality()

ArrayRef<int64_t> mlir::FlatAffineConstraints::getEquality ( unsigned  idx) const
inline

◆ getId() [1/2]

Optional<Value> mlir::FlatAffineConstraints::getId ( unsigned  pos) const
inline

Returns the optional Value corresponding to the pos^th identifier.

◆ getId() [2/2]

Optional<Value>& mlir::FlatAffineConstraints::getId ( unsigned  pos)
inline

◆ getIds() [1/2]

ArrayRef<Optional<Value> > mlir::FlatAffineConstraints::getIds ( ) const
inline

◆ getIds() [2/2]

MutableArrayRef<Optional<Value> > mlir::FlatAffineConstraints::getIds ( )
inline

◆ getIdValue()

Value mlir::FlatAffineConstraints::getIdValue ( unsigned  pos) const
inline

Returns the Value associated with the pos^th identifier. Asserts if no Value identifier was associated.

◆ getIdValues()

void mlir::FlatAffineConstraints::getIdValues ( unsigned  start,
unsigned  end,
SmallVectorImpl< Value > *  values 
) const
inline

Returns the Values associated with identifiers in range [start, end). Asserts if no Value was associated with one of these identifiers.

◆ getInequality()

ArrayRef<int64_t> mlir::FlatAffineConstraints::getInequality ( unsigned  idx) const
inline

◆ getLowerAndUpperBound()

std::pair< AffineMap, AffineMap > FlatAffineConstraints::getLowerAndUpperBound ( unsigned  pos,
unsigned  offset,
unsigned  num,
unsigned  symStartPos,
ArrayRef< AffineExpr localExprs,
MLIRContext context 
) const

Gets the lower and upper bound of the pos^th identifier treating [0, offset) U [offset + num, symStartPos) as dimensions and [symStartPos, getNumDimAndSymbolIds) as symbols. The returned multi-dimensional maps in the pair represent the max and min of potentially multiple affine expressions. The upper bound is exclusive. 'localExprs' holds pre-computed AffineExpr's for all local identifiers in the system.

Add to 'b' from 'a' in set [0, offset) U [offset + num, symbStartPos).

◆ getNumCols()

unsigned mlir::FlatAffineConstraints::getNumCols ( ) const
inline

Returns the number of columns in the constraint system.

◆ getNumConstraints()

unsigned mlir::FlatAffineConstraints::getNumConstraints ( ) const
inline

◆ getNumDimAndSymbolIds()

unsigned mlir::FlatAffineConstraints::getNumDimAndSymbolIds ( ) const
inline

◆ getNumDimIds()

unsigned mlir::FlatAffineConstraints::getNumDimIds ( ) const
inline

◆ getNumEqualities()

unsigned mlir::FlatAffineConstraints::getNumEqualities ( ) const
inline

◆ getNumIds()

unsigned mlir::FlatAffineConstraints::getNumIds ( ) const
inline

◆ getNumInequalities()

unsigned mlir::FlatAffineConstraints::getNumInequalities ( ) const
inline

◆ getNumLocalIds()

unsigned mlir::FlatAffineConstraints::getNumLocalIds ( ) const
inline

◆ getNumReservedEqualities()

unsigned mlir::FlatAffineConstraints::getNumReservedEqualities ( ) const
inline

◆ getNumReservedInequalities()

unsigned mlir::FlatAffineConstraints::getNumReservedInequalities ( ) const
inline

◆ getNumSymbolIds()

unsigned mlir::FlatAffineConstraints::getNumSymbolIds ( ) const
inline

◆ getSliceBounds()

void FlatAffineConstraints::getSliceBounds ( unsigned  offset,
unsigned  num,
MLIRContext context,
SmallVectorImpl< AffineMap > *  lbMaps,
SmallVectorImpl< AffineMap > *  ubMaps 
)

Computes the lower and upper bounds of the first 'num' dimensional identifiers (starting at 'offset') as an affine map of the remaining identifiers (dimensional and symbolic). This method is able to detect identifiers as floordiv's and mod's of affine expressions of other identifiers with respect to (positive) constants. Sets bound map to a null AffineMap if such a bound can't be found (or yet unimplemented).

Computes the lower and upper bounds of the first 'num' dimensional identifiers (starting at 'offset') as affine maps of the remaining identifiers (dimensional and symbolic identifiers). Local identifiers are themselves explicitly computed as affine functions of other identifiers in this process if needed.

◆ isEmpty()

bool FlatAffineConstraints::isEmpty ( ) const

◆ isEmptyByGCDTest()

bool FlatAffineConstraints::isEmptyByGCDTest ( ) const

◆ isHyperRectangular()

bool FlatAffineConstraints::isHyperRectangular ( unsigned  pos,
unsigned  num 
) const

Returns true if the set can be trivially detected as being hyper-rectangular on the specified contiguous set of identifiers.

◆ mergeAndAlignIdsWithOther()

void FlatAffineConstraints::mergeAndAlignIdsWithOther ( unsigned  offset,
FlatAffineConstraints other 
)

Merge and align the identifiers of 'this' and 'other' starting at 'offset', so that both constraint systems get the union of the contained identifiers that is dimension-wise and symbol-wise unique; both constraint systems are updated so that they have the union of all identifiers, with this's original identifiers appearing first followed by any of other's identifiers that didn't appear in 'this'. Local identifiers of each system are by design separate/local and are placed one after other (this's followed by other's).

◆ print()

void FlatAffineConstraints::print ( raw_ostream &  os) const

◆ projectOut() [1/3]

void FlatAffineConstraints::projectOut ( unsigned  pos,
unsigned  num 
)

Projects out (aka eliminates) 'num' identifiers starting at position 'pos'. The resulting constraint system is the shadow along the dimensions that still exist. This method may not always be integer exact.

◆ projectOut() [2/3]

void mlir::FlatAffineConstraints::projectOut ( unsigned  pos)
inline

◆ projectOut() [3/3]

void FlatAffineConstraints::projectOut ( Value  id)

Projects out the identifier that is associate with Value .

◆ removeDim()

void mlir::FlatAffineConstraints::removeDim ( unsigned  pos)

◆ removeEquality()

void FlatAffineConstraints::removeEquality ( unsigned  pos)

◆ removeId() [1/2]

void mlir::FlatAffineConstraints::removeId ( IdKind  idKind,
unsigned  pos 
)

◆ removeId() [2/2]

void FlatAffineConstraints::removeId ( unsigned  pos)

◆ removeInequality()

void mlir::FlatAffineConstraints::removeInequality ( unsigned  pos)

◆ removeRedundantInequalities()

void FlatAffineConstraints::removeRedundantInequalities ( )

A more expensive check to detect redundant inequalities thatn removeTrivialRedundancy.

◆ removeTrivialRedundancy()

void FlatAffineConstraints::removeTrivialRedundancy ( )

Removes duplicate constraints, trivially true constraints, and constraints that can be detected as redundant as a result of differing only in their constant term part. A constraint of the form <non-negative constant> >= 0 is considered trivially true. This method is a linear time method on the constraints, does a single scan, and updates in place.

Removes duplicate constraints, trivially true constraints, and constraints that can be detected as redundant as a result of differing only in their constant term part. A constraint of the form <non-negative constant> >= 0 is considered trivially true.

◆ reset() [1/2]

void FlatAffineConstraints::reset ( unsigned  numReservedInequalities,
unsigned  numReservedEqualities,
unsigned  numReservedCols,
unsigned  numDims,
unsigned  numSymbols,
unsigned  numLocals = 0,
ArrayRef< Value idArgs = {} 
)

◆ reset() [2/2]

void FlatAffineConstraints::reset ( unsigned  numDims = 0,
unsigned  numSymbols = 0,
unsigned  numLocals = 0,
ArrayRef< Value idArgs = {} 
)

◆ setAndEliminate()

void FlatAffineConstraints::setAndEliminate ( unsigned  pos,
int64_t  constVal 
)

Sets the specified identifier to a constant and removes it.

◆ setDimSymbolSeparation()

void FlatAffineConstraints::setDimSymbolSeparation ( unsigned  newSymbolCount)

Changes the partition between dimensions and symbols. Depending on the new symbol count, either a chunk of trailing dimensional identifiers becomes symbols, or some of the leading symbols become dimensions.

◆ setIdToConstant() [1/2]

void FlatAffineConstraints::setIdToConstant ( unsigned  pos,
int64_t  val 
)

Sets the identifier at the specified position to a constant.

Sets the specified identifier to a constant value.

◆ setIdToConstant() [2/2]

void FlatAffineConstraints::setIdToConstant ( Value  id,
int64_t  val 
)

Sets the identifier corresponding to the specified Value id to a constant. Asserts if the 'id' is not found.

Sets the specified identifier to a constant value; asserts if the id is not found.

◆ setIdValue()

void mlir::FlatAffineConstraints::setIdValue ( unsigned  pos,
Value  val 
)
inline

Sets Value associated with the pos^th identifier.

◆ setIdValues()

void mlir::FlatAffineConstraints::setIdValues ( unsigned  start,
unsigned  end,
ArrayRef< Value values 
)
inline

Sets Values associated with identifiers in the range [start, end).

◆ toAffineExpr()

AffineExpr mlir::FlatAffineConstraints::toAffineExpr ( unsigned  idx,
MLIRContext context 
)

◆ unionBoundingBox()

LogicalResult FlatAffineConstraints::unionBoundingBox ( const FlatAffineConstraints other)

Updates the constraints to be the smallest bounding (enclosing) box that contains the points of 'this' set and that of 'other', with the symbols being treated specially. For each of the dimensions, the min of the lower bounds (symbolic) and the max of the upper bounds (symbolic) is computed to determine such a bounding box. `other' is expected to have the same dimensional identifiers as this constraint system (in the same order).

Eg: if 'this' is {0 <= d0 <= 127}, 'other' is {16 <= d0 <= 192}, the output is {0 <= d0 <= 192}. 2) 'this' = {s0 + 5 <= d0 <= s0 + 20}, 'other' is {s0 + 1 <= d0 <= s0 + 9}, output = {s0 + 1 <= d0 <= s0 + 20}. 3) 'this' = {0 <= d0 <= 5, 1 <= d1 <= 9}, 'other' = {2 <= d0 <= 6, 5 <= d1 <= 15}, output = {0 <= d0 <= 6, 1 <= d1 <= 15}.


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