9#ifndef MLIR_DIALECT_LINALG_IR_LINALG_H
10#define MLIR_DIALECT_LINALG_IR_LINALG_H
31#include "llvm/ADT/STLFunctionalExtras.h"
68 MLIRContext *context);
73 MLIRContext *context);
76SmallVector<AffineExpr, 4>
concat(ArrayRef<AffineExpr> a,
77 ArrayRef<AffineExpr>
b);
99#include "mlir/Dialect/Linalg/IR/LinalgOpsEnums.h.inc"
119#define GET_ATTRDEF_CLASSES
120#include "mlir/Dialect/Linalg/IR/LinalgOpsAttrDefs.h.inc"
132#define GET_OP_CLASSES
133#include "mlir/Dialect/Linalg/IR/LinalgOps.h.inc"
135#define GET_OP_CLASSES
136#include "mlir/Dialect/Linalg/IR/LinalgStructuredOps.h.inc"
138#define GET_OP_CLASSES
139#include "mlir/Dialect/Linalg/IR/LinalgRelayoutOps.h.inc"
145template <
typename OpTy,
146 typename = std::enable_if_t<std::is_same_v<OpTy, linalg::PackOp> ||
147 std::is_same_v<OpTy, linalg::UnPackOp>>>
170 using MatmulOp::MatmulOp;
183 static void build(OpBuilder &builder, OperationState &
result,
186 ArrayRef<NamedAttribute> attributes = {});
188 static MatmulTransposeAOp
create(OpBuilder &builder, Location location,
191 ArrayRef<NamedAttribute> attributes = {});
194 static void build(OpBuilder &builder, OperationState &
result,
197 ArrayRef<NamedAttribute> attributes = {});
199 static MatmulTransposeAOp
create(OpBuilder &builder, Location location,
203 ArrayRef<NamedAttribute> attributes = {});
208 static bool classof(Operation *op);
217 using MatmulOp::MatmulOp;
230 static void build(OpBuilder &builder, OperationState &
result,
233 ArrayRef<NamedAttribute> attributes = {});
235 static MatmulTransposeBOp
create(OpBuilder &builder, Location location,
238 ArrayRef<NamedAttribute> attributes = {});
241 static void build(OpBuilder &builder, OperationState &
result,
244 ArrayRef<NamedAttribute> attributes = {});
246 static MatmulTransposeBOp
create(OpBuilder &builder, Location location,
250 ArrayRef<NamedAttribute> attributes = {});
255 static bool classof(Operation *op);
265 using BatchMatmulOp::BatchMatmulOp;
273 static BatchMatmulTransposeAOp
278 static void build(OpBuilder &builder, OperationState &
result,
281 ArrayRef<NamedAttribute> attributes = {});
283 static BatchMatmulTransposeAOp
284 create(OpBuilder &builder, Location location,
TypeRange resultTensorTypes,
286 ArrayRef<NamedAttribute> attributes = {});
289 static void build(OpBuilder &builder, OperationState &
result,
292 ArrayRef<NamedAttribute> attributes = {});
294 static BatchMatmulTransposeAOp
295 create(OpBuilder &builder, Location location,
TypeRange resultTensorTypes,
297 ArrayRef<NamedAttribute> attributes = {});
302 static bool classof(Operation *op);
312 using BatchMatmulOp::BatchMatmulOp;
320 static BatchMatmulTransposeBOp
325 static void build(OpBuilder &builder, OperationState &
result,
328 ArrayRef<NamedAttribute> attributes = {});
330 static BatchMatmulTransposeBOp
331 create(OpBuilder &builder, Location location,
TypeRange resultTensorTypes,
333 ArrayRef<NamedAttribute> attributes = {});
336 static void build(OpBuilder &builder, OperationState &
result,
339 ArrayRef<NamedAttribute> attributes = {});
341 static BatchMatmulTransposeBOp
342 create(OpBuilder &builder, Location location,
TypeRange resultTensorTypes,
344 ArrayRef<NamedAttribute> attributes = {});
349 static bool classof(Operation *op);
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
This class helps build Operations.
static TypeID get()
Construct a type info object for the given type T.
This class provides an abstraction over the different types of ranges over Values.
Specialization of linalg.batch_matmul op that has a transpose map on A.
static bool isDefaultIndexingMaps(Attribute attr)
Checks if the affine map is the expected one for this operation.
static bool classof(Operation *op)
static void build(OpBuilder &builder, OperationState &result, ValueRange inputs, ValueRange outputs, ArrayRef< NamedAttribute > attributes={})
Build a transpose A matmul.
static BatchMatmulTransposeAOp create(OpBuilder &builder, Location location, ValueRange inputs, ValueRange outputs, ArrayRef< NamedAttribute > attributes={})
::mlir::TypeID resolveTypeID()
Specialization of linalg.batch_matmul op that has a transpose map on B.
static void build(OpBuilder &builder, OperationState &result, ValueRange inputs, ValueRange outputs, ArrayRef< NamedAttribute > attributes={})
Build a transpose B matmul.
::mlir::TypeID resolveTypeID()
static bool classof(Operation *op)
static BatchMatmulTransposeBOp create(OpBuilder &builder, Location location, ValueRange inputs, ValueRange outputs, ArrayRef< NamedAttribute > attributes={})
static bool isDefaultIndexingMaps(Attribute attr)
Checks if the affine map is the expected one for this operation.
Specialization of linalg.matmul op that has a transpose map on A.
static bool isDefaultIndexingMaps(Attribute attr)
Checks if the affine map is the expected one for this operation.
static MatmulTransposeAOp create(OpBuilder &builder, Location location, ValueRange inputs, ValueRange outputs, ArrayRef< NamedAttribute > attributes={})
::mlir::TypeID resolveTypeID()
static void build(OpBuilder &builder, OperationState &result, ValueRange inputs, ValueRange outputs, ArrayRef< NamedAttribute > attributes={})
Build a transpose A matmul.
static bool classof(Operation *op)
Specialization of linalg.matmul op that has a transpose map on B.
::mlir::TypeID resolveTypeID()
static void build(OpBuilder &builder, OperationState &result, ValueRange inputs, ValueRange outputs, ArrayRef< NamedAttribute > attributes={})
Build a transpose B matmul.
static MatmulTransposeBOp create(OpBuilder &builder, Location location, ValueRange inputs, ValueRange outputs, ArrayRef< NamedAttribute > attributes={})
static bool isDefaultIndexingMaps(Attribute attr)
Checks if the affine map is the expected one for this operation.
static bool classof(Operation *op)
SmallVector< AffineExpr, 4 > concat(ArrayRef< AffineExpr > a, ArrayRef< AffineExpr > b)
Return the vector that is the concatenation of a and b.
OpFoldResult createFoldedDimOp(OpBuilder &b, Location loc, Value val, int64_t dim)
Create one memref::DimOp or tensor::DimOp depending on the type of val.
std::string generateLibraryCallName(Operation *op)
Returns the name mangled library call name to disambiguate between different overloads at the C level...
AffineMap extractOrIdentityMap(std::optional< AffineMap > maybeMap, unsigned rank, MLIRContext *context)
Returns maybeMap.get() if maybeMap is set, otherwise returns the symbol-less identity map of rank.
SmallVector< AffineExpr, 4 > makeAffineDimExprs(unsigned num, unsigned &startIdx, MLIRContext *context)
Returns num AffineDimExpr dimensions at positions [startIdx, startIdx + num) and increments startIdx ...
Value createOrFoldDimOp(OpBuilder &b, Location loc, Value val, int64_t dim)
Create one memref::DimOp or tensor::DimOp depending on the type of val.
std::pair< int64_t, int64_t > getFmrFromWinogradConv2DFmr(WinogradConv2DFmr fmr)
Converts the given WinogradConv2DFmr enumeration value to a pair of m and r parameters.
ArityGroupAndKind getArityGroupAndKind(ElementwiseKind kind)
std::optional< WinogradConv2DFmr > getWinogradConv2DFmr(int64_t m, int64_t r)
Converts the given m and r parameters to a WinogradConv2DFmr enumeration value.
SmallVector< int64_t > getPackedOuterShapeWithoutTransposition(OpTy packOrUnPack)
Returns the outer shape in the packed domain before applying the transposition.
Include the generated interface declarations.
This represents an operation in an abstracted form, suitable for use with the builder APIs.
Elementwise Arity and Kind groups.
ElementwiseArityGroup arityGroup