MLIR  20.0.0git
Classes | Macros | Functions
TosaCanonicalizations.cpp File Reference
#include "mlir/Dialect/Quant/IR/Quant.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
#include "mlir/Dialect/Tosa/Utils/ConversionUtils.h"
#include "mlir/Dialect/Tosa/Utils/QuantUtils.h"
#include "mlir/Dialect/Tosa/Utils/ShapeUtils.h"
#include "mlir/IR/BuiltinTypeInterfaces.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Transforms/FoldUtils.h"
#include "mlir/Transforms/InliningUtils.h"
#include "mlir/Transforms/RegionUtils.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/TypeSwitch.h"
#include <functional>

Go to the source code of this file.

Classes

struct  ConcatOptimization
 
struct  ConsolidateTransposeOptimization
 
struct  TransposeIsReshape
 
struct  MaterializePadValue
 
struct  MaxPool2dIsNoOp
 
struct  ClampIsNoOp
 
struct  ClampClampOptimization
 
struct  ConcatSliceOptimization
 

Macros

#define REDUCE_FOLDER(OP)
 

Functions

template<typename IntFolder , typename FloatFolder >
DenseElementsAttr binaryFolder (DenseElementsAttr lhs, DenseElementsAttr rhs, RankedTensorType returnTy)
 
static bool isSplatZero (Type elemType, DenseElementsAttr val)
 
static bool isSplatOne (Type elemType, DenseElementsAttr val, int64_t shift)
 

Macro Definition Documentation

◆ REDUCE_FOLDER

#define REDUCE_FOLDER (   OP)
Value:
OpFoldResult OP::fold(FoldAdaptor adaptor) { \
ShapedType inputTy = llvm::cast<ShapedType>(getInput().getType()); \
if (!inputTy.hasRank()) \
return {}; \
if (inputTy != getType()) \
return {}; \
if (inputTy.getRank() == 0 || inputTy.getDimSize(getAxis()) == 1) \
return getInput(); \
return {}; \
}
This class represents a single result from folding an operation.
Definition: OpDefinition.h:268
Type getType(OpFoldResult ofr)
Returns the int type of the integer in ofr.
Definition: Utils.cpp:305

Definition at line 811 of file TosaCanonicalizations.cpp.

Function Documentation

◆ binaryFolder()

template<typename IntFolder , typename FloatFolder >
DenseElementsAttr binaryFolder ( DenseElementsAttr  lhs,
DenseElementsAttr  rhs,
RankedTensorType  returnTy 
)

◆ isSplatOne()

static bool isSplatOne ( Type  elemType,
DenseElementsAttr  val,
int64_t  shift 
)
static

◆ isSplatZero()

static bool isSplatZero ( Type  elemType,
DenseElementsAttr  val 
)
static