1//===- SubsetOpInterface.h - Tensor Subsets ---------------------*- C++ -*-===//
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#ifndef MLIR_INTERFACES_SUBSETOPINTERFACE_H_
10#define MLIR_INTERFACES_SUBSETOPINTERFACE_H_
11
12#include "mlir/IR/OpDefinition.h"
13#include "mlir/Interfaces/ValueBoundsOpInterface.h"
14
15namespace mlir {
16class SubsetOpInterface;
17class SubsetExtractionOpInterface;
18class SubsetInsertionOpInterface;
19
20namespace detail {
21
22/// Return the destination/"init" operand of the op if it implements the
23/// `DestinationStyleOpInterface` and has exactly one "init" operand. Asserts
24/// otherwise.
25OpOperand &defaultGetDestinationOperand(Operation *op);
26
27/// Return the updated destination result of the op if it implements the
28/// `DestinationStyleOpInterface`.
29OpResult defaultGetUpdatedDestination(Operation *op);
30
31/// Default implementation of `SubsetInsertionOpInterface::isEquivalentSubset`.
32bool defaultIsEquivalentSubset(Operation *op, Value candidate,
33 function_ref<bool(Value, Value)> equivalenceFn);
34
35/// Default implementation of `SubsetOpInterface::operatesOnEquivalentSubset`.
36bool defaultOperatesOnEquivalentSubset(
37 Operation *op, SubsetOpInterface candidate,
38 function_ref<bool(Value, Value)> equivalenceFn);
39
40/// Default implementation of `SubsetOpInterface::operatesOnDisjointSubset`.
41bool defaultOperatesOnDisjointSubset(
42 Operation *op, SubsetOpInterface candidate,
43 function_ref<bool(Value, Value)> equivalenceFn);
44
45/// Return the container that the given subset op is operating on.
46Value getTensorContainer(Operation *op);
47
48/// Verify `SubsetOpInterface`.
49LogicalResult verifySubsetOpInterface(SubsetOpInterface op);
50
51/// Verify `SubsetExtractionOpInterface`.
52LogicalResult verifySubsetExtractionOpInterface(SubsetExtractionOpInterface op);
53
54} // namespace detail
55} // namespace mlir
56
57#include "mlir/Interfaces/SubsetOpInterface.h.inc"
58
59#endif // MLIR_INTERFACES_SUBSETOPINTERFACE_H_
60

source code of mlir/include/mlir/Interfaces/SubsetOpInterface.h