1//===- MaskableOpInterfaces.td - Masking Interfaces Decls -*- tablegen -*-===// 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 is the definition file for the MaskableOpInterface. 10// 11//===----------------------------------------------------------------------===// 12 13#ifndef MLIR_DIALECT_VECTOR_INTERFACES_MASKABLEOPINTERFACE_TD 14#define MLIR_DIALECT_VECTOR_INTERFACES_MASKABLEOPINTERFACE_TD 15 16include "mlir/IR/OpBase.td" 17 18def MaskableOpInterface : OpInterface<"MaskableOpInterface"> { 19 let description = [{ 20 The 'MaskableOpInterface' defines an operation that can be masked using a 21 MaskingOpInterface (e.g., `vector.mask`) and provides information about its 22 masking constraints and semantics. 23 }]; 24 let cppNamespace = "::mlir::vector"; 25 let methods = [ 26 InterfaceMethod< 27 /*desc=*/"Returns true if the operation is masked by a " 28 "MaskingOpInterface.", 29 /*retTy=*/"bool", 30 /*methodName=*/"isMasked", 31 /*args=*/(ins), 32 /*methodBody=*/"", 33 /*defaultImplementation=*/[{ 34 mlir::Operation *parentOp = $_op->getParentOp(); 35 return parentOp && 36 mlir::isa<mlir::vector::MaskingOpInterface>(parentOp); 37 }]>, 38 InterfaceMethod< 39 /*desc=*/"Returns the MaskingOpInterface masking this operation.", 40 /*retTy=*/"mlir::vector::MaskingOpInterface", 41 /*methodName=*/"getMaskingOp", 42 /*args=*/(ins), 43 /*methodBody=*/"", 44 /*defaultImplementation=*/[{ 45 return mlir::cast<mlir::vector::MaskingOpInterface>( 46 $_op->getParentOp()); 47 }]>, 48 InterfaceMethod< 49 /*desc=*/"Returns true if the operation can have a passthru argument when" 50 " masked.", 51 /*retTy=*/"bool", 52 /*methodName=*/"supportsPassthru", 53 /*args=*/(ins), 54 /*methodBody=*/"", 55 /*defaultImplementation=*/[{ 56 return false; 57 }]>, 58 InterfaceMethod< 59 /*desc=*/"Returns the mask type expected by this operation. Mostly used" 60 " for verification purposes. It requires the operation to be " 61 "vectorized.", 62 /*retTy=*/"mlir::Type", 63 /*methodName=*/"getExpectedMaskType", 64 /*args=*/(ins), 65 /*methodBody=*/"", 66 /*defaultImplementation=*/"">, 67 ]; 68} 69 70#endif // MLIR_DIALECT_VECTOR_INTERFACES_MASKABLEOPINTERFACE_TD 71