My Project
Traits.h
Go to the documentation of this file.
1 //===- Traits.h - Common op traits shared by dialects -----------*- C++ -*-===//
2 //
3 // Part of the MLIR 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 declares common op traits that are not core to MLIR but can be
10 // shared by multiple dialects.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef MLIR_DIALECT_TRAITS
15 #define MLIR_DIALECT_TRAITS
16 
17 #include "mlir/IR/OpDefinition.h"
18 
19 namespace mlir {
20 namespace OpTrait {
21 
22 // These functions are out-of-line implementations of the methods in the
23 // corresponding trait classes. This avoids them being template
24 // instantiated/duplicated.
25 namespace impl {
27 } // namespace impl
28 
29 namespace util {
48  SmallVectorImpl<int64_t> &resultShape);
49 
54 Type getBroadcastedType(Type type1, Type type2);
55 } // namespace util
56 
68 template <typename ConcreteType>
70  : public TraitBase<ConcreteType, BroadcastableTwoOperandsOneResult> {
71 public:
74  }
75 };
76 
77 } // end namespace OpTrait
78 } // end namespace mlir
79 
80 #endif // MLIR_DIALECT_TRAITS
Definition: InferTypeOpInterface.cpp:20
Definition: Operation.h:27
Definition: LLVM.h:34
Definition: LogicalResult.h:18
Definition: LLVM.h:37
Type getBroadcastedType(Type type1, Type type2)
Definition: Traits.cpp:83
LogicalResult verifyCompatibleOperandBroadcast(Operation *op)
Definition: Traits.cpp:160
Definition: Types.h:84
static LogicalResult verifyTrait(Operation *op)
Definition: Traits.h:72
Definition: OpDefinition.h:386
bool getBroadcastedShape(ArrayRef< int64_t > shape1, ArrayRef< int64_t > shape2, SmallVectorImpl< int64_t > &resultShape)
Definition: Traits.cpp:15