| 1 | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
| 2 | |* *| |
| 3 | |* Interface Definitions *| |
| 4 | |* *| |
| 5 | |* Automatically generated file, do not edit! *| |
| 6 | |* *| |
| 7 | \*===----------------------------------------------------------------------===*/ |
| 8 | |
| 9 | |
| 10 | /// Return the `in_bounds` attribute name. |
| 11 | ::mlir::StringRef mlir::VectorTransferOpInterface::getInBoundsAttrName() { |
| 12 | return getImpl()->getInBoundsAttrName(getImpl(), getOperation()); |
| 13 | } |
| 14 | |
| 15 | /// Return the `permutation_map` attribute name. |
| 16 | ::mlir::StringRef mlir::VectorTransferOpInterface::getPermutationMapAttrName() { |
| 17 | return getImpl()->getPermutationMapAttrName(getImpl(), getOperation()); |
| 18 | } |
| 19 | |
| 20 | /// Return the optional in_bounds attribute that specifies for each vector |
| 21 | /// dimension whether it is in-bounds or not. (Broadcast dimensions are |
| 22 | /// always in-bounds). |
| 23 | ::mlir::ArrayAttr mlir::VectorTransferOpInterface::getInBounds() { |
| 24 | return getImpl()->getInBounds(getImpl(), getOperation()); |
| 25 | } |
| 26 | |
| 27 | /// Return the memref or ranked tensor operand that this operation operates |
| 28 | /// on. In case of a "read" operation, that's the source from which the |
| 29 | /// operation reads. In case of a "write" operation, that's the destination |
| 30 | /// into which the operation writes. |
| 31 | /// TODO: Change name of operand, which is not accurate for xfer_write. |
| 32 | ::mlir::Value mlir::VectorTransferOpInterface::getBase() { |
| 33 | return getImpl()->getBase(getImpl(), getOperation()); |
| 34 | } |
| 35 | |
| 36 | /// Return the vector that this operation operates on. In case of a "read", |
| 37 | /// that's the vector OpResult. In case of a "write", that's the vector |
| 38 | /// operand value that is written by the op. |
| 39 | ::mlir::Value mlir::VectorTransferOpInterface::getVector() { |
| 40 | return getImpl()->getVector(getImpl(), getOperation()); |
| 41 | } |
| 42 | |
| 43 | /// Return the type of the vector that this operation operates on. |
| 44 | ::mlir::VectorType mlir::VectorTransferOpInterface::getVectorType() { |
| 45 | return getImpl()->getVectorType(getImpl(), getOperation()); |
| 46 | } |
| 47 | |
| 48 | /// Return the indices that specify the starting offsets into the source |
| 49 | /// operand. The starting offsets are guaranteed to be in-bounds except |
| 50 | /// when the transfer operation is masked or the `in_bounds` array doesn't |
| 51 | /// specify that that dimension is not necessarily in bounds. It is undefinied |
| 52 | /// behavior if these guarantees are violated. |
| 53 | ::mlir::OperandRange mlir::VectorTransferOpInterface::getIndices() { |
| 54 | return getImpl()->getIndices(getImpl(), getOperation()); |
| 55 | } |
| 56 | |
| 57 | /// Return the permutation map that describes the mapping of vector |
| 58 | /// dimensions to source dimensions, as well as broadcast dimensions. |
| 59 | /// |
| 60 | /// The permutation result has one result per vector transfer dimension. |
| 61 | /// Each result is either a dim expression, indicating the corresponding |
| 62 | /// dimension in the source operand, or a constant "0" expression, |
| 63 | /// indicating a broadcast dimension. |
| 64 | /// |
| 65 | /// Note: Nested vector dimensions that are flattened by this op are not |
| 66 | /// accounted for in the permutation map. E.g.: |
| 67 | /// ``` |
| 68 | /// // Vector type has rank 4, but permutation map has only 2 results. That |
| 69 | /// // is because there are only 2 transfer dimensions. |
| 70 | /// %0 = vector.transfer_read %arg1[%c3, %c3], %vf0 |
| 71 | /// {permutation_map = affine_map<(d0, d1) -> (d0, d1)>} |
| 72 | /// : memref<?x?xvector<4x3xf32>>, vector<1x1x4x3xf32> |
| 73 | /// ``` |
| 74 | ::mlir::AffineMap mlir::VectorTransferOpInterface::getPermutationMap() { |
| 75 | return getImpl()->getPermutationMap(getImpl(), getOperation()); |
| 76 | } |
| 77 | |
| 78 | /// Return the mask operand if the op has a mask. Otherwise, return an |
| 79 | /// empty value. |
| 80 | Value mlir::VectorTransferOpInterface::getMask() { |
| 81 | return getImpl()->getMask(getImpl(), getOperation()); |
| 82 | } |
| 83 | |
| 84 | /// Returns whether replacing the base operand with a shaped value of |
| 85 | /// `newBaseType` and updating the permutation map according to |
| 86 | /// `newPermutationMap`, where the replacement would adhere to the |
| 87 | /// conditions specified by `updateStartingPosition`, passes any additional |
| 88 | /// op-specific constraints. |
| 89 | ::mlir::LogicalResult mlir::VectorTransferOpInterface::mayUpdateStartingPosition(::mlir::ShapedType newBaseType, ::mlir::AffineMap newPermutationMap) { |
| 90 | return getImpl()->mayUpdateStartingPosition(getImpl(), getOperation(), newBaseType, newPermutationMap); |
| 91 | } |
| 92 | |
| 93 | /// Updates the base of this transfer operation to `newBase`, the indices into |
| 94 | /// that base into `newIndices`, and the permutation map to `newPermutationMap`. |
| 95 | /// The new base, indices, and map must: |
| 96 | /// - Keep the same element type as the base (this condition could be relaxed |
| 97 | /// in the future) |
| 98 | /// - Preserve the number of transfer dimensions and avoid inserting new |
| 99 | /// dimensions unaccounted for in the permutation map - that is, if the transfer operation is |
| 100 | /// reading or writing a 4x2 vector to/from an Nx4x2 tensor or memref, it is |
| 101 | /// not valid to update that base to an Nx8 one, but updating in an N0xN1x4x2 |
| 102 | /// base - or even an Nx16x32 one - is acceptable. Similarly, if the transfer |
| 103 | /// rank is 2 and the base is MxN, replacing it with a base that is Mx1xN or |
| 104 | /// MxKxN is only permitted if the permutation map is updated to skip the new |
| 105 | /// dimension. This restriction means that the updater does not need to reshape |
| 106 | /// or otherwise adjust the vector type of the transfer or other related attributes |
| 107 | /// like the inbounds attribute array. |
| 108 | /// - Must not shrink the size of a transfer dimension such that an `inbounds` |
| 109 | /// annotation becomes incorrect. |
| 110 | /// - Must pass any op-specific conditions in `mayUpdateStartingPosition` |
| 111 | /// |
| 112 | /// The update is performed in-place. Implementations of the interface |
| 113 | /// should use `RewriterBase::modifyOpInPlace` to ensure proper pattern |
| 114 | /// rewriter operation. |
| 115 | void mlir::VectorTransferOpInterface::updateStartingPosition(::mlir::RewriterBase& rewriter, ::mlir::Value newBase, ::mlir::ValueRange newIndices, ::mlir::AffineMapAttr newPermutationMap) { |
| 116 | return getImpl()->updateStartingPosition(getImpl(), getOperation(), rewriter, newBase, newIndices, newPermutationMap); |
| 117 | } |
| 118 | |
| 119 | /// Return the shape of the iteration space to unroll. |
| 120 | /// |
| 121 | /// For most vector operations, this is identical to the result shape. |
| 122 | /// For operations such as vector.contract, it also includes reduction |
| 123 | /// dimensions that are absent from the result shape, so unrolling accounts |
| 124 | /// for all iteration dimensions. |
| 125 | /// |
| 126 | /// For operations that support both vector and scalar operands, return |
| 127 | /// the iteration shape when operating on vectors, or std::nullopt when |
| 128 | /// operating on scalars to indicate that there is nothing to unroll. |
| 129 | ::std::optional<::llvm::SmallVector<int64_t, 4>> mlir::VectorUnrollOpInterface::getIterationShapeToUnroll() { |
| 130 | return getImpl()->getIterationShapeToUnroll(getImpl(), getOperation()); |
| 131 | } |
| 132 | |
| 133 | /// Return a default target shape for unrolling, or std::nullopt if no |
| 134 | /// default is available. |
| 135 | /// |
| 136 | /// This hook provides a fallback when the caller does not specify a target |
| 137 | /// shape. It is intended primarily for testing. Default shapes should have |
| 138 | /// nonzero rank and be representative of a target supported in-tree. |
| 139 | /// |
| 140 | /// No default shape is optimal for every target. Callers should provide |
| 141 | /// an explicit target shape when performance matters. |
| 142 | ::std::optional<::llvm::SmallVector<int64_t>> mlir::VectorUnrollOpInterface::getDefaultUnrollTargetShape() { |
| 143 | return getImpl()->getDefaultUnrollTargetShape(getImpl(), getOperation()); |
| 144 | } |
| 145 | |