MLIR  16.0.0git
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.

## ◆ clearBounds()

 void ComputationSliceState::clearBounds ( )

Definition at line 119 of file Utils.cpp.

Referenced by mlir::computeSliceUnion().

## ◆ dump()

 void ComputationSliceState::dump ( ) const

Definition at line 126 of file Utils.cpp.

## ◆ 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.

## ◆ isEmpty()

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

Returns true if the computation slice is empty.

Definition at line 107 of file Utils.h.

Referenced by isFusionProfitable().

## ◆ isMaximal()

 Optional< bool > ComputationSliceState::isMaximal ( ) const

Returns true if the computation slice encloses all the iterations of the sliced loop nest.

Returns false if it does not. Returns llvm::None if it cannot determine if the slice is maximal or not.

Definition at line 291 of file Utils.cpp.

Referenced by mlir::createLoopFusionPass(), and mlir::getComputationSliceState().

## ◆ 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.

Referenced by mlir::computeSliceUnion().

## ◆ insertPoint

 Block::iterator mlir::ComputationSliceState::insertPoint

Definition at line 88 of file Utils.h.

## ◆ ivs

 SmallVector mlir::ComputationSliceState::ivs

Definition at line 78 of file Utils.h.

## ◆ lbOperands

 std::vector > mlir::ComputationSliceState::lbOperands

Definition at line 84 of file Utils.h.

## ◆ lbs

 SmallVector mlir::ComputationSliceState::lbs

Definition at line 80 of file Utils.h.

## ◆ ubOperands

 std::vector > mlir::ComputationSliceState::ubOperands

Definition at line 86 of file Utils.h.

## ◆ ubs

 SmallVector mlir::ComputationSliceState::ubs

Definition at line 82 of file Utils.h.

The documentation for this struct was generated from the following files:
• include/mlir/Dialect/Affine/Analysis/Utils.h
• lib/Dialect/Affine/Analysis/Utils.cpp