1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Interface Declarations *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* *|
7\*===----------------------------------------------------------------------===*/
8
9#include "mlir/IR/OpDefinition.h"
10
11namespace mlir::arm_sme {
12
13/// An interface for operations that use Arm SME tiles. These operations need to
14/// be assigned a tile ID, an i32 attribute, which specifies which virtual tile
15/// within the ZA storage to use. The number of tiles available depends on the
16/// type of the tile. This is summarized below:
17///
18/// | Tile Vector Types | Possible Tile IDs |
19/// |-------------------------------------------------------------------------|---------------------|
20/// | `vector<[16]x[16]xi8>` | 0 |
21/// | `vector<[8]x[8]xi16>`, `vector<[8]x[8]xf16>`, or `vector<[8]x[8]xbf16>` | 0 and 1 |
22/// | `vector<[4]x[4]xi32>` or `vector<[4]x[4]xf32>` | 0 to 3 (inclusive) |
23/// | `vector<[2]x[2]xi64>` or `vector<[2]x[2]xf64>` | 0 to 7 (inclusive) |
24/// | `vector<[1]x[1]xi128>` | 0 to 15 (inclusive) |
25class ArmSMETileOpInterface;
26
27} // namespace mlir::arm_sme
28namespace mlir::arm_sme {
29
30/// An interface for operations that use Arm SME tiles. These operations need to
31/// be assigned a tile ID, an i32 attribute, which specifies which virtual tile
32/// within the ZA storage to use. The number of tiles available depends on the
33/// type of the tile. This is summarized below:
34///
35/// | Tile Vector Types | Possible Tile IDs |
36/// |-------------------------------------------------------------------------|---------------------|
37/// | `vector<[16]x[16]xi8>` | 0 |
38/// | `vector<[8]x[8]xi16>`, `vector<[8]x[8]xf16>`, or `vector<[8]x[8]xbf16>` | 0 and 1 |
39/// | `vector<[4]x[4]xi32>` or `vector<[4]x[4]xf32>` | 0 to 3 (inclusive) |
40/// | `vector<[2]x[2]xi64>` or `vector<[2]x[2]xf64>` | 0 to 7 (inclusive) |
41/// | `vector<[1]x[1]xi128>` | 0 to 15 (inclusive) |
42namespace detail {
43struct ArmSMETileOpInterfaceInterfaceTraits {
44 struct Concept {
45 /// The methods defined by the interface.
46 void (*setTileId)(const Concept *impl, ::mlir::Operation *, mlir::IntegerAttr);
47 mlir::IntegerAttr (*getTileId)(const Concept *impl, ::mlir::Operation *);
48 VectorType (*getTileType)(const Concept *impl, ::mlir::Operation *);
49 };
50 template<typename ConcreteOp>
51 class Model : public Concept {
52 public:
53 using Interface = ::mlir::arm_sme::ArmSMETileOpInterface;
54 using GeneratedModel = Model;
55 constexpr Model() : Concept{.setTileId: setTileId, .getTileId: getTileId, .getTileType: getTileType} {}
56
57 static inline void setTileId(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, mlir::IntegerAttr tileId);
58 static inline mlir::IntegerAttr getTileId(const Concept *impl, ::mlir::Operation *tablegen_opaque_val);
59 static inline VectorType getTileType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val);
60 };
61 template<typename ConcreteOp>
62 class FallbackModel : public Concept {
63 public:
64 using Interface = ::mlir::arm_sme::ArmSMETileOpInterface;
65 FallbackModel() : Concept{.setTileId: setTileId, .getTileId: getTileId, .getTileType: getTileType} {}
66
67 static inline void setTileId(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, mlir::IntegerAttr tileId);
68 static inline mlir::IntegerAttr getTileId(const Concept *impl, ::mlir::Operation *tablegen_opaque_val);
69 static inline VectorType getTileType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val);
70 };
71 template<typename ConcreteModel, typename ConcreteOp>
72 class ExternalModel : public FallbackModel<ConcreteModel> {
73 public:
74 using ConcreteEntity = ConcreteOp;
75 void setTileId(::mlir::Operation *tablegen_opaque_val, mlir::IntegerAttr tileId) const;
76 mlir::IntegerAttr getTileId(::mlir::Operation *tablegen_opaque_val) const;
77 };
78};
79template <typename ConcreteOp>
80struct ArmSMETileOpInterfaceTrait;
81
82} // namespace detail
83class ArmSMETileOpInterface : public ::mlir::OpInterface<ArmSMETileOpInterface, detail::ArmSMETileOpInterfaceInterfaceTraits> {
84public:
85 using ::mlir::OpInterface<ArmSMETileOpInterface, detail::ArmSMETileOpInterfaceInterfaceTraits>::OpInterface;
86 template <typename ConcreteOp>
87 struct Trait : public detail::ArmSMETileOpInterfaceTrait<ConcreteOp> {};
88
89 /// Sets the tile ID for this operation.
90 void setTileId(mlir::IntegerAttr tileId);
91
92 /// Returns the tile ID assigned to this operation. This will be null before
93 /// tile allocation.
94 mlir::IntegerAttr getTileId();
95
96 /// Returns the VectorType of the tile used by this operation.
97 VectorType getTileType();
98
99 bool isInMemoryTile() {
100 auto tileId = getTileId();
101 return tileId && tileId.getInt() >= kInMemoryTileIdBase;
102 }
103};
104
105} // namespace mlir::arm_sme
106namespace mlir::arm_sme::detail {
107
108 template <typename ConcreteOp>
109 struct ArmSMETileOpInterfaceTrait : public ::mlir::OpInterface<ArmSMETileOpInterface, detail::ArmSMETileOpInterfaceInterfaceTraits>::Trait<ConcreteOp> {
110
111 /// Sets the tile ID for this operation.
112 void setTileId(mlir::IntegerAttr tileId) {
113 if (!tileId)
114 return;
115 ::mlir::Operation* op = this->getOperation();
116 op->setDiscardableAttr(name: "tile_id", value: tileId);
117 }
118
119 /// Returns the tile ID assigned to this operation. This will be null before
120 /// tile allocation.
121 mlir::IntegerAttr getTileId() {
122 ::mlir::Operation* op = this->getOperation();
123 return op->getDiscardableAttrOfType<mlir::IntegerAttr>(name: "tile_id");
124 }
125 static ::llvm::LogicalResult verifyTrait(::mlir::Operation *op) {
126 return detail::verifyArmSMETileOpInterface(op);
127 }
128
129 bool isInMemoryTile() {
130 auto tileId = getTileId();
131 return tileId && tileId.getInt() >= kInMemoryTileIdBase;
132 }
133
134 };
135
136} // namespace mlir::arm_sme::detail
137namespace mlir::arm_sme {
138
139template<typename ConcreteOp>
140void detail::ArmSMETileOpInterfaceInterfaceTraits::Model<ConcreteOp>::setTileId(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, mlir::IntegerAttr tileId) {
141 return (llvm::cast<ConcreteOp>(tablegen_opaque_val)).setTileId(tileId);
142}
143template<typename ConcreteOp>
144mlir::IntegerAttr detail::ArmSMETileOpInterfaceInterfaceTraits::Model<ConcreteOp>::getTileId(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) {
145 return (llvm::cast<ConcreteOp>(tablegen_opaque_val)).getTileId();
146}
147template<typename ConcreteOp>
148VectorType detail::ArmSMETileOpInterfaceInterfaceTraits::Model<ConcreteOp>::getTileType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) {
149 return (llvm::cast<ConcreteOp>(tablegen_opaque_val)).getTileType();
150}
151template<typename ConcreteOp>
152void detail::ArmSMETileOpInterfaceInterfaceTraits::FallbackModel<ConcreteOp>::setTileId(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, mlir::IntegerAttr tileId) {
153 return static_cast<const ConcreteOp *>(impl)->setTileId(tablegen_opaque_val, tileId);
154}
155template<typename ConcreteOp>
156mlir::IntegerAttr detail::ArmSMETileOpInterfaceInterfaceTraits::FallbackModel<ConcreteOp>::getTileId(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) {
157 return static_cast<const ConcreteOp *>(impl)->getTileId(tablegen_opaque_val);
158}
159template<typename ConcreteOp>
160VectorType detail::ArmSMETileOpInterfaceInterfaceTraits::FallbackModel<ConcreteOp>::getTileType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) {
161 return static_cast<const ConcreteOp *>(impl)->getTileType(tablegen_opaque_val);
162}
163template<typename ConcreteModel, typename ConcreteOp>
164void detail::ArmSMETileOpInterfaceInterfaceTraits::ExternalModel<ConcreteModel, ConcreteOp>::setTileId(::mlir::Operation *tablegen_opaque_val, mlir::IntegerAttr tileId) const {
165if (!tileId)
166 return;
167 ::mlir::Operation* op = this->getOperation();
168 op->setDiscardableAttr(name: "tile_id", value: tileId);
169}
170template<typename ConcreteModel, typename ConcreteOp>
171mlir::IntegerAttr detail::ArmSMETileOpInterfaceInterfaceTraits::ExternalModel<ConcreteModel, ConcreteOp>::getTileId(::mlir::Operation *tablegen_opaque_val) const {
172::mlir::Operation* op = this->getOperation();
173 return op->getDiscardableAttrOfType<mlir::IntegerAttr>(name: "tile_id");
174}
175
176} // namespace mlir::arm_sme
177