MLIR 22.0.0git
AffineMap.cpp File Reference
#include "mlir/IR/AffineMap.h"
#include "AffineMapDetail.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/MathExtras.h"
#include <numeric>
#include <optional>
#include <type_traits>

Go to the source code of this file.

Functions

template<typename AffineExprContainer>
static SmallVector< AffineMap, 4 > inferFromExprList (ArrayRef< AffineExprContainer > exprsList, MLIRContext *context)
 Creates an affine map each for each list of AffineExpr's in exprsList while inferring the right number of dimensional and symbolic inputs needed based on the maximum dimensional and symbolic identifier appearing in the expressions.
static SmallVector< AffineMapcompressUnusedListImpl (ArrayRef< AffineMap > maps, llvm::function_ref< AffineMap(AffineMap)> compressionFun)
 Implementation detail to compress multiple affine maps with a compressionFun that is expected to be either compressUnusedDims or compressUnusedSymbols.
template<typename AffineDimOrSymExpr>
static AffineMap projectCommonImpl (AffineMap map, const llvm::SmallBitVector &toProject, bool compress)
 Common implementation to project out dimensions or symbols from an affine map based on the template type.

Function Documentation

◆ compressUnusedListImpl()

SmallVector< AffineMap > compressUnusedListImpl ( ArrayRef< AffineMap > maps,
llvm::function_ref< AffineMap(AffineMap)> compressionFun )
static

Implementation detail to compress multiple affine maps with a compressionFun that is expected to be either compressUnusedDims or compressUnusedSymbols.

The implementation keeps track of num dims and symbols across the different affine maps.

Definition at line 680 of file AffineMap.cpp.

References mlir::AffineMap::get(), mlir::AffineMap::getNumDims(), mlir::AffineMap::getNumSymbols(), and mlir::AffineMap::getResults().

Referenced by mlir::compressUnusedDims(), and mlir::compressUnusedSymbols().

◆ inferFromExprList()

template<typename AffineExprContainer>
SmallVector< AffineMap, 4 > inferFromExprList ( ArrayRef< AffineExprContainer > exprsList,
MLIRContext * context )
static

Creates an affine map each for each list of AffineExpr's in exprsList while inferring the right number of dimensional and symbolic inputs needed based on the maximum dimensional and symbolic identifier appearing in the expressions.

Definition at line 293 of file AffineMap.cpp.

References mlir::AffineMap::get(), and mlir::getMaxDimAndSymbol().

◆ projectCommonImpl()

template<typename AffineDimOrSymExpr>
AffineMap projectCommonImpl ( AffineMap map,
const llvm::SmallBitVector & toProject,
bool compress )
static

Common implementation to project out dimensions or symbols from an affine map based on the template type.

Additionally, if 'compress' is true, the projected out dimensions or symbols are also dropped from the resulting map.

Definition at line 853 of file AffineMap.cpp.

References mlir::AffineMap::get(), mlir::getAffineConstantExpr(), mlir::getAffineDimExpr(), mlir::getAffineSymbolExpr(), mlir::AffineMap::getContext(), mlir::AffineMap::getNumDims(), mlir::AffineMap::getNumResults(), mlir::AffineMap::getNumSymbols(), mlir::AffineMap::getResults(), mlir::AffineExpr::replaceDims(), and mlir::AffineExpr::replaceSymbols().

Referenced by mlir::projectDims(), and mlir::projectSymbols().