|
1 | 1 | #ifndef TRITON_IR_INTERFACES_H_ |
2 | 2 | #define TRITON_IR_INTERFACES_H_ |
3 | 3 |
|
| 4 | +#include "mlir/IR/DialectImplementation.h" |
4 | 5 | #include "mlir/IR/OpDefinition.h" |
| 6 | +#include "mlir/Transforms/InliningUtils.h" |
5 | 7 |
|
6 | 8 | #define GET_TYPEDEF_CLASSES |
7 | 9 | #include "triton/Dialect/Triton/IR/AttrInterfaces.h.inc" |
8 | 10 |
|
| 11 | +namespace mlir::triton { |
| 12 | + |
| 13 | +//===----------------------------------------------------------------------===// |
| 14 | +// TritonDialect Dialect Interfaces |
| 15 | +//===----------------------------------------------------------------------===// |
| 16 | + |
| 17 | +struct TritonInlinerInterface : public DialectInlinerInterface { |
| 18 | + using DialectInlinerInterface::DialectInlinerInterface; |
| 19 | + |
| 20 | + bool isLegalToInline(Operation *call, Operation *callable, |
| 21 | + bool wouldBeCloned) const final; |
| 22 | + bool isLegalToInline(Region *dest, Region *src, bool wouldBeCloned, |
| 23 | + IRMapping &valueMapping) const final { |
| 24 | + return true; |
| 25 | + } |
| 26 | + bool isLegalToInline(Operation *, Region *, bool wouldBeCloned, |
| 27 | + IRMapping &) const final { |
| 28 | + return true; |
| 29 | + } |
| 30 | + |
| 31 | + //===--------------------------------------------------------------------===// |
| 32 | + // Transformation Hooks |
| 33 | + //===--------------------------------------------------------------------===// |
| 34 | + |
| 35 | + /// Handle the given inlined terminator by replacing it with a new operation |
| 36 | + /// as necessary. |
| 37 | + void handleTerminator(Operation *op, Block *newDest) const final; |
| 38 | + /// Handle the given inlined terminator by replacing it with a new operation |
| 39 | + /// as necessary. |
| 40 | + void handleTerminator(Operation *op, ValueRange valuesToRepl) const final; |
| 41 | +}; |
| 42 | + |
| 43 | +} // namespace mlir::triton |
| 44 | + |
9 | 45 | #endif // TRITON_IR_TYPES_H_ |
0 commit comments