MLIR
20.0.0git
|
#include "mlir/Dialect/Arith/Transforms/Passes.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Arith/Transforms/WideIntEmulationConverter.h"
#include "mlir/Dialect/Arith/Utils/Utils.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Func/Transforms/FuncConversions.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/APInt.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>
#include "mlir/Dialect/Arith/Transforms/Passes.h.inc"
Go to the source code of this file.
Namespaces | |
mlir | |
Include the generated interface declarations. | |
mlir::arith | |
Macros | |
#define | GEN_PASS_DEF_ARITHEMULATEWIDEINT |
Functions | |
static std::pair< APInt, APInt > | getHalves (const APInt &value, unsigned newBitWidth) |
Returns N bottom and N top bits from value , where N = newBitWidth . More... | |
static Type | reduceInnermostDim (VectorType type) |
Returns the type with the last (innermost) dimension reduced to x1. More... | |
static Value | extractLastDimSlice (ConversionPatternRewriter &rewriter, Location loc, Value input, int64_t lastOffset) |
Extracts the input vector slice with elements at the last dimension offset by lastOffset . More... | |
static std::pair< Value, Value > | extractLastDimHalves (ConversionPatternRewriter &rewriter, Location loc, Value input) |
Extracts two vector slices from the input whose type is vector<...x2T> , with the first element at offset 0 and the second element at offset 1. More... | |
static Value | dropTrailingX1Dim (ConversionPatternRewriter &rewriter, Location loc, Value input) |
static Value | appendX1Dim (ConversionPatternRewriter &rewriter, Location loc, Value input) |
Performs a vector shape cast to append an x1 dimension. More... | |
static Value | insertLastDimSlice (ConversionPatternRewriter &rewriter, Location loc, Value source, Value dest, int64_t lastOffset) |
Inserts the source vector slice into the dest vector at offset lastOffset in the last dimension. More... | |
static Value | constructResultVector (ConversionPatternRewriter &rewriter, Location loc, VectorType resultType, ValueRange resultComponents) |
Constructs a new vector of type resultType by creating a series of insertions of resultComponents , each at the next offset of the last vector dimension. More... | |
#define GEN_PASS_DEF_ARITHEMULATEWIDEINT |
Definition at line 26 of file EmulateWideInt.cpp.
|
static |
Performs a vector shape cast to append an x1 dimension.
If the input
is a scalar, this is a noop.
Definition at line 114 of file EmulateWideInt.cpp.
References mlir::OpBuilder::create(), mlir::get(), and mlir::Value::getType().
|
static |
Constructs a new vector of type resultType
by creating a series of insertions of resultComponents
, each at the next offset of the last vector dimension.
When all resultComponents
are scalars, the result type is vector<NxT>
; when resultComponents
are vector<...x1xT>
s, the result type is vector<...xNxT>
, where N
is the number of resultComponents
.
Definition at line 153 of file EmulateWideInt.cpp.
References mlir::createScalarOrSplatConstant(), mlir::detail::enumerate(), and insertLastDimSlice().
|
static |
Definition at line 97 of file EmulateWideInt.cpp.
References mlir::OpBuilder::create(), mlir::get(), and mlir::Value::getType().
|
static |
Extracts two vector slices from the input
whose type is vector<...x2T>
, with the first element at offset 0 and the second element at offset 1.
Definition at line 89 of file EmulateWideInt.cpp.
References extractLastDimSlice().
|
static |
Extracts the input
vector slice with elements at the last dimension offset by lastOffset
.
Returns a value of vector type with the last dimension reduced to x1 or fully scalarized, e.g.:
Definition at line 66 of file EmulateWideInt.cpp.
References mlir::OpBuilder::create(), and mlir::Value::getType().
Referenced by extractLastDimHalves().
|
static |
Returns N bottom and N top bits from value
, where N = newBitWidth
.
Treats value
as a 2*N bits-wide integer. The bottom bits are returned in the first pair element, while the top bits in the second one.
Definition at line 40 of file EmulateWideInt.cpp.
|
static |
Inserts the source
vector slice into the dest
vector at offset lastOffset
in the last dimension.
source
can be a scalar when dest
is a 1D vector.
Definition at line 130 of file EmulateWideInt.cpp.
References mlir::OpBuilder::create(), and mlir::Value::getType().
Referenced by constructResultVector().
|
static |
Returns the type with the last (innermost) dimension reduced to x1.
Scalarizes 1D vector inputs to match how we extract/insert vector values, e.g.:
Definition at line 52 of file EmulateWideInt.cpp.
References mlir::get().