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