MLIR
21.0.0git
|
#include "mlir/Conversion/ArithToSPIRV/ArithToSPIRV.h"
#include "../SPIRVCommon/Pattern.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVAttributes.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h"
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/DialectResourceBlobManager.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>
#include <memory>
#include "mlir/Conversion/Passes.h.inc"
Go to the source code of this file.
Namespaces | |
mlir | |
Include the generated interface declarations. | |
Macros | |
#define | GEN_PASS_DEF_CONVERTARITHTOSPIRV |
#define | DEBUG_TYPE "arith-to-spirv-pattern" |
#define | DISPATCH(cmpPredicate, spirvOp) |
#define | DISPATCH(cmpPredicate, spirvOp) |
Functions | |
static BoolAttr | convertBoolAttr (Attribute srcAttr, Builder builder) |
Converts the given srcAttr into a boolean attribute if it holds an integral value. More... | |
static IntegerAttr | convertIntegerAttr (IntegerAttr srcAttr, IntegerType dstType, Builder builder) |
Converts the given srcAttr to a new attribute of the given dstType . More... | |
static FloatAttr | convertFloatAttr (FloatAttr srcAttr, FloatType dstType, Builder builder) |
Converts the given srcAttr to a new attribute of the given dstType . More... | |
static bool | isBoolScalarOrVector (Type type) |
Returns true if the given type is a boolean scalar or vector type. More... | |
static Value | getScalarOrVectorConstInt (Type type, uint64_t value, OpBuilder &builder, Location loc) |
Creates a scalar/vector integer constant. More... | |
static bool | hasSameBitwidth (Type a, Type b) |
Returns true if scalar/vector type a and b have the same number of bitwidth. More... | |
static LogicalResult | getTypeConversionFailure (ConversionPatternRewriter &rewriter, Operation *op, Type srcType) |
Returns a source type conversion failure for srcType and operation op . More... | |
static LogicalResult | getTypeConversionFailure (ConversionPatternRewriter &rewriter, Operation *op) |
Returns a source type conversion failure for the result type of op . More... | |
static std::string | getDecorationString (spirv::Decoration decor) |
#define DEBUG_TYPE "arith-to-spirv-pattern" |
Definition at line 34 of file ArithToSPIRV.cpp.
#define DISPATCH | ( | cmpPredicate, | |
spirvOp | |||
) |
#define DISPATCH | ( | cmpPredicate, | |
spirvOp | |||
) |
#define GEN_PASS_DEF_CONVERTARITHTOSPIRV |
Definition at line 30 of file ArithToSPIRV.cpp.
Converts the given srcAttr
into a boolean attribute if it holds an integral value.
Returns null attribute if conversion fails.
Definition at line 44 of file ArithToSPIRV.cpp.
References mlir::Builder::getBoolAttr().
|
static |
Converts the given srcAttr
to a new attribute of the given dstType
.
Returns null attribute if dstType
is not 32-bit or conversion fails.
Definition at line 81 of file ArithToSPIRV.cpp.
References mlir::Builder::getF32FloatAttr().
|
static |
Converts the given srcAttr
to a new attribute of the given dstType
.
Returns null attribute if conversion fails.
Definition at line 54 of file ArithToSPIRV.cpp.
References mlir::Builder::getIntegerAttr().
|
static |
Definition at line 163 of file ArithToSPIRV.cpp.
|
static |
Creates a scalar/vector integer constant.
Definition at line 115 of file ArithToSPIRV.cpp.
References mlir::OpBuilder::create(), mlir::get(), mlir::DenseElementsAttr::get(), and mlir::Builder::getIntegerAttr().
|
static |
Returns a source type conversion failure for the result type of op
.
Definition at line 157 of file ArithToSPIRV.cpp.
References mlir::ValueTypeRange< ValueRangeT >::front(), mlir::Operation::getNumResults(), mlir::Operation::getResultTypes(), and getTypeConversionFailure().
|
static |
Returns a source type conversion failure for srcType
and operation op
.
Definition at line 148 of file ArithToSPIRV.cpp.
References mlir::Operation::getLoc(), and mlir::RewriterBase::notifyMatchFailure().
Referenced by getTypeConversionFailure().
Returns true if scalar/vector type a
and b
have the same number of bitwidth.
Definition at line 132 of file ArithToSPIRV.cpp.
|
static |
Returns true if the given type
is a boolean scalar or vector type.
Definition at line 103 of file ArithToSPIRV.cpp.
References mlir::Type::isInteger().