1 | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
2 | |* *| |
3 | |* Op Declarations *| |
4 | |* *| |
5 | |* Automatically generated file, do not edit! *| |
6 | |* *| |
7 | \*===----------------------------------------------------------------------===*/ |
8 | |
9 | #if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) |
10 | #undef GET_OP_FWD_DEFINES |
11 | namespace mlir { |
12 | namespace tfg { |
13 | class CaseOp; |
14 | } // namespace tfg |
15 | } // namespace mlir |
16 | namespace mlir { |
17 | namespace tfg { |
18 | class CaseRegionOp; |
19 | } // namespace tfg |
20 | } // namespace mlir |
21 | namespace mlir { |
22 | namespace tfg { |
23 | class ConditionOp; |
24 | } // namespace tfg |
25 | } // namespace mlir |
26 | namespace mlir { |
27 | namespace tfg { |
28 | class ForOp; |
29 | } // namespace tfg |
30 | } // namespace mlir |
31 | namespace mlir { |
32 | namespace tfg { |
33 | class ForRegionOp; |
34 | } // namespace tfg |
35 | } // namespace mlir |
36 | namespace mlir { |
37 | namespace tfg { |
38 | class GetResultOp; |
39 | } // namespace tfg |
40 | } // namespace mlir |
41 | namespace mlir { |
42 | namespace tfg { |
43 | class GraphFuncOp; |
44 | } // namespace tfg |
45 | } // namespace mlir |
46 | namespace mlir { |
47 | namespace tfg { |
48 | class GraphOp; |
49 | } // namespace tfg |
50 | } // namespace mlir |
51 | namespace mlir { |
52 | namespace tfg { |
53 | class IfOp; |
54 | } // namespace tfg |
55 | } // namespace mlir |
56 | namespace mlir { |
57 | namespace tfg { |
58 | class IfRegionOp; |
59 | } // namespace tfg |
60 | } // namespace mlir |
61 | namespace mlir { |
62 | namespace tfg { |
63 | class ReturnOp; |
64 | } // namespace tfg |
65 | } // namespace mlir |
66 | namespace mlir { |
67 | namespace tfg { |
68 | class StatefulCaseOp; |
69 | } // namespace tfg |
70 | } // namespace mlir |
71 | namespace mlir { |
72 | namespace tfg { |
73 | class StatefulCaseRegionOp; |
74 | } // namespace tfg |
75 | } // namespace mlir |
76 | namespace mlir { |
77 | namespace tfg { |
78 | class StatefulIfOp; |
79 | } // namespace tfg |
80 | } // namespace mlir |
81 | namespace mlir { |
82 | namespace tfg { |
83 | class StatefulIfRegionOp; |
84 | } // namespace tfg |
85 | } // namespace mlir |
86 | namespace mlir { |
87 | namespace tfg { |
88 | class StatefulWhileOp; |
89 | } // namespace tfg |
90 | } // namespace mlir |
91 | namespace mlir { |
92 | namespace tfg { |
93 | class StatefulWhileRegionOp; |
94 | } // namespace tfg |
95 | } // namespace mlir |
96 | namespace mlir { |
97 | namespace tfg { |
98 | class StatelessCaseOp; |
99 | } // namespace tfg |
100 | } // namespace mlir |
101 | namespace mlir { |
102 | namespace tfg { |
103 | class StatelessCaseRegionOp; |
104 | } // namespace tfg |
105 | } // namespace mlir |
106 | namespace mlir { |
107 | namespace tfg { |
108 | class StatelessIfOp; |
109 | } // namespace tfg |
110 | } // namespace mlir |
111 | namespace mlir { |
112 | namespace tfg { |
113 | class StatelessIfRegionOp; |
114 | } // namespace tfg |
115 | } // namespace mlir |
116 | namespace mlir { |
117 | namespace tfg { |
118 | class StatelessWhileOp; |
119 | } // namespace tfg |
120 | } // namespace mlir |
121 | namespace mlir { |
122 | namespace tfg { |
123 | class StatelessWhileRegionOp; |
124 | } // namespace tfg |
125 | } // namespace mlir |
126 | namespace mlir { |
127 | namespace tfg { |
128 | class WhileOp; |
129 | } // namespace tfg |
130 | } // namespace mlir |
131 | namespace mlir { |
132 | namespace tfg { |
133 | class WhileRegionOp; |
134 | } // namespace tfg |
135 | } // namespace mlir |
136 | namespace mlir { |
137 | namespace tfg { |
138 | class YieldOp; |
139 | } // namespace tfg |
140 | } // namespace mlir |
141 | #endif |
142 | |
143 | #ifdef GET_OP_CLASSES |
144 | #undef GET_OP_CLASSES |
145 | |
146 | |
147 | //===----------------------------------------------------------------------===// |
148 | // Local Utility Method Definitions |
149 | //===----------------------------------------------------------------------===// |
150 | |
151 | namespace mlir { |
152 | namespace tfg { |
153 | |
154 | //===----------------------------------------------------------------------===// |
155 | // ::mlir::tfg::CaseOp declarations |
156 | //===----------------------------------------------------------------------===// |
157 | |
158 | class CaseOpAdaptor { |
159 | public: |
160 | CaseOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
161 | |
162 | CaseOpAdaptor(CaseOp op); |
163 | |
164 | ::mlir::ValueRange getOperands(); |
165 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
166 | ::mlir::ValueRange getODSOperands(unsigned index); |
167 | ::mlir::Value getBranchIndex(); |
168 | ::mlir::Value branch_index(); |
169 | ::mlir::ValueRange getArgs(); |
170 | ::mlir::ValueRange args(); |
171 | ::mlir::DictionaryAttr getAttributes(); |
172 | ::mlir::ArrayAttr getBranchesAttr(); |
173 | ::mlir::ArrayAttr getBranches(); |
174 | ::mlir::ArrayAttr branchesAttr(); |
175 | ::mlir::ArrayAttr branches(); |
176 | ::mlir::ArrayAttr getTinAttr(); |
177 | ::llvm::Optional< ::mlir::ArrayAttr > getTin(); |
178 | ::mlir::ArrayAttr TinAttr(); |
179 | ::llvm::Optional< ::mlir::ArrayAttr > Tin(); |
180 | ::mlir::ArrayAttr getToutAttr(); |
181 | ::llvm::Optional< ::mlir::ArrayAttr > getTout(); |
182 | ::mlir::ArrayAttr ToutAttr(); |
183 | ::llvm::Optional< ::mlir::ArrayAttr > Tout(); |
184 | ::mlir::ArrayAttr getOutputShapesAttr(); |
185 | ::llvm::Optional< ::mlir::ArrayAttr > getOutputShapes(); |
186 | ::mlir::ArrayAttr output_shapesAttr(); |
187 | ::llvm::Optional< ::mlir::ArrayAttr > output_shapes(); |
188 | ::mlir::LogicalResult verify(::mlir::Location loc); |
189 | private: |
190 | ::mlir::ValueRange odsOperands; |
191 | ::mlir::DictionaryAttr odsAttrs; |
192 | ::mlir::RegionRange odsRegions; |
193 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
194 | }; |
195 | class CaseOp : public ::mlir::Op<CaseOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::SymbolUserOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { |
196 | public: |
197 | using Op::Op; |
198 | using Op::print; |
199 | using Adaptor = CaseOpAdaptor; |
200 | public: |
201 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
202 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin" ), ::llvm::StringRef("Tout" ), ::llvm::StringRef("branches" ), ::llvm::StringRef("output_shapes" )}; |
203 | return ::llvm::makeArrayRef(attrNames); |
204 | } |
205 | |
206 | ::mlir::StringAttr getTinAttrName() { |
207 | return getAttributeNameForIndex(0); |
208 | } |
209 | |
210 | static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { |
211 | return getAttributeNameForIndex(name, 0); |
212 | } |
213 | |
214 | ::mlir::StringAttr TinAttrName() { |
215 | return getAttributeNameForIndex(0); |
216 | } |
217 | |
218 | static ::mlir::StringAttr TinAttrName(::mlir::OperationName name) { |
219 | return getAttributeNameForIndex(name, 0); |
220 | } |
221 | |
222 | ::mlir::StringAttr getToutAttrName() { |
223 | return getAttributeNameForIndex(1); |
224 | } |
225 | |
226 | static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { |
227 | return getAttributeNameForIndex(name, 1); |
228 | } |
229 | |
230 | ::mlir::StringAttr ToutAttrName() { |
231 | return getAttributeNameForIndex(1); |
232 | } |
233 | |
234 | static ::mlir::StringAttr ToutAttrName(::mlir::OperationName name) { |
235 | return getAttributeNameForIndex(name, 1); |
236 | } |
237 | |
238 | ::mlir::StringAttr getBranchesAttrName() { |
239 | return getAttributeNameForIndex(2); |
240 | } |
241 | |
242 | static ::mlir::StringAttr getBranchesAttrName(::mlir::OperationName name) { |
243 | return getAttributeNameForIndex(name, 2); |
244 | } |
245 | |
246 | ::mlir::StringAttr branchesAttrName() { |
247 | return getAttributeNameForIndex(2); |
248 | } |
249 | |
250 | static ::mlir::StringAttr branchesAttrName(::mlir::OperationName name) { |
251 | return getAttributeNameForIndex(name, 2); |
252 | } |
253 | |
254 | ::mlir::StringAttr getOutputShapesAttrName() { |
255 | return getAttributeNameForIndex(3); |
256 | } |
257 | |
258 | static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { |
259 | return getAttributeNameForIndex(name, 3); |
260 | } |
261 | |
262 | ::mlir::StringAttr output_shapesAttrName() { |
263 | return getAttributeNameForIndex(3); |
264 | } |
265 | |
266 | static ::mlir::StringAttr output_shapesAttrName(::mlir::OperationName name) { |
267 | return getAttributeNameForIndex(name, 3); |
268 | } |
269 | |
270 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
271 | static constexpr ::llvm::StringLiteral getOperationName() { |
272 | return ::llvm::StringLiteral("tfg.Case" ); |
273 | } |
274 | |
275 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
276 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
277 | ::mlir::Value getBranchIndex(); |
278 | ::mlir::Value branch_index(); |
279 | ::mlir::Operation::operand_range getArgs(); |
280 | ::mlir::Operation::operand_range args(); |
281 | ::mlir::MutableOperandRange getBranchIndexMutable(); |
282 | ::mlir::MutableOperandRange branch_indexMutable(); |
283 | ::mlir::MutableOperandRange getArgsMutable(); |
284 | ::mlir::MutableOperandRange argsMutable(); |
285 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
286 | ::mlir::Operation::result_range getODSResults(unsigned index); |
287 | ::mlir::Operation::result_range getOuts(); |
288 | ::mlir::Operation::result_range outs(); |
289 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
290 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
291 | ::mlir::ArrayAttr getBranchesAttr(); |
292 | ::mlir::ArrayAttr getBranches(); |
293 | ::mlir::ArrayAttr branchesAttr(); |
294 | ::mlir::ArrayAttr branches(); |
295 | ::mlir::ArrayAttr getTinAttr(); |
296 | ::llvm::Optional< ::mlir::ArrayAttr > getTin(); |
297 | ::mlir::ArrayAttr TinAttr(); |
298 | ::llvm::Optional< ::mlir::ArrayAttr > Tin(); |
299 | ::mlir::ArrayAttr getToutAttr(); |
300 | ::llvm::Optional< ::mlir::ArrayAttr > getTout(); |
301 | ::mlir::ArrayAttr ToutAttr(); |
302 | ::llvm::Optional< ::mlir::ArrayAttr > Tout(); |
303 | ::mlir::ArrayAttr getOutputShapesAttr(); |
304 | ::llvm::Optional< ::mlir::ArrayAttr > getOutputShapes(); |
305 | ::mlir::ArrayAttr output_shapesAttr(); |
306 | ::llvm::Optional< ::mlir::ArrayAttr > output_shapes(); |
307 | void setBranchesAttr(::mlir::ArrayAttr attr); |
308 | void branchesAttr(::mlir::ArrayAttr attr); |
309 | void setTinAttr(::mlir::ArrayAttr attr); |
310 | void TinAttr(::mlir::ArrayAttr attr); |
311 | void setToutAttr(::mlir::ArrayAttr attr); |
312 | void ToutAttr(::mlir::ArrayAttr attr); |
313 | void setOutputShapesAttr(::mlir::ArrayAttr attr); |
314 | void output_shapesAttr(::mlir::ArrayAttr attr); |
315 | ::mlir::Attribute removeTinAttr(); |
316 | ::mlir::Attribute removeToutAttr(); |
317 | ::mlir::Attribute removeOutput_shapesAttr(); |
318 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange results, Value branch_index, ValueRange args, ArrayAttr branches); |
319 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::Value branch_index, ::mlir::ValueRange args, ::mlir::ArrayAttr branches, /*optional*/::mlir::ArrayAttr Tin, /*optional*/::mlir::ArrayAttr Tout, /*optional*/::mlir::ArrayAttr output_shapes); |
320 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value branch_index, ::mlir::ValueRange args, ::mlir::ArrayAttr branches, /*optional*/::mlir::ArrayAttr Tin, /*optional*/::mlir::ArrayAttr Tout, /*optional*/::mlir::ArrayAttr output_shapes); |
321 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
322 | ::mlir::LogicalResult verifyInvariantsImpl(); |
323 | ::mlir::LogicalResult verifyInvariants(); |
324 | ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); |
325 | private: |
326 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
327 | return getAttributeNameForIndex((*this)->getName(), index); |
328 | } |
329 | |
330 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
331 | assert(index < 4 && "invalid attribute index" ); |
332 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
333 | } |
334 | |
335 | public: |
336 | }; |
337 | } // namespace tfg |
338 | } // namespace mlir |
339 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::CaseOp) |
340 | |
341 | namespace mlir { |
342 | namespace tfg { |
343 | |
344 | //===----------------------------------------------------------------------===// |
345 | // ::mlir::tfg::CaseRegionOp declarations |
346 | //===----------------------------------------------------------------------===// |
347 | |
348 | class CaseRegionOpAdaptor { |
349 | public: |
350 | CaseRegionOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
351 | |
352 | CaseRegionOpAdaptor(CaseRegionOp op); |
353 | |
354 | ::mlir::ValueRange getOperands(); |
355 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
356 | ::mlir::ValueRange getODSOperands(unsigned index); |
357 | ::mlir::Value getBranchIndex(); |
358 | ::mlir::Value branch_index(); |
359 | ::mlir::ValueRange getCtls(); |
360 | ::mlir::ValueRange ctls(); |
361 | ::mlir::DictionaryAttr getAttributes(); |
362 | ::mlir::ArrayAttr getBranchAttrsAttr(); |
363 | ::llvm::Optional< ::mlir::ArrayAttr > getBranchAttrs(); |
364 | ::mlir::ArrayAttr branch_attrsAttr(); |
365 | ::llvm::Optional< ::mlir::ArrayAttr > branch_attrs(); |
366 | ::mlir::ArrayAttr getRegionAttrsAttr(); |
367 | ::llvm::Optional< ::mlir::ArrayAttr > getRegionAttrs(); |
368 | ::mlir::ArrayAttr region_attrsAttr(); |
369 | ::llvm::Optional< ::mlir::ArrayAttr > region_attrs(); |
370 | ::mlir::RegionRange getRegions(); |
371 | ::mlir::RegionRange getBranches(); |
372 | ::mlir::RegionRange branches(); |
373 | ::mlir::LogicalResult verify(::mlir::Location loc); |
374 | private: |
375 | ::mlir::ValueRange odsOperands; |
376 | ::mlir::DictionaryAttr odsAttrs; |
377 | ::mlir::RegionRange odsRegions; |
378 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
379 | }; |
380 | class CaseRegionOp : public ::mlir::Op<CaseRegionOp, ::mlir::OpTrait::VariadicRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasOnlyGraphRegion, ::mlir::RegionKindInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::tfg::PreservedAttributesInterface::Trait, ::mlir::RegionBranchOpInterface::Trait, ::mlir::tfg::ControlArgumentInterface::Trait> { |
381 | public: |
382 | using Op::Op; |
383 | using Op::print; |
384 | using Adaptor = CaseRegionOpAdaptor; |
385 | public: |
386 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
387 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("branch_attrs" ), ::llvm::StringRef("region_attrs" )}; |
388 | return ::llvm::makeArrayRef(attrNames); |
389 | } |
390 | |
391 | ::mlir::StringAttr getBranchAttrsAttrName() { |
392 | return getAttributeNameForIndex(0); |
393 | } |
394 | |
395 | static ::mlir::StringAttr getBranchAttrsAttrName(::mlir::OperationName name) { |
396 | return getAttributeNameForIndex(name, 0); |
397 | } |
398 | |
399 | ::mlir::StringAttr branch_attrsAttrName() { |
400 | return getAttributeNameForIndex(0); |
401 | } |
402 | |
403 | static ::mlir::StringAttr branch_attrsAttrName(::mlir::OperationName name) { |
404 | return getAttributeNameForIndex(name, 0); |
405 | } |
406 | |
407 | ::mlir::StringAttr getRegionAttrsAttrName() { |
408 | return getAttributeNameForIndex(1); |
409 | } |
410 | |
411 | static ::mlir::StringAttr getRegionAttrsAttrName(::mlir::OperationName name) { |
412 | return getAttributeNameForIndex(name, 1); |
413 | } |
414 | |
415 | ::mlir::StringAttr region_attrsAttrName() { |
416 | return getAttributeNameForIndex(1); |
417 | } |
418 | |
419 | static ::mlir::StringAttr region_attrsAttrName(::mlir::OperationName name) { |
420 | return getAttributeNameForIndex(name, 1); |
421 | } |
422 | |
423 | static constexpr ::llvm::StringLiteral getOperationName() { |
424 | return ::llvm::StringLiteral("tfg.CaseRegion" ); |
425 | } |
426 | |
427 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
428 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
429 | ::mlir::TypedValue<::mlir::TensorType> getBranchIndex(); |
430 | ::mlir::TypedValue<::mlir::TensorType> branch_index(); |
431 | ::mlir::Operation::operand_range getCtls(); |
432 | ::mlir::Operation::operand_range ctls(); |
433 | ::mlir::MutableOperandRange getBranchIndexMutable(); |
434 | ::mlir::MutableOperandRange branch_indexMutable(); |
435 | ::mlir::MutableOperandRange getCtlsMutable(); |
436 | ::mlir::MutableOperandRange ctlsMutable(); |
437 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
438 | ::mlir::Operation::result_range getODSResults(unsigned index); |
439 | ::mlir::Operation::result_range getOuts(); |
440 | ::mlir::Operation::result_range outs(); |
441 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
442 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
443 | ::mlir::MutableArrayRef<::mlir::Region> getBranches(); |
444 | ::mlir::MutableArrayRef<::mlir::Region> branches(); |
445 | ::mlir::ArrayAttr getBranchAttrsAttr(); |
446 | ::llvm::Optional< ::mlir::ArrayAttr > getBranchAttrs(); |
447 | ::mlir::ArrayAttr branch_attrsAttr(); |
448 | ::llvm::Optional< ::mlir::ArrayAttr > branch_attrs(); |
449 | ::mlir::ArrayAttr getRegionAttrsAttr(); |
450 | ::llvm::Optional< ::mlir::ArrayAttr > getRegionAttrs(); |
451 | ::mlir::ArrayAttr region_attrsAttr(); |
452 | ::llvm::Optional< ::mlir::ArrayAttr > region_attrs(); |
453 | void setBranchAttrsAttr(::mlir::ArrayAttr attr); |
454 | void branch_attrsAttr(::mlir::ArrayAttr attr); |
455 | void setRegionAttrsAttr(::mlir::ArrayAttr attr); |
456 | void region_attrsAttr(::mlir::ArrayAttr attr); |
457 | ::mlir::Attribute removeBranch_attrsAttr(); |
458 | ::mlir::Attribute removeRegion_attrsAttr(); |
459 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::Value branch_index, ::mlir::ValueRange ctls, /*optional*/::mlir::ArrayAttr branch_attrs, /*optional*/::mlir::ArrayAttr region_attrs, unsigned branchesCount); |
460 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value branch_index, ::mlir::ValueRange ctls, /*optional*/::mlir::ArrayAttr branch_attrs, /*optional*/::mlir::ArrayAttr region_attrs, unsigned branchesCount); |
461 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions); |
462 | ::mlir::LogicalResult verifyInvariantsImpl(); |
463 | ::mlir::LogicalResult verifyInvariants(); |
464 | ::mlir::LogicalResult verify(); |
465 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
466 | static ::llvm::StringRef getDefaultDialect(); |
467 | void getSuccessorRegions(::llvm::Optional<unsigned> index, ::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); |
468 | void getRegionInvocationBounds(::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::InvocationBounds> &invocationBounds); |
469 | static mlir::BlockArgument getDataValueOf(BlockArgument ctl); |
470 | static mlir::BlockArgument getControlTokenOf(BlockArgument data); |
471 | static mlir::BlockArgument getDataValue(Region ®ion, unsigned idx); |
472 | static mlir::BlockArgument getControlToken(Region ®ion, unsigned idx); |
473 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
474 | void print(::mlir::OpAsmPrinter &_odsPrinter); |
475 | private: |
476 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
477 | return getAttributeNameForIndex((*this)->getName(), index); |
478 | } |
479 | |
480 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
481 | assert(index < 2 && "invalid attribute index" ); |
482 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
483 | } |
484 | |
485 | public: |
486 | Block &branch_block(unsigned idx) { return branches()[idx].front(); } |
487 | YieldOp branch_yield(unsigned idx); |
488 | |
489 | bool areTypesCompatible(Type lhs, Type rhs) { |
490 | return tf_type::HasCompatibleElementTypes(lhs, rhs); |
491 | } |
492 | |
493 | RegionAttr getPreservedAttrs(unsigned index) { |
494 | if (auto attrs = region_attrsAttr()) |
495 | return attrs[index].cast<RegionAttr>(); |
496 | return {}; |
497 | } |
498 | void setPreservedAttrs(unsigned index, RegionAttr attrs) { |
499 | SmallVector<Attribute> array = llvm::to_vector(region_attrsAttr()); |
500 | array[index] = attrs; |
501 | region_attrsAttr(ArrayAttr::get(getContext(), array)); |
502 | } |
503 | }; |
504 | } // namespace tfg |
505 | } // namespace mlir |
506 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::CaseRegionOp) |
507 | |
508 | namespace mlir { |
509 | namespace tfg { |
510 | |
511 | //===----------------------------------------------------------------------===// |
512 | // ::mlir::tfg::ConditionOp declarations |
513 | //===----------------------------------------------------------------------===// |
514 | |
515 | class ConditionOpAdaptor { |
516 | public: |
517 | ConditionOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
518 | |
519 | ConditionOpAdaptor(ConditionOp op); |
520 | |
521 | ::mlir::ValueRange getOperands(); |
522 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
523 | ::mlir::ValueRange getODSOperands(unsigned index); |
524 | ::mlir::Value getCond(); |
525 | ::mlir::Value cond(); |
526 | ::mlir::ValueRange getArgs(); |
527 | ::mlir::ValueRange args(); |
528 | ::mlir::ValueRange getCtls(); |
529 | ::mlir::ValueRange ctls(); |
530 | ::mlir::DictionaryAttr getAttributes(); |
531 | ::mlir::LogicalResult verify(::mlir::Location loc); |
532 | private: |
533 | ::mlir::ValueRange odsOperands; |
534 | ::mlir::DictionaryAttr odsAttrs; |
535 | ::mlir::RegionRange odsRegions; |
536 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
537 | }; |
538 | class ConditionOp : public ::mlir::Op<ConditionOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ReturnLike, ::mlir::OpTrait::IsTerminator, ::mlir::RegionBranchTerminatorOpInterface::Trait, ::mlir::OpTrait::IntrinsicOperation> { |
539 | public: |
540 | using Op::Op; |
541 | using Op::print; |
542 | using Adaptor = ConditionOpAdaptor; |
543 | public: |
544 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
545 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operand_segment_sizes" )}; |
546 | return ::llvm::makeArrayRef(attrNames); |
547 | } |
548 | |
549 | ::mlir::StringAttr getOperandSegmentSizesAttrName() { |
550 | return getAttributeNameForIndex(0); |
551 | } |
552 | |
553 | static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { |
554 | return getAttributeNameForIndex(name, 0); |
555 | } |
556 | |
557 | ::mlir::StringAttr operand_segment_sizesAttrName() { |
558 | return getAttributeNameForIndex(0); |
559 | } |
560 | |
561 | static ::mlir::StringAttr operand_segment_sizesAttrName(::mlir::OperationName name) { |
562 | return getAttributeNameForIndex(name, 0); |
563 | } |
564 | |
565 | static constexpr ::llvm::StringLiteral getOperationName() { |
566 | return ::llvm::StringLiteral("tfg.condition" ); |
567 | } |
568 | |
569 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
570 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
571 | ::mlir::TypedValue<::mlir::TensorType> getCond(); |
572 | ::mlir::TypedValue<::mlir::TensorType> cond(); |
573 | ::mlir::Operation::operand_range getArgs(); |
574 | ::mlir::Operation::operand_range args(); |
575 | ::mlir::Operation::operand_range getCtls(); |
576 | ::mlir::Operation::operand_range ctls(); |
577 | ::mlir::MutableOperandRange getCondMutable(); |
578 | ::mlir::MutableOperandRange condMutable(); |
579 | ::mlir::MutableOperandRange getArgsMutable(); |
580 | ::mlir::MutableOperandRange argsMutable(); |
581 | ::mlir::MutableOperandRange getCtlsMutable(); |
582 | ::mlir::MutableOperandRange ctlsMutable(); |
583 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
584 | ::mlir::Operation::result_range getODSResults(unsigned index); |
585 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value cond, ::mlir::ValueRange args, ::mlir::ValueRange ctls); |
586 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value cond, ::mlir::ValueRange args, ::mlir::ValueRange ctls); |
587 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
588 | ::mlir::LogicalResult verifyInvariantsImpl(); |
589 | ::mlir::LogicalResult verifyInvariants(); |
590 | ::mlir::MutableOperandRange getMutableSuccessorOperands(::llvm::Optional<unsigned> index); |
591 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
592 | void print(::mlir::OpAsmPrinter &_odsPrinter); |
593 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
594 | private: |
595 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
596 | return getAttributeNameForIndex((*this)->getName(), index); |
597 | } |
598 | |
599 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
600 | assert(index < 1 && "invalid attribute index" ); |
601 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
602 | } |
603 | |
604 | public: |
605 | }; |
606 | } // namespace tfg |
607 | } // namespace mlir |
608 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::ConditionOp) |
609 | |
610 | namespace mlir { |
611 | namespace tfg { |
612 | |
613 | //===----------------------------------------------------------------------===// |
614 | // ::mlir::tfg::ForOp declarations |
615 | //===----------------------------------------------------------------------===// |
616 | |
617 | class ForOpAdaptor { |
618 | public: |
619 | ForOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
620 | |
621 | ForOpAdaptor(ForOp op); |
622 | |
623 | ::mlir::ValueRange getOperands(); |
624 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
625 | ::mlir::ValueRange getODSOperands(unsigned index); |
626 | ::mlir::Value getStart(); |
627 | ::mlir::Value start(); |
628 | ::mlir::Value getLimit(); |
629 | ::mlir::Value limit(); |
630 | ::mlir::Value getDelta(); |
631 | ::mlir::Value delta(); |
632 | ::mlir::ValueRange getArgs(); |
633 | ::mlir::ValueRange args(); |
634 | ::mlir::DictionaryAttr getAttributes(); |
635 | ::mlir::tf_type::FuncAttr getBodyAttr(); |
636 | ::mlir::tf_type::FuncAttr getBody(); |
637 | ::mlir::tf_type::FuncAttr bodyAttr(); |
638 | ::mlir::tf_type::FuncAttr body(); |
639 | ::mlir::ArrayAttr getTAttr(); |
640 | ::llvm::Optional< ::mlir::ArrayAttr > getT(); |
641 | ::mlir::ArrayAttr TAttr(); |
642 | ::llvm::Optional< ::mlir::ArrayAttr > T(); |
643 | ::mlir::LogicalResult verify(::mlir::Location loc); |
644 | private: |
645 | ::mlir::ValueRange odsOperands; |
646 | ::mlir::DictionaryAttr odsAttrs; |
647 | ::mlir::RegionRange odsRegions; |
648 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
649 | }; |
650 | class ForOp : public ::mlir::Op<ForOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::SymbolUserOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { |
651 | public: |
652 | using Op::Op; |
653 | using Op::print; |
654 | using Adaptor = ForOpAdaptor; |
655 | public: |
656 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
657 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T" ), ::llvm::StringRef("body" )}; |
658 | return ::llvm::makeArrayRef(attrNames); |
659 | } |
660 | |
661 | ::mlir::StringAttr getTAttrName() { |
662 | return getAttributeNameForIndex(0); |
663 | } |
664 | |
665 | static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { |
666 | return getAttributeNameForIndex(name, 0); |
667 | } |
668 | |
669 | ::mlir::StringAttr TAttrName() { |
670 | return getAttributeNameForIndex(0); |
671 | } |
672 | |
673 | static ::mlir::StringAttr TAttrName(::mlir::OperationName name) { |
674 | return getAttributeNameForIndex(name, 0); |
675 | } |
676 | |
677 | ::mlir::StringAttr getBodyAttrName() { |
678 | return getAttributeNameForIndex(1); |
679 | } |
680 | |
681 | static ::mlir::StringAttr getBodyAttrName(::mlir::OperationName name) { |
682 | return getAttributeNameForIndex(name, 1); |
683 | } |
684 | |
685 | ::mlir::StringAttr bodyAttrName() { |
686 | return getAttributeNameForIndex(1); |
687 | } |
688 | |
689 | static ::mlir::StringAttr bodyAttrName(::mlir::OperationName name) { |
690 | return getAttributeNameForIndex(name, 1); |
691 | } |
692 | |
693 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
694 | static constexpr ::llvm::StringLiteral getOperationName() { |
695 | return ::llvm::StringLiteral("tfg.For" ); |
696 | } |
697 | |
698 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
699 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
700 | ::mlir::Value getStart(); |
701 | ::mlir::Value start(); |
702 | ::mlir::Value getLimit(); |
703 | ::mlir::Value limit(); |
704 | ::mlir::Value getDelta(); |
705 | ::mlir::Value delta(); |
706 | ::mlir::Operation::operand_range getArgs(); |
707 | ::mlir::Operation::operand_range args(); |
708 | ::mlir::MutableOperandRange getStartMutable(); |
709 | ::mlir::MutableOperandRange startMutable(); |
710 | ::mlir::MutableOperandRange getLimitMutable(); |
711 | ::mlir::MutableOperandRange limitMutable(); |
712 | ::mlir::MutableOperandRange getDeltaMutable(); |
713 | ::mlir::MutableOperandRange deltaMutable(); |
714 | ::mlir::MutableOperandRange getArgsMutable(); |
715 | ::mlir::MutableOperandRange argsMutable(); |
716 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
717 | ::mlir::Operation::result_range getODSResults(unsigned index); |
718 | ::mlir::Operation::result_range getOuts(); |
719 | ::mlir::Operation::result_range outs(); |
720 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
721 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
722 | ::mlir::tf_type::FuncAttr getBodyAttr(); |
723 | ::mlir::tf_type::FuncAttr getBody(); |
724 | ::mlir::tf_type::FuncAttr bodyAttr(); |
725 | ::mlir::tf_type::FuncAttr body(); |
726 | ::mlir::ArrayAttr getTAttr(); |
727 | ::llvm::Optional< ::mlir::ArrayAttr > getT(); |
728 | ::mlir::ArrayAttr TAttr(); |
729 | ::llvm::Optional< ::mlir::ArrayAttr > T(); |
730 | void setBodyAttr(::mlir::tf_type::FuncAttr attr); |
731 | void bodyAttr(::mlir::tf_type::FuncAttr attr); |
732 | void setTAttr(::mlir::ArrayAttr attr); |
733 | void TAttr(::mlir::ArrayAttr attr); |
734 | ::mlir::Attribute removeTAttr(); |
735 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange results, Value start, Value limit, Value delta, ValueRange args, FuncAttr body); |
736 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::Value start, ::mlir::Value limit, ::mlir::Value delta, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr body, /*optional*/::mlir::ArrayAttr T); |
737 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value start, ::mlir::Value limit, ::mlir::Value delta, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr body, /*optional*/::mlir::ArrayAttr T); |
738 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
739 | ::mlir::LogicalResult verifyInvariantsImpl(); |
740 | ::mlir::LogicalResult verifyInvariants(); |
741 | ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); |
742 | private: |
743 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
744 | return getAttributeNameForIndex((*this)->getName(), index); |
745 | } |
746 | |
747 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
748 | assert(index < 2 && "invalid attribute index" ); |
749 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
750 | } |
751 | |
752 | public: |
753 | }; |
754 | } // namespace tfg |
755 | } // namespace mlir |
756 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::ForOp) |
757 | |
758 | namespace mlir { |
759 | namespace tfg { |
760 | |
761 | //===----------------------------------------------------------------------===// |
762 | // ::mlir::tfg::ForRegionOp declarations |
763 | //===----------------------------------------------------------------------===// |
764 | |
765 | class ForRegionOpAdaptor { |
766 | public: |
767 | ForRegionOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
768 | |
769 | ForRegionOpAdaptor(ForRegionOp op); |
770 | |
771 | ::mlir::ValueRange getOperands(); |
772 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
773 | ::mlir::ValueRange getODSOperands(unsigned index); |
774 | ::mlir::Value getStart(); |
775 | ::mlir::Value start(); |
776 | ::mlir::Value getLimit(); |
777 | ::mlir::Value limit(); |
778 | ::mlir::Value getDelta(); |
779 | ::mlir::Value delta(); |
780 | ::mlir::ValueRange getInit(); |
781 | ::mlir::ValueRange init(); |
782 | ::mlir::ValueRange getCtls(); |
783 | ::mlir::ValueRange ctls(); |
784 | ::mlir::DictionaryAttr getAttributes(); |
785 | ::mlir::DictionaryAttr getBodyAttrsAttr(); |
786 | ::llvm::Optional< ::mlir::DictionaryAttr > getBodyAttrs(); |
787 | ::mlir::DictionaryAttr body_attrsAttr(); |
788 | ::llvm::Optional< ::mlir::DictionaryAttr > body_attrs(); |
789 | ::mlir::tfg::RegionAttr getRegionAttrsAttr(); |
790 | ::llvm::Optional<::mlir::tfg::RegionAttr> getRegionAttrs(); |
791 | ::mlir::tfg::RegionAttr region_attrsAttr(); |
792 | ::llvm::Optional<::mlir::tfg::RegionAttr> region_attrs(); |
793 | ::mlir::RegionRange getRegions(); |
794 | ::mlir::Region &getBodyRegion(); |
795 | ::mlir::Region &body_region(); |
796 | ::mlir::LogicalResult verify(::mlir::Location loc); |
797 | private: |
798 | ::mlir::ValueRange odsOperands; |
799 | ::mlir::DictionaryAttr odsAttrs; |
800 | ::mlir::RegionRange odsRegions; |
801 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
802 | }; |
803 | class ForRegionOp : public ::mlir::Op<ForRegionOp, ::mlir::OpTrait::OneRegion, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<3>::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasOnlyGraphRegion, ::mlir::RegionKindInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::tfg::PreservedAttributesInterface::Trait, ::mlir::RegionBranchOpInterface::Trait, ::mlir::tfg::ControlArgumentInterface::Trait> { |
804 | public: |
805 | using Op::Op; |
806 | using Op::print; |
807 | using Adaptor = ForRegionOpAdaptor; |
808 | public: |
809 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
810 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("body_attrs" ), ::llvm::StringRef("operand_segment_sizes" ), ::llvm::StringRef("region_attrs" )}; |
811 | return ::llvm::makeArrayRef(attrNames); |
812 | } |
813 | |
814 | ::mlir::StringAttr getBodyAttrsAttrName() { |
815 | return getAttributeNameForIndex(0); |
816 | } |
817 | |
818 | static ::mlir::StringAttr getBodyAttrsAttrName(::mlir::OperationName name) { |
819 | return getAttributeNameForIndex(name, 0); |
820 | } |
821 | |
822 | ::mlir::StringAttr body_attrsAttrName() { |
823 | return getAttributeNameForIndex(0); |
824 | } |
825 | |
826 | static ::mlir::StringAttr body_attrsAttrName(::mlir::OperationName name) { |
827 | return getAttributeNameForIndex(name, 0); |
828 | } |
829 | |
830 | ::mlir::StringAttr getOperandSegmentSizesAttrName() { |
831 | return getAttributeNameForIndex(1); |
832 | } |
833 | |
834 | static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { |
835 | return getAttributeNameForIndex(name, 1); |
836 | } |
837 | |
838 | ::mlir::StringAttr operand_segment_sizesAttrName() { |
839 | return getAttributeNameForIndex(1); |
840 | } |
841 | |
842 | static ::mlir::StringAttr operand_segment_sizesAttrName(::mlir::OperationName name) { |
843 | return getAttributeNameForIndex(name, 1); |
844 | } |
845 | |
846 | ::mlir::StringAttr getRegionAttrsAttrName() { |
847 | return getAttributeNameForIndex(2); |
848 | } |
849 | |
850 | static ::mlir::StringAttr getRegionAttrsAttrName(::mlir::OperationName name) { |
851 | return getAttributeNameForIndex(name, 2); |
852 | } |
853 | |
854 | ::mlir::StringAttr region_attrsAttrName() { |
855 | return getAttributeNameForIndex(2); |
856 | } |
857 | |
858 | static ::mlir::StringAttr region_attrsAttrName(::mlir::OperationName name) { |
859 | return getAttributeNameForIndex(name, 2); |
860 | } |
861 | |
862 | static constexpr ::llvm::StringLiteral getOperationName() { |
863 | return ::llvm::StringLiteral("tfg.ForRegion" ); |
864 | } |
865 | |
866 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
867 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
868 | ::mlir::TypedValue<::mlir::TensorType> getStart(); |
869 | ::mlir::TypedValue<::mlir::TensorType> start(); |
870 | ::mlir::TypedValue<::mlir::TensorType> getLimit(); |
871 | ::mlir::TypedValue<::mlir::TensorType> limit(); |
872 | ::mlir::TypedValue<::mlir::TensorType> getDelta(); |
873 | ::mlir::TypedValue<::mlir::TensorType> delta(); |
874 | ::mlir::Operation::operand_range getInit(); |
875 | ::mlir::Operation::operand_range init(); |
876 | ::mlir::Operation::operand_range getCtls(); |
877 | ::mlir::Operation::operand_range ctls(); |
878 | ::mlir::MutableOperandRange getStartMutable(); |
879 | ::mlir::MutableOperandRange startMutable(); |
880 | ::mlir::MutableOperandRange getLimitMutable(); |
881 | ::mlir::MutableOperandRange limitMutable(); |
882 | ::mlir::MutableOperandRange getDeltaMutable(); |
883 | ::mlir::MutableOperandRange deltaMutable(); |
884 | ::mlir::MutableOperandRange getInitMutable(); |
885 | ::mlir::MutableOperandRange initMutable(); |
886 | ::mlir::MutableOperandRange getCtlsMutable(); |
887 | ::mlir::MutableOperandRange ctlsMutable(); |
888 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
889 | ::mlir::Operation::result_range getODSResults(unsigned index); |
890 | ::mlir::Operation::result_range getOuts(); |
891 | ::mlir::Operation::result_range outs(); |
892 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
893 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
894 | ::mlir::Region &getBodyRegion(); |
895 | ::mlir::Region &body_region(); |
896 | ::mlir::DictionaryAttr getBodyAttrsAttr(); |
897 | ::llvm::Optional< ::mlir::DictionaryAttr > getBodyAttrs(); |
898 | ::mlir::DictionaryAttr body_attrsAttr(); |
899 | ::llvm::Optional< ::mlir::DictionaryAttr > body_attrs(); |
900 | ::mlir::tfg::RegionAttr getRegionAttrsAttr(); |
901 | ::llvm::Optional<::mlir::tfg::RegionAttr> getRegionAttrs(); |
902 | ::mlir::tfg::RegionAttr region_attrsAttr(); |
903 | ::llvm::Optional<::mlir::tfg::RegionAttr> region_attrs(); |
904 | void setBodyAttrsAttr(::mlir::DictionaryAttr attr); |
905 | void body_attrsAttr(::mlir::DictionaryAttr attr); |
906 | void setRegionAttrsAttr(::mlir::tfg::RegionAttr attr); |
907 | void region_attrsAttr(::mlir::tfg::RegionAttr attr); |
908 | ::mlir::Attribute removeBody_attrsAttr(); |
909 | ::mlir::Attribute removeRegion_attrsAttr(); |
910 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::Value start, ::mlir::Value limit, ::mlir::Value delta, ::mlir::ValueRange init, ::mlir::ValueRange ctls, /*optional*/::mlir::DictionaryAttr body_attrs, /*optional*/::mlir::tfg::RegionAttr region_attrs); |
911 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value start, ::mlir::Value limit, ::mlir::Value delta, ::mlir::ValueRange init, ::mlir::ValueRange ctls, /*optional*/::mlir::DictionaryAttr body_attrs, /*optional*/::mlir::tfg::RegionAttr region_attrs); |
912 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
913 | ::mlir::LogicalResult verifyInvariantsImpl(); |
914 | ::mlir::LogicalResult verifyInvariants(); |
915 | ::mlir::LogicalResult verify(); |
916 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
917 | static ::llvm::StringRef getDefaultDialect(); |
918 | ::mlir::OperandRange getSuccessorEntryOperands(::llvm::Optional<unsigned> index); |
919 | void getSuccessorRegions(::llvm::Optional<unsigned> index, ::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); |
920 | static mlir::BlockArgument getDataValueOf(BlockArgument ctl); |
921 | static mlir::BlockArgument getControlTokenOf(BlockArgument data); |
922 | static mlir::BlockArgument getDataValue(Region ®ion, unsigned idx); |
923 | static mlir::BlockArgument getControlToken(Region ®ion, unsigned idx); |
924 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
925 | void print(::mlir::OpAsmPrinter &_odsPrinter); |
926 | private: |
927 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
928 | return getAttributeNameForIndex((*this)->getName(), index); |
929 | } |
930 | |
931 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
932 | assert(index < 3 && "invalid attribute index" ); |
933 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
934 | } |
935 | |
936 | public: |
937 | Block &body_block() { return body_region().front(); } |
938 | YieldOp body_yield(); |
939 | |
940 | bool areTypesCompatible(Type lhs, Type rhs) { |
941 | return tf_type::HasCompatibleElementTypes(lhs, rhs); |
942 | } |
943 | |
944 | RegionAttr getPreservedAttrs(unsigned index) { |
945 | return region_attrsAttr(); |
946 | } |
947 | void setPreservedAttrs(unsigned index, RegionAttr attrs) { |
948 | region_attrsAttr(attrs); |
949 | } |
950 | }; |
951 | } // namespace tfg |
952 | } // namespace mlir |
953 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::ForRegionOp) |
954 | |
955 | namespace mlir { |
956 | namespace tfg { |
957 | |
958 | //===----------------------------------------------------------------------===// |
959 | // ::mlir::tfg::GetResultOp declarations |
960 | //===----------------------------------------------------------------------===// |
961 | |
962 | class GetResultOpAdaptor { |
963 | public: |
964 | GetResultOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
965 | |
966 | GetResultOpAdaptor(GetResultOp op); |
967 | |
968 | ::mlir::ValueRange getOperands(); |
969 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
970 | ::mlir::ValueRange getODSOperands(unsigned index); |
971 | ::mlir::Value getValue(); |
972 | ::mlir::Value value(); |
973 | ::mlir::DictionaryAttr getAttributes(); |
974 | ::mlir::StringAttr getNameAttr(); |
975 | ::llvm::StringRef getName(); |
976 | ::mlir::StringAttr nameAttr(); |
977 | ::llvm::StringRef name(); |
978 | ::mlir::IntegerAttr getNumberAttr(); |
979 | uint32_t getNumber(); |
980 | ::mlir::IntegerAttr numberAttr(); |
981 | uint32_t number(); |
982 | ::mlir::LogicalResult verify(::mlir::Location loc); |
983 | private: |
984 | ::mlir::ValueRange odsOperands; |
985 | ::mlir::DictionaryAttr odsAttrs; |
986 | ::mlir::RegionRange odsRegions; |
987 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
988 | }; |
989 | class GetResultOp : public ::mlir::Op<GetResultOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::tf_type::OpaqueTensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::IntrinsicOperation, ::mlir::InferTypeOpInterface::Trait> { |
990 | public: |
991 | using Op::Op; |
992 | using Op::print; |
993 | using Adaptor = GetResultOpAdaptor; |
994 | public: |
995 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
996 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("name" ), ::llvm::StringRef("number" )}; |
997 | return ::llvm::makeArrayRef(attrNames); |
998 | } |
999 | |
1000 | ::mlir::StringAttr getNameAttrName() { |
1001 | return getAttributeNameForIndex(0); |
1002 | } |
1003 | |
1004 | static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { |
1005 | return getAttributeNameForIndex(name, 0); |
1006 | } |
1007 | |
1008 | ::mlir::StringAttr nameAttrName() { |
1009 | return getAttributeNameForIndex(0); |
1010 | } |
1011 | |
1012 | static ::mlir::StringAttr nameAttrName(::mlir::OperationName name) { |
1013 | return getAttributeNameForIndex(name, 0); |
1014 | } |
1015 | |
1016 | ::mlir::StringAttr getNumberAttrName() { |
1017 | return getAttributeNameForIndex(1); |
1018 | } |
1019 | |
1020 | static ::mlir::StringAttr getNumberAttrName(::mlir::OperationName name) { |
1021 | return getAttributeNameForIndex(name, 1); |
1022 | } |
1023 | |
1024 | ::mlir::StringAttr numberAttrName() { |
1025 | return getAttributeNameForIndex(1); |
1026 | } |
1027 | |
1028 | static ::mlir::StringAttr numberAttrName(::mlir::OperationName name) { |
1029 | return getAttributeNameForIndex(name, 1); |
1030 | } |
1031 | |
1032 | static constexpr ::llvm::StringLiteral getOperationName() { |
1033 | return ::llvm::StringLiteral("tfg.get_result" ); |
1034 | } |
1035 | |
1036 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1037 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
1038 | ::mlir::TypedValue<::mlir::tf_type::OpaqueTensorType> getValue(); |
1039 | ::mlir::TypedValue<::mlir::tf_type::OpaqueTensorType> value(); |
1040 | ::mlir::MutableOperandRange getValueMutable(); |
1041 | ::mlir::MutableOperandRange valueMutable(); |
1042 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1043 | ::mlir::Operation::result_range getODSResults(unsigned index); |
1044 | ::mlir::TypedValue<::mlir::tf_type::OpaqueTensorType> getResult(); |
1045 | ::mlir::TypedValue<::mlir::tf_type::OpaqueTensorType> result(); |
1046 | ::mlir::StringAttr getNameAttr(); |
1047 | ::llvm::StringRef getName(); |
1048 | ::mlir::StringAttr nameAttr(); |
1049 | ::llvm::StringRef name(); |
1050 | ::mlir::IntegerAttr getNumberAttr(); |
1051 | uint32_t getNumber(); |
1052 | ::mlir::IntegerAttr numberAttr(); |
1053 | uint32_t number(); |
1054 | void setNameAttr(::mlir::StringAttr attr); |
1055 | void nameAttr(::mlir::StringAttr attr); |
1056 | void setNumberAttr(::mlir::IntegerAttr attr); |
1057 | void numberAttr(::mlir::IntegerAttr attr); |
1058 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value value, ::mlir::StringAttr name, ::mlir::IntegerAttr number); |
1059 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::StringAttr name, ::mlir::IntegerAttr number); |
1060 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::StringAttr name, ::mlir::IntegerAttr number); |
1061 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value value, ::llvm::StringRef name, uint32_t number); |
1062 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::llvm::StringRef name, uint32_t number); |
1063 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::llvm::StringRef name, uint32_t number); |
1064 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
1065 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
1066 | ::mlir::LogicalResult verifyInvariantsImpl(); |
1067 | ::mlir::LogicalResult verifyInvariants(); |
1068 | static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::llvm::Optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); |
1069 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
1070 | void print(::mlir::OpAsmPrinter &_odsPrinter); |
1071 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
1072 | private: |
1073 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
1074 | return getAttributeNameForIndex((*this)->getName(), index); |
1075 | } |
1076 | |
1077 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
1078 | assert(index < 2 && "invalid attribute index" ); |
1079 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
1080 | } |
1081 | |
1082 | public: |
1083 | }; |
1084 | } // namespace tfg |
1085 | } // namespace mlir |
1086 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::GetResultOp) |
1087 | |
1088 | namespace mlir { |
1089 | namespace tfg { |
1090 | |
1091 | //===----------------------------------------------------------------------===// |
1092 | // ::mlir::tfg::GraphFuncOp declarations |
1093 | //===----------------------------------------------------------------------===// |
1094 | |
1095 | class GraphFuncOpAdaptor { |
1096 | public: |
1097 | GraphFuncOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
1098 | |
1099 | GraphFuncOpAdaptor(GraphFuncOp op); |
1100 | |
1101 | ::mlir::ValueRange getOperands(); |
1102 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1103 | ::mlir::ValueRange getODSOperands(unsigned index); |
1104 | ::mlir::DictionaryAttr getAttributes(); |
1105 | ::mlir::UnitAttr getGenericAttr(); |
1106 | bool getGeneric(); |
1107 | ::mlir::UnitAttr genericAttr(); |
1108 | bool generic(); |
1109 | ::mlir::StringAttr getSymNameAttr(); |
1110 | ::llvm::StringRef getSymName(); |
1111 | ::mlir::StringAttr sym_nameAttr(); |
1112 | ::llvm::StringRef sym_name(); |
1113 | ::mlir::TypeAttr getFunctionTypeAttr(); |
1114 | ::mlir::FunctionType getFunctionType(); |
1115 | ::mlir::TypeAttr function_typeAttr(); |
1116 | ::mlir::FunctionType function_type(); |
1117 | ::mlir::ArrayAttr getArgAttrsAttr(); |
1118 | ::llvm::Optional< ::mlir::ArrayAttr > getArgAttrs(); |
1119 | ::mlir::ArrayAttr arg_attrsAttr(); |
1120 | ::llvm::Optional< ::mlir::ArrayAttr > arg_attrs(); |
1121 | ::mlir::ArrayAttr getResAttrsAttr(); |
1122 | ::llvm::Optional< ::mlir::ArrayAttr > getResAttrs(); |
1123 | ::mlir::ArrayAttr res_attrsAttr(); |
1124 | ::llvm::Optional< ::mlir::ArrayAttr > res_attrs(); |
1125 | ::mlir::StringAttr getDescriptionAttr(); |
1126 | ::llvm::Optional< ::llvm::StringRef > getDescription(); |
1127 | ::mlir::StringAttr descriptionAttr(); |
1128 | ::llvm::Optional< ::llvm::StringRef > description(); |
1129 | ::mlir::UnitAttr getIsStatefulAttr(); |
1130 | bool getIsStateful(); |
1131 | ::mlir::UnitAttr is_statefulAttr(); |
1132 | bool is_stateful(); |
1133 | ::mlir::FlatSymbolRefAttr getGradientAttr(); |
1134 | ::llvm::Optional< ::llvm::StringRef > getGradient(); |
1135 | ::mlir::FlatSymbolRefAttr gradientAttr(); |
1136 | ::llvm::Optional< ::llvm::StringRef > gradient(); |
1137 | ::mlir::DenseIntElementsAttr getResourceArgUniqueIdsKeysAttr(); |
1138 | ::llvm::Optional< ::mlir::DenseIntElementsAttr > getResourceArgUniqueIdsKeys(); |
1139 | ::mlir::DenseIntElementsAttr resource_arg_unique_ids_keysAttr(); |
1140 | ::llvm::Optional< ::mlir::DenseIntElementsAttr > resource_arg_unique_ids_keys(); |
1141 | ::mlir::DenseIntElementsAttr getResourceArgUniqueIdsValuesAttr(); |
1142 | ::llvm::Optional< ::mlir::DenseIntElementsAttr > getResourceArgUniqueIdsValues(); |
1143 | ::mlir::DenseIntElementsAttr resource_arg_unique_ids_valuesAttr(); |
1144 | ::llvm::Optional< ::mlir::DenseIntElementsAttr > resource_arg_unique_ids_values(); |
1145 | ::mlir::ArrayAttr getControlOutputAttr(); |
1146 | ::llvm::Optional< ::mlir::ArrayAttr > getControlOutput(); |
1147 | ::mlir::ArrayAttr control_outputAttr(); |
1148 | ::llvm::Optional< ::mlir::ArrayAttr > control_output(); |
1149 | ::mlir::RegionRange getRegions(); |
1150 | ::mlir::Region &getBody(); |
1151 | ::mlir::Region &body(); |
1152 | ::mlir::LogicalResult verify(::mlir::Location loc); |
1153 | private: |
1154 | ::mlir::ValueRange odsOperands; |
1155 | ::mlir::DictionaryAttr odsAttrs; |
1156 | ::mlir::RegionRange odsRegions; |
1157 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
1158 | }; |
1159 | class GraphFuncOp : public ::mlir::Op<GraphFuncOp, ::mlir::OpTrait::OneRegion, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::OpInvariants, ::mlir::RegionKindInterface::Trait, ::mlir::OpTrait::HasOnlyGraphRegion, ::mlir::CallableOpInterface::Trait, ::mlir::FunctionOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove, ::mlir::SymbolOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::tfg::ControlArgumentInterface::Trait, ::mlir::OpTrait::IntrinsicOperation> { |
1160 | public: |
1161 | using Op::Op; |
1162 | using Op::print; |
1163 | using Adaptor = GraphFuncOpAdaptor; |
1164 | public: |
1165 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
1166 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("arg_attrs" ), ::llvm::StringRef("control_output" ), ::llvm::StringRef("description" ), ::llvm::StringRef("function_type" ), ::llvm::StringRef("generic" ), ::llvm::StringRef("gradient" ), ::llvm::StringRef("is_stateful" ), ::llvm::StringRef("res_attrs" ), ::llvm::StringRef("resource_arg_unique_ids_keys" ), ::llvm::StringRef("resource_arg_unique_ids_values" ), ::llvm::StringRef("sym_name" )}; |
1167 | return ::llvm::makeArrayRef(attrNames); |
1168 | } |
1169 | |
1170 | ::mlir::StringAttr getArgAttrsAttrName() { |
1171 | return getAttributeNameForIndex(0); |
1172 | } |
1173 | |
1174 | static ::mlir::StringAttr getArgAttrsAttrName(::mlir::OperationName name) { |
1175 | return getAttributeNameForIndex(name, 0); |
1176 | } |
1177 | |
1178 | ::mlir::StringAttr arg_attrsAttrName() { |
1179 | return getAttributeNameForIndex(0); |
1180 | } |
1181 | |
1182 | static ::mlir::StringAttr arg_attrsAttrName(::mlir::OperationName name) { |
1183 | return getAttributeNameForIndex(name, 0); |
1184 | } |
1185 | |
1186 | ::mlir::StringAttr getControlOutputAttrName() { |
1187 | return getAttributeNameForIndex(1); |
1188 | } |
1189 | |
1190 | static ::mlir::StringAttr getControlOutputAttrName(::mlir::OperationName name) { |
1191 | return getAttributeNameForIndex(name, 1); |
1192 | } |
1193 | |
1194 | ::mlir::StringAttr control_outputAttrName() { |
1195 | return getAttributeNameForIndex(1); |
1196 | } |
1197 | |
1198 | static ::mlir::StringAttr control_outputAttrName(::mlir::OperationName name) { |
1199 | return getAttributeNameForIndex(name, 1); |
1200 | } |
1201 | |
1202 | ::mlir::StringAttr getDescriptionAttrName() { |
1203 | return getAttributeNameForIndex(2); |
1204 | } |
1205 | |
1206 | static ::mlir::StringAttr getDescriptionAttrName(::mlir::OperationName name) { |
1207 | return getAttributeNameForIndex(name, 2); |
1208 | } |
1209 | |
1210 | ::mlir::StringAttr descriptionAttrName() { |
1211 | return getAttributeNameForIndex(2); |
1212 | } |
1213 | |
1214 | static ::mlir::StringAttr descriptionAttrName(::mlir::OperationName name) { |
1215 | return getAttributeNameForIndex(name, 2); |
1216 | } |
1217 | |
1218 | ::mlir::StringAttr getFunctionTypeAttrName() { |
1219 | return getAttributeNameForIndex(3); |
1220 | } |
1221 | |
1222 | static ::mlir::StringAttr getFunctionTypeAttrName(::mlir::OperationName name) { |
1223 | return getAttributeNameForIndex(name, 3); |
1224 | } |
1225 | |
1226 | ::mlir::StringAttr function_typeAttrName() { |
1227 | return getAttributeNameForIndex(3); |
1228 | } |
1229 | |
1230 | static ::mlir::StringAttr function_typeAttrName(::mlir::OperationName name) { |
1231 | return getAttributeNameForIndex(name, 3); |
1232 | } |
1233 | |
1234 | ::mlir::StringAttr getGenericAttrName() { |
1235 | return getAttributeNameForIndex(4); |
1236 | } |
1237 | |
1238 | static ::mlir::StringAttr getGenericAttrName(::mlir::OperationName name) { |
1239 | return getAttributeNameForIndex(name, 4); |
1240 | } |
1241 | |
1242 | ::mlir::StringAttr genericAttrName() { |
1243 | return getAttributeNameForIndex(4); |
1244 | } |
1245 | |
1246 | static ::mlir::StringAttr genericAttrName(::mlir::OperationName name) { |
1247 | return getAttributeNameForIndex(name, 4); |
1248 | } |
1249 | |
1250 | ::mlir::StringAttr getGradientAttrName() { |
1251 | return getAttributeNameForIndex(5); |
1252 | } |
1253 | |
1254 | static ::mlir::StringAttr getGradientAttrName(::mlir::OperationName name) { |
1255 | return getAttributeNameForIndex(name, 5); |
1256 | } |
1257 | |
1258 | ::mlir::StringAttr gradientAttrName() { |
1259 | return getAttributeNameForIndex(5); |
1260 | } |
1261 | |
1262 | static ::mlir::StringAttr gradientAttrName(::mlir::OperationName name) { |
1263 | return getAttributeNameForIndex(name, 5); |
1264 | } |
1265 | |
1266 | ::mlir::StringAttr getIsStatefulAttrName() { |
1267 | return getAttributeNameForIndex(6); |
1268 | } |
1269 | |
1270 | static ::mlir::StringAttr getIsStatefulAttrName(::mlir::OperationName name) { |
1271 | return getAttributeNameForIndex(name, 6); |
1272 | } |
1273 | |
1274 | ::mlir::StringAttr is_statefulAttrName() { |
1275 | return getAttributeNameForIndex(6); |
1276 | } |
1277 | |
1278 | static ::mlir::StringAttr is_statefulAttrName(::mlir::OperationName name) { |
1279 | return getAttributeNameForIndex(name, 6); |
1280 | } |
1281 | |
1282 | ::mlir::StringAttr getResAttrsAttrName() { |
1283 | return getAttributeNameForIndex(7); |
1284 | } |
1285 | |
1286 | static ::mlir::StringAttr getResAttrsAttrName(::mlir::OperationName name) { |
1287 | return getAttributeNameForIndex(name, 7); |
1288 | } |
1289 | |
1290 | ::mlir::StringAttr res_attrsAttrName() { |
1291 | return getAttributeNameForIndex(7); |
1292 | } |
1293 | |
1294 | static ::mlir::StringAttr res_attrsAttrName(::mlir::OperationName name) { |
1295 | return getAttributeNameForIndex(name, 7); |
1296 | } |
1297 | |
1298 | ::mlir::StringAttr getResourceArgUniqueIdsKeysAttrName() { |
1299 | return getAttributeNameForIndex(8); |
1300 | } |
1301 | |
1302 | static ::mlir::StringAttr getResourceArgUniqueIdsKeysAttrName(::mlir::OperationName name) { |
1303 | return getAttributeNameForIndex(name, 8); |
1304 | } |
1305 | |
1306 | ::mlir::StringAttr resource_arg_unique_ids_keysAttrName() { |
1307 | return getAttributeNameForIndex(8); |
1308 | } |
1309 | |
1310 | static ::mlir::StringAttr resource_arg_unique_ids_keysAttrName(::mlir::OperationName name) { |
1311 | return getAttributeNameForIndex(name, 8); |
1312 | } |
1313 | |
1314 | ::mlir::StringAttr getResourceArgUniqueIdsValuesAttrName() { |
1315 | return getAttributeNameForIndex(9); |
1316 | } |
1317 | |
1318 | static ::mlir::StringAttr getResourceArgUniqueIdsValuesAttrName(::mlir::OperationName name) { |
1319 | return getAttributeNameForIndex(name, 9); |
1320 | } |
1321 | |
1322 | ::mlir::StringAttr resource_arg_unique_ids_valuesAttrName() { |
1323 | return getAttributeNameForIndex(9); |
1324 | } |
1325 | |
1326 | static ::mlir::StringAttr resource_arg_unique_ids_valuesAttrName(::mlir::OperationName name) { |
1327 | return getAttributeNameForIndex(name, 9); |
1328 | } |
1329 | |
1330 | ::mlir::StringAttr getSymNameAttrName() { |
1331 | return getAttributeNameForIndex(10); |
1332 | } |
1333 | |
1334 | static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { |
1335 | return getAttributeNameForIndex(name, 10); |
1336 | } |
1337 | |
1338 | ::mlir::StringAttr sym_nameAttrName() { |
1339 | return getAttributeNameForIndex(10); |
1340 | } |
1341 | |
1342 | static ::mlir::StringAttr sym_nameAttrName(::mlir::OperationName name) { |
1343 | return getAttributeNameForIndex(name, 10); |
1344 | } |
1345 | |
1346 | static constexpr ::llvm::StringLiteral getOperationName() { |
1347 | return ::llvm::StringLiteral("tfg.func" ); |
1348 | } |
1349 | |
1350 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1351 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
1352 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1353 | ::mlir::Operation::result_range getODSResults(unsigned index); |
1354 | ::mlir::Region &getBody(); |
1355 | ::mlir::Region &body(); |
1356 | ::mlir::UnitAttr getGenericAttr(); |
1357 | bool getGeneric(); |
1358 | ::mlir::UnitAttr genericAttr(); |
1359 | bool generic(); |
1360 | ::mlir::StringAttr getSymNameAttr(); |
1361 | ::llvm::StringRef getSymName(); |
1362 | ::mlir::StringAttr sym_nameAttr(); |
1363 | ::llvm::StringRef sym_name(); |
1364 | ::mlir::TypeAttr getFunctionTypeAttr(); |
1365 | ::mlir::FunctionType getFunctionType(); |
1366 | ::mlir::TypeAttr function_typeAttr(); |
1367 | ::mlir::FunctionType function_type(); |
1368 | ::mlir::ArrayAttr getArgAttrsAttr(); |
1369 | ::llvm::Optional< ::mlir::ArrayAttr > getArgAttrs(); |
1370 | ::mlir::ArrayAttr arg_attrsAttr(); |
1371 | ::llvm::Optional< ::mlir::ArrayAttr > arg_attrs(); |
1372 | ::mlir::ArrayAttr getResAttrsAttr(); |
1373 | ::llvm::Optional< ::mlir::ArrayAttr > getResAttrs(); |
1374 | ::mlir::ArrayAttr res_attrsAttr(); |
1375 | ::llvm::Optional< ::mlir::ArrayAttr > res_attrs(); |
1376 | ::mlir::StringAttr getDescriptionAttr(); |
1377 | ::llvm::Optional< ::llvm::StringRef > getDescription(); |
1378 | ::mlir::StringAttr descriptionAttr(); |
1379 | ::llvm::Optional< ::llvm::StringRef > description(); |
1380 | ::mlir::UnitAttr getIsStatefulAttr(); |
1381 | bool getIsStateful(); |
1382 | ::mlir::UnitAttr is_statefulAttr(); |
1383 | bool is_stateful(); |
1384 | ::mlir::FlatSymbolRefAttr getGradientAttr(); |
1385 | ::llvm::Optional< ::llvm::StringRef > getGradient(); |
1386 | ::mlir::FlatSymbolRefAttr gradientAttr(); |
1387 | ::llvm::Optional< ::llvm::StringRef > gradient(); |
1388 | ::mlir::DenseIntElementsAttr getResourceArgUniqueIdsKeysAttr(); |
1389 | ::llvm::Optional< ::mlir::DenseIntElementsAttr > getResourceArgUniqueIdsKeys(); |
1390 | ::mlir::DenseIntElementsAttr resource_arg_unique_ids_keysAttr(); |
1391 | ::llvm::Optional< ::mlir::DenseIntElementsAttr > resource_arg_unique_ids_keys(); |
1392 | ::mlir::DenseIntElementsAttr getResourceArgUniqueIdsValuesAttr(); |
1393 | ::llvm::Optional< ::mlir::DenseIntElementsAttr > getResourceArgUniqueIdsValues(); |
1394 | ::mlir::DenseIntElementsAttr resource_arg_unique_ids_valuesAttr(); |
1395 | ::llvm::Optional< ::mlir::DenseIntElementsAttr > resource_arg_unique_ids_values(); |
1396 | ::mlir::ArrayAttr getControlOutputAttr(); |
1397 | ::llvm::Optional< ::mlir::ArrayAttr > getControlOutput(); |
1398 | ::mlir::ArrayAttr control_outputAttr(); |
1399 | ::llvm::Optional< ::mlir::ArrayAttr > control_output(); |
1400 | void setGenericAttr(::mlir::UnitAttr attr); |
1401 | void genericAttr(::mlir::UnitAttr attr); |
1402 | void setSymNameAttr(::mlir::StringAttr attr); |
1403 | void sym_nameAttr(::mlir::StringAttr attr); |
1404 | void setFunctionTypeAttr(::mlir::TypeAttr attr); |
1405 | void function_typeAttr(::mlir::TypeAttr attr); |
1406 | void setArgAttrsAttr(::mlir::ArrayAttr attr); |
1407 | void arg_attrsAttr(::mlir::ArrayAttr attr); |
1408 | void setResAttrsAttr(::mlir::ArrayAttr attr); |
1409 | void res_attrsAttr(::mlir::ArrayAttr attr); |
1410 | void setDescriptionAttr(::mlir::StringAttr attr); |
1411 | void descriptionAttr(::mlir::StringAttr attr); |
1412 | void setIsStatefulAttr(::mlir::UnitAttr attr); |
1413 | void is_statefulAttr(::mlir::UnitAttr attr); |
1414 | void setGradientAttr(::mlir::FlatSymbolRefAttr attr); |
1415 | void gradientAttr(::mlir::FlatSymbolRefAttr attr); |
1416 | void setResourceArgUniqueIdsKeysAttr(::mlir::DenseIntElementsAttr attr); |
1417 | void resource_arg_unique_ids_keysAttr(::mlir::DenseIntElementsAttr attr); |
1418 | void setResourceArgUniqueIdsValuesAttr(::mlir::DenseIntElementsAttr attr); |
1419 | void resource_arg_unique_ids_valuesAttr(::mlir::DenseIntElementsAttr attr); |
1420 | void setControlOutputAttr(::mlir::ArrayAttr attr); |
1421 | void control_outputAttr(::mlir::ArrayAttr attr); |
1422 | ::mlir::Attribute removeGenericAttr(); |
1423 | ::mlir::Attribute removeArg_attrsAttr(); |
1424 | ::mlir::Attribute removeRes_attrsAttr(); |
1425 | ::mlir::Attribute removeDescriptionAttr(); |
1426 | ::mlir::Attribute removeIs_statefulAttr(); |
1427 | ::mlir::Attribute removeGradientAttr(); |
1428 | ::mlir::Attribute removeResource_arg_unique_ids_keysAttr(); |
1429 | ::mlir::Attribute removeResource_arg_unique_ids_valuesAttr(); |
1430 | ::mlir::Attribute removeControl_outputAttr(); |
1431 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); |
1432 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, const Twine &sym_name, FunctionType type, bool generic); |
1433 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::UnitAttr generic, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr description, /*optional*/::mlir::UnitAttr is_stateful, /*optional*/::mlir::FlatSymbolRefAttr gradient, /*optional*/::mlir::DenseIntElementsAttr resource_arg_unique_ids_keys, /*optional*/::mlir::DenseIntElementsAttr resource_arg_unique_ids_values, /*optional*/::mlir::ArrayAttr control_output); |
1434 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::UnitAttr generic, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr description, /*optional*/::mlir::UnitAttr is_stateful, /*optional*/::mlir::FlatSymbolRefAttr gradient, /*optional*/::mlir::DenseIntElementsAttr resource_arg_unique_ids_keys, /*optional*/::mlir::DenseIntElementsAttr resource_arg_unique_ids_values, /*optional*/::mlir::ArrayAttr control_output); |
1435 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/bool generic, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr description, /*optional*/bool is_stateful, /*optional*/::mlir::FlatSymbolRefAttr gradient, /*optional*/::mlir::DenseIntElementsAttr resource_arg_unique_ids_keys, /*optional*/::mlir::DenseIntElementsAttr resource_arg_unique_ids_values, /*optional*/::mlir::ArrayAttr control_output); |
1436 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/bool generic, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr description, /*optional*/bool is_stateful, /*optional*/::mlir::FlatSymbolRefAttr gradient, /*optional*/::mlir::DenseIntElementsAttr resource_arg_unique_ids_keys, /*optional*/::mlir::DenseIntElementsAttr resource_arg_unique_ids_values, /*optional*/::mlir::ArrayAttr control_output); |
1437 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
1438 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
1439 | void print(::mlir::OpAsmPrinter &p); |
1440 | ::mlir::LogicalResult verifyInvariantsImpl(); |
1441 | ::mlir::LogicalResult verifyInvariants(); |
1442 | ::mlir::LogicalResult verify(); |
1443 | static ::mlir::LogicalResult canonicalize(GraphFuncOp op, ::mlir::PatternRewriter &rewriter); |
1444 | static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); |
1445 | static mlir::BlockArgument getDataValueOf(BlockArgument ctl); |
1446 | static mlir::BlockArgument getControlTokenOf(BlockArgument data); |
1447 | static mlir::BlockArgument getDataValue(Region ®ion, unsigned idx); |
1448 | private: |
1449 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
1450 | return getAttributeNameForIndex((*this)->getName(), index); |
1451 | } |
1452 | |
1453 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
1454 | assert(index < 11 && "invalid attribute index" ); |
1455 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
1456 | } |
1457 | |
1458 | public: |
1459 | TFGraphDialect *getDialect() { |
1460 | return cast<TFGraphDialect>((*this)->getDialect()); |
1461 | } |
1462 | |
1463 | // Returns true if this function is marked for JIT compilation. |
1464 | bool isMarkedForCompilation(); |
1465 | |
1466 | // Return the function called by this operation if this operation is a call |
1467 | // and the function exists in the symbol_table, otherwise return null. |
1468 | static GraphFuncOp getCalledFunction(Operation *op, |
1469 | SymbolTable &symbol_table); |
1470 | |
1471 | //===------------------------------------------------------------------===// |
1472 | // OpAsmOpInterface |
1473 | //===------------------------------------------------------------------===// |
1474 | |
1475 | // This will filter the `tfg.` prefix in front of operations inside the |
1476 | // func body. |
1477 | static StringRef getDefaultDialect() { |
1478 | return "tfg" ; |
1479 | } |
1480 | |
1481 | /// Get a special name to use when printing block arguments. |
1482 | void getAsmBlockArgumentNames(Region ®ion, OpAsmSetValueNameFn set_name_fn); |
1483 | |
1484 | //===------------------------------------------------------------------===// |
1485 | // CallableOpInterface |
1486 | //===------------------------------------------------------------------===// |
1487 | |
1488 | // Returns the region on the current operation that is callable. This may |
1489 | // return null in the case of an external callable object, e.g. an external |
1490 | // function. |
1491 | Region *getCallableRegion() { |
1492 | return isExternal() ? nullptr : &this->getRegion(); |
1493 | } |
1494 | |
1495 | // Returns the results types that the callable region produces when |
1496 | // executed. |
1497 | ArrayRef<Type> getCallableResults() { return getFunctionType().getResults(); } |
1498 | |
1499 | //===------------------------------------------------------------------===// |
1500 | // FunctionOpInterface Methods |
1501 | //===------------------------------------------------------------------===// |
1502 | |
1503 | /// Returns the argument types of this function. |
1504 | ArrayRef<Type> getArgumentTypes() { return getFunctionType().getInputs(); } |
1505 | |
1506 | /// Returns the result types of this function. |
1507 | ArrayRef<Type> getResultTypes() { return getFunctionType().getResults(); } |
1508 | |
1509 | LogicalResult verifyType(); |
1510 | LogicalResult verifyBody(); |
1511 | |
1512 | //===------------------------------------------------------------------===// |
1513 | // SymbolOpInterface Methods |
1514 | //===------------------------------------------------------------------===// |
1515 | |
1516 | bool isDeclaration() { return isExternal(); } |
1517 | }; |
1518 | } // namespace tfg |
1519 | } // namespace mlir |
1520 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::GraphFuncOp) |
1521 | |
1522 | namespace mlir { |
1523 | namespace tfg { |
1524 | |
1525 | //===----------------------------------------------------------------------===// |
1526 | // ::mlir::tfg::GraphOp declarations |
1527 | //===----------------------------------------------------------------------===// |
1528 | |
1529 | class GraphOpAdaptor { |
1530 | public: |
1531 | GraphOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
1532 | |
1533 | GraphOpAdaptor(GraphOp op); |
1534 | |
1535 | ::mlir::ValueRange getOperands(); |
1536 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1537 | ::mlir::ValueRange getODSOperands(unsigned index); |
1538 | ::mlir::DictionaryAttr getAttributes(); |
1539 | ::mlir::tf_type::VersionAttr getVersionAttr(); |
1540 | ::mlir::tf_type::VersionAttr getVersion(); |
1541 | ::mlir::tf_type::VersionAttr versionAttr(); |
1542 | ::mlir::tf_type::VersionAttr version(); |
1543 | ::mlir::RegionRange getRegions(); |
1544 | ::mlir::Region &getNodes(); |
1545 | ::mlir::Region &nodes(); |
1546 | ::mlir::LogicalResult verify(::mlir::Location loc); |
1547 | private: |
1548 | ::mlir::ValueRange odsOperands; |
1549 | ::mlir::DictionaryAttr odsAttrs; |
1550 | ::mlir::RegionRange odsRegions; |
1551 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
1552 | }; |
1553 | class GraphOp : public ::mlir::Op<GraphOp, ::mlir::OpTrait::OneRegion, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::NoTerminator, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasOnlyGraphRegion, ::mlir::OpTrait::IsIsolatedFromAbove, ::mlir::OpAsmOpInterface::Trait, ::mlir::RegionKindInterface::Trait, ::mlir::OpTrait::IntrinsicOperation> { |
1554 | public: |
1555 | using Op::Op; |
1556 | using Op::print; |
1557 | using Adaptor = GraphOpAdaptor; |
1558 | public: |
1559 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
1560 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("version" )}; |
1561 | return ::llvm::makeArrayRef(attrNames); |
1562 | } |
1563 | |
1564 | ::mlir::StringAttr getVersionAttrName() { |
1565 | return getAttributeNameForIndex(0); |
1566 | } |
1567 | |
1568 | static ::mlir::StringAttr getVersionAttrName(::mlir::OperationName name) { |
1569 | return getAttributeNameForIndex(name, 0); |
1570 | } |
1571 | |
1572 | ::mlir::StringAttr versionAttrName() { |
1573 | return getAttributeNameForIndex(0); |
1574 | } |
1575 | |
1576 | static ::mlir::StringAttr versionAttrName(::mlir::OperationName name) { |
1577 | return getAttributeNameForIndex(name, 0); |
1578 | } |
1579 | |
1580 | static constexpr ::llvm::StringLiteral getOperationName() { |
1581 | return ::llvm::StringLiteral("tfg.graph" ); |
1582 | } |
1583 | |
1584 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1585 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
1586 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1587 | ::mlir::Operation::result_range getODSResults(unsigned index); |
1588 | ::mlir::Region &getNodes(); |
1589 | ::mlir::Region &nodes(); |
1590 | ::mlir::tf_type::VersionAttr getVersionAttr(); |
1591 | ::mlir::tf_type::VersionAttr getVersion(); |
1592 | ::mlir::tf_type::VersionAttr versionAttr(); |
1593 | ::mlir::tf_type::VersionAttr version(); |
1594 | void setVersionAttr(::mlir::tf_type::VersionAttr attr); |
1595 | void versionAttr(::mlir::tf_type::VersionAttr attr); |
1596 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::tf_type::VersionAttr version); |
1597 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::tf_type::VersionAttr version); |
1598 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
1599 | ::mlir::LogicalResult verifyInvariantsImpl(); |
1600 | ::mlir::LogicalResult verifyInvariants(); |
1601 | ::mlir::LogicalResult verify(); |
1602 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
1603 | void print(::mlir::OpAsmPrinter &_odsPrinter); |
1604 | private: |
1605 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
1606 | return getAttributeNameForIndex((*this)->getName(), index); |
1607 | } |
1608 | |
1609 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
1610 | assert(index < 1 && "invalid attribute index" ); |
1611 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
1612 | } |
1613 | |
1614 | public: |
1615 | TFGraphDialect *getDialect() { |
1616 | return cast<TFGraphDialect>((*this)->getDialect()); |
1617 | } |
1618 | |
1619 | // Override the getOps() inherited from the OneRegion trait to return a |
1620 | // range of TFOp instead of the generic mlir::Operation. |
1621 | auto getOps() { return getRegion().template getOps<TFOp>(); } |
1622 | |
1623 | //===------------------------------------------------------------------===// |
1624 | // OpAsmOpInterface |
1625 | //===------------------------------------------------------------------===// |
1626 | |
1627 | // This will filter the `tfg.` prefix in front of operations inside the |
1628 | // graph body. |
1629 | static StringRef getDefaultDialect() { |
1630 | return "tfg" ; |
1631 | } |
1632 | }; |
1633 | } // namespace tfg |
1634 | } // namespace mlir |
1635 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::GraphOp) |
1636 | |
1637 | namespace mlir { |
1638 | namespace tfg { |
1639 | |
1640 | //===----------------------------------------------------------------------===// |
1641 | // ::mlir::tfg::IfOp declarations |
1642 | //===----------------------------------------------------------------------===// |
1643 | |
1644 | class IfOpAdaptor { |
1645 | public: |
1646 | IfOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
1647 | |
1648 | IfOpAdaptor(IfOp op); |
1649 | |
1650 | ::mlir::ValueRange getOperands(); |
1651 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1652 | ::mlir::ValueRange getODSOperands(unsigned index); |
1653 | ::mlir::Value getCond(); |
1654 | ::mlir::Value cond(); |
1655 | ::mlir::ValueRange getArgs(); |
1656 | ::mlir::ValueRange args(); |
1657 | ::mlir::DictionaryAttr getAttributes(); |
1658 | ::mlir::tf_type::FuncAttr getThenBranchAttr(); |
1659 | ::mlir::tf_type::FuncAttr getThenBranch(); |
1660 | ::mlir::tf_type::FuncAttr then_branchAttr(); |
1661 | ::mlir::tf_type::FuncAttr then_branch(); |
1662 | ::mlir::tf_type::FuncAttr getElseBranchAttr(); |
1663 | ::mlir::tf_type::FuncAttr getElseBranch(); |
1664 | ::mlir::tf_type::FuncAttr else_branchAttr(); |
1665 | ::mlir::tf_type::FuncAttr else_branch(); |
1666 | ::mlir::TypeAttr getTcondAttr(); |
1667 | ::llvm::Optional<::mlir::Type> getTcond(); |
1668 | ::mlir::TypeAttr TcondAttr(); |
1669 | ::llvm::Optional<::mlir::Type> Tcond(); |
1670 | ::mlir::ArrayAttr getTinAttr(); |
1671 | ::llvm::Optional< ::mlir::ArrayAttr > getTin(); |
1672 | ::mlir::ArrayAttr TinAttr(); |
1673 | ::llvm::Optional< ::mlir::ArrayAttr > Tin(); |
1674 | ::mlir::ArrayAttr getToutAttr(); |
1675 | ::llvm::Optional< ::mlir::ArrayAttr > getTout(); |
1676 | ::mlir::ArrayAttr ToutAttr(); |
1677 | ::llvm::Optional< ::mlir::ArrayAttr > Tout(); |
1678 | ::mlir::ArrayAttr getOutputShapesAttr(); |
1679 | ::llvm::Optional< ::mlir::ArrayAttr > getOutputShapes(); |
1680 | ::mlir::ArrayAttr output_shapesAttr(); |
1681 | ::llvm::Optional< ::mlir::ArrayAttr > output_shapes(); |
1682 | ::mlir::LogicalResult verify(::mlir::Location loc); |
1683 | private: |
1684 | ::mlir::ValueRange odsOperands; |
1685 | ::mlir::DictionaryAttr odsAttrs; |
1686 | ::mlir::RegionRange odsRegions; |
1687 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
1688 | }; |
1689 | class IfOp : public ::mlir::Op<IfOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::SymbolUserOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { |
1690 | public: |
1691 | using Op::Op; |
1692 | using Op::print; |
1693 | using Adaptor = IfOpAdaptor; |
1694 | public: |
1695 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
1696 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcond" ), ::llvm::StringRef("Tin" ), ::llvm::StringRef("Tout" ), ::llvm::StringRef("else_branch" ), ::llvm::StringRef("output_shapes" ), ::llvm::StringRef("then_branch" )}; |
1697 | return ::llvm::makeArrayRef(attrNames); |
1698 | } |
1699 | |
1700 | ::mlir::StringAttr getTcondAttrName() { |
1701 | return getAttributeNameForIndex(0); |
1702 | } |
1703 | |
1704 | static ::mlir::StringAttr getTcondAttrName(::mlir::OperationName name) { |
1705 | return getAttributeNameForIndex(name, 0); |
1706 | } |
1707 | |
1708 | ::mlir::StringAttr TcondAttrName() { |
1709 | return getAttributeNameForIndex(0); |
1710 | } |
1711 | |
1712 | static ::mlir::StringAttr TcondAttrName(::mlir::OperationName name) { |
1713 | return getAttributeNameForIndex(name, 0); |
1714 | } |
1715 | |
1716 | ::mlir::StringAttr getTinAttrName() { |
1717 | return getAttributeNameForIndex(1); |
1718 | } |
1719 | |
1720 | static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { |
1721 | return getAttributeNameForIndex(name, 1); |
1722 | } |
1723 | |
1724 | ::mlir::StringAttr TinAttrName() { |
1725 | return getAttributeNameForIndex(1); |
1726 | } |
1727 | |
1728 | static ::mlir::StringAttr TinAttrName(::mlir::OperationName name) { |
1729 | return getAttributeNameForIndex(name, 1); |
1730 | } |
1731 | |
1732 | ::mlir::StringAttr getToutAttrName() { |
1733 | return getAttributeNameForIndex(2); |
1734 | } |
1735 | |
1736 | static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { |
1737 | return getAttributeNameForIndex(name, 2); |
1738 | } |
1739 | |
1740 | ::mlir::StringAttr ToutAttrName() { |
1741 | return getAttributeNameForIndex(2); |
1742 | } |
1743 | |
1744 | static ::mlir::StringAttr ToutAttrName(::mlir::OperationName name) { |
1745 | return getAttributeNameForIndex(name, 2); |
1746 | } |
1747 | |
1748 | ::mlir::StringAttr getElseBranchAttrName() { |
1749 | return getAttributeNameForIndex(3); |
1750 | } |
1751 | |
1752 | static ::mlir::StringAttr getElseBranchAttrName(::mlir::OperationName name) { |
1753 | return getAttributeNameForIndex(name, 3); |
1754 | } |
1755 | |
1756 | ::mlir::StringAttr else_branchAttrName() { |
1757 | return getAttributeNameForIndex(3); |
1758 | } |
1759 | |
1760 | static ::mlir::StringAttr else_branchAttrName(::mlir::OperationName name) { |
1761 | return getAttributeNameForIndex(name, 3); |
1762 | } |
1763 | |
1764 | ::mlir::StringAttr getOutputShapesAttrName() { |
1765 | return getAttributeNameForIndex(4); |
1766 | } |
1767 | |
1768 | static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { |
1769 | return getAttributeNameForIndex(name, 4); |
1770 | } |
1771 | |
1772 | ::mlir::StringAttr output_shapesAttrName() { |
1773 | return getAttributeNameForIndex(4); |
1774 | } |
1775 | |
1776 | static ::mlir::StringAttr output_shapesAttrName(::mlir::OperationName name) { |
1777 | return getAttributeNameForIndex(name, 4); |
1778 | } |
1779 | |
1780 | ::mlir::StringAttr getThenBranchAttrName() { |
1781 | return getAttributeNameForIndex(5); |
1782 | } |
1783 | |
1784 | static ::mlir::StringAttr getThenBranchAttrName(::mlir::OperationName name) { |
1785 | return getAttributeNameForIndex(name, 5); |
1786 | } |
1787 | |
1788 | ::mlir::StringAttr then_branchAttrName() { |
1789 | return getAttributeNameForIndex(5); |
1790 | } |
1791 | |
1792 | static ::mlir::StringAttr then_branchAttrName(::mlir::OperationName name) { |
1793 | return getAttributeNameForIndex(name, 5); |
1794 | } |
1795 | |
1796 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
1797 | static constexpr ::llvm::StringLiteral getOperationName() { |
1798 | return ::llvm::StringLiteral("tfg.If" ); |
1799 | } |
1800 | |
1801 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1802 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
1803 | ::mlir::Value getCond(); |
1804 | ::mlir::Value cond(); |
1805 | ::mlir::Operation::operand_range getArgs(); |
1806 | ::mlir::Operation::operand_range args(); |
1807 | ::mlir::MutableOperandRange getCondMutable(); |
1808 | ::mlir::MutableOperandRange condMutable(); |
1809 | ::mlir::MutableOperandRange getArgsMutable(); |
1810 | ::mlir::MutableOperandRange argsMutable(); |
1811 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1812 | ::mlir::Operation::result_range getODSResults(unsigned index); |
1813 | ::mlir::Operation::result_range getOuts(); |
1814 | ::mlir::Operation::result_range outs(); |
1815 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
1816 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
1817 | ::mlir::tf_type::FuncAttr getThenBranchAttr(); |
1818 | ::mlir::tf_type::FuncAttr getThenBranch(); |
1819 | ::mlir::tf_type::FuncAttr then_branchAttr(); |
1820 | ::mlir::tf_type::FuncAttr then_branch(); |
1821 | ::mlir::tf_type::FuncAttr getElseBranchAttr(); |
1822 | ::mlir::tf_type::FuncAttr getElseBranch(); |
1823 | ::mlir::tf_type::FuncAttr else_branchAttr(); |
1824 | ::mlir::tf_type::FuncAttr else_branch(); |
1825 | ::mlir::TypeAttr getTcondAttr(); |
1826 | ::llvm::Optional<::mlir::Type> getTcond(); |
1827 | ::mlir::TypeAttr TcondAttr(); |
1828 | ::llvm::Optional<::mlir::Type> Tcond(); |
1829 | ::mlir::ArrayAttr getTinAttr(); |
1830 | ::llvm::Optional< ::mlir::ArrayAttr > getTin(); |
1831 | ::mlir::ArrayAttr TinAttr(); |
1832 | ::llvm::Optional< ::mlir::ArrayAttr > Tin(); |
1833 | ::mlir::ArrayAttr getToutAttr(); |
1834 | ::llvm::Optional< ::mlir::ArrayAttr > getTout(); |
1835 | ::mlir::ArrayAttr ToutAttr(); |
1836 | ::llvm::Optional< ::mlir::ArrayAttr > Tout(); |
1837 | ::mlir::ArrayAttr getOutputShapesAttr(); |
1838 | ::llvm::Optional< ::mlir::ArrayAttr > getOutputShapes(); |
1839 | ::mlir::ArrayAttr output_shapesAttr(); |
1840 | ::llvm::Optional< ::mlir::ArrayAttr > output_shapes(); |
1841 | void setThenBranchAttr(::mlir::tf_type::FuncAttr attr); |
1842 | void then_branchAttr(::mlir::tf_type::FuncAttr attr); |
1843 | void setElseBranchAttr(::mlir::tf_type::FuncAttr attr); |
1844 | void else_branchAttr(::mlir::tf_type::FuncAttr attr); |
1845 | void setTcondAttr(::mlir::TypeAttr attr); |
1846 | void TcondAttr(::mlir::TypeAttr attr); |
1847 | void setTinAttr(::mlir::ArrayAttr attr); |
1848 | void TinAttr(::mlir::ArrayAttr attr); |
1849 | void setToutAttr(::mlir::ArrayAttr attr); |
1850 | void ToutAttr(::mlir::ArrayAttr attr); |
1851 | void setOutputShapesAttr(::mlir::ArrayAttr attr); |
1852 | void output_shapesAttr(::mlir::ArrayAttr attr); |
1853 | ::mlir::Attribute removeTcondAttr(); |
1854 | ::mlir::Attribute removeTinAttr(); |
1855 | ::mlir::Attribute removeToutAttr(); |
1856 | ::mlir::Attribute removeOutput_shapesAttr(); |
1857 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange results, Value cond, ValueRange args, FuncAttr then_branch, FuncAttr else_branch); |
1858 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::Value cond, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr then_branch, ::mlir::tf_type::FuncAttr else_branch, /*optional*/::mlir::TypeAttr Tcond, /*optional*/::mlir::ArrayAttr Tin, /*optional*/::mlir::ArrayAttr Tout, /*optional*/::mlir::ArrayAttr output_shapes); |
1859 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value cond, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr then_branch, ::mlir::tf_type::FuncAttr else_branch, /*optional*/::mlir::TypeAttr Tcond, /*optional*/::mlir::ArrayAttr Tin, /*optional*/::mlir::ArrayAttr Tout, /*optional*/::mlir::ArrayAttr output_shapes); |
1860 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
1861 | ::mlir::LogicalResult verifyInvariantsImpl(); |
1862 | ::mlir::LogicalResult verifyInvariants(); |
1863 | ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); |
1864 | private: |
1865 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
1866 | return getAttributeNameForIndex((*this)->getName(), index); |
1867 | } |
1868 | |
1869 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
1870 | assert(index < 6 && "invalid attribute index" ); |
1871 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
1872 | } |
1873 | |
1874 | public: |
1875 | }; |
1876 | } // namespace tfg |
1877 | } // namespace mlir |
1878 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::IfOp) |
1879 | |
1880 | namespace mlir { |
1881 | namespace tfg { |
1882 | |
1883 | //===----------------------------------------------------------------------===// |
1884 | // ::mlir::tfg::IfRegionOp declarations |
1885 | //===----------------------------------------------------------------------===// |
1886 | |
1887 | class IfRegionOpAdaptor { |
1888 | public: |
1889 | IfRegionOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
1890 | |
1891 | IfRegionOpAdaptor(IfRegionOp op); |
1892 | |
1893 | ::mlir::ValueRange getOperands(); |
1894 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1895 | ::mlir::ValueRange getODSOperands(unsigned index); |
1896 | ::mlir::Value getCond(); |
1897 | ::mlir::Value cond(); |
1898 | ::mlir::ValueRange getCtls(); |
1899 | ::mlir::ValueRange ctls(); |
1900 | ::mlir::DictionaryAttr getAttributes(); |
1901 | ::mlir::DictionaryAttr getThenAttrsAttr(); |
1902 | ::llvm::Optional< ::mlir::DictionaryAttr > getThenAttrs(); |
1903 | ::mlir::DictionaryAttr then_attrsAttr(); |
1904 | ::llvm::Optional< ::mlir::DictionaryAttr > then_attrs(); |
1905 | ::mlir::DictionaryAttr getElseAttrsAttr(); |
1906 | ::llvm::Optional< ::mlir::DictionaryAttr > getElseAttrs(); |
1907 | ::mlir::DictionaryAttr else_attrsAttr(); |
1908 | ::llvm::Optional< ::mlir::DictionaryAttr > else_attrs(); |
1909 | ::mlir::tfg::RegionAttr getThenRegionAttrsAttr(); |
1910 | ::llvm::Optional<::mlir::tfg::RegionAttr> getThenRegionAttrs(); |
1911 | ::mlir::tfg::RegionAttr then_region_attrsAttr(); |
1912 | ::llvm::Optional<::mlir::tfg::RegionAttr> then_region_attrs(); |
1913 | ::mlir::tfg::RegionAttr getElseRegionAttrsAttr(); |
1914 | ::llvm::Optional<::mlir::tfg::RegionAttr> getElseRegionAttrs(); |
1915 | ::mlir::tfg::RegionAttr else_region_attrsAttr(); |
1916 | ::llvm::Optional<::mlir::tfg::RegionAttr> else_region_attrs(); |
1917 | ::mlir::RegionRange getRegions(); |
1918 | ::mlir::Region &getThenRegion(); |
1919 | ::mlir::Region &then_region(); |
1920 | ::mlir::Region &getElseRegion(); |
1921 | ::mlir::Region &else_region(); |
1922 | ::mlir::LogicalResult verify(::mlir::Location loc); |
1923 | private: |
1924 | ::mlir::ValueRange odsOperands; |
1925 | ::mlir::DictionaryAttr odsAttrs; |
1926 | ::mlir::RegionRange odsRegions; |
1927 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
1928 | }; |
1929 | class IfRegionOp : public ::mlir::Op<IfRegionOp, ::mlir::OpTrait::NRegions<2>::Impl, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasOnlyGraphRegion, ::mlir::RegionKindInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::tfg::PreservedAttributesInterface::Trait, ::mlir::RegionBranchOpInterface::Trait, ::mlir::tfg::ControlArgumentInterface::Trait> { |
1930 | public: |
1931 | using Op::Op; |
1932 | using Op::print; |
1933 | using Adaptor = IfRegionOpAdaptor; |
1934 | public: |
1935 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
1936 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("else_attrs" ), ::llvm::StringRef("else_region_attrs" ), ::llvm::StringRef("then_attrs" ), ::llvm::StringRef("then_region_attrs" )}; |
1937 | return ::llvm::makeArrayRef(attrNames); |
1938 | } |
1939 | |
1940 | ::mlir::StringAttr getElseAttrsAttrName() { |
1941 | return getAttributeNameForIndex(0); |
1942 | } |
1943 | |
1944 | static ::mlir::StringAttr getElseAttrsAttrName(::mlir::OperationName name) { |
1945 | return getAttributeNameForIndex(name, 0); |
1946 | } |
1947 | |
1948 | ::mlir::StringAttr else_attrsAttrName() { |
1949 | return getAttributeNameForIndex(0); |
1950 | } |
1951 | |
1952 | static ::mlir::StringAttr else_attrsAttrName(::mlir::OperationName name) { |
1953 | return getAttributeNameForIndex(name, 0); |
1954 | } |
1955 | |
1956 | ::mlir::StringAttr getElseRegionAttrsAttrName() { |
1957 | return getAttributeNameForIndex(1); |
1958 | } |
1959 | |
1960 | static ::mlir::StringAttr getElseRegionAttrsAttrName(::mlir::OperationName name) { |
1961 | return getAttributeNameForIndex(name, 1); |
1962 | } |
1963 | |
1964 | ::mlir::StringAttr else_region_attrsAttrName() { |
1965 | return getAttributeNameForIndex(1); |
1966 | } |
1967 | |
1968 | static ::mlir::StringAttr else_region_attrsAttrName(::mlir::OperationName name) { |
1969 | return getAttributeNameForIndex(name, 1); |
1970 | } |
1971 | |
1972 | ::mlir::StringAttr getThenAttrsAttrName() { |
1973 | return getAttributeNameForIndex(2); |
1974 | } |
1975 | |
1976 | static ::mlir::StringAttr getThenAttrsAttrName(::mlir::OperationName name) { |
1977 | return getAttributeNameForIndex(name, 2); |
1978 | } |
1979 | |
1980 | ::mlir::StringAttr then_attrsAttrName() { |
1981 | return getAttributeNameForIndex(2); |
1982 | } |
1983 | |
1984 | static ::mlir::StringAttr then_attrsAttrName(::mlir::OperationName name) { |
1985 | return getAttributeNameForIndex(name, 2); |
1986 | } |
1987 | |
1988 | ::mlir::StringAttr getThenRegionAttrsAttrName() { |
1989 | return getAttributeNameForIndex(3); |
1990 | } |
1991 | |
1992 | static ::mlir::StringAttr getThenRegionAttrsAttrName(::mlir::OperationName name) { |
1993 | return getAttributeNameForIndex(name, 3); |
1994 | } |
1995 | |
1996 | ::mlir::StringAttr then_region_attrsAttrName() { |
1997 | return getAttributeNameForIndex(3); |
1998 | } |
1999 | |
2000 | static ::mlir::StringAttr then_region_attrsAttrName(::mlir::OperationName name) { |
2001 | return getAttributeNameForIndex(name, 3); |
2002 | } |
2003 | |
2004 | static constexpr ::llvm::StringLiteral getOperationName() { |
2005 | return ::llvm::StringLiteral("tfg.IfRegion" ); |
2006 | } |
2007 | |
2008 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2009 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
2010 | ::mlir::TypedValue<::mlir::TensorType> getCond(); |
2011 | ::mlir::TypedValue<::mlir::TensorType> cond(); |
2012 | ::mlir::Operation::operand_range getCtls(); |
2013 | ::mlir::Operation::operand_range ctls(); |
2014 | ::mlir::MutableOperandRange getCondMutable(); |
2015 | ::mlir::MutableOperandRange condMutable(); |
2016 | ::mlir::MutableOperandRange getCtlsMutable(); |
2017 | ::mlir::MutableOperandRange ctlsMutable(); |
2018 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2019 | ::mlir::Operation::result_range getODSResults(unsigned index); |
2020 | ::mlir::Operation::result_range getOuts(); |
2021 | ::mlir::Operation::result_range outs(); |
2022 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
2023 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
2024 | ::mlir::Region &getThenRegion(); |
2025 | ::mlir::Region &then_region(); |
2026 | ::mlir::Region &getElseRegion(); |
2027 | ::mlir::Region &else_region(); |
2028 | ::mlir::DictionaryAttr getThenAttrsAttr(); |
2029 | ::llvm::Optional< ::mlir::DictionaryAttr > getThenAttrs(); |
2030 | ::mlir::DictionaryAttr then_attrsAttr(); |
2031 | ::llvm::Optional< ::mlir::DictionaryAttr > then_attrs(); |
2032 | ::mlir::DictionaryAttr getElseAttrsAttr(); |
2033 | ::llvm::Optional< ::mlir::DictionaryAttr > getElseAttrs(); |
2034 | ::mlir::DictionaryAttr else_attrsAttr(); |
2035 | ::llvm::Optional< ::mlir::DictionaryAttr > else_attrs(); |
2036 | ::mlir::tfg::RegionAttr getThenRegionAttrsAttr(); |
2037 | ::llvm::Optional<::mlir::tfg::RegionAttr> getThenRegionAttrs(); |
2038 | ::mlir::tfg::RegionAttr then_region_attrsAttr(); |
2039 | ::llvm::Optional<::mlir::tfg::RegionAttr> then_region_attrs(); |
2040 | ::mlir::tfg::RegionAttr getElseRegionAttrsAttr(); |
2041 | ::llvm::Optional<::mlir::tfg::RegionAttr> getElseRegionAttrs(); |
2042 | ::mlir::tfg::RegionAttr else_region_attrsAttr(); |
2043 | ::llvm::Optional<::mlir::tfg::RegionAttr> else_region_attrs(); |
2044 | void setThenAttrsAttr(::mlir::DictionaryAttr attr); |
2045 | void then_attrsAttr(::mlir::DictionaryAttr attr); |
2046 | void setElseAttrsAttr(::mlir::DictionaryAttr attr); |
2047 | void else_attrsAttr(::mlir::DictionaryAttr attr); |
2048 | void setThenRegionAttrsAttr(::mlir::tfg::RegionAttr attr); |
2049 | void then_region_attrsAttr(::mlir::tfg::RegionAttr attr); |
2050 | void setElseRegionAttrsAttr(::mlir::tfg::RegionAttr attr); |
2051 | void else_region_attrsAttr(::mlir::tfg::RegionAttr attr); |
2052 | ::mlir::Attribute removeThen_attrsAttr(); |
2053 | ::mlir::Attribute removeElse_attrsAttr(); |
2054 | ::mlir::Attribute removeThen_region_attrsAttr(); |
2055 | ::mlir::Attribute removeElse_region_attrsAttr(); |
2056 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::Value cond, ::mlir::ValueRange ctls, /*optional*/::mlir::DictionaryAttr then_attrs, /*optional*/::mlir::DictionaryAttr else_attrs, /*optional*/::mlir::tfg::RegionAttr then_region_attrs, /*optional*/::mlir::tfg::RegionAttr else_region_attrs); |
2057 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value cond, ::mlir::ValueRange ctls, /*optional*/::mlir::DictionaryAttr then_attrs, /*optional*/::mlir::DictionaryAttr else_attrs, /*optional*/::mlir::tfg::RegionAttr then_region_attrs, /*optional*/::mlir::tfg::RegionAttr else_region_attrs); |
2058 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
2059 | ::mlir::LogicalResult verifyInvariantsImpl(); |
2060 | ::mlir::LogicalResult verifyInvariants(); |
2061 | ::mlir::LogicalResult verify(); |
2062 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
2063 | static ::llvm::StringRef getDefaultDialect(); |
2064 | void getSuccessorRegions(::llvm::Optional<unsigned> index, ::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); |
2065 | void getRegionInvocationBounds(::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::InvocationBounds> &invocationBounds); |
2066 | static mlir::BlockArgument getDataValueOf(BlockArgument ctl); |
2067 | static mlir::BlockArgument getControlTokenOf(BlockArgument data); |
2068 | static mlir::BlockArgument getDataValue(Region ®ion, unsigned idx); |
2069 | static mlir::BlockArgument getControlToken(Region ®ion, unsigned idx); |
2070 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
2071 | void print(::mlir::OpAsmPrinter &_odsPrinter); |
2072 | private: |
2073 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
2074 | return getAttributeNameForIndex((*this)->getName(), index); |
2075 | } |
2076 | |
2077 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
2078 | assert(index < 4 && "invalid attribute index" ); |
2079 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
2080 | } |
2081 | |
2082 | public: |
2083 | Block &then_block() { return then_region().front(); } |
2084 | Block &else_block() { return else_region().front(); } |
2085 | YieldOp then_yield(); |
2086 | YieldOp else_yield(); |
2087 | |
2088 | bool areTypesCompatible(Type lhs, Type rhs) { |
2089 | return tf_type::HasCompatibleElementTypes(lhs, rhs); |
2090 | } |
2091 | |
2092 | RegionAttr getPreservedAttrs(unsigned index) { |
2093 | if (index == 0) return then_region_attrsAttr(); |
2094 | return else_region_attrsAttr(); |
2095 | } |
2096 | void setPreservedAttrs(unsigned index, RegionAttr attrs) { |
2097 | if (index == 0) then_region_attrsAttr(attrs); |
2098 | else else_region_attrsAttr(attrs); |
2099 | } |
2100 | }; |
2101 | } // namespace tfg |
2102 | } // namespace mlir |
2103 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::IfRegionOp) |
2104 | |
2105 | namespace mlir { |
2106 | namespace tfg { |
2107 | |
2108 | //===----------------------------------------------------------------------===// |
2109 | // ::mlir::tfg::ReturnOp declarations |
2110 | //===----------------------------------------------------------------------===// |
2111 | |
2112 | class ReturnOpAdaptor { |
2113 | public: |
2114 | ReturnOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
2115 | |
2116 | ReturnOpAdaptor(ReturnOp op); |
2117 | |
2118 | ::mlir::ValueRange getOperands(); |
2119 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2120 | ::mlir::ValueRange getODSOperands(unsigned index); |
2121 | ::mlir::ValueRange operands(); |
2122 | ::mlir::DictionaryAttr getAttributes(); |
2123 | ::mlir::ArrayAttr getControlRetAttrsAttr(); |
2124 | ::mlir::ArrayAttr getControlRetAttrs(); |
2125 | ::mlir::ArrayAttr control_ret_attrsAttr(); |
2126 | ::mlir::ArrayAttr control_ret_attrs(); |
2127 | ::mlir::LogicalResult verify(::mlir::Location loc); |
2128 | private: |
2129 | ::mlir::ValueRange odsOperands; |
2130 | ::mlir::DictionaryAttr odsAttrs; |
2131 | ::mlir::RegionRange odsRegions; |
2132 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
2133 | }; |
2134 | class ReturnOp : public ::mlir::Op<ReturnOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::HasParent<GraphFuncOp>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ReturnLike, ::mlir::OpTrait::IsTerminator, ::mlir::OpTrait::IntrinsicOperation> { |
2135 | public: |
2136 | using Op::Op; |
2137 | using Op::print; |
2138 | using Adaptor = ReturnOpAdaptor; |
2139 | public: |
2140 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
2141 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("control_ret_attrs" )}; |
2142 | return ::llvm::makeArrayRef(attrNames); |
2143 | } |
2144 | |
2145 | ::mlir::StringAttr getControlRetAttrsAttrName() { |
2146 | return getAttributeNameForIndex(0); |
2147 | } |
2148 | |
2149 | static ::mlir::StringAttr getControlRetAttrsAttrName(::mlir::OperationName name) { |
2150 | return getAttributeNameForIndex(name, 0); |
2151 | } |
2152 | |
2153 | ::mlir::StringAttr control_ret_attrsAttrName() { |
2154 | return getAttributeNameForIndex(0); |
2155 | } |
2156 | |
2157 | static ::mlir::StringAttr control_ret_attrsAttrName(::mlir::OperationName name) { |
2158 | return getAttributeNameForIndex(name, 0); |
2159 | } |
2160 | |
2161 | static constexpr ::llvm::StringLiteral getOperationName() { |
2162 | return ::llvm::StringLiteral("tfg.return" ); |
2163 | } |
2164 | |
2165 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2166 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
2167 | ::mlir::Operation::operand_range operands(); |
2168 | ::mlir::MutableOperandRange operandsMutable(); |
2169 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2170 | ::mlir::Operation::result_range getODSResults(unsigned index); |
2171 | ::mlir::ArrayAttr getControlRetAttrsAttr(); |
2172 | ::mlir::ArrayAttr getControlRetAttrs(); |
2173 | ::mlir::ArrayAttr control_ret_attrsAttr(); |
2174 | ::mlir::ArrayAttr control_ret_attrs(); |
2175 | void setControlRetAttrsAttr(::mlir::ArrayAttr attr); |
2176 | void control_ret_attrsAttr(::mlir::ArrayAttr attr); |
2177 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, ValueRange control_operands); |
2178 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::mlir::ArrayAttr control_ret_attrs); |
2179 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::mlir::ArrayAttr control_ret_attrs); |
2180 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
2181 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
2182 | void print(::mlir::OpAsmPrinter &p); |
2183 | ::mlir::LogicalResult verifyInvariantsImpl(); |
2184 | ::mlir::LogicalResult verifyInvariants(); |
2185 | ::mlir::LogicalResult verify(); |
2186 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
2187 | private: |
2188 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
2189 | return getAttributeNameForIndex((*this)->getName(), index); |
2190 | } |
2191 | |
2192 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
2193 | assert(index < 1 && "invalid attribute index" ); |
2194 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
2195 | } |
2196 | |
2197 | public: |
2198 | }; |
2199 | } // namespace tfg |
2200 | } // namespace mlir |
2201 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::ReturnOp) |
2202 | |
2203 | namespace mlir { |
2204 | namespace tfg { |
2205 | |
2206 | //===----------------------------------------------------------------------===// |
2207 | // ::mlir::tfg::StatefulCaseOp declarations |
2208 | //===----------------------------------------------------------------------===// |
2209 | |
2210 | class StatefulCaseOpAdaptor { |
2211 | public: |
2212 | StatefulCaseOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
2213 | |
2214 | StatefulCaseOpAdaptor(StatefulCaseOp op); |
2215 | |
2216 | ::mlir::ValueRange getOperands(); |
2217 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2218 | ::mlir::ValueRange getODSOperands(unsigned index); |
2219 | ::mlir::Value getBranchIndex(); |
2220 | ::mlir::Value branch_index(); |
2221 | ::mlir::ValueRange getArgs(); |
2222 | ::mlir::ValueRange args(); |
2223 | ::mlir::DictionaryAttr getAttributes(); |
2224 | ::mlir::ArrayAttr getBranchesAttr(); |
2225 | ::mlir::ArrayAttr getBranches(); |
2226 | ::mlir::ArrayAttr branchesAttr(); |
2227 | ::mlir::ArrayAttr branches(); |
2228 | ::mlir::ArrayAttr getTinAttr(); |
2229 | ::llvm::Optional< ::mlir::ArrayAttr > getTin(); |
2230 | ::mlir::ArrayAttr TinAttr(); |
2231 | ::llvm::Optional< ::mlir::ArrayAttr > Tin(); |
2232 | ::mlir::ArrayAttr getToutAttr(); |
2233 | ::llvm::Optional< ::mlir::ArrayAttr > getTout(); |
2234 | ::mlir::ArrayAttr ToutAttr(); |
2235 | ::llvm::Optional< ::mlir::ArrayAttr > Tout(); |
2236 | ::mlir::ArrayAttr getOutputShapesAttr(); |
2237 | ::llvm::Optional< ::mlir::ArrayAttr > getOutputShapes(); |
2238 | ::mlir::ArrayAttr output_shapesAttr(); |
2239 | ::llvm::Optional< ::mlir::ArrayAttr > output_shapes(); |
2240 | ::mlir::LogicalResult verify(::mlir::Location loc); |
2241 | private: |
2242 | ::mlir::ValueRange odsOperands; |
2243 | ::mlir::DictionaryAttr odsAttrs; |
2244 | ::mlir::RegionRange odsRegions; |
2245 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
2246 | }; |
2247 | class StatefulCaseOp : public ::mlir::Op<StatefulCaseOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::SymbolUserOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { |
2248 | public: |
2249 | using Op::Op; |
2250 | using Op::print; |
2251 | using Adaptor = StatefulCaseOpAdaptor; |
2252 | public: |
2253 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
2254 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin" ), ::llvm::StringRef("Tout" ), ::llvm::StringRef("branches" ), ::llvm::StringRef("output_shapes" )}; |
2255 | return ::llvm::makeArrayRef(attrNames); |
2256 | } |
2257 | |
2258 | ::mlir::StringAttr getTinAttrName() { |
2259 | return getAttributeNameForIndex(0); |
2260 | } |
2261 | |
2262 | static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { |
2263 | return getAttributeNameForIndex(name, 0); |
2264 | } |
2265 | |
2266 | ::mlir::StringAttr TinAttrName() { |
2267 | return getAttributeNameForIndex(0); |
2268 | } |
2269 | |
2270 | static ::mlir::StringAttr TinAttrName(::mlir::OperationName name) { |
2271 | return getAttributeNameForIndex(name, 0); |
2272 | } |
2273 | |
2274 | ::mlir::StringAttr getToutAttrName() { |
2275 | return getAttributeNameForIndex(1); |
2276 | } |
2277 | |
2278 | static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { |
2279 | return getAttributeNameForIndex(name, 1); |
2280 | } |
2281 | |
2282 | ::mlir::StringAttr ToutAttrName() { |
2283 | return getAttributeNameForIndex(1); |
2284 | } |
2285 | |
2286 | static ::mlir::StringAttr ToutAttrName(::mlir::OperationName name) { |
2287 | return getAttributeNameForIndex(name, 1); |
2288 | } |
2289 | |
2290 | ::mlir::StringAttr getBranchesAttrName() { |
2291 | return getAttributeNameForIndex(2); |
2292 | } |
2293 | |
2294 | static ::mlir::StringAttr getBranchesAttrName(::mlir::OperationName name) { |
2295 | return getAttributeNameForIndex(name, 2); |
2296 | } |
2297 | |
2298 | ::mlir::StringAttr branchesAttrName() { |
2299 | return getAttributeNameForIndex(2); |
2300 | } |
2301 | |
2302 | static ::mlir::StringAttr branchesAttrName(::mlir::OperationName name) { |
2303 | return getAttributeNameForIndex(name, 2); |
2304 | } |
2305 | |
2306 | ::mlir::StringAttr getOutputShapesAttrName() { |
2307 | return getAttributeNameForIndex(3); |
2308 | } |
2309 | |
2310 | static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { |
2311 | return getAttributeNameForIndex(name, 3); |
2312 | } |
2313 | |
2314 | ::mlir::StringAttr output_shapesAttrName() { |
2315 | return getAttributeNameForIndex(3); |
2316 | } |
2317 | |
2318 | static ::mlir::StringAttr output_shapesAttrName(::mlir::OperationName name) { |
2319 | return getAttributeNameForIndex(name, 3); |
2320 | } |
2321 | |
2322 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
2323 | static constexpr ::llvm::StringLiteral getOperationName() { |
2324 | return ::llvm::StringLiteral("tfg.StatefulCase" ); |
2325 | } |
2326 | |
2327 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2328 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
2329 | ::mlir::Value getBranchIndex(); |
2330 | ::mlir::Value branch_index(); |
2331 | ::mlir::Operation::operand_range getArgs(); |
2332 | ::mlir::Operation::operand_range args(); |
2333 | ::mlir::MutableOperandRange getBranchIndexMutable(); |
2334 | ::mlir::MutableOperandRange branch_indexMutable(); |
2335 | ::mlir::MutableOperandRange getArgsMutable(); |
2336 | ::mlir::MutableOperandRange argsMutable(); |
2337 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2338 | ::mlir::Operation::result_range getODSResults(unsigned index); |
2339 | ::mlir::Operation::result_range getOuts(); |
2340 | ::mlir::Operation::result_range outs(); |
2341 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
2342 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
2343 | ::mlir::ArrayAttr getBranchesAttr(); |
2344 | ::mlir::ArrayAttr getBranches(); |
2345 | ::mlir::ArrayAttr branchesAttr(); |
2346 | ::mlir::ArrayAttr branches(); |
2347 | ::mlir::ArrayAttr getTinAttr(); |
2348 | ::llvm::Optional< ::mlir::ArrayAttr > getTin(); |
2349 | ::mlir::ArrayAttr TinAttr(); |
2350 | ::llvm::Optional< ::mlir::ArrayAttr > Tin(); |
2351 | ::mlir::ArrayAttr getToutAttr(); |
2352 | ::llvm::Optional< ::mlir::ArrayAttr > getTout(); |
2353 | ::mlir::ArrayAttr ToutAttr(); |
2354 | ::llvm::Optional< ::mlir::ArrayAttr > Tout(); |
2355 | ::mlir::ArrayAttr getOutputShapesAttr(); |
2356 | ::llvm::Optional< ::mlir::ArrayAttr > getOutputShapes(); |
2357 | ::mlir::ArrayAttr output_shapesAttr(); |
2358 | ::llvm::Optional< ::mlir::ArrayAttr > output_shapes(); |
2359 | void setBranchesAttr(::mlir::ArrayAttr attr); |
2360 | void branchesAttr(::mlir::ArrayAttr attr); |
2361 | void setTinAttr(::mlir::ArrayAttr attr); |
2362 | void TinAttr(::mlir::ArrayAttr attr); |
2363 | void setToutAttr(::mlir::ArrayAttr attr); |
2364 | void ToutAttr(::mlir::ArrayAttr attr); |
2365 | void setOutputShapesAttr(::mlir::ArrayAttr attr); |
2366 | void output_shapesAttr(::mlir::ArrayAttr attr); |
2367 | ::mlir::Attribute removeTinAttr(); |
2368 | ::mlir::Attribute removeToutAttr(); |
2369 | ::mlir::Attribute removeOutput_shapesAttr(); |
2370 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange results, Value branch_index, ValueRange args, ArrayAttr branches); |
2371 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::Value branch_index, ::mlir::ValueRange args, ::mlir::ArrayAttr branches, /*optional*/::mlir::ArrayAttr Tin, /*optional*/::mlir::ArrayAttr Tout, /*optional*/::mlir::ArrayAttr output_shapes); |
2372 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value branch_index, ::mlir::ValueRange args, ::mlir::ArrayAttr branches, /*optional*/::mlir::ArrayAttr Tin, /*optional*/::mlir::ArrayAttr Tout, /*optional*/::mlir::ArrayAttr output_shapes); |
2373 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
2374 | ::mlir::LogicalResult verifyInvariantsImpl(); |
2375 | ::mlir::LogicalResult verifyInvariants(); |
2376 | ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); |
2377 | private: |
2378 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
2379 | return getAttributeNameForIndex((*this)->getName(), index); |
2380 | } |
2381 | |
2382 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
2383 | assert(index < 4 && "invalid attribute index" ); |
2384 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
2385 | } |
2386 | |
2387 | public: |
2388 | }; |
2389 | } // namespace tfg |
2390 | } // namespace mlir |
2391 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::StatefulCaseOp) |
2392 | |
2393 | namespace mlir { |
2394 | namespace tfg { |
2395 | |
2396 | //===----------------------------------------------------------------------===// |
2397 | // ::mlir::tfg::StatefulCaseRegionOp declarations |
2398 | //===----------------------------------------------------------------------===// |
2399 | |
2400 | class StatefulCaseRegionOpAdaptor { |
2401 | public: |
2402 | StatefulCaseRegionOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
2403 | |
2404 | StatefulCaseRegionOpAdaptor(StatefulCaseRegionOp op); |
2405 | |
2406 | ::mlir::ValueRange getOperands(); |
2407 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2408 | ::mlir::ValueRange getODSOperands(unsigned index); |
2409 | ::mlir::Value getBranchIndex(); |
2410 | ::mlir::Value branch_index(); |
2411 | ::mlir::ValueRange getCtls(); |
2412 | ::mlir::ValueRange ctls(); |
2413 | ::mlir::DictionaryAttr getAttributes(); |
2414 | ::mlir::ArrayAttr getBranchAttrsAttr(); |
2415 | ::llvm::Optional< ::mlir::ArrayAttr > getBranchAttrs(); |
2416 | ::mlir::ArrayAttr branch_attrsAttr(); |
2417 | ::llvm::Optional< ::mlir::ArrayAttr > branch_attrs(); |
2418 | ::mlir::ArrayAttr getRegionAttrsAttr(); |
2419 | ::llvm::Optional< ::mlir::ArrayAttr > getRegionAttrs(); |
2420 | ::mlir::ArrayAttr region_attrsAttr(); |
2421 | ::llvm::Optional< ::mlir::ArrayAttr > region_attrs(); |
2422 | ::mlir::RegionRange getRegions(); |
2423 | ::mlir::RegionRange getBranches(); |
2424 | ::mlir::RegionRange branches(); |
2425 | ::mlir::LogicalResult verify(::mlir::Location loc); |
2426 | private: |
2427 | ::mlir::ValueRange odsOperands; |
2428 | ::mlir::DictionaryAttr odsAttrs; |
2429 | ::mlir::RegionRange odsRegions; |
2430 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
2431 | }; |
2432 | class StatefulCaseRegionOp : public ::mlir::Op<StatefulCaseRegionOp, ::mlir::OpTrait::VariadicRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasOnlyGraphRegion, ::mlir::RegionKindInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::tfg::PreservedAttributesInterface::Trait, ::mlir::RegionBranchOpInterface::Trait, ::mlir::tfg::ControlArgumentInterface::Trait> { |
2433 | public: |
2434 | using Op::Op; |
2435 | using Op::print; |
2436 | using Adaptor = StatefulCaseRegionOpAdaptor; |
2437 | public: |
2438 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
2439 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("branch_attrs" ), ::llvm::StringRef("region_attrs" )}; |
2440 | return ::llvm::makeArrayRef(attrNames); |
2441 | } |
2442 | |
2443 | ::mlir::StringAttr getBranchAttrsAttrName() { |
2444 | return getAttributeNameForIndex(0); |
2445 | } |
2446 | |
2447 | static ::mlir::StringAttr getBranchAttrsAttrName(::mlir::OperationName name) { |
2448 | return getAttributeNameForIndex(name, 0); |
2449 | } |
2450 | |
2451 | ::mlir::StringAttr branch_attrsAttrName() { |
2452 | return getAttributeNameForIndex(0); |
2453 | } |
2454 | |
2455 | static ::mlir::StringAttr branch_attrsAttrName(::mlir::OperationName name) { |
2456 | return getAttributeNameForIndex(name, 0); |
2457 | } |
2458 | |
2459 | ::mlir::StringAttr getRegionAttrsAttrName() { |
2460 | return getAttributeNameForIndex(1); |
2461 | } |
2462 | |
2463 | static ::mlir::StringAttr getRegionAttrsAttrName(::mlir::OperationName name) { |
2464 | return getAttributeNameForIndex(name, 1); |
2465 | } |
2466 | |
2467 | ::mlir::StringAttr region_attrsAttrName() { |
2468 | return getAttributeNameForIndex(1); |
2469 | } |
2470 | |
2471 | static ::mlir::StringAttr region_attrsAttrName(::mlir::OperationName name) { |
2472 | return getAttributeNameForIndex(name, 1); |
2473 | } |
2474 | |
2475 | static constexpr ::llvm::StringLiteral getOperationName() { |
2476 | return ::llvm::StringLiteral("tfg.StatefulCaseRegion" ); |
2477 | } |
2478 | |
2479 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2480 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
2481 | ::mlir::TypedValue<::mlir::TensorType> getBranchIndex(); |
2482 | ::mlir::TypedValue<::mlir::TensorType> branch_index(); |
2483 | ::mlir::Operation::operand_range getCtls(); |
2484 | ::mlir::Operation::operand_range ctls(); |
2485 | ::mlir::MutableOperandRange getBranchIndexMutable(); |
2486 | ::mlir::MutableOperandRange branch_indexMutable(); |
2487 | ::mlir::MutableOperandRange getCtlsMutable(); |
2488 | ::mlir::MutableOperandRange ctlsMutable(); |
2489 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2490 | ::mlir::Operation::result_range getODSResults(unsigned index); |
2491 | ::mlir::Operation::result_range getOuts(); |
2492 | ::mlir::Operation::result_range outs(); |
2493 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
2494 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
2495 | ::mlir::MutableArrayRef<::mlir::Region> getBranches(); |
2496 | ::mlir::MutableArrayRef<::mlir::Region> branches(); |
2497 | ::mlir::ArrayAttr getBranchAttrsAttr(); |
2498 | ::llvm::Optional< ::mlir::ArrayAttr > getBranchAttrs(); |
2499 | ::mlir::ArrayAttr branch_attrsAttr(); |
2500 | ::llvm::Optional< ::mlir::ArrayAttr > branch_attrs(); |
2501 | ::mlir::ArrayAttr getRegionAttrsAttr(); |
2502 | ::llvm::Optional< ::mlir::ArrayAttr > getRegionAttrs(); |
2503 | ::mlir::ArrayAttr region_attrsAttr(); |
2504 | ::llvm::Optional< ::mlir::ArrayAttr > region_attrs(); |
2505 | void setBranchAttrsAttr(::mlir::ArrayAttr attr); |
2506 | void branch_attrsAttr(::mlir::ArrayAttr attr); |
2507 | void setRegionAttrsAttr(::mlir::ArrayAttr attr); |
2508 | void region_attrsAttr(::mlir::ArrayAttr attr); |
2509 | ::mlir::Attribute removeBranch_attrsAttr(); |
2510 | ::mlir::Attribute removeRegion_attrsAttr(); |
2511 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::Value branch_index, ::mlir::ValueRange ctls, /*optional*/::mlir::ArrayAttr branch_attrs, /*optional*/::mlir::ArrayAttr region_attrs, unsigned branchesCount); |
2512 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value branch_index, ::mlir::ValueRange ctls, /*optional*/::mlir::ArrayAttr branch_attrs, /*optional*/::mlir::ArrayAttr region_attrs, unsigned branchesCount); |
2513 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions); |
2514 | ::mlir::LogicalResult verifyInvariantsImpl(); |
2515 | ::mlir::LogicalResult verifyInvariants(); |
2516 | ::mlir::LogicalResult verify(); |
2517 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
2518 | static ::llvm::StringRef getDefaultDialect(); |
2519 | void getSuccessorRegions(::llvm::Optional<unsigned> index, ::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); |
2520 | void getRegionInvocationBounds(::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::InvocationBounds> &invocationBounds); |
2521 | static mlir::BlockArgument getDataValueOf(BlockArgument ctl); |
2522 | static mlir::BlockArgument getControlTokenOf(BlockArgument data); |
2523 | static mlir::BlockArgument getDataValue(Region ®ion, unsigned idx); |
2524 | static mlir::BlockArgument getControlToken(Region ®ion, unsigned idx); |
2525 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
2526 | void print(::mlir::OpAsmPrinter &_odsPrinter); |
2527 | private: |
2528 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
2529 | return getAttributeNameForIndex((*this)->getName(), index); |
2530 | } |
2531 | |
2532 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
2533 | assert(index < 2 && "invalid attribute index" ); |
2534 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
2535 | } |
2536 | |
2537 | public: |
2538 | Block &branch_block(unsigned idx) { return branches()[idx].front(); } |
2539 | YieldOp branch_yield(unsigned idx); |
2540 | |
2541 | bool areTypesCompatible(Type lhs, Type rhs) { |
2542 | return tf_type::HasCompatibleElementTypes(lhs, rhs); |
2543 | } |
2544 | |
2545 | RegionAttr getPreservedAttrs(unsigned index) { |
2546 | if (auto attrs = region_attrsAttr()) |
2547 | return attrs[index].cast<RegionAttr>(); |
2548 | return {}; |
2549 | } |
2550 | void setPreservedAttrs(unsigned index, RegionAttr attrs) { |
2551 | SmallVector<Attribute> array = llvm::to_vector(region_attrsAttr()); |
2552 | array[index] = attrs; |
2553 | region_attrsAttr(ArrayAttr::get(getContext(), array)); |
2554 | } |
2555 | }; |
2556 | } // namespace tfg |
2557 | } // namespace mlir |
2558 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::StatefulCaseRegionOp) |
2559 | |
2560 | namespace mlir { |
2561 | namespace tfg { |
2562 | |
2563 | //===----------------------------------------------------------------------===// |
2564 | // ::mlir::tfg::StatefulIfOp declarations |
2565 | //===----------------------------------------------------------------------===// |
2566 | |
2567 | class StatefulIfOpAdaptor { |
2568 | public: |
2569 | StatefulIfOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
2570 | |
2571 | StatefulIfOpAdaptor(StatefulIfOp op); |
2572 | |
2573 | ::mlir::ValueRange getOperands(); |
2574 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2575 | ::mlir::ValueRange getODSOperands(unsigned index); |
2576 | ::mlir::Value getCond(); |
2577 | ::mlir::Value cond(); |
2578 | ::mlir::ValueRange getArgs(); |
2579 | ::mlir::ValueRange args(); |
2580 | ::mlir::DictionaryAttr getAttributes(); |
2581 | ::mlir::tf_type::FuncAttr getThenBranchAttr(); |
2582 | ::mlir::tf_type::FuncAttr getThenBranch(); |
2583 | ::mlir::tf_type::FuncAttr then_branchAttr(); |
2584 | ::mlir::tf_type::FuncAttr then_branch(); |
2585 | ::mlir::tf_type::FuncAttr getElseBranchAttr(); |
2586 | ::mlir::tf_type::FuncAttr getElseBranch(); |
2587 | ::mlir::tf_type::FuncAttr else_branchAttr(); |
2588 | ::mlir::tf_type::FuncAttr else_branch(); |
2589 | ::mlir::TypeAttr getTcondAttr(); |
2590 | ::llvm::Optional<::mlir::Type> getTcond(); |
2591 | ::mlir::TypeAttr TcondAttr(); |
2592 | ::llvm::Optional<::mlir::Type> Tcond(); |
2593 | ::mlir::ArrayAttr getTinAttr(); |
2594 | ::llvm::Optional< ::mlir::ArrayAttr > getTin(); |
2595 | ::mlir::ArrayAttr TinAttr(); |
2596 | ::llvm::Optional< ::mlir::ArrayAttr > Tin(); |
2597 | ::mlir::ArrayAttr getToutAttr(); |
2598 | ::llvm::Optional< ::mlir::ArrayAttr > getTout(); |
2599 | ::mlir::ArrayAttr ToutAttr(); |
2600 | ::llvm::Optional< ::mlir::ArrayAttr > Tout(); |
2601 | ::mlir::ArrayAttr getOutputShapesAttr(); |
2602 | ::llvm::Optional< ::mlir::ArrayAttr > getOutputShapes(); |
2603 | ::mlir::ArrayAttr output_shapesAttr(); |
2604 | ::llvm::Optional< ::mlir::ArrayAttr > output_shapes(); |
2605 | ::mlir::LogicalResult verify(::mlir::Location loc); |
2606 | private: |
2607 | ::mlir::ValueRange odsOperands; |
2608 | ::mlir::DictionaryAttr odsAttrs; |
2609 | ::mlir::RegionRange odsRegions; |
2610 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
2611 | }; |
2612 | class StatefulIfOp : public ::mlir::Op<StatefulIfOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::SymbolUserOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { |
2613 | public: |
2614 | using Op::Op; |
2615 | using Op::print; |
2616 | using Adaptor = StatefulIfOpAdaptor; |
2617 | public: |
2618 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
2619 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcond" ), ::llvm::StringRef("Tin" ), ::llvm::StringRef("Tout" ), ::llvm::StringRef("else_branch" ), ::llvm::StringRef("output_shapes" ), ::llvm::StringRef("then_branch" )}; |
2620 | return ::llvm::makeArrayRef(attrNames); |
2621 | } |
2622 | |
2623 | ::mlir::StringAttr getTcondAttrName() { |
2624 | return getAttributeNameForIndex(0); |
2625 | } |
2626 | |
2627 | static ::mlir::StringAttr getTcondAttrName(::mlir::OperationName name) { |
2628 | return getAttributeNameForIndex(name, 0); |
2629 | } |
2630 | |
2631 | ::mlir::StringAttr TcondAttrName() { |
2632 | return getAttributeNameForIndex(0); |
2633 | } |
2634 | |
2635 | static ::mlir::StringAttr TcondAttrName(::mlir::OperationName name) { |
2636 | return getAttributeNameForIndex(name, 0); |
2637 | } |
2638 | |
2639 | ::mlir::StringAttr getTinAttrName() { |
2640 | return getAttributeNameForIndex(1); |
2641 | } |
2642 | |
2643 | static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { |
2644 | return getAttributeNameForIndex(name, 1); |
2645 | } |
2646 | |
2647 | ::mlir::StringAttr TinAttrName() { |
2648 | return getAttributeNameForIndex(1); |
2649 | } |
2650 | |
2651 | static ::mlir::StringAttr TinAttrName(::mlir::OperationName name) { |
2652 | return getAttributeNameForIndex(name, 1); |
2653 | } |
2654 | |
2655 | ::mlir::StringAttr getToutAttrName() { |
2656 | return getAttributeNameForIndex(2); |
2657 | } |
2658 | |
2659 | static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { |
2660 | return getAttributeNameForIndex(name, 2); |
2661 | } |
2662 | |
2663 | ::mlir::StringAttr ToutAttrName() { |
2664 | return getAttributeNameForIndex(2); |
2665 | } |
2666 | |
2667 | static ::mlir::StringAttr ToutAttrName(::mlir::OperationName name) { |
2668 | return getAttributeNameForIndex(name, 2); |
2669 | } |
2670 | |
2671 | ::mlir::StringAttr getElseBranchAttrName() { |
2672 | return getAttributeNameForIndex(3); |
2673 | } |
2674 | |
2675 | static ::mlir::StringAttr getElseBranchAttrName(::mlir::OperationName name) { |
2676 | return getAttributeNameForIndex(name, 3); |
2677 | } |
2678 | |
2679 | ::mlir::StringAttr else_branchAttrName() { |
2680 | return getAttributeNameForIndex(3); |
2681 | } |
2682 | |
2683 | static ::mlir::StringAttr else_branchAttrName(::mlir::OperationName name) { |
2684 | return getAttributeNameForIndex(name, 3); |
2685 | } |
2686 | |
2687 | ::mlir::StringAttr getOutputShapesAttrName() { |
2688 | return getAttributeNameForIndex(4); |
2689 | } |
2690 | |
2691 | static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { |
2692 | return getAttributeNameForIndex(name, 4); |
2693 | } |
2694 | |
2695 | ::mlir::StringAttr output_shapesAttrName() { |
2696 | return getAttributeNameForIndex(4); |
2697 | } |
2698 | |
2699 | static ::mlir::StringAttr output_shapesAttrName(::mlir::OperationName name) { |
2700 | return getAttributeNameForIndex(name, 4); |
2701 | } |
2702 | |
2703 | ::mlir::StringAttr getThenBranchAttrName() { |
2704 | return getAttributeNameForIndex(5); |
2705 | } |
2706 | |
2707 | static ::mlir::StringAttr getThenBranchAttrName(::mlir::OperationName name) { |
2708 | return getAttributeNameForIndex(name, 5); |
2709 | } |
2710 | |
2711 | ::mlir::StringAttr then_branchAttrName() { |
2712 | return getAttributeNameForIndex(5); |
2713 | } |
2714 | |
2715 | static ::mlir::StringAttr then_branchAttrName(::mlir::OperationName name) { |
2716 | return getAttributeNameForIndex(name, 5); |
2717 | } |
2718 | |
2719 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
2720 | static constexpr ::llvm::StringLiteral getOperationName() { |
2721 | return ::llvm::StringLiteral("tfg.StatefulIf" ); |
2722 | } |
2723 | |
2724 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2725 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
2726 | ::mlir::Value getCond(); |
2727 | ::mlir::Value cond(); |
2728 | ::mlir::Operation::operand_range getArgs(); |
2729 | ::mlir::Operation::operand_range args(); |
2730 | ::mlir::MutableOperandRange getCondMutable(); |
2731 | ::mlir::MutableOperandRange condMutable(); |
2732 | ::mlir::MutableOperandRange getArgsMutable(); |
2733 | ::mlir::MutableOperandRange argsMutable(); |
2734 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2735 | ::mlir::Operation::result_range getODSResults(unsigned index); |
2736 | ::mlir::Operation::result_range getOuts(); |
2737 | ::mlir::Operation::result_range outs(); |
2738 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
2739 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
2740 | ::mlir::tf_type::FuncAttr getThenBranchAttr(); |
2741 | ::mlir::tf_type::FuncAttr getThenBranch(); |
2742 | ::mlir::tf_type::FuncAttr then_branchAttr(); |
2743 | ::mlir::tf_type::FuncAttr then_branch(); |
2744 | ::mlir::tf_type::FuncAttr getElseBranchAttr(); |
2745 | ::mlir::tf_type::FuncAttr getElseBranch(); |
2746 | ::mlir::tf_type::FuncAttr else_branchAttr(); |
2747 | ::mlir::tf_type::FuncAttr else_branch(); |
2748 | ::mlir::TypeAttr getTcondAttr(); |
2749 | ::llvm::Optional<::mlir::Type> getTcond(); |
2750 | ::mlir::TypeAttr TcondAttr(); |
2751 | ::llvm::Optional<::mlir::Type> Tcond(); |
2752 | ::mlir::ArrayAttr getTinAttr(); |
2753 | ::llvm::Optional< ::mlir::ArrayAttr > getTin(); |
2754 | ::mlir::ArrayAttr TinAttr(); |
2755 | ::llvm::Optional< ::mlir::ArrayAttr > Tin(); |
2756 | ::mlir::ArrayAttr getToutAttr(); |
2757 | ::llvm::Optional< ::mlir::ArrayAttr > getTout(); |
2758 | ::mlir::ArrayAttr ToutAttr(); |
2759 | ::llvm::Optional< ::mlir::ArrayAttr > Tout(); |
2760 | ::mlir::ArrayAttr getOutputShapesAttr(); |
2761 | ::llvm::Optional< ::mlir::ArrayAttr > getOutputShapes(); |
2762 | ::mlir::ArrayAttr output_shapesAttr(); |
2763 | ::llvm::Optional< ::mlir::ArrayAttr > output_shapes(); |
2764 | void setThenBranchAttr(::mlir::tf_type::FuncAttr attr); |
2765 | void then_branchAttr(::mlir::tf_type::FuncAttr attr); |
2766 | void setElseBranchAttr(::mlir::tf_type::FuncAttr attr); |
2767 | void else_branchAttr(::mlir::tf_type::FuncAttr attr); |
2768 | void setTcondAttr(::mlir::TypeAttr attr); |
2769 | void TcondAttr(::mlir::TypeAttr attr); |
2770 | void setTinAttr(::mlir::ArrayAttr attr); |
2771 | void TinAttr(::mlir::ArrayAttr attr); |
2772 | void setToutAttr(::mlir::ArrayAttr attr); |
2773 | void ToutAttr(::mlir::ArrayAttr attr); |
2774 | void setOutputShapesAttr(::mlir::ArrayAttr attr); |
2775 | void output_shapesAttr(::mlir::ArrayAttr attr); |
2776 | ::mlir::Attribute removeTcondAttr(); |
2777 | ::mlir::Attribute removeTinAttr(); |
2778 | ::mlir::Attribute removeToutAttr(); |
2779 | ::mlir::Attribute removeOutput_shapesAttr(); |
2780 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange results, Value cond, ValueRange args, FuncAttr then_branch, FuncAttr else_branch); |
2781 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::Value cond, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr then_branch, ::mlir::tf_type::FuncAttr else_branch, /*optional*/::mlir::TypeAttr Tcond, /*optional*/::mlir::ArrayAttr Tin, /*optional*/::mlir::ArrayAttr Tout, /*optional*/::mlir::ArrayAttr output_shapes); |
2782 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value cond, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr then_branch, ::mlir::tf_type::FuncAttr else_branch, /*optional*/::mlir::TypeAttr Tcond, /*optional*/::mlir::ArrayAttr Tin, /*optional*/::mlir::ArrayAttr Tout, /*optional*/::mlir::ArrayAttr output_shapes); |
2783 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
2784 | ::mlir::LogicalResult verifyInvariantsImpl(); |
2785 | ::mlir::LogicalResult verifyInvariants(); |
2786 | ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); |
2787 | private: |
2788 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
2789 | return getAttributeNameForIndex((*this)->getName(), index); |
2790 | } |
2791 | |
2792 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
2793 | assert(index < 6 && "invalid attribute index" ); |
2794 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
2795 | } |
2796 | |
2797 | public: |
2798 | }; |
2799 | } // namespace tfg |
2800 | } // namespace mlir |
2801 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::StatefulIfOp) |
2802 | |
2803 | namespace mlir { |
2804 | namespace tfg { |
2805 | |
2806 | //===----------------------------------------------------------------------===// |
2807 | // ::mlir::tfg::StatefulIfRegionOp declarations |
2808 | //===----------------------------------------------------------------------===// |
2809 | |
2810 | class StatefulIfRegionOpAdaptor { |
2811 | public: |
2812 | StatefulIfRegionOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
2813 | |
2814 | StatefulIfRegionOpAdaptor(StatefulIfRegionOp op); |
2815 | |
2816 | ::mlir::ValueRange getOperands(); |
2817 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2818 | ::mlir::ValueRange getODSOperands(unsigned index); |
2819 | ::mlir::Value getCond(); |
2820 | ::mlir::Value cond(); |
2821 | ::mlir::ValueRange getCtls(); |
2822 | ::mlir::ValueRange ctls(); |
2823 | ::mlir::DictionaryAttr getAttributes(); |
2824 | ::mlir::DictionaryAttr getThenAttrsAttr(); |
2825 | ::llvm::Optional< ::mlir::DictionaryAttr > getThenAttrs(); |
2826 | ::mlir::DictionaryAttr then_attrsAttr(); |
2827 | ::llvm::Optional< ::mlir::DictionaryAttr > then_attrs(); |
2828 | ::mlir::DictionaryAttr getElseAttrsAttr(); |
2829 | ::llvm::Optional< ::mlir::DictionaryAttr > getElseAttrs(); |
2830 | ::mlir::DictionaryAttr else_attrsAttr(); |
2831 | ::llvm::Optional< ::mlir::DictionaryAttr > else_attrs(); |
2832 | ::mlir::tfg::RegionAttr getThenRegionAttrsAttr(); |
2833 | ::llvm::Optional<::mlir::tfg::RegionAttr> getThenRegionAttrs(); |
2834 | ::mlir::tfg::RegionAttr then_region_attrsAttr(); |
2835 | ::llvm::Optional<::mlir::tfg::RegionAttr> then_region_attrs(); |
2836 | ::mlir::tfg::RegionAttr getElseRegionAttrsAttr(); |
2837 | ::llvm::Optional<::mlir::tfg::RegionAttr> getElseRegionAttrs(); |
2838 | ::mlir::tfg::RegionAttr else_region_attrsAttr(); |
2839 | ::llvm::Optional<::mlir::tfg::RegionAttr> else_region_attrs(); |
2840 | ::mlir::RegionRange getRegions(); |
2841 | ::mlir::Region &getThenRegion(); |
2842 | ::mlir::Region &then_region(); |
2843 | ::mlir::Region &getElseRegion(); |
2844 | ::mlir::Region &else_region(); |
2845 | ::mlir::LogicalResult verify(::mlir::Location loc); |
2846 | private: |
2847 | ::mlir::ValueRange odsOperands; |
2848 | ::mlir::DictionaryAttr odsAttrs; |
2849 | ::mlir::RegionRange odsRegions; |
2850 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
2851 | }; |
2852 | class StatefulIfRegionOp : public ::mlir::Op<StatefulIfRegionOp, ::mlir::OpTrait::NRegions<2>::Impl, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasOnlyGraphRegion, ::mlir::RegionKindInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::tfg::PreservedAttributesInterface::Trait, ::mlir::RegionBranchOpInterface::Trait, ::mlir::tfg::ControlArgumentInterface::Trait> { |
2853 | public: |
2854 | using Op::Op; |
2855 | using Op::print; |
2856 | using Adaptor = StatefulIfRegionOpAdaptor; |
2857 | public: |
2858 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
2859 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("else_attrs" ), ::llvm::StringRef("else_region_attrs" ), ::llvm::StringRef("then_attrs" ), ::llvm::StringRef("then_region_attrs" )}; |
2860 | return ::llvm::makeArrayRef(attrNames); |
2861 | } |
2862 | |
2863 | ::mlir::StringAttr getElseAttrsAttrName() { |
2864 | return getAttributeNameForIndex(0); |
2865 | } |
2866 | |
2867 | static ::mlir::StringAttr getElseAttrsAttrName(::mlir::OperationName name) { |
2868 | return getAttributeNameForIndex(name, 0); |
2869 | } |
2870 | |
2871 | ::mlir::StringAttr else_attrsAttrName() { |
2872 | return getAttributeNameForIndex(0); |
2873 | } |
2874 | |
2875 | static ::mlir::StringAttr else_attrsAttrName(::mlir::OperationName name) { |
2876 | return getAttributeNameForIndex(name, 0); |
2877 | } |
2878 | |
2879 | ::mlir::StringAttr getElseRegionAttrsAttrName() { |
2880 | return getAttributeNameForIndex(1); |
2881 | } |
2882 | |
2883 | static ::mlir::StringAttr getElseRegionAttrsAttrName(::mlir::OperationName name) { |
2884 | return getAttributeNameForIndex(name, 1); |
2885 | } |
2886 | |
2887 | ::mlir::StringAttr else_region_attrsAttrName() { |
2888 | return getAttributeNameForIndex(1); |
2889 | } |
2890 | |
2891 | static ::mlir::StringAttr else_region_attrsAttrName(::mlir::OperationName name) { |
2892 | return getAttributeNameForIndex(name, 1); |
2893 | } |
2894 | |
2895 | ::mlir::StringAttr getThenAttrsAttrName() { |
2896 | return getAttributeNameForIndex(2); |
2897 | } |
2898 | |
2899 | static ::mlir::StringAttr getThenAttrsAttrName(::mlir::OperationName name) { |
2900 | return getAttributeNameForIndex(name, 2); |
2901 | } |
2902 | |
2903 | ::mlir::StringAttr then_attrsAttrName() { |
2904 | return getAttributeNameForIndex(2); |
2905 | } |
2906 | |
2907 | static ::mlir::StringAttr then_attrsAttrName(::mlir::OperationName name) { |
2908 | return getAttributeNameForIndex(name, 2); |
2909 | } |
2910 | |
2911 | ::mlir::StringAttr getThenRegionAttrsAttrName() { |
2912 | return getAttributeNameForIndex(3); |
2913 | } |
2914 | |
2915 | static ::mlir::StringAttr getThenRegionAttrsAttrName(::mlir::OperationName name) { |
2916 | return getAttributeNameForIndex(name, 3); |
2917 | } |
2918 | |
2919 | ::mlir::StringAttr then_region_attrsAttrName() { |
2920 | return getAttributeNameForIndex(3); |
2921 | } |
2922 | |
2923 | static ::mlir::StringAttr then_region_attrsAttrName(::mlir::OperationName name) { |
2924 | return getAttributeNameForIndex(name, 3); |
2925 | } |
2926 | |
2927 | static constexpr ::llvm::StringLiteral getOperationName() { |
2928 | return ::llvm::StringLiteral("tfg.StatefulIfRegion" ); |
2929 | } |
2930 | |
2931 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2932 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
2933 | ::mlir::TypedValue<::mlir::TensorType> getCond(); |
2934 | ::mlir::TypedValue<::mlir::TensorType> cond(); |
2935 | ::mlir::Operation::operand_range getCtls(); |
2936 | ::mlir::Operation::operand_range ctls(); |
2937 | ::mlir::MutableOperandRange getCondMutable(); |
2938 | ::mlir::MutableOperandRange condMutable(); |
2939 | ::mlir::MutableOperandRange getCtlsMutable(); |
2940 | ::mlir::MutableOperandRange ctlsMutable(); |
2941 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2942 | ::mlir::Operation::result_range getODSResults(unsigned index); |
2943 | ::mlir::Operation::result_range getOuts(); |
2944 | ::mlir::Operation::result_range outs(); |
2945 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
2946 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
2947 | ::mlir::Region &getThenRegion(); |
2948 | ::mlir::Region &then_region(); |
2949 | ::mlir::Region &getElseRegion(); |
2950 | ::mlir::Region &else_region(); |
2951 | ::mlir::DictionaryAttr getThenAttrsAttr(); |
2952 | ::llvm::Optional< ::mlir::DictionaryAttr > getThenAttrs(); |
2953 | ::mlir::DictionaryAttr then_attrsAttr(); |
2954 | ::llvm::Optional< ::mlir::DictionaryAttr > then_attrs(); |
2955 | ::mlir::DictionaryAttr getElseAttrsAttr(); |
2956 | ::llvm::Optional< ::mlir::DictionaryAttr > getElseAttrs(); |
2957 | ::mlir::DictionaryAttr else_attrsAttr(); |
2958 | ::llvm::Optional< ::mlir::DictionaryAttr > else_attrs(); |
2959 | ::mlir::tfg::RegionAttr getThenRegionAttrsAttr(); |
2960 | ::llvm::Optional<::mlir::tfg::RegionAttr> getThenRegionAttrs(); |
2961 | ::mlir::tfg::RegionAttr then_region_attrsAttr(); |
2962 | ::llvm::Optional<::mlir::tfg::RegionAttr> then_region_attrs(); |
2963 | ::mlir::tfg::RegionAttr getElseRegionAttrsAttr(); |
2964 | ::llvm::Optional<::mlir::tfg::RegionAttr> getElseRegionAttrs(); |
2965 | ::mlir::tfg::RegionAttr else_region_attrsAttr(); |
2966 | ::llvm::Optional<::mlir::tfg::RegionAttr> else_region_attrs(); |
2967 | void setThenAttrsAttr(::mlir::DictionaryAttr attr); |
2968 | void then_attrsAttr(::mlir::DictionaryAttr attr); |
2969 | void setElseAttrsAttr(::mlir::DictionaryAttr attr); |
2970 | void else_attrsAttr(::mlir::DictionaryAttr attr); |
2971 | void setThenRegionAttrsAttr(::mlir::tfg::RegionAttr attr); |
2972 | void then_region_attrsAttr(::mlir::tfg::RegionAttr attr); |
2973 | void setElseRegionAttrsAttr(::mlir::tfg::RegionAttr attr); |
2974 | void else_region_attrsAttr(::mlir::tfg::RegionAttr attr); |
2975 | ::mlir::Attribute removeThen_attrsAttr(); |
2976 | ::mlir::Attribute removeElse_attrsAttr(); |
2977 | ::mlir::Attribute removeThen_region_attrsAttr(); |
2978 | ::mlir::Attribute removeElse_region_attrsAttr(); |
2979 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::Value cond, ::mlir::ValueRange ctls, /*optional*/::mlir::DictionaryAttr then_attrs, /*optional*/::mlir::DictionaryAttr else_attrs, /*optional*/::mlir::tfg::RegionAttr then_region_attrs, /*optional*/::mlir::tfg::RegionAttr else_region_attrs); |
2980 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value cond, ::mlir::ValueRange ctls, /*optional*/::mlir::DictionaryAttr then_attrs, /*optional*/::mlir::DictionaryAttr else_attrs, /*optional*/::mlir::tfg::RegionAttr then_region_attrs, /*optional*/::mlir::tfg::RegionAttr else_region_attrs); |
2981 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
2982 | ::mlir::LogicalResult verifyInvariantsImpl(); |
2983 | ::mlir::LogicalResult verifyInvariants(); |
2984 | ::mlir::LogicalResult verify(); |
2985 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
2986 | static ::llvm::StringRef getDefaultDialect(); |
2987 | void getSuccessorRegions(::llvm::Optional<unsigned> index, ::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); |
2988 | void getRegionInvocationBounds(::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::InvocationBounds> &invocationBounds); |
2989 | static mlir::BlockArgument getDataValueOf(BlockArgument ctl); |
2990 | static mlir::BlockArgument getControlTokenOf(BlockArgument data); |
2991 | static mlir::BlockArgument getDataValue(Region ®ion, unsigned idx); |
2992 | static mlir::BlockArgument getControlToken(Region ®ion, unsigned idx); |
2993 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
2994 | void print(::mlir::OpAsmPrinter &_odsPrinter); |
2995 | private: |
2996 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
2997 | return getAttributeNameForIndex((*this)->getName(), index); |
2998 | } |
2999 | |
3000 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
3001 | assert(index < 4 && "invalid attribute index" ); |
3002 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
3003 | } |
3004 | |
3005 | public: |
3006 | Block &then_block() { return then_region().front(); } |
3007 | Block &else_block() { return else_region().front(); } |
3008 | YieldOp then_yield(); |
3009 | YieldOp else_yield(); |
3010 | |
3011 | bool areTypesCompatible(Type lhs, Type rhs) { |
3012 | return tf_type::HasCompatibleElementTypes(lhs, rhs); |
3013 | } |
3014 | |
3015 | RegionAttr getPreservedAttrs(unsigned index) { |
3016 | if (index == 0) return then_region_attrsAttr(); |
3017 | return else_region_attrsAttr(); |
3018 | } |
3019 | void setPreservedAttrs(unsigned index, RegionAttr attrs) { |
3020 | if (index == 0) then_region_attrsAttr(attrs); |
3021 | else else_region_attrsAttr(attrs); |
3022 | } |
3023 | }; |
3024 | } // namespace tfg |
3025 | } // namespace mlir |
3026 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::StatefulIfRegionOp) |
3027 | |
3028 | namespace mlir { |
3029 | namespace tfg { |
3030 | |
3031 | //===----------------------------------------------------------------------===// |
3032 | // ::mlir::tfg::StatefulWhileOp declarations |
3033 | //===----------------------------------------------------------------------===// |
3034 | |
3035 | class StatefulWhileOpAdaptor { |
3036 | public: |
3037 | StatefulWhileOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
3038 | |
3039 | StatefulWhileOpAdaptor(StatefulWhileOp op); |
3040 | |
3041 | ::mlir::ValueRange getOperands(); |
3042 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3043 | ::mlir::ValueRange getODSOperands(unsigned index); |
3044 | ::mlir::ValueRange getArgs(); |
3045 | ::mlir::ValueRange args(); |
3046 | ::mlir::DictionaryAttr getAttributes(); |
3047 | ::mlir::tf_type::FuncAttr getCondAttr(); |
3048 | ::mlir::tf_type::FuncAttr getCond(); |
3049 | ::mlir::tf_type::FuncAttr condAttr(); |
3050 | ::mlir::tf_type::FuncAttr cond(); |
3051 | ::mlir::tf_type::FuncAttr getBodyAttr(); |
3052 | ::mlir::tf_type::FuncAttr getBody(); |
3053 | ::mlir::tf_type::FuncAttr bodyAttr(); |
3054 | ::mlir::tf_type::FuncAttr body(); |
3055 | ::mlir::IntegerAttr getParallelIterationsAttr(); |
3056 | uint64_t getParallelIterations(); |
3057 | ::mlir::IntegerAttr parallel_iterationsAttr(); |
3058 | uint64_t parallel_iterations(); |
3059 | ::mlir::ArrayAttr getTAttr(); |
3060 | ::llvm::Optional< ::mlir::ArrayAttr > getT(); |
3061 | ::mlir::ArrayAttr TAttr(); |
3062 | ::llvm::Optional< ::mlir::ArrayAttr > T(); |
3063 | ::mlir::ArrayAttr getOutputShapesAttr(); |
3064 | ::llvm::Optional< ::mlir::ArrayAttr > getOutputShapes(); |
3065 | ::mlir::ArrayAttr output_shapesAttr(); |
3066 | ::llvm::Optional< ::mlir::ArrayAttr > output_shapes(); |
3067 | ::mlir::LogicalResult verify(::mlir::Location loc); |
3068 | private: |
3069 | ::mlir::ValueRange odsOperands; |
3070 | ::mlir::DictionaryAttr odsAttrs; |
3071 | ::mlir::RegionRange odsRegions; |
3072 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
3073 | }; |
3074 | class StatefulWhileOp : public ::mlir::Op<StatefulWhileOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::SymbolUserOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { |
3075 | public: |
3076 | using Op::Op; |
3077 | using Op::print; |
3078 | using Adaptor = StatefulWhileOpAdaptor; |
3079 | public: |
3080 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
3081 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T" ), ::llvm::StringRef("body" ), ::llvm::StringRef("cond" ), ::llvm::StringRef("output_shapes" ), ::llvm::StringRef("parallel_iterations" )}; |
3082 | return ::llvm::makeArrayRef(attrNames); |
3083 | } |
3084 | |
3085 | ::mlir::StringAttr getTAttrName() { |
3086 | return getAttributeNameForIndex(0); |
3087 | } |
3088 | |
3089 | static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { |
3090 | return getAttributeNameForIndex(name, 0); |
3091 | } |
3092 | |
3093 | ::mlir::StringAttr TAttrName() { |
3094 | return getAttributeNameForIndex(0); |
3095 | } |
3096 | |
3097 | static ::mlir::StringAttr TAttrName(::mlir::OperationName name) { |
3098 | return getAttributeNameForIndex(name, 0); |
3099 | } |
3100 | |
3101 | ::mlir::StringAttr getBodyAttrName() { |
3102 | return getAttributeNameForIndex(1); |
3103 | } |
3104 | |
3105 | static ::mlir::StringAttr getBodyAttrName(::mlir::OperationName name) { |
3106 | return getAttributeNameForIndex(name, 1); |
3107 | } |
3108 | |
3109 | ::mlir::StringAttr bodyAttrName() { |
3110 | return getAttributeNameForIndex(1); |
3111 | } |
3112 | |
3113 | static ::mlir::StringAttr bodyAttrName(::mlir::OperationName name) { |
3114 | return getAttributeNameForIndex(name, 1); |
3115 | } |
3116 | |
3117 | ::mlir::StringAttr getCondAttrName() { |
3118 | return getAttributeNameForIndex(2); |
3119 | } |
3120 | |
3121 | static ::mlir::StringAttr getCondAttrName(::mlir::OperationName name) { |
3122 | return getAttributeNameForIndex(name, 2); |
3123 | } |
3124 | |
3125 | ::mlir::StringAttr condAttrName() { |
3126 | return getAttributeNameForIndex(2); |
3127 | } |
3128 | |
3129 | static ::mlir::StringAttr condAttrName(::mlir::OperationName name) { |
3130 | return getAttributeNameForIndex(name, 2); |
3131 | } |
3132 | |
3133 | ::mlir::StringAttr getOutputShapesAttrName() { |
3134 | return getAttributeNameForIndex(3); |
3135 | } |
3136 | |
3137 | static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { |
3138 | return getAttributeNameForIndex(name, 3); |
3139 | } |
3140 | |
3141 | ::mlir::StringAttr output_shapesAttrName() { |
3142 | return getAttributeNameForIndex(3); |
3143 | } |
3144 | |
3145 | static ::mlir::StringAttr output_shapesAttrName(::mlir::OperationName name) { |
3146 | return getAttributeNameForIndex(name, 3); |
3147 | } |
3148 | |
3149 | ::mlir::StringAttr getParallelIterationsAttrName() { |
3150 | return getAttributeNameForIndex(4); |
3151 | } |
3152 | |
3153 | static ::mlir::StringAttr getParallelIterationsAttrName(::mlir::OperationName name) { |
3154 | return getAttributeNameForIndex(name, 4); |
3155 | } |
3156 | |
3157 | ::mlir::StringAttr parallel_iterationsAttrName() { |
3158 | return getAttributeNameForIndex(4); |
3159 | } |
3160 | |
3161 | static ::mlir::StringAttr parallel_iterationsAttrName(::mlir::OperationName name) { |
3162 | return getAttributeNameForIndex(name, 4); |
3163 | } |
3164 | |
3165 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
3166 | static constexpr ::llvm::StringLiteral getOperationName() { |
3167 | return ::llvm::StringLiteral("tfg.StatefulWhile" ); |
3168 | } |
3169 | |
3170 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3171 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
3172 | ::mlir::Operation::operand_range getArgs(); |
3173 | ::mlir::Operation::operand_range args(); |
3174 | ::mlir::MutableOperandRange getArgsMutable(); |
3175 | ::mlir::MutableOperandRange argsMutable(); |
3176 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
3177 | ::mlir::Operation::result_range getODSResults(unsigned index); |
3178 | ::mlir::Operation::result_range getOuts(); |
3179 | ::mlir::Operation::result_range outs(); |
3180 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
3181 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
3182 | ::mlir::tf_type::FuncAttr getCondAttr(); |
3183 | ::mlir::tf_type::FuncAttr getCond(); |
3184 | ::mlir::tf_type::FuncAttr condAttr(); |
3185 | ::mlir::tf_type::FuncAttr cond(); |
3186 | ::mlir::tf_type::FuncAttr getBodyAttr(); |
3187 | ::mlir::tf_type::FuncAttr getBody(); |
3188 | ::mlir::tf_type::FuncAttr bodyAttr(); |
3189 | ::mlir::tf_type::FuncAttr body(); |
3190 | ::mlir::IntegerAttr getParallelIterationsAttr(); |
3191 | uint64_t getParallelIterations(); |
3192 | ::mlir::IntegerAttr parallel_iterationsAttr(); |
3193 | uint64_t parallel_iterations(); |
3194 | ::mlir::ArrayAttr getTAttr(); |
3195 | ::llvm::Optional< ::mlir::ArrayAttr > getT(); |
3196 | ::mlir::ArrayAttr TAttr(); |
3197 | ::llvm::Optional< ::mlir::ArrayAttr > T(); |
3198 | ::mlir::ArrayAttr getOutputShapesAttr(); |
3199 | ::llvm::Optional< ::mlir::ArrayAttr > getOutputShapes(); |
3200 | ::mlir::ArrayAttr output_shapesAttr(); |
3201 | ::llvm::Optional< ::mlir::ArrayAttr > output_shapes(); |
3202 | void setCondAttr(::mlir::tf_type::FuncAttr attr); |
3203 | void condAttr(::mlir::tf_type::FuncAttr attr); |
3204 | void setBodyAttr(::mlir::tf_type::FuncAttr attr); |
3205 | void bodyAttr(::mlir::tf_type::FuncAttr attr); |
3206 | void setParallelIterationsAttr(::mlir::IntegerAttr attr); |
3207 | void parallel_iterationsAttr(::mlir::IntegerAttr attr); |
3208 | void setTAttr(::mlir::ArrayAttr attr); |
3209 | void TAttr(::mlir::ArrayAttr attr); |
3210 | void setOutputShapesAttr(::mlir::ArrayAttr attr); |
3211 | void output_shapesAttr(::mlir::ArrayAttr attr); |
3212 | ::mlir::Attribute removeTAttr(); |
3213 | ::mlir::Attribute removeOutput_shapesAttr(); |
3214 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange results, ValueRange args, FuncAttr cond, FuncAttr body, IntegerAttr parallel_iterations); |
3215 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr cond, ::mlir::tf_type::FuncAttr body, ::mlir::IntegerAttr parallel_iterations, /*optional*/::mlir::ArrayAttr T, /*optional*/::mlir::ArrayAttr output_shapes); |
3216 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr cond, ::mlir::tf_type::FuncAttr body, ::mlir::IntegerAttr parallel_iterations, /*optional*/::mlir::ArrayAttr T, /*optional*/::mlir::ArrayAttr output_shapes); |
3217 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr cond, ::mlir::tf_type::FuncAttr body, uint64_t parallel_iterations, /*optional*/::mlir::ArrayAttr T, /*optional*/::mlir::ArrayAttr output_shapes); |
3218 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr cond, ::mlir::tf_type::FuncAttr body, uint64_t parallel_iterations, /*optional*/::mlir::ArrayAttr T, /*optional*/::mlir::ArrayAttr output_shapes); |
3219 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
3220 | ::mlir::LogicalResult verifyInvariantsImpl(); |
3221 | ::mlir::LogicalResult verifyInvariants(); |
3222 | ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); |
3223 | private: |
3224 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
3225 | return getAttributeNameForIndex((*this)->getName(), index); |
3226 | } |
3227 | |
3228 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
3229 | assert(index < 5 && "invalid attribute index" ); |
3230 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
3231 | } |
3232 | |
3233 | public: |
3234 | }; |
3235 | } // namespace tfg |
3236 | } // namespace mlir |
3237 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::StatefulWhileOp) |
3238 | |
3239 | namespace mlir { |
3240 | namespace tfg { |
3241 | |
3242 | //===----------------------------------------------------------------------===// |
3243 | // ::mlir::tfg::StatefulWhileRegionOp declarations |
3244 | //===----------------------------------------------------------------------===// |
3245 | |
3246 | class StatefulWhileRegionOpAdaptor { |
3247 | public: |
3248 | StatefulWhileRegionOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
3249 | |
3250 | StatefulWhileRegionOpAdaptor(StatefulWhileRegionOp op); |
3251 | |
3252 | ::mlir::ValueRange getOperands(); |
3253 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3254 | ::mlir::ValueRange getODSOperands(unsigned index); |
3255 | ::mlir::ValueRange getInit(); |
3256 | ::mlir::ValueRange init(); |
3257 | ::mlir::ValueRange getCtls(); |
3258 | ::mlir::ValueRange ctls(); |
3259 | ::mlir::DictionaryAttr getAttributes(); |
3260 | ::mlir::IntegerAttr getParallelIterationsAttr(); |
3261 | uint64_t getParallelIterations(); |
3262 | ::mlir::IntegerAttr parallel_iterationsAttr(); |
3263 | uint64_t parallel_iterations(); |
3264 | ::mlir::DictionaryAttr getCondAttrsAttr(); |
3265 | ::llvm::Optional< ::mlir::DictionaryAttr > getCondAttrs(); |
3266 | ::mlir::DictionaryAttr cond_attrsAttr(); |
3267 | ::llvm::Optional< ::mlir::DictionaryAttr > cond_attrs(); |
3268 | ::mlir::DictionaryAttr getBodyAttrsAttr(); |
3269 | ::llvm::Optional< ::mlir::DictionaryAttr > getBodyAttrs(); |
3270 | ::mlir::DictionaryAttr body_attrsAttr(); |
3271 | ::llvm::Optional< ::mlir::DictionaryAttr > body_attrs(); |
3272 | ::mlir::tfg::RegionAttr getCondRegionAttrsAttr(); |
3273 | ::llvm::Optional<::mlir::tfg::RegionAttr> getCondRegionAttrs(); |
3274 | ::mlir::tfg::RegionAttr cond_region_attrsAttr(); |
3275 | ::llvm::Optional<::mlir::tfg::RegionAttr> cond_region_attrs(); |
3276 | ::mlir::tfg::RegionAttr getBodyRegionAttrsAttr(); |
3277 | ::llvm::Optional<::mlir::tfg::RegionAttr> getBodyRegionAttrs(); |
3278 | ::mlir::tfg::RegionAttr body_region_attrsAttr(); |
3279 | ::llvm::Optional<::mlir::tfg::RegionAttr> body_region_attrs(); |
3280 | ::mlir::RegionRange getRegions(); |
3281 | ::mlir::Region &getCondRegion(); |
3282 | ::mlir::Region &cond_region(); |
3283 | ::mlir::Region &getBodyRegion(); |
3284 | ::mlir::Region &body_region(); |
3285 | ::mlir::LogicalResult verify(::mlir::Location loc); |
3286 | private: |
3287 | ::mlir::ValueRange odsOperands; |
3288 | ::mlir::DictionaryAttr odsAttrs; |
3289 | ::mlir::RegionRange odsRegions; |
3290 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
3291 | }; |
3292 | class StatefulWhileRegionOp : public ::mlir::Op<StatefulWhileRegionOp, ::mlir::OpTrait::NRegions<2>::Impl, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasOnlyGraphRegion, ::mlir::RegionKindInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::tfg::PreservedAttributesInterface::Trait, ::mlir::RegionBranchOpInterface::Trait, ::mlir::tfg::ControlArgumentInterface::Trait> { |
3293 | public: |
3294 | using Op::Op; |
3295 | using Op::print; |
3296 | using Adaptor = StatefulWhileRegionOpAdaptor; |
3297 | public: |
3298 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
3299 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("body_attrs" ), ::llvm::StringRef("body_region_attrs" ), ::llvm::StringRef("cond_attrs" ), ::llvm::StringRef("cond_region_attrs" ), ::llvm::StringRef("operand_segment_sizes" ), ::llvm::StringRef("parallel_iterations" )}; |
3300 | return ::llvm::makeArrayRef(attrNames); |
3301 | } |
3302 | |
3303 | ::mlir::StringAttr getBodyAttrsAttrName() { |
3304 | return getAttributeNameForIndex(0); |
3305 | } |
3306 | |
3307 | static ::mlir::StringAttr getBodyAttrsAttrName(::mlir::OperationName name) { |
3308 | return getAttributeNameForIndex(name, 0); |
3309 | } |
3310 | |
3311 | ::mlir::StringAttr body_attrsAttrName() { |
3312 | return getAttributeNameForIndex(0); |
3313 | } |
3314 | |
3315 | static ::mlir::StringAttr body_attrsAttrName(::mlir::OperationName name) { |
3316 | return getAttributeNameForIndex(name, 0); |
3317 | } |
3318 | |
3319 | ::mlir::StringAttr getBodyRegionAttrsAttrName() { |
3320 | return getAttributeNameForIndex(1); |
3321 | } |
3322 | |
3323 | static ::mlir::StringAttr getBodyRegionAttrsAttrName(::mlir::OperationName name) { |
3324 | return getAttributeNameForIndex(name, 1); |
3325 | } |
3326 | |
3327 | ::mlir::StringAttr body_region_attrsAttrName() { |
3328 | return getAttributeNameForIndex(1); |
3329 | } |
3330 | |
3331 | static ::mlir::StringAttr body_region_attrsAttrName(::mlir::OperationName name) { |
3332 | return getAttributeNameForIndex(name, 1); |
3333 | } |
3334 | |
3335 | ::mlir::StringAttr getCondAttrsAttrName() { |
3336 | return getAttributeNameForIndex(2); |
3337 | } |
3338 | |
3339 | static ::mlir::StringAttr getCondAttrsAttrName(::mlir::OperationName name) { |
3340 | return getAttributeNameForIndex(name, 2); |
3341 | } |
3342 | |
3343 | ::mlir::StringAttr cond_attrsAttrName() { |
3344 | return getAttributeNameForIndex(2); |
3345 | } |
3346 | |
3347 | static ::mlir::StringAttr cond_attrsAttrName(::mlir::OperationName name) { |
3348 | return getAttributeNameForIndex(name, 2); |
3349 | } |
3350 | |
3351 | ::mlir::StringAttr getCondRegionAttrsAttrName() { |
3352 | return getAttributeNameForIndex(3); |
3353 | } |
3354 | |
3355 | static ::mlir::StringAttr getCondRegionAttrsAttrName(::mlir::OperationName name) { |
3356 | return getAttributeNameForIndex(name, 3); |
3357 | } |
3358 | |
3359 | ::mlir::StringAttr cond_region_attrsAttrName() { |
3360 | return getAttributeNameForIndex(3); |
3361 | } |
3362 | |
3363 | static ::mlir::StringAttr cond_region_attrsAttrName(::mlir::OperationName name) { |
3364 | return getAttributeNameForIndex(name, 3); |
3365 | } |
3366 | |
3367 | ::mlir::StringAttr getOperandSegmentSizesAttrName() { |
3368 | return getAttributeNameForIndex(4); |
3369 | } |
3370 | |
3371 | static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { |
3372 | return getAttributeNameForIndex(name, 4); |
3373 | } |
3374 | |
3375 | ::mlir::StringAttr operand_segment_sizesAttrName() { |
3376 | return getAttributeNameForIndex(4); |
3377 | } |
3378 | |
3379 | static ::mlir::StringAttr operand_segment_sizesAttrName(::mlir::OperationName name) { |
3380 | return getAttributeNameForIndex(name, 4); |
3381 | } |
3382 | |
3383 | ::mlir::StringAttr getParallelIterationsAttrName() { |
3384 | return getAttributeNameForIndex(5); |
3385 | } |
3386 | |
3387 | static ::mlir::StringAttr getParallelIterationsAttrName(::mlir::OperationName name) { |
3388 | return getAttributeNameForIndex(name, 5); |
3389 | } |
3390 | |
3391 | ::mlir::StringAttr parallel_iterationsAttrName() { |
3392 | return getAttributeNameForIndex(5); |
3393 | } |
3394 | |
3395 | static ::mlir::StringAttr parallel_iterationsAttrName(::mlir::OperationName name) { |
3396 | return getAttributeNameForIndex(name, 5); |
3397 | } |
3398 | |
3399 | static constexpr ::llvm::StringLiteral getOperationName() { |
3400 | return ::llvm::StringLiteral("tfg.StatefulWhileRegion" ); |
3401 | } |
3402 | |
3403 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3404 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
3405 | ::mlir::Operation::operand_range getInit(); |
3406 | ::mlir::Operation::operand_range init(); |
3407 | ::mlir::Operation::operand_range getCtls(); |
3408 | ::mlir::Operation::operand_range ctls(); |
3409 | ::mlir::MutableOperandRange getInitMutable(); |
3410 | ::mlir::MutableOperandRange initMutable(); |
3411 | ::mlir::MutableOperandRange getCtlsMutable(); |
3412 | ::mlir::MutableOperandRange ctlsMutable(); |
3413 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
3414 | ::mlir::Operation::result_range getODSResults(unsigned index); |
3415 | ::mlir::Operation::result_range getOuts(); |
3416 | ::mlir::Operation::result_range outs(); |
3417 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
3418 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
3419 | ::mlir::Region &getCondRegion(); |
3420 | ::mlir::Region &cond_region(); |
3421 | ::mlir::Region &getBodyRegion(); |
3422 | ::mlir::Region &body_region(); |
3423 | ::mlir::IntegerAttr getParallelIterationsAttr(); |
3424 | uint64_t getParallelIterations(); |
3425 | ::mlir::IntegerAttr parallel_iterationsAttr(); |
3426 | uint64_t parallel_iterations(); |
3427 | ::mlir::DictionaryAttr getCondAttrsAttr(); |
3428 | ::llvm::Optional< ::mlir::DictionaryAttr > getCondAttrs(); |
3429 | ::mlir::DictionaryAttr cond_attrsAttr(); |
3430 | ::llvm::Optional< ::mlir::DictionaryAttr > cond_attrs(); |
3431 | ::mlir::DictionaryAttr getBodyAttrsAttr(); |
3432 | ::llvm::Optional< ::mlir::DictionaryAttr > getBodyAttrs(); |
3433 | ::mlir::DictionaryAttr body_attrsAttr(); |
3434 | ::llvm::Optional< ::mlir::DictionaryAttr > body_attrs(); |
3435 | ::mlir::tfg::RegionAttr getCondRegionAttrsAttr(); |
3436 | ::llvm::Optional<::mlir::tfg::RegionAttr> getCondRegionAttrs(); |
3437 | ::mlir::tfg::RegionAttr cond_region_attrsAttr(); |
3438 | ::llvm::Optional<::mlir::tfg::RegionAttr> cond_region_attrs(); |
3439 | ::mlir::tfg::RegionAttr getBodyRegionAttrsAttr(); |
3440 | ::llvm::Optional<::mlir::tfg::RegionAttr> getBodyRegionAttrs(); |
3441 | ::mlir::tfg::RegionAttr body_region_attrsAttr(); |
3442 | ::llvm::Optional<::mlir::tfg::RegionAttr> body_region_attrs(); |
3443 | void setParallelIterationsAttr(::mlir::IntegerAttr attr); |
3444 | void parallel_iterationsAttr(::mlir::IntegerAttr attr); |
3445 | void setCondAttrsAttr(::mlir::DictionaryAttr attr); |
3446 | void cond_attrsAttr(::mlir::DictionaryAttr attr); |
3447 | void setBodyAttrsAttr(::mlir::DictionaryAttr attr); |
3448 | void body_attrsAttr(::mlir::DictionaryAttr attr); |
3449 | void setCondRegionAttrsAttr(::mlir::tfg::RegionAttr attr); |
3450 | void cond_region_attrsAttr(::mlir::tfg::RegionAttr attr); |
3451 | void setBodyRegionAttrsAttr(::mlir::tfg::RegionAttr attr); |
3452 | void body_region_attrsAttr(::mlir::tfg::RegionAttr attr); |
3453 | ::mlir::Attribute removeCond_attrsAttr(); |
3454 | ::mlir::Attribute removeBody_attrsAttr(); |
3455 | ::mlir::Attribute removeCond_region_attrsAttr(); |
3456 | ::mlir::Attribute removeBody_region_attrsAttr(); |
3457 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::ValueRange init, ::mlir::ValueRange ctls, ::mlir::IntegerAttr parallel_iterations, /*optional*/::mlir::DictionaryAttr cond_attrs, /*optional*/::mlir::DictionaryAttr body_attrs, /*optional*/::mlir::tfg::RegionAttr cond_region_attrs, /*optional*/::mlir::tfg::RegionAttr body_region_attrs); |
3458 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange init, ::mlir::ValueRange ctls, ::mlir::IntegerAttr parallel_iterations, /*optional*/::mlir::DictionaryAttr cond_attrs, /*optional*/::mlir::DictionaryAttr body_attrs, /*optional*/::mlir::tfg::RegionAttr cond_region_attrs, /*optional*/::mlir::tfg::RegionAttr body_region_attrs); |
3459 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::ValueRange init, ::mlir::ValueRange ctls, uint64_t parallel_iterations, /*optional*/::mlir::DictionaryAttr cond_attrs, /*optional*/::mlir::DictionaryAttr body_attrs, /*optional*/::mlir::tfg::RegionAttr cond_region_attrs, /*optional*/::mlir::tfg::RegionAttr body_region_attrs); |
3460 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange init, ::mlir::ValueRange ctls, uint64_t parallel_iterations, /*optional*/::mlir::DictionaryAttr cond_attrs, /*optional*/::mlir::DictionaryAttr body_attrs, /*optional*/::mlir::tfg::RegionAttr cond_region_attrs, /*optional*/::mlir::tfg::RegionAttr body_region_attrs); |
3461 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
3462 | ::mlir::LogicalResult verifyInvariantsImpl(); |
3463 | ::mlir::LogicalResult verifyInvariants(); |
3464 | ::mlir::LogicalResult verify(); |
3465 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
3466 | static ::llvm::StringRef getDefaultDialect(); |
3467 | ::mlir::OperandRange getSuccessorEntryOperands(::llvm::Optional<unsigned> index); |
3468 | void getSuccessorRegions(::llvm::Optional<unsigned> index, ::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); |
3469 | static mlir::BlockArgument getDataValueOf(BlockArgument ctl); |
3470 | static mlir::BlockArgument getControlTokenOf(BlockArgument data); |
3471 | static mlir::BlockArgument getDataValue(Region ®ion, unsigned idx); |
3472 | static mlir::BlockArgument getControlToken(Region ®ion, unsigned idx); |
3473 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
3474 | void print(::mlir::OpAsmPrinter &_odsPrinter); |
3475 | private: |
3476 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
3477 | return getAttributeNameForIndex((*this)->getName(), index); |
3478 | } |
3479 | |
3480 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
3481 | assert(index < 6 && "invalid attribute index" ); |
3482 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
3483 | } |
3484 | |
3485 | public: |
3486 | Block &cond_block() { return cond_region().front(); } |
3487 | Block &body_block() { return body_region().front(); } |
3488 | ConditionOp cond_condition(); |
3489 | YieldOp body_yield(); |
3490 | |
3491 | bool areTypesCompatible(Type lhs, Type rhs) { |
3492 | return tf_type::HasCompatibleElementTypes(lhs, rhs); |
3493 | } |
3494 | |
3495 | RegionAttr getPreservedAttrs(unsigned index) { |
3496 | if (index == 0) return cond_region_attrsAttr(); |
3497 | return body_region_attrsAttr(); |
3498 | } |
3499 | void setPreservedAttrs(unsigned index, RegionAttr attrs) { |
3500 | if (index == 0) cond_region_attrsAttr(attrs); |
3501 | else body_region_attrsAttr(attrs); |
3502 | } |
3503 | }; |
3504 | } // namespace tfg |
3505 | } // namespace mlir |
3506 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::StatefulWhileRegionOp) |
3507 | |
3508 | namespace mlir { |
3509 | namespace tfg { |
3510 | |
3511 | //===----------------------------------------------------------------------===// |
3512 | // ::mlir::tfg::StatelessCaseOp declarations |
3513 | //===----------------------------------------------------------------------===// |
3514 | |
3515 | class StatelessCaseOpAdaptor { |
3516 | public: |
3517 | StatelessCaseOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
3518 | |
3519 | StatelessCaseOpAdaptor(StatelessCaseOp op); |
3520 | |
3521 | ::mlir::ValueRange getOperands(); |
3522 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3523 | ::mlir::ValueRange getODSOperands(unsigned index); |
3524 | ::mlir::Value getBranchIndex(); |
3525 | ::mlir::Value branch_index(); |
3526 | ::mlir::ValueRange getArgs(); |
3527 | ::mlir::ValueRange args(); |
3528 | ::mlir::DictionaryAttr getAttributes(); |
3529 | ::mlir::ArrayAttr getBranchesAttr(); |
3530 | ::mlir::ArrayAttr getBranches(); |
3531 | ::mlir::ArrayAttr branchesAttr(); |
3532 | ::mlir::ArrayAttr branches(); |
3533 | ::mlir::ArrayAttr getTinAttr(); |
3534 | ::llvm::Optional< ::mlir::ArrayAttr > getTin(); |
3535 | ::mlir::ArrayAttr TinAttr(); |
3536 | ::llvm::Optional< ::mlir::ArrayAttr > Tin(); |
3537 | ::mlir::ArrayAttr getToutAttr(); |
3538 | ::llvm::Optional< ::mlir::ArrayAttr > getTout(); |
3539 | ::mlir::ArrayAttr ToutAttr(); |
3540 | ::llvm::Optional< ::mlir::ArrayAttr > Tout(); |
3541 | ::mlir::ArrayAttr getOutputShapesAttr(); |
3542 | ::llvm::Optional< ::mlir::ArrayAttr > getOutputShapes(); |
3543 | ::mlir::ArrayAttr output_shapesAttr(); |
3544 | ::llvm::Optional< ::mlir::ArrayAttr > output_shapes(); |
3545 | ::mlir::LogicalResult verify(::mlir::Location loc); |
3546 | private: |
3547 | ::mlir::ValueRange odsOperands; |
3548 | ::mlir::DictionaryAttr odsAttrs; |
3549 | ::mlir::RegionRange odsRegions; |
3550 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
3551 | }; |
3552 | class StatelessCaseOp : public ::mlir::Op<StatelessCaseOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::SymbolUserOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { |
3553 | public: |
3554 | using Op::Op; |
3555 | using Op::print; |
3556 | using Adaptor = StatelessCaseOpAdaptor; |
3557 | public: |
3558 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
3559 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin" ), ::llvm::StringRef("Tout" ), ::llvm::StringRef("branches" ), ::llvm::StringRef("output_shapes" )}; |
3560 | return ::llvm::makeArrayRef(attrNames); |
3561 | } |
3562 | |
3563 | ::mlir::StringAttr getTinAttrName() { |
3564 | return getAttributeNameForIndex(0); |
3565 | } |
3566 | |
3567 | static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { |
3568 | return getAttributeNameForIndex(name, 0); |
3569 | } |
3570 | |
3571 | ::mlir::StringAttr TinAttrName() { |
3572 | return getAttributeNameForIndex(0); |
3573 | } |
3574 | |
3575 | static ::mlir::StringAttr TinAttrName(::mlir::OperationName name) { |
3576 | return getAttributeNameForIndex(name, 0); |
3577 | } |
3578 | |
3579 | ::mlir::StringAttr getToutAttrName() { |
3580 | return getAttributeNameForIndex(1); |
3581 | } |
3582 | |
3583 | static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { |
3584 | return getAttributeNameForIndex(name, 1); |
3585 | } |
3586 | |
3587 | ::mlir::StringAttr ToutAttrName() { |
3588 | return getAttributeNameForIndex(1); |
3589 | } |
3590 | |
3591 | static ::mlir::StringAttr ToutAttrName(::mlir::OperationName name) { |
3592 | return getAttributeNameForIndex(name, 1); |
3593 | } |
3594 | |
3595 | ::mlir::StringAttr getBranchesAttrName() { |
3596 | return getAttributeNameForIndex(2); |
3597 | } |
3598 | |
3599 | static ::mlir::StringAttr getBranchesAttrName(::mlir::OperationName name) { |
3600 | return getAttributeNameForIndex(name, 2); |
3601 | } |
3602 | |
3603 | ::mlir::StringAttr branchesAttrName() { |
3604 | return getAttributeNameForIndex(2); |
3605 | } |
3606 | |
3607 | static ::mlir::StringAttr branchesAttrName(::mlir::OperationName name) { |
3608 | return getAttributeNameForIndex(name, 2); |
3609 | } |
3610 | |
3611 | ::mlir::StringAttr getOutputShapesAttrName() { |
3612 | return getAttributeNameForIndex(3); |
3613 | } |
3614 | |
3615 | static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { |
3616 | return getAttributeNameForIndex(name, 3); |
3617 | } |
3618 | |
3619 | ::mlir::StringAttr output_shapesAttrName() { |
3620 | return getAttributeNameForIndex(3); |
3621 | } |
3622 | |
3623 | static ::mlir::StringAttr output_shapesAttrName(::mlir::OperationName name) { |
3624 | return getAttributeNameForIndex(name, 3); |
3625 | } |
3626 | |
3627 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
3628 | static constexpr ::llvm::StringLiteral getOperationName() { |
3629 | return ::llvm::StringLiteral("tfg.StatelessCase" ); |
3630 | } |
3631 | |
3632 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3633 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
3634 | ::mlir::Value getBranchIndex(); |
3635 | ::mlir::Value branch_index(); |
3636 | ::mlir::Operation::operand_range getArgs(); |
3637 | ::mlir::Operation::operand_range args(); |
3638 | ::mlir::MutableOperandRange getBranchIndexMutable(); |
3639 | ::mlir::MutableOperandRange branch_indexMutable(); |
3640 | ::mlir::MutableOperandRange getArgsMutable(); |
3641 | ::mlir::MutableOperandRange argsMutable(); |
3642 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
3643 | ::mlir::Operation::result_range getODSResults(unsigned index); |
3644 | ::mlir::Operation::result_range getOuts(); |
3645 | ::mlir::Operation::result_range outs(); |
3646 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
3647 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
3648 | ::mlir::ArrayAttr getBranchesAttr(); |
3649 | ::mlir::ArrayAttr getBranches(); |
3650 | ::mlir::ArrayAttr branchesAttr(); |
3651 | ::mlir::ArrayAttr branches(); |
3652 | ::mlir::ArrayAttr getTinAttr(); |
3653 | ::llvm::Optional< ::mlir::ArrayAttr > getTin(); |
3654 | ::mlir::ArrayAttr TinAttr(); |
3655 | ::llvm::Optional< ::mlir::ArrayAttr > Tin(); |
3656 | ::mlir::ArrayAttr getToutAttr(); |
3657 | ::llvm::Optional< ::mlir::ArrayAttr > getTout(); |
3658 | ::mlir::ArrayAttr ToutAttr(); |
3659 | ::llvm::Optional< ::mlir::ArrayAttr > Tout(); |
3660 | ::mlir::ArrayAttr getOutputShapesAttr(); |
3661 | ::llvm::Optional< ::mlir::ArrayAttr > getOutputShapes(); |
3662 | ::mlir::ArrayAttr output_shapesAttr(); |
3663 | ::llvm::Optional< ::mlir::ArrayAttr > output_shapes(); |
3664 | void setBranchesAttr(::mlir::ArrayAttr attr); |
3665 | void branchesAttr(::mlir::ArrayAttr attr); |
3666 | void setTinAttr(::mlir::ArrayAttr attr); |
3667 | void TinAttr(::mlir::ArrayAttr attr); |
3668 | void setToutAttr(::mlir::ArrayAttr attr); |
3669 | void ToutAttr(::mlir::ArrayAttr attr); |
3670 | void setOutputShapesAttr(::mlir::ArrayAttr attr); |
3671 | void output_shapesAttr(::mlir::ArrayAttr attr); |
3672 | ::mlir::Attribute removeTinAttr(); |
3673 | ::mlir::Attribute removeToutAttr(); |
3674 | ::mlir::Attribute removeOutput_shapesAttr(); |
3675 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange results, Value branch_index, ValueRange args, ArrayAttr branches); |
3676 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::Value branch_index, ::mlir::ValueRange args, ::mlir::ArrayAttr branches, /*optional*/::mlir::ArrayAttr Tin, /*optional*/::mlir::ArrayAttr Tout, /*optional*/::mlir::ArrayAttr output_shapes); |
3677 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value branch_index, ::mlir::ValueRange args, ::mlir::ArrayAttr branches, /*optional*/::mlir::ArrayAttr Tin, /*optional*/::mlir::ArrayAttr Tout, /*optional*/::mlir::ArrayAttr output_shapes); |
3678 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
3679 | ::mlir::LogicalResult verifyInvariantsImpl(); |
3680 | ::mlir::LogicalResult verifyInvariants(); |
3681 | ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); |
3682 | private: |
3683 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
3684 | return getAttributeNameForIndex((*this)->getName(), index); |
3685 | } |
3686 | |
3687 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
3688 | assert(index < 4 && "invalid attribute index" ); |
3689 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
3690 | } |
3691 | |
3692 | public: |
3693 | }; |
3694 | } // namespace tfg |
3695 | } // namespace mlir |
3696 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::StatelessCaseOp) |
3697 | |
3698 | namespace mlir { |
3699 | namespace tfg { |
3700 | |
3701 | //===----------------------------------------------------------------------===// |
3702 | // ::mlir::tfg::StatelessCaseRegionOp declarations |
3703 | //===----------------------------------------------------------------------===// |
3704 | |
3705 | class StatelessCaseRegionOpAdaptor { |
3706 | public: |
3707 | StatelessCaseRegionOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
3708 | |
3709 | StatelessCaseRegionOpAdaptor(StatelessCaseRegionOp op); |
3710 | |
3711 | ::mlir::ValueRange getOperands(); |
3712 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3713 | ::mlir::ValueRange getODSOperands(unsigned index); |
3714 | ::mlir::Value getBranchIndex(); |
3715 | ::mlir::Value branch_index(); |
3716 | ::mlir::ValueRange getCtls(); |
3717 | ::mlir::ValueRange ctls(); |
3718 | ::mlir::DictionaryAttr getAttributes(); |
3719 | ::mlir::ArrayAttr getBranchAttrsAttr(); |
3720 | ::llvm::Optional< ::mlir::ArrayAttr > getBranchAttrs(); |
3721 | ::mlir::ArrayAttr branch_attrsAttr(); |
3722 | ::llvm::Optional< ::mlir::ArrayAttr > branch_attrs(); |
3723 | ::mlir::ArrayAttr getRegionAttrsAttr(); |
3724 | ::llvm::Optional< ::mlir::ArrayAttr > getRegionAttrs(); |
3725 | ::mlir::ArrayAttr region_attrsAttr(); |
3726 | ::llvm::Optional< ::mlir::ArrayAttr > region_attrs(); |
3727 | ::mlir::RegionRange getRegions(); |
3728 | ::mlir::RegionRange getBranches(); |
3729 | ::mlir::RegionRange branches(); |
3730 | ::mlir::LogicalResult verify(::mlir::Location loc); |
3731 | private: |
3732 | ::mlir::ValueRange odsOperands; |
3733 | ::mlir::DictionaryAttr odsAttrs; |
3734 | ::mlir::RegionRange odsRegions; |
3735 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
3736 | }; |
3737 | class StatelessCaseRegionOp : public ::mlir::Op<StatelessCaseRegionOp, ::mlir::OpTrait::VariadicRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasOnlyGraphRegion, ::mlir::RegionKindInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::tfg::PreservedAttributesInterface::Trait, ::mlir::RegionBranchOpInterface::Trait, ::mlir::tfg::ControlArgumentInterface::Trait> { |
3738 | public: |
3739 | using Op::Op; |
3740 | using Op::print; |
3741 | using Adaptor = StatelessCaseRegionOpAdaptor; |
3742 | public: |
3743 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
3744 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("branch_attrs" ), ::llvm::StringRef("region_attrs" )}; |
3745 | return ::llvm::makeArrayRef(attrNames); |
3746 | } |
3747 | |
3748 | ::mlir::StringAttr getBranchAttrsAttrName() { |
3749 | return getAttributeNameForIndex(0); |
3750 | } |
3751 | |
3752 | static ::mlir::StringAttr getBranchAttrsAttrName(::mlir::OperationName name) { |
3753 | return getAttributeNameForIndex(name, 0); |
3754 | } |
3755 | |
3756 | ::mlir::StringAttr branch_attrsAttrName() { |
3757 | return getAttributeNameForIndex(0); |
3758 | } |
3759 | |
3760 | static ::mlir::StringAttr branch_attrsAttrName(::mlir::OperationName name) { |
3761 | return getAttributeNameForIndex(name, 0); |
3762 | } |
3763 | |
3764 | ::mlir::StringAttr getRegionAttrsAttrName() { |
3765 | return getAttributeNameForIndex(1); |
3766 | } |
3767 | |
3768 | static ::mlir::StringAttr getRegionAttrsAttrName(::mlir::OperationName name) { |
3769 | return getAttributeNameForIndex(name, 1); |
3770 | } |
3771 | |
3772 | ::mlir::StringAttr region_attrsAttrName() { |
3773 | return getAttributeNameForIndex(1); |
3774 | } |
3775 | |
3776 | static ::mlir::StringAttr region_attrsAttrName(::mlir::OperationName name) { |
3777 | return getAttributeNameForIndex(name, 1); |
3778 | } |
3779 | |
3780 | static constexpr ::llvm::StringLiteral getOperationName() { |
3781 | return ::llvm::StringLiteral("tfg.StatelessCaseRegion" ); |
3782 | } |
3783 | |
3784 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3785 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
3786 | ::mlir::TypedValue<::mlir::TensorType> getBranchIndex(); |
3787 | ::mlir::TypedValue<::mlir::TensorType> branch_index(); |
3788 | ::mlir::Operation::operand_range getCtls(); |
3789 | ::mlir::Operation::operand_range ctls(); |
3790 | ::mlir::MutableOperandRange getBranchIndexMutable(); |
3791 | ::mlir::MutableOperandRange branch_indexMutable(); |
3792 | ::mlir::MutableOperandRange getCtlsMutable(); |
3793 | ::mlir::MutableOperandRange ctlsMutable(); |
3794 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
3795 | ::mlir::Operation::result_range getODSResults(unsigned index); |
3796 | ::mlir::Operation::result_range getOuts(); |
3797 | ::mlir::Operation::result_range outs(); |
3798 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
3799 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
3800 | ::mlir::MutableArrayRef<::mlir::Region> getBranches(); |
3801 | ::mlir::MutableArrayRef<::mlir::Region> branches(); |
3802 | ::mlir::ArrayAttr getBranchAttrsAttr(); |
3803 | ::llvm::Optional< ::mlir::ArrayAttr > getBranchAttrs(); |
3804 | ::mlir::ArrayAttr branch_attrsAttr(); |
3805 | ::llvm::Optional< ::mlir::ArrayAttr > branch_attrs(); |
3806 | ::mlir::ArrayAttr getRegionAttrsAttr(); |
3807 | ::llvm::Optional< ::mlir::ArrayAttr > getRegionAttrs(); |
3808 | ::mlir::ArrayAttr region_attrsAttr(); |
3809 | ::llvm::Optional< ::mlir::ArrayAttr > region_attrs(); |
3810 | void setBranchAttrsAttr(::mlir::ArrayAttr attr); |
3811 | void branch_attrsAttr(::mlir::ArrayAttr attr); |
3812 | void setRegionAttrsAttr(::mlir::ArrayAttr attr); |
3813 | void region_attrsAttr(::mlir::ArrayAttr attr); |
3814 | ::mlir::Attribute removeBranch_attrsAttr(); |
3815 | ::mlir::Attribute removeRegion_attrsAttr(); |
3816 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::Value branch_index, ::mlir::ValueRange ctls, /*optional*/::mlir::ArrayAttr branch_attrs, /*optional*/::mlir::ArrayAttr region_attrs, unsigned branchesCount); |
3817 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value branch_index, ::mlir::ValueRange ctls, /*optional*/::mlir::ArrayAttr branch_attrs, /*optional*/::mlir::ArrayAttr region_attrs, unsigned branchesCount); |
3818 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions); |
3819 | ::mlir::LogicalResult verifyInvariantsImpl(); |
3820 | ::mlir::LogicalResult verifyInvariants(); |
3821 | ::mlir::LogicalResult verify(); |
3822 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
3823 | static ::llvm::StringRef getDefaultDialect(); |
3824 | void getSuccessorRegions(::llvm::Optional<unsigned> index, ::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); |
3825 | void getRegionInvocationBounds(::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::InvocationBounds> &invocationBounds); |
3826 | static mlir::BlockArgument getDataValueOf(BlockArgument ctl); |
3827 | static mlir::BlockArgument getControlTokenOf(BlockArgument data); |
3828 | static mlir::BlockArgument getDataValue(Region ®ion, unsigned idx); |
3829 | static mlir::BlockArgument getControlToken(Region ®ion, unsigned idx); |
3830 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
3831 | void print(::mlir::OpAsmPrinter &_odsPrinter); |
3832 | private: |
3833 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
3834 | return getAttributeNameForIndex((*this)->getName(), index); |
3835 | } |
3836 | |
3837 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
3838 | assert(index < 2 && "invalid attribute index" ); |
3839 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
3840 | } |
3841 | |
3842 | public: |
3843 | Block &branch_block(unsigned idx) { return branches()[idx].front(); } |
3844 | YieldOp branch_yield(unsigned idx); |
3845 | |
3846 | bool areTypesCompatible(Type lhs, Type rhs) { |
3847 | return tf_type::HasCompatibleElementTypes(lhs, rhs); |
3848 | } |
3849 | |
3850 | RegionAttr getPreservedAttrs(unsigned index) { |
3851 | if (auto attrs = region_attrsAttr()) |
3852 | return attrs[index].cast<RegionAttr>(); |
3853 | return {}; |
3854 | } |
3855 | void setPreservedAttrs(unsigned index, RegionAttr attrs) { |
3856 | SmallVector<Attribute> array = llvm::to_vector(region_attrsAttr()); |
3857 | array[index] = attrs; |
3858 | region_attrsAttr(ArrayAttr::get(getContext(), array)); |
3859 | } |
3860 | }; |
3861 | } // namespace tfg |
3862 | } // namespace mlir |
3863 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::StatelessCaseRegionOp) |
3864 | |
3865 | namespace mlir { |
3866 | namespace tfg { |
3867 | |
3868 | //===----------------------------------------------------------------------===// |
3869 | // ::mlir::tfg::StatelessIfOp declarations |
3870 | //===----------------------------------------------------------------------===// |
3871 | |
3872 | class StatelessIfOpAdaptor { |
3873 | public: |
3874 | StatelessIfOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
3875 | |
3876 | StatelessIfOpAdaptor(StatelessIfOp op); |
3877 | |
3878 | ::mlir::ValueRange getOperands(); |
3879 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3880 | ::mlir::ValueRange getODSOperands(unsigned index); |
3881 | ::mlir::Value getCond(); |
3882 | ::mlir::Value cond(); |
3883 | ::mlir::ValueRange getArgs(); |
3884 | ::mlir::ValueRange args(); |
3885 | ::mlir::DictionaryAttr getAttributes(); |
3886 | ::mlir::tf_type::FuncAttr getThenBranchAttr(); |
3887 | ::mlir::tf_type::FuncAttr getThenBranch(); |
3888 | ::mlir::tf_type::FuncAttr then_branchAttr(); |
3889 | ::mlir::tf_type::FuncAttr then_branch(); |
3890 | ::mlir::tf_type::FuncAttr getElseBranchAttr(); |
3891 | ::mlir::tf_type::FuncAttr getElseBranch(); |
3892 | ::mlir::tf_type::FuncAttr else_branchAttr(); |
3893 | ::mlir::tf_type::FuncAttr else_branch(); |
3894 | ::mlir::TypeAttr getTcondAttr(); |
3895 | ::llvm::Optional<::mlir::Type> getTcond(); |
3896 | ::mlir::TypeAttr TcondAttr(); |
3897 | ::llvm::Optional<::mlir::Type> Tcond(); |
3898 | ::mlir::ArrayAttr getTinAttr(); |
3899 | ::llvm::Optional< ::mlir::ArrayAttr > getTin(); |
3900 | ::mlir::ArrayAttr TinAttr(); |
3901 | ::llvm::Optional< ::mlir::ArrayAttr > Tin(); |
3902 | ::mlir::ArrayAttr getToutAttr(); |
3903 | ::llvm::Optional< ::mlir::ArrayAttr > getTout(); |
3904 | ::mlir::ArrayAttr ToutAttr(); |
3905 | ::llvm::Optional< ::mlir::ArrayAttr > Tout(); |
3906 | ::mlir::ArrayAttr getOutputShapesAttr(); |
3907 | ::llvm::Optional< ::mlir::ArrayAttr > getOutputShapes(); |
3908 | ::mlir::ArrayAttr output_shapesAttr(); |
3909 | ::llvm::Optional< ::mlir::ArrayAttr > output_shapes(); |
3910 | ::mlir::LogicalResult verify(::mlir::Location loc); |
3911 | private: |
3912 | ::mlir::ValueRange odsOperands; |
3913 | ::mlir::DictionaryAttr odsAttrs; |
3914 | ::mlir::RegionRange odsRegions; |
3915 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
3916 | }; |
3917 | class StatelessIfOp : public ::mlir::Op<StatelessIfOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::SymbolUserOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { |
3918 | public: |
3919 | using Op::Op; |
3920 | using Op::print; |
3921 | using Adaptor = StatelessIfOpAdaptor; |
3922 | public: |
3923 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
3924 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcond" ), ::llvm::StringRef("Tin" ), ::llvm::StringRef("Tout" ), ::llvm::StringRef("else_branch" ), ::llvm::StringRef("output_shapes" ), ::llvm::StringRef("then_branch" )}; |
3925 | return ::llvm::makeArrayRef(attrNames); |
3926 | } |
3927 | |
3928 | ::mlir::StringAttr getTcondAttrName() { |
3929 | return getAttributeNameForIndex(0); |
3930 | } |
3931 | |
3932 | static ::mlir::StringAttr getTcondAttrName(::mlir::OperationName name) { |
3933 | return getAttributeNameForIndex(name, 0); |
3934 | } |
3935 | |
3936 | ::mlir::StringAttr TcondAttrName() { |
3937 | return getAttributeNameForIndex(0); |
3938 | } |
3939 | |
3940 | static ::mlir::StringAttr TcondAttrName(::mlir::OperationName name) { |
3941 | return getAttributeNameForIndex(name, 0); |
3942 | } |
3943 | |
3944 | ::mlir::StringAttr getTinAttrName() { |
3945 | return getAttributeNameForIndex(1); |
3946 | } |
3947 | |
3948 | static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { |
3949 | return getAttributeNameForIndex(name, 1); |
3950 | } |
3951 | |
3952 | ::mlir::StringAttr TinAttrName() { |
3953 | return getAttributeNameForIndex(1); |
3954 | } |
3955 | |
3956 | static ::mlir::StringAttr TinAttrName(::mlir::OperationName name) { |
3957 | return getAttributeNameForIndex(name, 1); |
3958 | } |
3959 | |
3960 | ::mlir::StringAttr getToutAttrName() { |
3961 | return getAttributeNameForIndex(2); |
3962 | } |
3963 | |
3964 | static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { |
3965 | return getAttributeNameForIndex(name, 2); |
3966 | } |
3967 | |
3968 | ::mlir::StringAttr ToutAttrName() { |
3969 | return getAttributeNameForIndex(2); |
3970 | } |
3971 | |
3972 | static ::mlir::StringAttr ToutAttrName(::mlir::OperationName name) { |
3973 | return getAttributeNameForIndex(name, 2); |
3974 | } |
3975 | |
3976 | ::mlir::StringAttr getElseBranchAttrName() { |
3977 | return getAttributeNameForIndex(3); |
3978 | } |
3979 | |
3980 | static ::mlir::StringAttr getElseBranchAttrName(::mlir::OperationName name) { |
3981 | return getAttributeNameForIndex(name, 3); |
3982 | } |
3983 | |
3984 | ::mlir::StringAttr else_branchAttrName() { |
3985 | return getAttributeNameForIndex(3); |
3986 | } |
3987 | |
3988 | static ::mlir::StringAttr else_branchAttrName(::mlir::OperationName name) { |
3989 | return getAttributeNameForIndex(name, 3); |
3990 | } |
3991 | |
3992 | ::mlir::StringAttr getOutputShapesAttrName() { |
3993 | return getAttributeNameForIndex(4); |
3994 | } |
3995 | |
3996 | static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { |
3997 | return getAttributeNameForIndex(name, 4); |
3998 | } |
3999 | |
4000 | ::mlir::StringAttr output_shapesAttrName() { |
4001 | return getAttributeNameForIndex(4); |
4002 | } |
4003 | |
4004 | static ::mlir::StringAttr output_shapesAttrName(::mlir::OperationName name) { |
4005 | return getAttributeNameForIndex(name, 4); |
4006 | } |
4007 | |
4008 | ::mlir::StringAttr getThenBranchAttrName() { |
4009 | return getAttributeNameForIndex(5); |
4010 | } |
4011 | |
4012 | static ::mlir::StringAttr getThenBranchAttrName(::mlir::OperationName name) { |
4013 | return getAttributeNameForIndex(name, 5); |
4014 | } |
4015 | |
4016 | ::mlir::StringAttr then_branchAttrName() { |
4017 | return getAttributeNameForIndex(5); |
4018 | } |
4019 | |
4020 | static ::mlir::StringAttr then_branchAttrName(::mlir::OperationName name) { |
4021 | return getAttributeNameForIndex(name, 5); |
4022 | } |
4023 | |
4024 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
4025 | static constexpr ::llvm::StringLiteral getOperationName() { |
4026 | return ::llvm::StringLiteral("tfg.StatelessIf" ); |
4027 | } |
4028 | |
4029 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
4030 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
4031 | ::mlir::Value getCond(); |
4032 | ::mlir::Value cond(); |
4033 | ::mlir::Operation::operand_range getArgs(); |
4034 | ::mlir::Operation::operand_range args(); |
4035 | ::mlir::MutableOperandRange getCondMutable(); |
4036 | ::mlir::MutableOperandRange condMutable(); |
4037 | ::mlir::MutableOperandRange getArgsMutable(); |
4038 | ::mlir::MutableOperandRange argsMutable(); |
4039 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
4040 | ::mlir::Operation::result_range getODSResults(unsigned index); |
4041 | ::mlir::Operation::result_range getOuts(); |
4042 | ::mlir::Operation::result_range outs(); |
4043 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
4044 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
4045 | ::mlir::tf_type::FuncAttr getThenBranchAttr(); |
4046 | ::mlir::tf_type::FuncAttr getThenBranch(); |
4047 | ::mlir::tf_type::FuncAttr then_branchAttr(); |
4048 | ::mlir::tf_type::FuncAttr then_branch(); |
4049 | ::mlir::tf_type::FuncAttr getElseBranchAttr(); |
4050 | ::mlir::tf_type::FuncAttr getElseBranch(); |
4051 | ::mlir::tf_type::FuncAttr else_branchAttr(); |
4052 | ::mlir::tf_type::FuncAttr else_branch(); |
4053 | ::mlir::TypeAttr getTcondAttr(); |
4054 | ::llvm::Optional<::mlir::Type> getTcond(); |
4055 | ::mlir::TypeAttr TcondAttr(); |
4056 | ::llvm::Optional<::mlir::Type> Tcond(); |
4057 | ::mlir::ArrayAttr getTinAttr(); |
4058 | ::llvm::Optional< ::mlir::ArrayAttr > getTin(); |
4059 | ::mlir::ArrayAttr TinAttr(); |
4060 | ::llvm::Optional< ::mlir::ArrayAttr > Tin(); |
4061 | ::mlir::ArrayAttr getToutAttr(); |
4062 | ::llvm::Optional< ::mlir::ArrayAttr > getTout(); |
4063 | ::mlir::ArrayAttr ToutAttr(); |
4064 | ::llvm::Optional< ::mlir::ArrayAttr > Tout(); |
4065 | ::mlir::ArrayAttr getOutputShapesAttr(); |
4066 | ::llvm::Optional< ::mlir::ArrayAttr > getOutputShapes(); |
4067 | ::mlir::ArrayAttr output_shapesAttr(); |
4068 | ::llvm::Optional< ::mlir::ArrayAttr > output_shapes(); |
4069 | void setThenBranchAttr(::mlir::tf_type::FuncAttr attr); |
4070 | void then_branchAttr(::mlir::tf_type::FuncAttr attr); |
4071 | void setElseBranchAttr(::mlir::tf_type::FuncAttr attr); |
4072 | void else_branchAttr(::mlir::tf_type::FuncAttr attr); |
4073 | void setTcondAttr(::mlir::TypeAttr attr); |
4074 | void TcondAttr(::mlir::TypeAttr attr); |
4075 | void setTinAttr(::mlir::ArrayAttr attr); |
4076 | void TinAttr(::mlir::ArrayAttr attr); |
4077 | void setToutAttr(::mlir::ArrayAttr attr); |
4078 | void ToutAttr(::mlir::ArrayAttr attr); |
4079 | void setOutputShapesAttr(::mlir::ArrayAttr attr); |
4080 | void output_shapesAttr(::mlir::ArrayAttr attr); |
4081 | ::mlir::Attribute removeTcondAttr(); |
4082 | ::mlir::Attribute removeTinAttr(); |
4083 | ::mlir::Attribute removeToutAttr(); |
4084 | ::mlir::Attribute removeOutput_shapesAttr(); |
4085 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange results, Value cond, ValueRange args, FuncAttr then_branch, FuncAttr else_branch); |
4086 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::Value cond, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr then_branch, ::mlir::tf_type::FuncAttr else_branch, /*optional*/::mlir::TypeAttr Tcond, /*optional*/::mlir::ArrayAttr Tin, /*optional*/::mlir::ArrayAttr Tout, /*optional*/::mlir::ArrayAttr output_shapes); |
4087 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value cond, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr then_branch, ::mlir::tf_type::FuncAttr else_branch, /*optional*/::mlir::TypeAttr Tcond, /*optional*/::mlir::ArrayAttr Tin, /*optional*/::mlir::ArrayAttr Tout, /*optional*/::mlir::ArrayAttr output_shapes); |
4088 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
4089 | ::mlir::LogicalResult verifyInvariantsImpl(); |
4090 | ::mlir::LogicalResult verifyInvariants(); |
4091 | ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); |
4092 | private: |
4093 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
4094 | return getAttributeNameForIndex((*this)->getName(), index); |
4095 | } |
4096 | |
4097 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
4098 | assert(index < 6 && "invalid attribute index" ); |
4099 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
4100 | } |
4101 | |
4102 | public: |
4103 | }; |
4104 | } // namespace tfg |
4105 | } // namespace mlir |
4106 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::StatelessIfOp) |
4107 | |
4108 | namespace mlir { |
4109 | namespace tfg { |
4110 | |
4111 | //===----------------------------------------------------------------------===// |
4112 | // ::mlir::tfg::StatelessIfRegionOp declarations |
4113 | //===----------------------------------------------------------------------===// |
4114 | |
4115 | class StatelessIfRegionOpAdaptor { |
4116 | public: |
4117 | StatelessIfRegionOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
4118 | |
4119 | StatelessIfRegionOpAdaptor(StatelessIfRegionOp op); |
4120 | |
4121 | ::mlir::ValueRange getOperands(); |
4122 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
4123 | ::mlir::ValueRange getODSOperands(unsigned index); |
4124 | ::mlir::Value getCond(); |
4125 | ::mlir::Value cond(); |
4126 | ::mlir::ValueRange getCtls(); |
4127 | ::mlir::ValueRange ctls(); |
4128 | ::mlir::DictionaryAttr getAttributes(); |
4129 | ::mlir::DictionaryAttr getThenAttrsAttr(); |
4130 | ::llvm::Optional< ::mlir::DictionaryAttr > getThenAttrs(); |
4131 | ::mlir::DictionaryAttr then_attrsAttr(); |
4132 | ::llvm::Optional< ::mlir::DictionaryAttr > then_attrs(); |
4133 | ::mlir::DictionaryAttr getElseAttrsAttr(); |
4134 | ::llvm::Optional< ::mlir::DictionaryAttr > getElseAttrs(); |
4135 | ::mlir::DictionaryAttr else_attrsAttr(); |
4136 | ::llvm::Optional< ::mlir::DictionaryAttr > else_attrs(); |
4137 | ::mlir::tfg::RegionAttr getThenRegionAttrsAttr(); |
4138 | ::llvm::Optional<::mlir::tfg::RegionAttr> getThenRegionAttrs(); |
4139 | ::mlir::tfg::RegionAttr then_region_attrsAttr(); |
4140 | ::llvm::Optional<::mlir::tfg::RegionAttr> then_region_attrs(); |
4141 | ::mlir::tfg::RegionAttr getElseRegionAttrsAttr(); |
4142 | ::llvm::Optional<::mlir::tfg::RegionAttr> getElseRegionAttrs(); |
4143 | ::mlir::tfg::RegionAttr else_region_attrsAttr(); |
4144 | ::llvm::Optional<::mlir::tfg::RegionAttr> else_region_attrs(); |
4145 | ::mlir::RegionRange getRegions(); |
4146 | ::mlir::Region &getThenRegion(); |
4147 | ::mlir::Region &then_region(); |
4148 | ::mlir::Region &getElseRegion(); |
4149 | ::mlir::Region &else_region(); |
4150 | ::mlir::LogicalResult verify(::mlir::Location loc); |
4151 | private: |
4152 | ::mlir::ValueRange odsOperands; |
4153 | ::mlir::DictionaryAttr odsAttrs; |
4154 | ::mlir::RegionRange odsRegions; |
4155 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
4156 | }; |
4157 | class StatelessIfRegionOp : public ::mlir::Op<StatelessIfRegionOp, ::mlir::OpTrait::NRegions<2>::Impl, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasOnlyGraphRegion, ::mlir::RegionKindInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::tfg::PreservedAttributesInterface::Trait, ::mlir::RegionBranchOpInterface::Trait, ::mlir::tfg::ControlArgumentInterface::Trait> { |
4158 | public: |
4159 | using Op::Op; |
4160 | using Op::print; |
4161 | using Adaptor = StatelessIfRegionOpAdaptor; |
4162 | public: |
4163 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
4164 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("else_attrs" ), ::llvm::StringRef("else_region_attrs" ), ::llvm::StringRef("then_attrs" ), ::llvm::StringRef("then_region_attrs" )}; |
4165 | return ::llvm::makeArrayRef(attrNames); |
4166 | } |
4167 | |
4168 | ::mlir::StringAttr getElseAttrsAttrName() { |
4169 | return getAttributeNameForIndex(0); |
4170 | } |
4171 | |
4172 | static ::mlir::StringAttr getElseAttrsAttrName(::mlir::OperationName name) { |
4173 | return getAttributeNameForIndex(name, 0); |
4174 | } |
4175 | |
4176 | ::mlir::StringAttr else_attrsAttrName() { |
4177 | return getAttributeNameForIndex(0); |
4178 | } |
4179 | |
4180 | static ::mlir::StringAttr else_attrsAttrName(::mlir::OperationName name) { |
4181 | return getAttributeNameForIndex(name, 0); |
4182 | } |
4183 | |
4184 | ::mlir::StringAttr getElseRegionAttrsAttrName() { |
4185 | return getAttributeNameForIndex(1); |
4186 | } |
4187 | |
4188 | static ::mlir::StringAttr getElseRegionAttrsAttrName(::mlir::OperationName name) { |
4189 | return getAttributeNameForIndex(name, 1); |
4190 | } |
4191 | |
4192 | ::mlir::StringAttr else_region_attrsAttrName() { |
4193 | return getAttributeNameForIndex(1); |
4194 | } |
4195 | |
4196 | static ::mlir::StringAttr else_region_attrsAttrName(::mlir::OperationName name) { |
4197 | return getAttributeNameForIndex(name, 1); |
4198 | } |
4199 | |
4200 | ::mlir::StringAttr getThenAttrsAttrName() { |
4201 | return getAttributeNameForIndex(2); |
4202 | } |
4203 | |
4204 | static ::mlir::StringAttr getThenAttrsAttrName(::mlir::OperationName name) { |
4205 | return getAttributeNameForIndex(name, 2); |
4206 | } |
4207 | |
4208 | ::mlir::StringAttr then_attrsAttrName() { |
4209 | return getAttributeNameForIndex(2); |
4210 | } |
4211 | |
4212 | static ::mlir::StringAttr then_attrsAttrName(::mlir::OperationName name) { |
4213 | return getAttributeNameForIndex(name, 2); |
4214 | } |
4215 | |
4216 | ::mlir::StringAttr getThenRegionAttrsAttrName() { |
4217 | return getAttributeNameForIndex(3); |
4218 | } |
4219 | |
4220 | static ::mlir::StringAttr getThenRegionAttrsAttrName(::mlir::OperationName name) { |
4221 | return getAttributeNameForIndex(name, 3); |
4222 | } |
4223 | |
4224 | ::mlir::StringAttr then_region_attrsAttrName() { |
4225 | return getAttributeNameForIndex(3); |
4226 | } |
4227 | |
4228 | static ::mlir::StringAttr then_region_attrsAttrName(::mlir::OperationName name) { |
4229 | return getAttributeNameForIndex(name, 3); |
4230 | } |
4231 | |
4232 | static constexpr ::llvm::StringLiteral getOperationName() { |
4233 | return ::llvm::StringLiteral("tfg.StatelessIfRegion" ); |
4234 | } |
4235 | |
4236 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
4237 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
4238 | ::mlir::TypedValue<::mlir::TensorType> getCond(); |
4239 | ::mlir::TypedValue<::mlir::TensorType> cond(); |
4240 | ::mlir::Operation::operand_range getCtls(); |
4241 | ::mlir::Operation::operand_range ctls(); |
4242 | ::mlir::MutableOperandRange getCondMutable(); |
4243 | ::mlir::MutableOperandRange condMutable(); |
4244 | ::mlir::MutableOperandRange getCtlsMutable(); |
4245 | ::mlir::MutableOperandRange ctlsMutable(); |
4246 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
4247 | ::mlir::Operation::result_range getODSResults(unsigned index); |
4248 | ::mlir::Operation::result_range getOuts(); |
4249 | ::mlir::Operation::result_range outs(); |
4250 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
4251 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
4252 | ::mlir::Region &getThenRegion(); |
4253 | ::mlir::Region &then_region(); |
4254 | ::mlir::Region &getElseRegion(); |
4255 | ::mlir::Region &else_region(); |
4256 | ::mlir::DictionaryAttr getThenAttrsAttr(); |
4257 | ::llvm::Optional< ::mlir::DictionaryAttr > getThenAttrs(); |
4258 | ::mlir::DictionaryAttr then_attrsAttr(); |
4259 | ::llvm::Optional< ::mlir::DictionaryAttr > then_attrs(); |
4260 | ::mlir::DictionaryAttr getElseAttrsAttr(); |
4261 | ::llvm::Optional< ::mlir::DictionaryAttr > getElseAttrs(); |
4262 | ::mlir::DictionaryAttr else_attrsAttr(); |
4263 | ::llvm::Optional< ::mlir::DictionaryAttr > else_attrs(); |
4264 | ::mlir::tfg::RegionAttr getThenRegionAttrsAttr(); |
4265 | ::llvm::Optional<::mlir::tfg::RegionAttr> getThenRegionAttrs(); |
4266 | ::mlir::tfg::RegionAttr then_region_attrsAttr(); |
4267 | ::llvm::Optional<::mlir::tfg::RegionAttr> then_region_attrs(); |
4268 | ::mlir::tfg::RegionAttr getElseRegionAttrsAttr(); |
4269 | ::llvm::Optional<::mlir::tfg::RegionAttr> getElseRegionAttrs(); |
4270 | ::mlir::tfg::RegionAttr else_region_attrsAttr(); |
4271 | ::llvm::Optional<::mlir::tfg::RegionAttr> else_region_attrs(); |
4272 | void setThenAttrsAttr(::mlir::DictionaryAttr attr); |
4273 | void then_attrsAttr(::mlir::DictionaryAttr attr); |
4274 | void setElseAttrsAttr(::mlir::DictionaryAttr attr); |
4275 | void else_attrsAttr(::mlir::DictionaryAttr attr); |
4276 | void setThenRegionAttrsAttr(::mlir::tfg::RegionAttr attr); |
4277 | void then_region_attrsAttr(::mlir::tfg::RegionAttr attr); |
4278 | void setElseRegionAttrsAttr(::mlir::tfg::RegionAttr attr); |
4279 | void else_region_attrsAttr(::mlir::tfg::RegionAttr attr); |
4280 | ::mlir::Attribute removeThen_attrsAttr(); |
4281 | ::mlir::Attribute removeElse_attrsAttr(); |
4282 | ::mlir::Attribute removeThen_region_attrsAttr(); |
4283 | ::mlir::Attribute removeElse_region_attrsAttr(); |
4284 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::Value cond, ::mlir::ValueRange ctls, /*optional*/::mlir::DictionaryAttr then_attrs, /*optional*/::mlir::DictionaryAttr else_attrs, /*optional*/::mlir::tfg::RegionAttr then_region_attrs, /*optional*/::mlir::tfg::RegionAttr else_region_attrs); |
4285 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value cond, ::mlir::ValueRange ctls, /*optional*/::mlir::DictionaryAttr then_attrs, /*optional*/::mlir::DictionaryAttr else_attrs, /*optional*/::mlir::tfg::RegionAttr then_region_attrs, /*optional*/::mlir::tfg::RegionAttr else_region_attrs); |
4286 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
4287 | ::mlir::LogicalResult verifyInvariantsImpl(); |
4288 | ::mlir::LogicalResult verifyInvariants(); |
4289 | ::mlir::LogicalResult verify(); |
4290 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
4291 | static ::llvm::StringRef getDefaultDialect(); |
4292 | void getSuccessorRegions(::llvm::Optional<unsigned> index, ::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); |
4293 | void getRegionInvocationBounds(::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::InvocationBounds> &invocationBounds); |
4294 | static mlir::BlockArgument getDataValueOf(BlockArgument ctl); |
4295 | static mlir::BlockArgument getControlTokenOf(BlockArgument data); |
4296 | static mlir::BlockArgument getDataValue(Region ®ion, unsigned idx); |
4297 | static mlir::BlockArgument getControlToken(Region ®ion, unsigned idx); |
4298 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
4299 | void print(::mlir::OpAsmPrinter &_odsPrinter); |
4300 | private: |
4301 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
4302 | return getAttributeNameForIndex((*this)->getName(), index); |
4303 | } |
4304 | |
4305 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
4306 | assert(index < 4 && "invalid attribute index" ); |
4307 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
4308 | } |
4309 | |
4310 | public: |
4311 | Block &then_block() { return then_region().front(); } |
4312 | Block &else_block() { return else_region().front(); } |
4313 | YieldOp then_yield(); |
4314 | YieldOp else_yield(); |
4315 | |
4316 | bool areTypesCompatible(Type lhs, Type rhs) { |
4317 | return tf_type::HasCompatibleElementTypes(lhs, rhs); |
4318 | } |
4319 | |
4320 | RegionAttr getPreservedAttrs(unsigned index) { |
4321 | if (index == 0) return then_region_attrsAttr(); |
4322 | return else_region_attrsAttr(); |
4323 | } |
4324 | void setPreservedAttrs(unsigned index, RegionAttr attrs) { |
4325 | if (index == 0) then_region_attrsAttr(attrs); |
4326 | else else_region_attrsAttr(attrs); |
4327 | } |
4328 | }; |
4329 | } // namespace tfg |
4330 | } // namespace mlir |
4331 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::StatelessIfRegionOp) |
4332 | |
4333 | namespace mlir { |
4334 | namespace tfg { |
4335 | |
4336 | //===----------------------------------------------------------------------===// |
4337 | // ::mlir::tfg::StatelessWhileOp declarations |
4338 | //===----------------------------------------------------------------------===// |
4339 | |
4340 | class StatelessWhileOpAdaptor { |
4341 | public: |
4342 | StatelessWhileOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
4343 | |
4344 | StatelessWhileOpAdaptor(StatelessWhileOp op); |
4345 | |
4346 | ::mlir::ValueRange getOperands(); |
4347 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
4348 | ::mlir::ValueRange getODSOperands(unsigned index); |
4349 | ::mlir::ValueRange getArgs(); |
4350 | ::mlir::ValueRange args(); |
4351 | ::mlir::DictionaryAttr getAttributes(); |
4352 | ::mlir::tf_type::FuncAttr getCondAttr(); |
4353 | ::mlir::tf_type::FuncAttr getCond(); |
4354 | ::mlir::tf_type::FuncAttr condAttr(); |
4355 | ::mlir::tf_type::FuncAttr cond(); |
4356 | ::mlir::tf_type::FuncAttr getBodyAttr(); |
4357 | ::mlir::tf_type::FuncAttr getBody(); |
4358 | ::mlir::tf_type::FuncAttr bodyAttr(); |
4359 | ::mlir::tf_type::FuncAttr body(); |
4360 | ::mlir::IntegerAttr getParallelIterationsAttr(); |
4361 | uint64_t getParallelIterations(); |
4362 | ::mlir::IntegerAttr parallel_iterationsAttr(); |
4363 | uint64_t parallel_iterations(); |
4364 | ::mlir::ArrayAttr getTAttr(); |
4365 | ::llvm::Optional< ::mlir::ArrayAttr > getT(); |
4366 | ::mlir::ArrayAttr TAttr(); |
4367 | ::llvm::Optional< ::mlir::ArrayAttr > T(); |
4368 | ::mlir::ArrayAttr getOutputShapesAttr(); |
4369 | ::llvm::Optional< ::mlir::ArrayAttr > getOutputShapes(); |
4370 | ::mlir::ArrayAttr output_shapesAttr(); |
4371 | ::llvm::Optional< ::mlir::ArrayAttr > output_shapes(); |
4372 | ::mlir::LogicalResult verify(::mlir::Location loc); |
4373 | private: |
4374 | ::mlir::ValueRange odsOperands; |
4375 | ::mlir::DictionaryAttr odsAttrs; |
4376 | ::mlir::RegionRange odsRegions; |
4377 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
4378 | }; |
4379 | class StatelessWhileOp : public ::mlir::Op<StatelessWhileOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::SymbolUserOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { |
4380 | public: |
4381 | using Op::Op; |
4382 | using Op::print; |
4383 | using Adaptor = StatelessWhileOpAdaptor; |
4384 | public: |
4385 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
4386 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T" ), ::llvm::StringRef("body" ), ::llvm::StringRef("cond" ), ::llvm::StringRef("output_shapes" ), ::llvm::StringRef("parallel_iterations" )}; |
4387 | return ::llvm::makeArrayRef(attrNames); |
4388 | } |
4389 | |
4390 | ::mlir::StringAttr getTAttrName() { |
4391 | return getAttributeNameForIndex(0); |
4392 | } |
4393 | |
4394 | static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { |
4395 | return getAttributeNameForIndex(name, 0); |
4396 | } |
4397 | |
4398 | ::mlir::StringAttr TAttrName() { |
4399 | return getAttributeNameForIndex(0); |
4400 | } |
4401 | |
4402 | static ::mlir::StringAttr TAttrName(::mlir::OperationName name) { |
4403 | return getAttributeNameForIndex(name, 0); |
4404 | } |
4405 | |
4406 | ::mlir::StringAttr getBodyAttrName() { |
4407 | return getAttributeNameForIndex(1); |
4408 | } |
4409 | |
4410 | static ::mlir::StringAttr getBodyAttrName(::mlir::OperationName name) { |
4411 | return getAttributeNameForIndex(name, 1); |
4412 | } |
4413 | |
4414 | ::mlir::StringAttr bodyAttrName() { |
4415 | return getAttributeNameForIndex(1); |
4416 | } |
4417 | |
4418 | static ::mlir::StringAttr bodyAttrName(::mlir::OperationName name) { |
4419 | return getAttributeNameForIndex(name, 1); |
4420 | } |
4421 | |
4422 | ::mlir::StringAttr getCondAttrName() { |
4423 | return getAttributeNameForIndex(2); |
4424 | } |
4425 | |
4426 | static ::mlir::StringAttr getCondAttrName(::mlir::OperationName name) { |
4427 | return getAttributeNameForIndex(name, 2); |
4428 | } |
4429 | |
4430 | ::mlir::StringAttr condAttrName() { |
4431 | return getAttributeNameForIndex(2); |
4432 | } |
4433 | |
4434 | static ::mlir::StringAttr condAttrName(::mlir::OperationName name) { |
4435 | return getAttributeNameForIndex(name, 2); |
4436 | } |
4437 | |
4438 | ::mlir::StringAttr getOutputShapesAttrName() { |
4439 | return getAttributeNameForIndex(3); |
4440 | } |
4441 | |
4442 | static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { |
4443 | return getAttributeNameForIndex(name, 3); |
4444 | } |
4445 | |
4446 | ::mlir::StringAttr output_shapesAttrName() { |
4447 | return getAttributeNameForIndex(3); |
4448 | } |
4449 | |
4450 | static ::mlir::StringAttr output_shapesAttrName(::mlir::OperationName name) { |
4451 | return getAttributeNameForIndex(name, 3); |
4452 | } |
4453 | |
4454 | ::mlir::StringAttr getParallelIterationsAttrName() { |
4455 | return getAttributeNameForIndex(4); |
4456 | } |
4457 | |
4458 | static ::mlir::StringAttr getParallelIterationsAttrName(::mlir::OperationName name) { |
4459 | return getAttributeNameForIndex(name, 4); |
4460 | } |
4461 | |
4462 | ::mlir::StringAttr parallel_iterationsAttrName() { |
4463 | return getAttributeNameForIndex(4); |
4464 | } |
4465 | |
4466 | static ::mlir::StringAttr parallel_iterationsAttrName(::mlir::OperationName name) { |
4467 | return getAttributeNameForIndex(name, 4); |
4468 | } |
4469 | |
4470 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
4471 | static constexpr ::llvm::StringLiteral getOperationName() { |
4472 | return ::llvm::StringLiteral("tfg.StatelessWhile" ); |
4473 | } |
4474 | |
4475 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
4476 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
4477 | ::mlir::Operation::operand_range getArgs(); |
4478 | ::mlir::Operation::operand_range args(); |
4479 | ::mlir::MutableOperandRange getArgsMutable(); |
4480 | ::mlir::MutableOperandRange argsMutable(); |
4481 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
4482 | ::mlir::Operation::result_range getODSResults(unsigned index); |
4483 | ::mlir::Operation::result_range getOuts(); |
4484 | ::mlir::Operation::result_range outs(); |
4485 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
4486 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
4487 | ::mlir::tf_type::FuncAttr getCondAttr(); |
4488 | ::mlir::tf_type::FuncAttr getCond(); |
4489 | ::mlir::tf_type::FuncAttr condAttr(); |
4490 | ::mlir::tf_type::FuncAttr cond(); |
4491 | ::mlir::tf_type::FuncAttr getBodyAttr(); |
4492 | ::mlir::tf_type::FuncAttr getBody(); |
4493 | ::mlir::tf_type::FuncAttr bodyAttr(); |
4494 | ::mlir::tf_type::FuncAttr body(); |
4495 | ::mlir::IntegerAttr getParallelIterationsAttr(); |
4496 | uint64_t getParallelIterations(); |
4497 | ::mlir::IntegerAttr parallel_iterationsAttr(); |
4498 | uint64_t parallel_iterations(); |
4499 | ::mlir::ArrayAttr getTAttr(); |
4500 | ::llvm::Optional< ::mlir::ArrayAttr > getT(); |
4501 | ::mlir::ArrayAttr TAttr(); |
4502 | ::llvm::Optional< ::mlir::ArrayAttr > T(); |
4503 | ::mlir::ArrayAttr getOutputShapesAttr(); |
4504 | ::llvm::Optional< ::mlir::ArrayAttr > getOutputShapes(); |
4505 | ::mlir::ArrayAttr output_shapesAttr(); |
4506 | ::llvm::Optional< ::mlir::ArrayAttr > output_shapes(); |
4507 | void setCondAttr(::mlir::tf_type::FuncAttr attr); |
4508 | void condAttr(::mlir::tf_type::FuncAttr attr); |
4509 | void setBodyAttr(::mlir::tf_type::FuncAttr attr); |
4510 | void bodyAttr(::mlir::tf_type::FuncAttr attr); |
4511 | void setParallelIterationsAttr(::mlir::IntegerAttr attr); |
4512 | void parallel_iterationsAttr(::mlir::IntegerAttr attr); |
4513 | void setTAttr(::mlir::ArrayAttr attr); |
4514 | void TAttr(::mlir::ArrayAttr attr); |
4515 | void setOutputShapesAttr(::mlir::ArrayAttr attr); |
4516 | void output_shapesAttr(::mlir::ArrayAttr attr); |
4517 | ::mlir::Attribute removeTAttr(); |
4518 | ::mlir::Attribute removeOutput_shapesAttr(); |
4519 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange results, ValueRange args, FuncAttr cond, FuncAttr body, IntegerAttr parallel_iterations); |
4520 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr cond, ::mlir::tf_type::FuncAttr body, ::mlir::IntegerAttr parallel_iterations, /*optional*/::mlir::ArrayAttr T, /*optional*/::mlir::ArrayAttr output_shapes); |
4521 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr cond, ::mlir::tf_type::FuncAttr body, ::mlir::IntegerAttr parallel_iterations, /*optional*/::mlir::ArrayAttr T, /*optional*/::mlir::ArrayAttr output_shapes); |
4522 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr cond, ::mlir::tf_type::FuncAttr body, uint64_t parallel_iterations, /*optional*/::mlir::ArrayAttr T, /*optional*/::mlir::ArrayAttr output_shapes); |
4523 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr cond, ::mlir::tf_type::FuncAttr body, uint64_t parallel_iterations, /*optional*/::mlir::ArrayAttr T, /*optional*/::mlir::ArrayAttr output_shapes); |
4524 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
4525 | ::mlir::LogicalResult verifyInvariantsImpl(); |
4526 | ::mlir::LogicalResult verifyInvariants(); |
4527 | ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); |
4528 | private: |
4529 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
4530 | return getAttributeNameForIndex((*this)->getName(), index); |
4531 | } |
4532 | |
4533 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
4534 | assert(index < 5 && "invalid attribute index" ); |
4535 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
4536 | } |
4537 | |
4538 | public: |
4539 | }; |
4540 | } // namespace tfg |
4541 | } // namespace mlir |
4542 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::StatelessWhileOp) |
4543 | |
4544 | namespace mlir { |
4545 | namespace tfg { |
4546 | |
4547 | //===----------------------------------------------------------------------===// |
4548 | // ::mlir::tfg::StatelessWhileRegionOp declarations |
4549 | //===----------------------------------------------------------------------===// |
4550 | |
4551 | class StatelessWhileRegionOpAdaptor { |
4552 | public: |
4553 | StatelessWhileRegionOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
4554 | |
4555 | StatelessWhileRegionOpAdaptor(StatelessWhileRegionOp op); |
4556 | |
4557 | ::mlir::ValueRange getOperands(); |
4558 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
4559 | ::mlir::ValueRange getODSOperands(unsigned index); |
4560 | ::mlir::ValueRange getInit(); |
4561 | ::mlir::ValueRange init(); |
4562 | ::mlir::ValueRange getCtls(); |
4563 | ::mlir::ValueRange ctls(); |
4564 | ::mlir::DictionaryAttr getAttributes(); |
4565 | ::mlir::IntegerAttr getParallelIterationsAttr(); |
4566 | uint64_t getParallelIterations(); |
4567 | ::mlir::IntegerAttr parallel_iterationsAttr(); |
4568 | uint64_t parallel_iterations(); |
4569 | ::mlir::DictionaryAttr getCondAttrsAttr(); |
4570 | ::llvm::Optional< ::mlir::DictionaryAttr > getCondAttrs(); |
4571 | ::mlir::DictionaryAttr cond_attrsAttr(); |
4572 | ::llvm::Optional< ::mlir::DictionaryAttr > cond_attrs(); |
4573 | ::mlir::DictionaryAttr getBodyAttrsAttr(); |
4574 | ::llvm::Optional< ::mlir::DictionaryAttr > getBodyAttrs(); |
4575 | ::mlir::DictionaryAttr body_attrsAttr(); |
4576 | ::llvm::Optional< ::mlir::DictionaryAttr > body_attrs(); |
4577 | ::mlir::tfg::RegionAttr getCondRegionAttrsAttr(); |
4578 | ::llvm::Optional<::mlir::tfg::RegionAttr> getCondRegionAttrs(); |
4579 | ::mlir::tfg::RegionAttr cond_region_attrsAttr(); |
4580 | ::llvm::Optional<::mlir::tfg::RegionAttr> cond_region_attrs(); |
4581 | ::mlir::tfg::RegionAttr getBodyRegionAttrsAttr(); |
4582 | ::llvm::Optional<::mlir::tfg::RegionAttr> getBodyRegionAttrs(); |
4583 | ::mlir::tfg::RegionAttr body_region_attrsAttr(); |
4584 | ::llvm::Optional<::mlir::tfg::RegionAttr> body_region_attrs(); |
4585 | ::mlir::RegionRange getRegions(); |
4586 | ::mlir::Region &getCondRegion(); |
4587 | ::mlir::Region &cond_region(); |
4588 | ::mlir::Region &getBodyRegion(); |
4589 | ::mlir::Region &body_region(); |
4590 | ::mlir::LogicalResult verify(::mlir::Location loc); |
4591 | private: |
4592 | ::mlir::ValueRange odsOperands; |
4593 | ::mlir::DictionaryAttr odsAttrs; |
4594 | ::mlir::RegionRange odsRegions; |
4595 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
4596 | }; |
4597 | class StatelessWhileRegionOp : public ::mlir::Op<StatelessWhileRegionOp, ::mlir::OpTrait::NRegions<2>::Impl, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasOnlyGraphRegion, ::mlir::RegionKindInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::tfg::PreservedAttributesInterface::Trait, ::mlir::RegionBranchOpInterface::Trait, ::mlir::tfg::ControlArgumentInterface::Trait> { |
4598 | public: |
4599 | using Op::Op; |
4600 | using Op::print; |
4601 | using Adaptor = StatelessWhileRegionOpAdaptor; |
4602 | public: |
4603 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
4604 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("body_attrs" ), ::llvm::StringRef("body_region_attrs" ), ::llvm::StringRef("cond_attrs" ), ::llvm::StringRef("cond_region_attrs" ), ::llvm::StringRef("operand_segment_sizes" ), ::llvm::StringRef("parallel_iterations" )}; |
4605 | return ::llvm::makeArrayRef(attrNames); |
4606 | } |
4607 | |
4608 | ::mlir::StringAttr getBodyAttrsAttrName() { |
4609 | return getAttributeNameForIndex(0); |
4610 | } |
4611 | |
4612 | static ::mlir::StringAttr getBodyAttrsAttrName(::mlir::OperationName name) { |
4613 | return getAttributeNameForIndex(name, 0); |
4614 | } |
4615 | |
4616 | ::mlir::StringAttr body_attrsAttrName() { |
4617 | return getAttributeNameForIndex(0); |
4618 | } |
4619 | |
4620 | static ::mlir::StringAttr body_attrsAttrName(::mlir::OperationName name) { |
4621 | return getAttributeNameForIndex(name, 0); |
4622 | } |
4623 | |
4624 | ::mlir::StringAttr getBodyRegionAttrsAttrName() { |
4625 | return getAttributeNameForIndex(1); |
4626 | } |
4627 | |
4628 | static ::mlir::StringAttr getBodyRegionAttrsAttrName(::mlir::OperationName name) { |
4629 | return getAttributeNameForIndex(name, 1); |
4630 | } |
4631 | |
4632 | ::mlir::StringAttr body_region_attrsAttrName() { |
4633 | return getAttributeNameForIndex(1); |
4634 | } |
4635 | |
4636 | static ::mlir::StringAttr body_region_attrsAttrName(::mlir::OperationName name) { |
4637 | return getAttributeNameForIndex(name, 1); |
4638 | } |
4639 | |
4640 | ::mlir::StringAttr getCondAttrsAttrName() { |
4641 | return getAttributeNameForIndex(2); |
4642 | } |
4643 | |
4644 | static ::mlir::StringAttr getCondAttrsAttrName(::mlir::OperationName name) { |
4645 | return getAttributeNameForIndex(name, 2); |
4646 | } |
4647 | |
4648 | ::mlir::StringAttr cond_attrsAttrName() { |
4649 | return getAttributeNameForIndex(2); |
4650 | } |
4651 | |
4652 | static ::mlir::StringAttr cond_attrsAttrName(::mlir::OperationName name) { |
4653 | return getAttributeNameForIndex(name, 2); |
4654 | } |
4655 | |
4656 | ::mlir::StringAttr getCondRegionAttrsAttrName() { |
4657 | return getAttributeNameForIndex(3); |
4658 | } |
4659 | |
4660 | static ::mlir::StringAttr getCondRegionAttrsAttrName(::mlir::OperationName name) { |
4661 | return getAttributeNameForIndex(name, 3); |
4662 | } |
4663 | |
4664 | ::mlir::StringAttr cond_region_attrsAttrName() { |
4665 | return getAttributeNameForIndex(3); |
4666 | } |
4667 | |
4668 | static ::mlir::StringAttr cond_region_attrsAttrName(::mlir::OperationName name) { |
4669 | return getAttributeNameForIndex(name, 3); |
4670 | } |
4671 | |
4672 | ::mlir::StringAttr getOperandSegmentSizesAttrName() { |
4673 | return getAttributeNameForIndex(4); |
4674 | } |
4675 | |
4676 | static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { |
4677 | return getAttributeNameForIndex(name, 4); |
4678 | } |
4679 | |
4680 | ::mlir::StringAttr operand_segment_sizesAttrName() { |
4681 | return getAttributeNameForIndex(4); |
4682 | } |
4683 | |
4684 | static ::mlir::StringAttr operand_segment_sizesAttrName(::mlir::OperationName name) { |
4685 | return getAttributeNameForIndex(name, 4); |
4686 | } |
4687 | |
4688 | ::mlir::StringAttr getParallelIterationsAttrName() { |
4689 | return getAttributeNameForIndex(5); |
4690 | } |
4691 | |
4692 | static ::mlir::StringAttr getParallelIterationsAttrName(::mlir::OperationName name) { |
4693 | return getAttributeNameForIndex(name, 5); |
4694 | } |
4695 | |
4696 | ::mlir::StringAttr parallel_iterationsAttrName() { |
4697 | return getAttributeNameForIndex(5); |
4698 | } |
4699 | |
4700 | static ::mlir::StringAttr parallel_iterationsAttrName(::mlir::OperationName name) { |
4701 | return getAttributeNameForIndex(name, 5); |
4702 | } |
4703 | |
4704 | static constexpr ::llvm::StringLiteral getOperationName() { |
4705 | return ::llvm::StringLiteral("tfg.StatelessWhileRegion" ); |
4706 | } |
4707 | |
4708 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
4709 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
4710 | ::mlir::Operation::operand_range getInit(); |
4711 | ::mlir::Operation::operand_range init(); |
4712 | ::mlir::Operation::operand_range getCtls(); |
4713 | ::mlir::Operation::operand_range ctls(); |
4714 | ::mlir::MutableOperandRange getInitMutable(); |
4715 | ::mlir::MutableOperandRange initMutable(); |
4716 | ::mlir::MutableOperandRange getCtlsMutable(); |
4717 | ::mlir::MutableOperandRange ctlsMutable(); |
4718 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
4719 | ::mlir::Operation::result_range getODSResults(unsigned index); |
4720 | ::mlir::Operation::result_range getOuts(); |
4721 | ::mlir::Operation::result_range outs(); |
4722 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
4723 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
4724 | ::mlir::Region &getCondRegion(); |
4725 | ::mlir::Region &cond_region(); |
4726 | ::mlir::Region &getBodyRegion(); |
4727 | ::mlir::Region &body_region(); |
4728 | ::mlir::IntegerAttr getParallelIterationsAttr(); |
4729 | uint64_t getParallelIterations(); |
4730 | ::mlir::IntegerAttr parallel_iterationsAttr(); |
4731 | uint64_t parallel_iterations(); |
4732 | ::mlir::DictionaryAttr getCondAttrsAttr(); |
4733 | ::llvm::Optional< ::mlir::DictionaryAttr > getCondAttrs(); |
4734 | ::mlir::DictionaryAttr cond_attrsAttr(); |
4735 | ::llvm::Optional< ::mlir::DictionaryAttr > cond_attrs(); |
4736 | ::mlir::DictionaryAttr getBodyAttrsAttr(); |
4737 | ::llvm::Optional< ::mlir::DictionaryAttr > getBodyAttrs(); |
4738 | ::mlir::DictionaryAttr body_attrsAttr(); |
4739 | ::llvm::Optional< ::mlir::DictionaryAttr > body_attrs(); |
4740 | ::mlir::tfg::RegionAttr getCondRegionAttrsAttr(); |
4741 | ::llvm::Optional<::mlir::tfg::RegionAttr> getCondRegionAttrs(); |
4742 | ::mlir::tfg::RegionAttr cond_region_attrsAttr(); |
4743 | ::llvm::Optional<::mlir::tfg::RegionAttr> cond_region_attrs(); |
4744 | ::mlir::tfg::RegionAttr getBodyRegionAttrsAttr(); |
4745 | ::llvm::Optional<::mlir::tfg::RegionAttr> getBodyRegionAttrs(); |
4746 | ::mlir::tfg::RegionAttr body_region_attrsAttr(); |
4747 | ::llvm::Optional<::mlir::tfg::RegionAttr> body_region_attrs(); |
4748 | void setParallelIterationsAttr(::mlir::IntegerAttr attr); |
4749 | void parallel_iterationsAttr(::mlir::IntegerAttr attr); |
4750 | void setCondAttrsAttr(::mlir::DictionaryAttr attr); |
4751 | void cond_attrsAttr(::mlir::DictionaryAttr attr); |
4752 | void setBodyAttrsAttr(::mlir::DictionaryAttr attr); |
4753 | void body_attrsAttr(::mlir::DictionaryAttr attr); |
4754 | void setCondRegionAttrsAttr(::mlir::tfg::RegionAttr attr); |
4755 | void cond_region_attrsAttr(::mlir::tfg::RegionAttr attr); |
4756 | void setBodyRegionAttrsAttr(::mlir::tfg::RegionAttr attr); |
4757 | void body_region_attrsAttr(::mlir::tfg::RegionAttr attr); |
4758 | ::mlir::Attribute removeCond_attrsAttr(); |
4759 | ::mlir::Attribute removeBody_attrsAttr(); |
4760 | ::mlir::Attribute removeCond_region_attrsAttr(); |
4761 | ::mlir::Attribute removeBody_region_attrsAttr(); |
4762 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::ValueRange init, ::mlir::ValueRange ctls, ::mlir::IntegerAttr parallel_iterations, /*optional*/::mlir::DictionaryAttr cond_attrs, /*optional*/::mlir::DictionaryAttr body_attrs, /*optional*/::mlir::tfg::RegionAttr cond_region_attrs, /*optional*/::mlir::tfg::RegionAttr body_region_attrs); |
4763 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange init, ::mlir::ValueRange ctls, ::mlir::IntegerAttr parallel_iterations, /*optional*/::mlir::DictionaryAttr cond_attrs, /*optional*/::mlir::DictionaryAttr body_attrs, /*optional*/::mlir::tfg::RegionAttr cond_region_attrs, /*optional*/::mlir::tfg::RegionAttr body_region_attrs); |
4764 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::ValueRange init, ::mlir::ValueRange ctls, uint64_t parallel_iterations, /*optional*/::mlir::DictionaryAttr cond_attrs, /*optional*/::mlir::DictionaryAttr body_attrs, /*optional*/::mlir::tfg::RegionAttr cond_region_attrs, /*optional*/::mlir::tfg::RegionAttr body_region_attrs); |
4765 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange init, ::mlir::ValueRange ctls, uint64_t parallel_iterations, /*optional*/::mlir::DictionaryAttr cond_attrs, /*optional*/::mlir::DictionaryAttr body_attrs, /*optional*/::mlir::tfg::RegionAttr cond_region_attrs, /*optional*/::mlir::tfg::RegionAttr body_region_attrs); |
4766 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
4767 | ::mlir::LogicalResult verifyInvariantsImpl(); |
4768 | ::mlir::LogicalResult verifyInvariants(); |
4769 | ::mlir::LogicalResult verify(); |
4770 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
4771 | static ::llvm::StringRef getDefaultDialect(); |
4772 | ::mlir::OperandRange getSuccessorEntryOperands(::llvm::Optional<unsigned> index); |
4773 | void getSuccessorRegions(::llvm::Optional<unsigned> index, ::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); |
4774 | static mlir::BlockArgument getDataValueOf(BlockArgument ctl); |
4775 | static mlir::BlockArgument getControlTokenOf(BlockArgument data); |
4776 | static mlir::BlockArgument getDataValue(Region ®ion, unsigned idx); |
4777 | static mlir::BlockArgument getControlToken(Region ®ion, unsigned idx); |
4778 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
4779 | void print(::mlir::OpAsmPrinter &_odsPrinter); |
4780 | private: |
4781 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
4782 | return getAttributeNameForIndex((*this)->getName(), index); |
4783 | } |
4784 | |
4785 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
4786 | assert(index < 6 && "invalid attribute index" ); |
4787 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
4788 | } |
4789 | |
4790 | public: |
4791 | Block &cond_block() { return cond_region().front(); } |
4792 | Block &body_block() { return body_region().front(); } |
4793 | ConditionOp cond_condition(); |
4794 | YieldOp body_yield(); |
4795 | |
4796 | bool areTypesCompatible(Type lhs, Type rhs) { |
4797 | return tf_type::HasCompatibleElementTypes(lhs, rhs); |
4798 | } |
4799 | |
4800 | RegionAttr getPreservedAttrs(unsigned index) { |
4801 | if (index == 0) return cond_region_attrsAttr(); |
4802 | return body_region_attrsAttr(); |
4803 | } |
4804 | void setPreservedAttrs(unsigned index, RegionAttr attrs) { |
4805 | if (index == 0) cond_region_attrsAttr(attrs); |
4806 | else body_region_attrsAttr(attrs); |
4807 | } |
4808 | }; |
4809 | } // namespace tfg |
4810 | } // namespace mlir |
4811 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::StatelessWhileRegionOp) |
4812 | |
4813 | namespace mlir { |
4814 | namespace tfg { |
4815 | |
4816 | //===----------------------------------------------------------------------===// |
4817 | // ::mlir::tfg::WhileOp declarations |
4818 | //===----------------------------------------------------------------------===// |
4819 | |
4820 | class WhileOpAdaptor { |
4821 | public: |
4822 | WhileOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
4823 | |
4824 | WhileOpAdaptor(WhileOp op); |
4825 | |
4826 | ::mlir::ValueRange getOperands(); |
4827 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
4828 | ::mlir::ValueRange getODSOperands(unsigned index); |
4829 | ::mlir::ValueRange getArgs(); |
4830 | ::mlir::ValueRange args(); |
4831 | ::mlir::DictionaryAttr getAttributes(); |
4832 | ::mlir::tf_type::FuncAttr getCondAttr(); |
4833 | ::mlir::tf_type::FuncAttr getCond(); |
4834 | ::mlir::tf_type::FuncAttr condAttr(); |
4835 | ::mlir::tf_type::FuncAttr cond(); |
4836 | ::mlir::tf_type::FuncAttr getBodyAttr(); |
4837 | ::mlir::tf_type::FuncAttr getBody(); |
4838 | ::mlir::tf_type::FuncAttr bodyAttr(); |
4839 | ::mlir::tf_type::FuncAttr body(); |
4840 | ::mlir::IntegerAttr getParallelIterationsAttr(); |
4841 | uint64_t getParallelIterations(); |
4842 | ::mlir::IntegerAttr parallel_iterationsAttr(); |
4843 | uint64_t parallel_iterations(); |
4844 | ::mlir::ArrayAttr getTAttr(); |
4845 | ::llvm::Optional< ::mlir::ArrayAttr > getT(); |
4846 | ::mlir::ArrayAttr TAttr(); |
4847 | ::llvm::Optional< ::mlir::ArrayAttr > T(); |
4848 | ::mlir::ArrayAttr getOutputShapesAttr(); |
4849 | ::llvm::Optional< ::mlir::ArrayAttr > getOutputShapes(); |
4850 | ::mlir::ArrayAttr output_shapesAttr(); |
4851 | ::llvm::Optional< ::mlir::ArrayAttr > output_shapes(); |
4852 | ::mlir::LogicalResult verify(::mlir::Location loc); |
4853 | private: |
4854 | ::mlir::ValueRange odsOperands; |
4855 | ::mlir::DictionaryAttr odsAttrs; |
4856 | ::mlir::RegionRange odsRegions; |
4857 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
4858 | }; |
4859 | class WhileOp : public ::mlir::Op<WhileOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::SymbolUserOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { |
4860 | public: |
4861 | using Op::Op; |
4862 | using Op::print; |
4863 | using Adaptor = WhileOpAdaptor; |
4864 | public: |
4865 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
4866 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T" ), ::llvm::StringRef("body" ), ::llvm::StringRef("cond" ), ::llvm::StringRef("output_shapes" ), ::llvm::StringRef("parallel_iterations" )}; |
4867 | return ::llvm::makeArrayRef(attrNames); |
4868 | } |
4869 | |
4870 | ::mlir::StringAttr getTAttrName() { |
4871 | return getAttributeNameForIndex(0); |
4872 | } |
4873 | |
4874 | static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { |
4875 | return getAttributeNameForIndex(name, 0); |
4876 | } |
4877 | |
4878 | ::mlir::StringAttr TAttrName() { |
4879 | return getAttributeNameForIndex(0); |
4880 | } |
4881 | |
4882 | static ::mlir::StringAttr TAttrName(::mlir::OperationName name) { |
4883 | return getAttributeNameForIndex(name, 0); |
4884 | } |
4885 | |
4886 | ::mlir::StringAttr getBodyAttrName() { |
4887 | return getAttributeNameForIndex(1); |
4888 | } |
4889 | |
4890 | static ::mlir::StringAttr getBodyAttrName(::mlir::OperationName name) { |
4891 | return getAttributeNameForIndex(name, 1); |
4892 | } |
4893 | |
4894 | ::mlir::StringAttr bodyAttrName() { |
4895 | return getAttributeNameForIndex(1); |
4896 | } |
4897 | |
4898 | static ::mlir::StringAttr bodyAttrName(::mlir::OperationName name) { |
4899 | return getAttributeNameForIndex(name, 1); |
4900 | } |
4901 | |
4902 | ::mlir::StringAttr getCondAttrName() { |
4903 | return getAttributeNameForIndex(2); |
4904 | } |
4905 | |
4906 | static ::mlir::StringAttr getCondAttrName(::mlir::OperationName name) { |
4907 | return getAttributeNameForIndex(name, 2); |
4908 | } |
4909 | |
4910 | ::mlir::StringAttr condAttrName() { |
4911 | return getAttributeNameForIndex(2); |
4912 | } |
4913 | |
4914 | static ::mlir::StringAttr condAttrName(::mlir::OperationName name) { |
4915 | return getAttributeNameForIndex(name, 2); |
4916 | } |
4917 | |
4918 | ::mlir::StringAttr getOutputShapesAttrName() { |
4919 | return getAttributeNameForIndex(3); |
4920 | } |
4921 | |
4922 | static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { |
4923 | return getAttributeNameForIndex(name, 3); |
4924 | } |
4925 | |
4926 | ::mlir::StringAttr output_shapesAttrName() { |
4927 | return getAttributeNameForIndex(3); |
4928 | } |
4929 | |
4930 | static ::mlir::StringAttr output_shapesAttrName(::mlir::OperationName name) { |
4931 | return getAttributeNameForIndex(name, 3); |
4932 | } |
4933 | |
4934 | ::mlir::StringAttr getParallelIterationsAttrName() { |
4935 | return getAttributeNameForIndex(4); |
4936 | } |
4937 | |
4938 | static ::mlir::StringAttr getParallelIterationsAttrName(::mlir::OperationName name) { |
4939 | return getAttributeNameForIndex(name, 4); |
4940 | } |
4941 | |
4942 | ::mlir::StringAttr parallel_iterationsAttrName() { |
4943 | return getAttributeNameForIndex(4); |
4944 | } |
4945 | |
4946 | static ::mlir::StringAttr parallel_iterationsAttrName(::mlir::OperationName name) { |
4947 | return getAttributeNameForIndex(name, 4); |
4948 | } |
4949 | |
4950 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
4951 | static constexpr ::llvm::StringLiteral getOperationName() { |
4952 | return ::llvm::StringLiteral("tfg.While" ); |
4953 | } |
4954 | |
4955 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
4956 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
4957 | ::mlir::Operation::operand_range getArgs(); |
4958 | ::mlir::Operation::operand_range args(); |
4959 | ::mlir::MutableOperandRange getArgsMutable(); |
4960 | ::mlir::MutableOperandRange argsMutable(); |
4961 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
4962 | ::mlir::Operation::result_range getODSResults(unsigned index); |
4963 | ::mlir::Operation::result_range getOuts(); |
4964 | ::mlir::Operation::result_range outs(); |
4965 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
4966 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
4967 | ::mlir::tf_type::FuncAttr getCondAttr(); |
4968 | ::mlir::tf_type::FuncAttr getCond(); |
4969 | ::mlir::tf_type::FuncAttr condAttr(); |
4970 | ::mlir::tf_type::FuncAttr cond(); |
4971 | ::mlir::tf_type::FuncAttr getBodyAttr(); |
4972 | ::mlir::tf_type::FuncAttr getBody(); |
4973 | ::mlir::tf_type::FuncAttr bodyAttr(); |
4974 | ::mlir::tf_type::FuncAttr body(); |
4975 | ::mlir::IntegerAttr getParallelIterationsAttr(); |
4976 | uint64_t getParallelIterations(); |
4977 | ::mlir::IntegerAttr parallel_iterationsAttr(); |
4978 | uint64_t parallel_iterations(); |
4979 | ::mlir::ArrayAttr getTAttr(); |
4980 | ::llvm::Optional< ::mlir::ArrayAttr > getT(); |
4981 | ::mlir::ArrayAttr TAttr(); |
4982 | ::llvm::Optional< ::mlir::ArrayAttr > T(); |
4983 | ::mlir::ArrayAttr getOutputShapesAttr(); |
4984 | ::llvm::Optional< ::mlir::ArrayAttr > getOutputShapes(); |
4985 | ::mlir::ArrayAttr output_shapesAttr(); |
4986 | ::llvm::Optional< ::mlir::ArrayAttr > output_shapes(); |
4987 | void setCondAttr(::mlir::tf_type::FuncAttr attr); |
4988 | void condAttr(::mlir::tf_type::FuncAttr attr); |
4989 | void setBodyAttr(::mlir::tf_type::FuncAttr attr); |
4990 | void bodyAttr(::mlir::tf_type::FuncAttr attr); |
4991 | void setParallelIterationsAttr(::mlir::IntegerAttr attr); |
4992 | void parallel_iterationsAttr(::mlir::IntegerAttr attr); |
4993 | void setTAttr(::mlir::ArrayAttr attr); |
4994 | void TAttr(::mlir::ArrayAttr attr); |
4995 | void setOutputShapesAttr(::mlir::ArrayAttr attr); |
4996 | void output_shapesAttr(::mlir::ArrayAttr attr); |
4997 | ::mlir::Attribute removeTAttr(); |
4998 | ::mlir::Attribute removeOutput_shapesAttr(); |
4999 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange results, ValueRange args, FuncAttr cond, FuncAttr body, IntegerAttr parallel_iterations); |
5000 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr cond, ::mlir::tf_type::FuncAttr body, ::mlir::IntegerAttr parallel_iterations, /*optional*/::mlir::ArrayAttr T, /*optional*/::mlir::ArrayAttr output_shapes); |
5001 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr cond, ::mlir::tf_type::FuncAttr body, ::mlir::IntegerAttr parallel_iterations, /*optional*/::mlir::ArrayAttr T, /*optional*/::mlir::ArrayAttr output_shapes); |
5002 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr cond, ::mlir::tf_type::FuncAttr body, uint64_t parallel_iterations, /*optional*/::mlir::ArrayAttr T, /*optional*/::mlir::ArrayAttr output_shapes); |
5003 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::tf_type::FuncAttr cond, ::mlir::tf_type::FuncAttr body, uint64_t parallel_iterations, /*optional*/::mlir::ArrayAttr T, /*optional*/::mlir::ArrayAttr output_shapes); |
5004 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
5005 | ::mlir::LogicalResult verifyInvariantsImpl(); |
5006 | ::mlir::LogicalResult verifyInvariants(); |
5007 | ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); |
5008 | private: |
5009 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
5010 | return getAttributeNameForIndex((*this)->getName(), index); |
5011 | } |
5012 | |
5013 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
5014 | assert(index < 5 && "invalid attribute index" ); |
5015 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
5016 | } |
5017 | |
5018 | public: |
5019 | }; |
5020 | } // namespace tfg |
5021 | } // namespace mlir |
5022 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::WhileOp) |
5023 | |
5024 | namespace mlir { |
5025 | namespace tfg { |
5026 | |
5027 | //===----------------------------------------------------------------------===// |
5028 | // ::mlir::tfg::WhileRegionOp declarations |
5029 | //===----------------------------------------------------------------------===// |
5030 | |
5031 | class WhileRegionOpAdaptor { |
5032 | public: |
5033 | WhileRegionOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
5034 | |
5035 | WhileRegionOpAdaptor(WhileRegionOp op); |
5036 | |
5037 | ::mlir::ValueRange getOperands(); |
5038 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
5039 | ::mlir::ValueRange getODSOperands(unsigned index); |
5040 | ::mlir::ValueRange getInit(); |
5041 | ::mlir::ValueRange init(); |
5042 | ::mlir::ValueRange getCtls(); |
5043 | ::mlir::ValueRange ctls(); |
5044 | ::mlir::DictionaryAttr getAttributes(); |
5045 | ::mlir::IntegerAttr getParallelIterationsAttr(); |
5046 | uint64_t getParallelIterations(); |
5047 | ::mlir::IntegerAttr parallel_iterationsAttr(); |
5048 | uint64_t parallel_iterations(); |
5049 | ::mlir::DictionaryAttr getCondAttrsAttr(); |
5050 | ::llvm::Optional< ::mlir::DictionaryAttr > getCondAttrs(); |
5051 | ::mlir::DictionaryAttr cond_attrsAttr(); |
5052 | ::llvm::Optional< ::mlir::DictionaryAttr > cond_attrs(); |
5053 | ::mlir::DictionaryAttr getBodyAttrsAttr(); |
5054 | ::llvm::Optional< ::mlir::DictionaryAttr > getBodyAttrs(); |
5055 | ::mlir::DictionaryAttr body_attrsAttr(); |
5056 | ::llvm::Optional< ::mlir::DictionaryAttr > body_attrs(); |
5057 | ::mlir::tfg::RegionAttr getCondRegionAttrsAttr(); |
5058 | ::llvm::Optional<::mlir::tfg::RegionAttr> getCondRegionAttrs(); |
5059 | ::mlir::tfg::RegionAttr cond_region_attrsAttr(); |
5060 | ::llvm::Optional<::mlir::tfg::RegionAttr> cond_region_attrs(); |
5061 | ::mlir::tfg::RegionAttr getBodyRegionAttrsAttr(); |
5062 | ::llvm::Optional<::mlir::tfg::RegionAttr> getBodyRegionAttrs(); |
5063 | ::mlir::tfg::RegionAttr body_region_attrsAttr(); |
5064 | ::llvm::Optional<::mlir::tfg::RegionAttr> body_region_attrs(); |
5065 | ::mlir::RegionRange getRegions(); |
5066 | ::mlir::Region &getCondRegion(); |
5067 | ::mlir::Region &cond_region(); |
5068 | ::mlir::Region &getBodyRegion(); |
5069 | ::mlir::Region &body_region(); |
5070 | ::mlir::LogicalResult verify(::mlir::Location loc); |
5071 | private: |
5072 | ::mlir::ValueRange odsOperands; |
5073 | ::mlir::DictionaryAttr odsAttrs; |
5074 | ::mlir::RegionRange odsRegions; |
5075 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
5076 | }; |
5077 | class WhileRegionOp : public ::mlir::Op<WhileRegionOp, ::mlir::OpTrait::NRegions<2>::Impl, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasOnlyGraphRegion, ::mlir::RegionKindInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::tfg::PreservedAttributesInterface::Trait, ::mlir::RegionBranchOpInterface::Trait, ::mlir::tfg::ControlArgumentInterface::Trait> { |
5078 | public: |
5079 | using Op::Op; |
5080 | using Op::print; |
5081 | using Adaptor = WhileRegionOpAdaptor; |
5082 | public: |
5083 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
5084 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("body_attrs" ), ::llvm::StringRef("body_region_attrs" ), ::llvm::StringRef("cond_attrs" ), ::llvm::StringRef("cond_region_attrs" ), ::llvm::StringRef("operand_segment_sizes" ), ::llvm::StringRef("parallel_iterations" )}; |
5085 | return ::llvm::makeArrayRef(attrNames); |
5086 | } |
5087 | |
5088 | ::mlir::StringAttr getBodyAttrsAttrName() { |
5089 | return getAttributeNameForIndex(0); |
5090 | } |
5091 | |
5092 | static ::mlir::StringAttr getBodyAttrsAttrName(::mlir::OperationName name) { |
5093 | return getAttributeNameForIndex(name, 0); |
5094 | } |
5095 | |
5096 | ::mlir::StringAttr body_attrsAttrName() { |
5097 | return getAttributeNameForIndex(0); |
5098 | } |
5099 | |
5100 | static ::mlir::StringAttr body_attrsAttrName(::mlir::OperationName name) { |
5101 | return getAttributeNameForIndex(name, 0); |
5102 | } |
5103 | |
5104 | ::mlir::StringAttr getBodyRegionAttrsAttrName() { |
5105 | return getAttributeNameForIndex(1); |
5106 | } |
5107 | |
5108 | static ::mlir::StringAttr getBodyRegionAttrsAttrName(::mlir::OperationName name) { |
5109 | return getAttributeNameForIndex(name, 1); |
5110 | } |
5111 | |
5112 | ::mlir::StringAttr body_region_attrsAttrName() { |
5113 | return getAttributeNameForIndex(1); |
5114 | } |
5115 | |
5116 | static ::mlir::StringAttr body_region_attrsAttrName(::mlir::OperationName name) { |
5117 | return getAttributeNameForIndex(name, 1); |
5118 | } |
5119 | |
5120 | ::mlir::StringAttr getCondAttrsAttrName() { |
5121 | return getAttributeNameForIndex(2); |
5122 | } |
5123 | |
5124 | static ::mlir::StringAttr getCondAttrsAttrName(::mlir::OperationName name) { |
5125 | return getAttributeNameForIndex(name, 2); |
5126 | } |
5127 | |
5128 | ::mlir::StringAttr cond_attrsAttrName() { |
5129 | return getAttributeNameForIndex(2); |
5130 | } |
5131 | |
5132 | static ::mlir::StringAttr cond_attrsAttrName(::mlir::OperationName name) { |
5133 | return getAttributeNameForIndex(name, 2); |
5134 | } |
5135 | |
5136 | ::mlir::StringAttr getCondRegionAttrsAttrName() { |
5137 | return getAttributeNameForIndex(3); |
5138 | } |
5139 | |
5140 | static ::mlir::StringAttr getCondRegionAttrsAttrName(::mlir::OperationName name) { |
5141 | return getAttributeNameForIndex(name, 3); |
5142 | } |
5143 | |
5144 | ::mlir::StringAttr cond_region_attrsAttrName() { |
5145 | return getAttributeNameForIndex(3); |
5146 | } |
5147 | |
5148 | static ::mlir::StringAttr cond_region_attrsAttrName(::mlir::OperationName name) { |
5149 | return getAttributeNameForIndex(name, 3); |
5150 | } |
5151 | |
5152 | ::mlir::StringAttr getOperandSegmentSizesAttrName() { |
5153 | return getAttributeNameForIndex(4); |
5154 | } |
5155 | |
5156 | static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { |
5157 | return getAttributeNameForIndex(name, 4); |
5158 | } |
5159 | |
5160 | ::mlir::StringAttr operand_segment_sizesAttrName() { |
5161 | return getAttributeNameForIndex(4); |
5162 | } |
5163 | |
5164 | static ::mlir::StringAttr operand_segment_sizesAttrName(::mlir::OperationName name) { |
5165 | return getAttributeNameForIndex(name, 4); |
5166 | } |
5167 | |
5168 | ::mlir::StringAttr getParallelIterationsAttrName() { |
5169 | return getAttributeNameForIndex(5); |
5170 | } |
5171 | |
5172 | static ::mlir::StringAttr getParallelIterationsAttrName(::mlir::OperationName name) { |
5173 | return getAttributeNameForIndex(name, 5); |
5174 | } |
5175 | |
5176 | ::mlir::StringAttr parallel_iterationsAttrName() { |
5177 | return getAttributeNameForIndex(5); |
5178 | } |
5179 | |
5180 | static ::mlir::StringAttr parallel_iterationsAttrName(::mlir::OperationName name) { |
5181 | return getAttributeNameForIndex(name, 5); |
5182 | } |
5183 | |
5184 | static constexpr ::llvm::StringLiteral getOperationName() { |
5185 | return ::llvm::StringLiteral("tfg.WhileRegion" ); |
5186 | } |
5187 | |
5188 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
5189 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
5190 | ::mlir::Operation::operand_range getInit(); |
5191 | ::mlir::Operation::operand_range init(); |
5192 | ::mlir::Operation::operand_range getCtls(); |
5193 | ::mlir::Operation::operand_range ctls(); |
5194 | ::mlir::MutableOperandRange getInitMutable(); |
5195 | ::mlir::MutableOperandRange initMutable(); |
5196 | ::mlir::MutableOperandRange getCtlsMutable(); |
5197 | ::mlir::MutableOperandRange ctlsMutable(); |
5198 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
5199 | ::mlir::Operation::result_range getODSResults(unsigned index); |
5200 | ::mlir::Operation::result_range getOuts(); |
5201 | ::mlir::Operation::result_range outs(); |
5202 | ::mlir::TypedValue<::mlir::tf_type::ControlType> getCtl(); |
5203 | ::mlir::TypedValue<::mlir::tf_type::ControlType> ctl(); |
5204 | ::mlir::Region &getCondRegion(); |
5205 | ::mlir::Region &cond_region(); |
5206 | ::mlir::Region &getBodyRegion(); |
5207 | ::mlir::Region &body_region(); |
5208 | ::mlir::IntegerAttr getParallelIterationsAttr(); |
5209 | uint64_t getParallelIterations(); |
5210 | ::mlir::IntegerAttr parallel_iterationsAttr(); |
5211 | uint64_t parallel_iterations(); |
5212 | ::mlir::DictionaryAttr getCondAttrsAttr(); |
5213 | ::llvm::Optional< ::mlir::DictionaryAttr > getCondAttrs(); |
5214 | ::mlir::DictionaryAttr cond_attrsAttr(); |
5215 | ::llvm::Optional< ::mlir::DictionaryAttr > cond_attrs(); |
5216 | ::mlir::DictionaryAttr getBodyAttrsAttr(); |
5217 | ::llvm::Optional< ::mlir::DictionaryAttr > getBodyAttrs(); |
5218 | ::mlir::DictionaryAttr body_attrsAttr(); |
5219 | ::llvm::Optional< ::mlir::DictionaryAttr > body_attrs(); |
5220 | ::mlir::tfg::RegionAttr getCondRegionAttrsAttr(); |
5221 | ::llvm::Optional<::mlir::tfg::RegionAttr> getCondRegionAttrs(); |
5222 | ::mlir::tfg::RegionAttr cond_region_attrsAttr(); |
5223 | ::llvm::Optional<::mlir::tfg::RegionAttr> cond_region_attrs(); |
5224 | ::mlir::tfg::RegionAttr getBodyRegionAttrsAttr(); |
5225 | ::llvm::Optional<::mlir::tfg::RegionAttr> getBodyRegionAttrs(); |
5226 | ::mlir::tfg::RegionAttr body_region_attrsAttr(); |
5227 | ::llvm::Optional<::mlir::tfg::RegionAttr> body_region_attrs(); |
5228 | void setParallelIterationsAttr(::mlir::IntegerAttr attr); |
5229 | void parallel_iterationsAttr(::mlir::IntegerAttr attr); |
5230 | void setCondAttrsAttr(::mlir::DictionaryAttr attr); |
5231 | void cond_attrsAttr(::mlir::DictionaryAttr attr); |
5232 | void setBodyAttrsAttr(::mlir::DictionaryAttr attr); |
5233 | void body_attrsAttr(::mlir::DictionaryAttr attr); |
5234 | void setCondRegionAttrsAttr(::mlir::tfg::RegionAttr attr); |
5235 | void cond_region_attrsAttr(::mlir::tfg::RegionAttr attr); |
5236 | void setBodyRegionAttrsAttr(::mlir::tfg::RegionAttr attr); |
5237 | void body_region_attrsAttr(::mlir::tfg::RegionAttr attr); |
5238 | ::mlir::Attribute removeCond_attrsAttr(); |
5239 | ::mlir::Attribute removeBody_attrsAttr(); |
5240 | ::mlir::Attribute removeCond_region_attrsAttr(); |
5241 | ::mlir::Attribute removeBody_region_attrsAttr(); |
5242 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::ValueRange init, ::mlir::ValueRange ctls, ::mlir::IntegerAttr parallel_iterations, /*optional*/::mlir::DictionaryAttr cond_attrs, /*optional*/::mlir::DictionaryAttr body_attrs, /*optional*/::mlir::tfg::RegionAttr cond_region_attrs, /*optional*/::mlir::tfg::RegionAttr body_region_attrs); |
5243 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange init, ::mlir::ValueRange ctls, ::mlir::IntegerAttr parallel_iterations, /*optional*/::mlir::DictionaryAttr cond_attrs, /*optional*/::mlir::DictionaryAttr body_attrs, /*optional*/::mlir::tfg::RegionAttr cond_region_attrs, /*optional*/::mlir::tfg::RegionAttr body_region_attrs); |
5244 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::Type ctl, ::mlir::ValueRange init, ::mlir::ValueRange ctls, uint64_t parallel_iterations, /*optional*/::mlir::DictionaryAttr cond_attrs, /*optional*/::mlir::DictionaryAttr body_attrs, /*optional*/::mlir::tfg::RegionAttr cond_region_attrs, /*optional*/::mlir::tfg::RegionAttr body_region_attrs); |
5245 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange init, ::mlir::ValueRange ctls, uint64_t parallel_iterations, /*optional*/::mlir::DictionaryAttr cond_attrs, /*optional*/::mlir::DictionaryAttr body_attrs, /*optional*/::mlir::tfg::RegionAttr cond_region_attrs, /*optional*/::mlir::tfg::RegionAttr body_region_attrs); |
5246 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
5247 | ::mlir::LogicalResult verifyInvariantsImpl(); |
5248 | ::mlir::LogicalResult verifyInvariants(); |
5249 | ::mlir::LogicalResult verify(); |
5250 | void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); |
5251 | static ::llvm::StringRef getDefaultDialect(); |
5252 | ::mlir::OperandRange getSuccessorEntryOperands(::llvm::Optional<unsigned> index); |
5253 | void getSuccessorRegions(::llvm::Optional<unsigned> index, ::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); |
5254 | static mlir::BlockArgument getDataValueOf(BlockArgument ctl); |
5255 | static mlir::BlockArgument getControlTokenOf(BlockArgument data); |
5256 | static mlir::BlockArgument getDataValue(Region ®ion, unsigned idx); |
5257 | static mlir::BlockArgument getControlToken(Region ®ion, unsigned idx); |
5258 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
5259 | void print(::mlir::OpAsmPrinter &_odsPrinter); |
5260 | private: |
5261 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
5262 | return getAttributeNameForIndex((*this)->getName(), index); |
5263 | } |
5264 | |
5265 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
5266 | assert(index < 6 && "invalid attribute index" ); |
5267 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
5268 | } |
5269 | |
5270 | public: |
5271 | Block &cond_block() { return cond_region().front(); } |
5272 | Block &body_block() { return body_region().front(); } |
5273 | ConditionOp cond_condition(); |
5274 | YieldOp body_yield(); |
5275 | |
5276 | bool areTypesCompatible(Type lhs, Type rhs) { |
5277 | return tf_type::HasCompatibleElementTypes(lhs, rhs); |
5278 | } |
5279 | |
5280 | RegionAttr getPreservedAttrs(unsigned index) { |
5281 | if (index == 0) return cond_region_attrsAttr(); |
5282 | return body_region_attrsAttr(); |
5283 | } |
5284 | void setPreservedAttrs(unsigned index, RegionAttr attrs) { |
5285 | if (index == 0) cond_region_attrsAttr(attrs); |
5286 | else body_region_attrsAttr(attrs); |
5287 | } |
5288 | }; |
5289 | } // namespace tfg |
5290 | } // namespace mlir |
5291 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::WhileRegionOp) |
5292 | |
5293 | namespace mlir { |
5294 | namespace tfg { |
5295 | |
5296 | //===----------------------------------------------------------------------===// |
5297 | // ::mlir::tfg::YieldOp declarations |
5298 | //===----------------------------------------------------------------------===// |
5299 | |
5300 | class YieldOpAdaptor { |
5301 | public: |
5302 | YieldOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs = nullptr, ::mlir::RegionRange regions = {}); |
5303 | |
5304 | YieldOpAdaptor(YieldOp op); |
5305 | |
5306 | ::mlir::ValueRange getOperands(); |
5307 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
5308 | ::mlir::ValueRange getODSOperands(unsigned index); |
5309 | ::mlir::ValueRange getArgs(); |
5310 | ::mlir::ValueRange args(); |
5311 | ::mlir::ValueRange getCtls(); |
5312 | ::mlir::ValueRange ctls(); |
5313 | ::mlir::DictionaryAttr getAttributes(); |
5314 | ::mlir::LogicalResult verify(::mlir::Location loc); |
5315 | private: |
5316 | ::mlir::ValueRange odsOperands; |
5317 | ::mlir::DictionaryAttr odsAttrs; |
5318 | ::mlir::RegionRange odsRegions; |
5319 | ::llvm::Optional<::mlir::OperationName> odsOpName; |
5320 | }; |
5321 | class YieldOp : public ::mlir::Op<YieldOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ReturnLike, ::mlir::OpTrait::IsTerminator, ::mlir::RegionBranchTerminatorOpInterface::Trait, ::mlir::OpTrait::IntrinsicOperation> { |
5322 | public: |
5323 | using Op::Op; |
5324 | using Op::print; |
5325 | using Adaptor = YieldOpAdaptor; |
5326 | public: |
5327 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
5328 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operand_segment_sizes" )}; |
5329 | return ::llvm::makeArrayRef(attrNames); |
5330 | } |
5331 | |
5332 | ::mlir::StringAttr getOperandSegmentSizesAttrName() { |
5333 | return getAttributeNameForIndex(0); |
5334 | } |
5335 | |
5336 | static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { |
5337 | return getAttributeNameForIndex(name, 0); |
5338 | } |
5339 | |
5340 | ::mlir::StringAttr operand_segment_sizesAttrName() { |
5341 | return getAttributeNameForIndex(0); |
5342 | } |
5343 | |
5344 | static ::mlir::StringAttr operand_segment_sizesAttrName(::mlir::OperationName name) { |
5345 | return getAttributeNameForIndex(name, 0); |
5346 | } |
5347 | |
5348 | static constexpr ::llvm::StringLiteral getOperationName() { |
5349 | return ::llvm::StringLiteral("tfg.yield" ); |
5350 | } |
5351 | |
5352 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
5353 | ::mlir::Operation::operand_range getODSOperands(unsigned index); |
5354 | ::mlir::Operation::operand_range getArgs(); |
5355 | ::mlir::Operation::operand_range args(); |
5356 | ::mlir::Operation::operand_range getCtls(); |
5357 | ::mlir::Operation::operand_range ctls(); |
5358 | ::mlir::MutableOperandRange getArgsMutable(); |
5359 | ::mlir::MutableOperandRange argsMutable(); |
5360 | ::mlir::MutableOperandRange getCtlsMutable(); |
5361 | ::mlir::MutableOperandRange ctlsMutable(); |
5362 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
5363 | ::mlir::Operation::result_range getODSResults(unsigned index); |
5364 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange args, ::mlir::ValueRange ctls); |
5365 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ValueRange ctls); |
5366 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
5367 | ::mlir::LogicalResult verifyInvariantsImpl(); |
5368 | ::mlir::LogicalResult verifyInvariants(); |
5369 | ::mlir::MutableOperandRange getMutableSuccessorOperands(::llvm::Optional<unsigned> index); |
5370 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
5371 | void print(::mlir::OpAsmPrinter &_odsPrinter); |
5372 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
5373 | private: |
5374 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
5375 | return getAttributeNameForIndex((*this)->getName(), index); |
5376 | } |
5377 | |
5378 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
5379 | assert(index < 1 && "invalid attribute index" ); |
5380 | return name.getRegisteredInfo()->getAttributeNames()[index]; |
5381 | } |
5382 | |
5383 | public: |
5384 | }; |
5385 | } // namespace tfg |
5386 | } // namespace mlir |
5387 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tfg::YieldOp) |
5388 | |
5389 | |
5390 | #endif // GET_OP_CLASSES |
5391 | |
5392 | |