MLIR
22.0.0git
|
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/Math/Transforms/Passes.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Transforms/DialectConversion.h"
Go to the source code of this file.
Functions | |
static Value | createFloatConst (Location loc, Type type, APFloat value, OpBuilder &b) |
Create a float constant. More... | |
static Value | createFloatConst (Location loc, Type type, double value, OpBuilder &b) |
static Value | createIntConst (Location loc, Type type, int64_t value, OpBuilder &b) |
Create an integer constant. More... | |
static Value | createTruncatedFPValue (Value operand, ImplicitLocOpBuilder &b) |
static LogicalResult | convertSinhOp (math::SinhOp op, PatternRewriter &rewriter) |
static LogicalResult | convertCoshOp (math::CoshOp op, PatternRewriter &rewriter) |
static LogicalResult | convertTanhOp (math::TanhOp op, PatternRewriter &rewriter) |
Expands tanh op into 1-exp^{-2x} / 1+exp^{-2x} To avoid overflow we exploit the reflection symmetry tanh(-x) = -tanh(x) . More... | |
static LogicalResult | convertTanOp (math::TanOp op, PatternRewriter &rewriter) |
static LogicalResult | convertAsinhOp (math::AsinhOp op, PatternRewriter &rewriter) |
static LogicalResult | convertAcoshOp (math::AcoshOp op, PatternRewriter &rewriter) |
static LogicalResult | convertAtanhOp (math::AtanhOp op, PatternRewriter &rewriter) |
static LogicalResult | convertFmaFOp (math::FmaOp op, PatternRewriter &rewriter) |
static LogicalResult | convertCeilOp (math::CeilOp op, PatternRewriter &rewriter) |
static LogicalResult | convertFPowIOp (math::FPowIOp op, PatternRewriter &rewriter) |
static LogicalResult | convertPowfOp (math::PowFOp op, PatternRewriter &rewriter) |
static LogicalResult | convertExp2fOp (math::Exp2Op op, PatternRewriter &rewriter) |
static LogicalResult | convertRoundOp (math::RoundOp op, PatternRewriter &rewriter) |
static LogicalResult | convertCtlzOp (math::CountLeadingZerosOp op, PatternRewriter &rewriter) |
static LogicalResult | convertRoundEvenOp (math::RoundEvenOp op, PatternRewriter &rewriter) |
static LogicalResult | convertRsqrtOp (math::RsqrtOp op, PatternRewriter &rewriter) |
|
static |
Definition at line 171 of file ExpandPatterns.cpp.
References createFloatConst(), mlir::Value::getType(), and mlir::RewriterBase::replaceOp().
Referenced by mlir::populateExpandAcoshPattern().
|
static |
Definition at line 155 of file ExpandPatterns.cpp.
References createFloatConst(), mlir::Value::getType(), and mlir::RewriterBase::replaceOp().
Referenced by mlir::populateExpandAsinhPattern().
|
static |
Definition at line 187 of file ExpandPatterns.cpp.
References createFloatConst(), mlir::Value::getType(), and mlir::RewriterBase::replaceOp().
Referenced by mlir::populateExpandAtanhPattern().
|
static |
Definition at line 222 of file ExpandPatterns.cpp.
References createFloatConst(), createTruncatedFPValue(), mlir::ImplicitLocOpBuilder::getLoc(), mlir::Value::getType(), and mlir::RewriterBase::replaceOp().
Referenced by mlir::populateExpandCeilFPattern().
|
static |
Definition at line 87 of file ExpandPatterns.cpp.
References createFloatConst(), mlir::Value::getType(), and mlir::RewriterBase::replaceOp().
Referenced by mlir::populateExpandCoshPattern().
|
static |
Definition at line 468 of file ExpandPatterns.cpp.
References createIntConst(), mlir::getElementTypeOrSelf(), and mlir::RewriterBase::replaceOp().
Referenced by mlir::populateExpandCtlzPattern().
|
static |
Definition at line 396 of file ExpandPatterns.cpp.
References createFloatConst(), mlir::ImplicitLocOpBuilder::getLoc(), mlir::Value::getType(), and mlir::RewriterBase::replaceOp().
Referenced by mlir::populateExpandExp2FPattern().
|
static |
Definition at line 205 of file ExpandPatterns.cpp.
References mlir::RewriterBase::replaceOp().
Referenced by mlir::populateExpandFmaFPattern().
|
static |
Definition at line 251 of file ExpandPatterns.cpp.
References mlir::presburger::abs(), createFloatConst(), mlir::getElementTypeOrSelf(), mlir::ImplicitLocOpBuilder::getLoc(), mlir::Value::getType(), getZero(), mlir::m_Constant(), mlir::m_ConstantInt(), mlir::matchPattern(), and mlir::RewriterBase::replaceOp().
Referenced by mlir::populateExpandFPowIPattern().
|
static |
Definition at line 322 of file ExpandPatterns.cpp.
References createFloatConst(), mlir::getElementTypeOrSelf(), mlir::Value::getType(), mlir::m_ConstantFloat(), mlir::matchPattern(), and mlir::RewriterBase::replaceOp().
Referenced by mlir::populateExpandPowFPattern().
|
static |
Definition at line 511 of file ExpandPatterns.cpp.
References createFloatConst(), createIntConst(), mlir::getElementTypeOrSelf(), mlir::Builder::getIntegerType(), mlir::Type::getIntOrFloatBitWidth(), mlir::RewriterBase::notifyMatchFailure(), mlir::RewriterBase::replaceOp(), and mlir::presburger::round().
Referenced by mlir::populateExpandRoundEvenPattern().
|
static |
Definition at line 408 of file ExpandPatterns.cpp.
References createFloatConst(), createIntConst(), createTruncatedFPValue(), mlir::getElementTypeOrSelf(), mlir::Builder::getI32Type(), mlir::Value::getType(), mlir::Type::isF32(), mlir::RewriterBase::notifyMatchFailure(), and mlir::RewriterBase::replaceOp().
Referenced by mlir::populateExpandRoundFPattern().
|
static |
Definition at line 643 of file ExpandPatterns.cpp.
References createFloatConst(), mlir::getElementTypeOrSelf(), and mlir::RewriterBase::replaceOpWithNewOp().
Referenced by mlir::populateExpandRsqrtPattern().
|
static |
Definition at line 71 of file ExpandPatterns.cpp.
References createFloatConst(), mlir::Value::getType(), and mlir::RewriterBase::replaceOp().
Referenced by mlir::populateExpandSinhPattern().
|
static |
Expands tanh op into 1-exp^{-2x} / 1+exp^{-2x} To avoid overflow we exploit the reflection symmetry tanh(-x) = -tanh(x)
.
We compute a "signs" value which is -1 if input is negative and +1 if input is positive. Then multiply the input by this value, guaranteeing that the result is positive, which also guarantees exp^{-2x * sign(x)}
is in (0, 1]. Expand the computation on the input x * sign(x)
, then multiply the result by sign(x)
to retain sign of the real result.
Definition at line 110 of file ExpandPatterns.cpp.
References createFloatConst(), and mlir::RewriterBase::replaceOpWithNewOp().
Referenced by mlir::populateExpandTanhPattern().
|
static |
Definition at line 143 of file ExpandPatterns.cpp.
References mlir::Value::getType(), and mlir::RewriterBase::replaceOp().
Referenced by mlir::populateExpandTanPattern().
Create a float constant.
Definition at line 25 of file ExpandPatterns.cpp.
References mlir::DenseElementsAttr::get(), mlir::getElementTypeOrSelf(), and mlir::Builder::getFloatAttr().
Referenced by convertAcoshOp(), convertAsinhOp(), convertAtanhOp(), convertCeilOp(), convertCoshOp(), convertExp2fOp(), convertFPowIOp(), convertPowfOp(), convertRoundEvenOp(), convertRoundOp(), convertRsqrtOp(), convertSinhOp(), convertTanhOp(), and createFloatConst().
Definition at line 41 of file ExpandPatterns.cpp.
References createFloatConst().
Create an integer constant.
Definition at line 47 of file ExpandPatterns.cpp.
References mlir::DenseElementsAttr::get(), mlir::getElementTypeOrSelf(), and mlir::Builder::getIntegerAttr().
Referenced by convertCtlzOp(), convertRoundEvenOp(), and convertRoundOp().
|
static |
Definition at line 58 of file ExpandPatterns.cpp.
References mlir::Builder::getI64Type(), and mlir::Value::getType().
Referenced by convertCeilOp(), and convertRoundOp().