MLIR
20.0.0git
|
#include "../SPIRVCommon/Pattern.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/FormatVariadic.h"
Go to the source code of this file.
Namespaces | |
mlir | |
Include the generated interface declarations. | |
Macros | |
#define | DEBUG_TYPE "math-to-spirv-pattern" |
Functions | |
static Value | getScalarOrVectorI32Constant (Type type, int value, OpBuilder &builder, Location loc) |
Creates a 32-bit scalar/vector integer constant. More... | |
static bool | isSupportedSourceType (Type originalType) |
Check if the type is supported by math-to-spirv conversion. More... | |
static LogicalResult | checkSourceOpTypes (ConversionPatternRewriter &rewriter, Operation *sourceOp) |
Check if all sourceOp types are supported by math-to-spirv conversion. More... | |
void | mlir::populateMathToSPIRVPatterns (SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns) |
Appends to a pattern list additional patterns for translating Math ops to SPIR-V ops. More... | |
#define DEBUG_TYPE "math-to-spirv-pattern" |
Definition at line 25 of file MathToSPIRV.cpp.
|
static |
Check if all sourceOp
types are supported by math-to-spirv conversion.
Notify of a match failure othwerise and return a failure
result. This is intended to simplify type checks in OpConversionPattern
s.
Definition at line 75 of file MathToSPIRV.cpp.
References mlir::Operation::getOperandTypes(), mlir::Operation::getResultTypes(), isSupportedSourceType(), and mlir::RewriterBase::notifyMatchFailure().
|
static |
Creates a 32-bit scalar/vector integer constant.
Returns nullptr if the given type is not a 32-bit scalar/vector type.
Definition at line 35 of file MathToSPIRV.cpp.
References mlir::OpBuilder::create(), mlir::Builder::getI32IntegerAttr(), mlir::Builder::getI32VectorAttr(), and mlir::Type::isInteger().
|
static |
Check if the type is supported by math-to-spirv conversion.
We expect to only see scalars and vectors at this point, with higher-level types already lowered.
Definition at line 54 of file MathToSPIRV.cpp.
References mlir::Type::isIntOrIndexOrFloat().
Referenced by checkSourceOpTypes().