MLIR  16.0.0git
LinalgInterfaces.h
Go to the documentation of this file.
1 //===- LinalgInterface.h - Linalg operations interfaces -------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the operation interfaces for Linalg operations.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef MLIR_DIALECT_LINALG_IR_LINALGINTERFACES_H_
14 #define MLIR_DIALECT_LINALG_IR_LINALGINTERFACES_H_
15 
17 #include "mlir/IR/AffineMap.h"
19 #include "mlir/IR/BuiltinTypes.h"
21 #include "mlir/IR/OpDefinition.h"
24 
25 namespace mlir {
26 namespace linalg {
27 class LinalgOp;
28 
29 /// OpOperand vector that implicitly converts to a Value vector.
30 struct OpOperandVector : public SmallVector<OpOperand *> {
31  operator SmallVector<Value>();
32 };
33 
34 namespace detail {
35 /// Implementation of the method that that check if given operands
36 /// can be dropped, i.e. the remaining operands can compute the loop
37 /// bounds of the op.
38 bool canOpOperandsBeDroppedImpl(linalg::LinalgOp linalgOp,
39  ArrayRef<OpOperand *> droppedOperands);
40 } // namespace detail
41 
42 /// Checks whether `linalgOp` conforms to ContractionOpInterface.
43 // TODO: embed within `isa<ContractionOpInterface>` if possible / natural.
44 bool isaContractionOpInterface(LinalgOp linalgOp);
45 
46 namespace detail {
47 
48 /// Verify that `op` conforms to ContractionOpInterface.
50 
51 /// Verify that `op` conforms to the ConvolutionOpInterface.
53 
54 /// Verify that `op` conforms to the FillOpInterface.
56 
57 /// Verify that `op` conforms to the invariants of StructuredOpInterface
59 
60 } // namespace detail
61 } // namespace linalg
62 } // namespace mlir
63 
64 #include "mlir/Dialect/Linalg/IR/LinalgStructuredOps.h.inc"
65 
66 /// Include the generated interface declarations.
67 #include "mlir/Dialect/Linalg/IR/LinalgInterfaces.h.inc"
68 
69 #endif // MLIR_DIALECT_LINALG_IR_LINALGINTERFACES_H_
Include the generated interface declarations.
Operation is a basic unit of execution within MLIR.
Definition: Operation.h:28
bool isaContractionOpInterface(LinalgOp linalgOp)
Checks whether linalgOp conforms to ContractionOpInterface.
LogicalResult verifyFillInterface(Operation *op)
Verify that op conforms to the FillOpInterface.
This class represents an efficient way to signal success or failure.
Definition: LogicalResult.h:26
LogicalResult verifyStructuredOpInterface(Operation *op)
Verify that op conforms to the invariants of StructuredOpInterface.
OpOperand vector that implicitly converts to a Value vector.
LogicalResult verifyConvolutionInterface(Operation *op)
Verify that op conforms to the ConvolutionOpInterface.
LogicalResult verifyContractionInterface(Operation *op)
Verify that op conforms to ContractionOpInterface.
bool canOpOperandsBeDroppedImpl(linalg::LinalgOp linalgOp, ArrayRef< OpOperand *> droppedOperands)
Implementation of the method that that check if given operands can be dropped, i.e.