MLIR
17.0.0git
|
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/AsmParser/AsmParser.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Arith/Utils/Utils.h"
#include "mlir/Dialect/Complex/IR/Complex.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/SparseTensor/IR/SparseTensor.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Utils/IndexingUtils.h"
#include "mlir/Dialect/Utils/ReshapeOpsUtils.h"
#include "mlir/Dialect/Utils/StaticValueUtils.h"
#include "mlir/IR/AffineExprVisitor.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/OperationSupport.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Interfaces/InferTypeOpInterface.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>
#include "mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yamlgen.cpp.inc"
#include "mlir/Dialect/Linalg/IR/LinalgOps.cpp.inc"
#include "mlir/Dialect/Linalg/IR/LinalgStructuredOps.cpp.inc"
Go to the source code of this file.
Macros | |
#define | GET_OP_CLASSES |
#define | GET_OP_CLASSES |
Typedefs | |
using | RegionBuilderFn = llvm::function_ref< void(ImplicitLocOpBuilder &, Block &, ArrayRef< NamedAttribute >)> |
Functions | |
static void | fillStructuredOpRegion (OpBuilder &opBuilder, Region ®ion, TypeRange inputTypes, TypeRange outputTypes, ArrayRef< NamedAttribute > attrs, RegionBuilderFn regionBuilder) |
Fills the region of a structured operation using the provided regionBuilder . More... | |
static void | buildStructuredOp (OpBuilder &b, OperationState &state, std::optional< TypeRange > resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef< NamedAttribute > attributes, RegionBuilderFn regionBuilder) |
Creates a structured operation given inputs , outputs , and attributes . More... | |
static ParseResult | parseCommonStructuredOpParts (OpAsmParser &parser, OperationState &result, SmallVectorImpl< Type > &inputTypes, SmallVectorImpl< Type > &outputTypes, bool addOperandSegmentSizes=true) |
Common parsing used for both named structured ops created by ods-gen and by manually defined C++ ops. More... | |
static void | printCommonStructuredOpParts (OpAsmPrinter &p, ValueRange inputs, ValueRange outputs) |
static ParseResult | parseNamedStructuredOpRegion (OpAsmParser &parser, Region ®ion, unsigned numRegionArgs, TypeRange inputTypes, TypeRange outputTypes, ArrayRef< NamedAttribute > attrs, RegionBuilderFn regionBuilder) |
static ParseResult | parseNamedStructuredOpResults (OpAsmParser &parser, SmallVectorImpl< Type > &resultTypes) |
static ParseResult | parseNamedStructuredOp (OpAsmParser &parser, OperationState &result, unsigned numRegionArgs, RegionBuilderFn regionBuilder) |
static void | printNamedStructuredOpResults (OpAsmPrinter &p, TypeRange resultTypes) |
static void | printNamedStructuredOp (OpAsmPrinter &p, Operation *op, ValueRange inputs, ValueRange outputs) |
static void | buildGenericRegion (OpBuilder &builder, Location loc, Region ®ion, ValueRange inputs, ValueRange outputs, function_ref< void(OpBuilder &, Location, ValueRange)> bodyBuild) |
static void | getGenericEffectsImpl (SmallVectorImpl< SideEffects::EffectInstance< MemoryEffects::Effect >> &effects, ValueRange results, const OpOperandVector &inputOperands, const OpOperandVector &outputOperands) |
static ParseResult | parseDstStyleOp (OpAsmParser &parser, OperationState &result, function_ref< ParseResult(OpAsmParser &, NamedAttrList &)> parseAttrsFn=nullptr) |
static void | addBodyWithPayloadOp (OpAsmParser &parser, OperationState &result, const OperationName &payloadOpName, const NamedAttrList &payloadOpAttrs, ArrayRef< Value > operands, bool initFirst=false) |
static Operation * | findPayloadOp (Block *body, bool initFirst=false) |
void | printShortForm (OpAsmPrinter &p, Operation *payloadOp) |
static ParseResult | parseDenseI64ArrayAttr (OpAsmParser &parser, NamedAttrList &attributes, StringRef attributeName) |
static void | printDenseI64ArrayAttr (OpAsmPrinter &p, StringRef attributeName, ArrayRef< int64_t > attributeValue) |
static void | buildIdentityRegion (OpBuilder &builder, Location loc, Region ®ion, ValueRange inputs, ValueRange outputs) |
static LogicalResult | verifyYield (linalg::YieldOp op, LinalgOp linalgOp) |
static LogicalResult | appendMangledType (llvm::raw_string_ostream &ss, Type t) |
#define GET_OP_CLASSES |
Definition at line 1811 of file LinalgOps.cpp.
#define GET_OP_CLASSES |
Definition at line 1811 of file LinalgOps.cpp.
using RegionBuilderFn = llvm::function_ref<void(ImplicitLocOpBuilder &, Block &, ArrayRef<NamedAttribute>)> |
Definition at line 53 of file LinalgOps.cpp.
|
static |
Definition at line 1054 of file LinalgOps.cpp.
References mlir::Block::addArgument(), mlir::OperationState::addRegion(), mlir::OpBuilder::create(), mlir::Region::emplaceBlock(), mlir::Block::getArguments(), mlir::AsmParser::getContext(), mlir::Operation::getResults(), mlir::Builder::getStringAttr(), mlir::OperationName::getStringRef(), mlir::Value::getType(), mlir::Builder::getUnknownLoc(), mlir::OperationState::location, and mlir::OpBuilder::setInsertionPointToStart().
|
static |
Definition at line 1842 of file LinalgOps.cpp.
References mlir::failed(), mlir::failure(), mlir::Type::isSignlessIntOrIndexOrFloat(), and mlir::success().
|
static |
Definition at line 652 of file LinalgOps.cpp.
References mlir::OpBuilder::createBlock(), mlir::Region::end(), mlir::Block::getArguments(), and mlir::getElementTypeOrSelf().
Referenced by buildIdentityRegion().
|
static |
Definition at line 1491 of file LinalgOps.cpp.
References buildGenericRegion(), and mlir::OpBuilder::create().
|
static |
Creates a structured operation given inputs
, outputs
, and attributes
.
The result types are derived automatically if resultTensorTypes
is none. The body of the operation is filled using regionBuilder
. All ods-gen created structured operations use the method to implement their builders.
Definition at line 100 of file LinalgOps.cpp.
References mlir::OperationState::addAttribute(), mlir::OperationState::addAttributes(), mlir::OperationState::addOperands(), mlir::OperationState::addRegion(), mlir::OperationState::addTypes(), mlir::OperationState::attributes, fillStructuredOpRegion(), mlir::NamedAttrList::getAttrs(), mlir::Builder::getDenseI32ArrayAttr(), and mlir::ValueRange::getTypes().
|
static |
Fills the region of a structured operation using the provided regionBuilder
.
The method is used by both named structured ops created by ods-gen and by manually defined C++ ops. It is called by both builders and parsers and creates a block with arguments corresponding to the elemental types of inputTypes
and outputTypes
. All output types are asserted to be ShapedType.
Definition at line 62 of file LinalgOps.cpp.
References mlir::OpBuilder::createBlock(), mlir::getElementTypeOrSelf(), mlir::Builder::getUnknownLoc(), and mlir::OpBuilder::setInsertionPointToStart().
Referenced by buildStructuredOp(), and parseNamedStructuredOpRegion().
Definition at line 1127 of file LinalgOps.cpp.
References mlir::Block::getArgument(), mlir::Block::getArguments(), mlir::Block::getNumArguments(), mlir::Operation::getNumOperands(), mlir::Operation::getOperands(), and mlir::Block::getOperations().
|
static |
Definition at line 876 of file LinalgOps.cpp.
References mlir::SideEffects::Effect::Base< DerivedEffect, BaseEffect >::get(), mlir::SideEffects::Resource::Base< DefaultResource >::get(), and mlir::Value::getType().
|
static |
Common parsing used for both named structured ops created by ods-gen and by manually defined C++ ops.
Does not handle regions.
Definition at line 130 of file LinalgOps.cpp.
References mlir::OperationState::addAttribute(), mlir::NamedAttrList::append(), mlir::OperationState::attributes, mlir::failed(), mlir::failure(), mlir::AsmParser::getBuilder(), mlir::AsmParser::getContext(), mlir::AsmParser::getCurrentLocation(), mlir::Builder::getDenseI32ArrayAttr(), mlir::NamedAttrList::getDictionary(), mlir::OperationName::getRegisteredInfo(), mlir::OperationState::name, mlir::OperationState::operands, mlir::AsmParser::parseAttribute(), mlir::AsmParser::parseColonTypeList(), mlir::AsmParser::parseGreater(), mlir::AsmParser::parseLParen(), mlir::OpAsmParser::parseOperandList(), mlir::AsmParser::parseOptionalAttrDict(), mlir::AsmParser::parseOptionalKeyword(), mlir::AsmParser::parseOptionalLess(), mlir::AsmParser::parseRParen(), mlir::OperationState::propertiesAttr, mlir::OpAsmParser::resolveOperands(), mlir::succeeded(), and mlir::success().
Referenced by parseDstStyleOp(), and parseNamedStructuredOp().
|
static |
Definition at line 1322 of file LinalgOps.cpp.
References mlir::failure(), mlir::detail::DenseArrayAttrImpl< T >::parse(), mlir::AsmParser::parseEqual(), mlir::AsmParser::parseKeyword(), mlir::NamedAttrList::set(), and mlir::success().
|
static |
Definition at line 1000 of file LinalgOps.cpp.
References mlir::OperationState::addTypes(), mlir::OperationState::attributes, mlir::failed(), mlir::failure(), parseCommonStructuredOpParts(), mlir::AsmParser::parseOptionalAttrDict(), and mlir::success().
|
static |
Definition at line 242 of file LinalgOps.cpp.
References mlir::OperationState::addRegion(), mlir::OperationState::addTypes(), mlir::OperationState::attributes, mlir::failure(), mlir::NamedAttrList::getAttrs(), parseCommonStructuredOpParts(), parseNamedStructuredOpRegion(), parseNamedStructuredOpResults(), and mlir::success().
|
static |
Definition at line 216 of file LinalgOps.cpp.
References mlir::AsmParser::emitError(), fillStructuredOpRegion(), mlir::AsmParser::getContext(), mlir::AsmParser::getCurrentLocation(), and mlir::success().
Referenced by parseNamedStructuredOp().
|
static |
Definition at line 235 of file LinalgOps.cpp.
References mlir::failure(), mlir::AsmParser::parseOptionalArrowTypeList(), and mlir::success().
Referenced by parseNamedStructuredOp().
|
static |
Definition at line 204 of file LinalgOps.cpp.
References mlir::ValueRange::getTypes().
|
static |
Definition at line 1370 of file LinalgOps.cpp.
|
static |
Definition at line 275 of file LinalgOps.cpp.
|
static |
Definition at line 268 of file LinalgOps.cpp.
References mlir::AsmPrinter::printOptionalArrowTypeList().
void printShortForm | ( | OpAsmPrinter & | p, |
Operation * | payloadOp | ||
) |
Definition at line 1156 of file LinalgOps.cpp.
References mlir::Operation::getAttrs(), mlir::Operation::getName(), mlir::OperationName::getStringRef(), and mlir::OpAsmPrinter::printOptionalAttrDict().
|
static |
Definition at line 1757 of file LinalgOps.cpp.