tvm
frame.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 #ifndef TVM_SCRIPT_IR_BUILDER_TIR_FRAME_H_
20 #define TVM_SCRIPT_IR_BUILDER_TIR_FRAME_H_
21 
24 #include <tvm/tirx/stmt.h>
25 
26 #include <utility>
27 
28 namespace tvm {
29 namespace script {
30 namespace ir_builder {
31 namespace tirx {
32 
39  public:
41  ffi::Array<tvm::tirx::Stmt> stmts;
42 
43  static void RegisterReflection() {
44  namespace refl = tvm::ffi::reflection;
45  refl::ObjectDef<TIRFrameNode>().def_ro("stmts", &TIRFrameNode::stmts);
46  }
47  TVM_FFI_DECLARE_OBJECT_INFO("script.ir_builder.tirx.TIRFrame", TIRFrameNode, IRBuilderFrameNode);
48 };
49 
55 class TIRFrame : public IRBuilderFrame {
56  public:
58 
59  protected:
60  TIRFrame() = default;
61  explicit TIRFrame(ObjectPtr<TIRFrameNode> data) : IRBuilderFrame(data) {}
62 };
63 
70  public:
72  ffi::Optional<ffi::String> name;
74  ffi::Array<tvm::tirx::Var> args;
76  bool is_private;
78  ffi::Optional<Type> ret_type;
80  ffi::Map<tvm::tirx::Var, tvm::tirx::Buffer> buffer_map;
82  ffi::Map<ffi::String, Any> attrs;
84  ffi::Map<tvm::tirx::Var, tvm::tirx::IterVar> env_threads;
86  ffi::Array<tvm::tirx::Buffer> root_alloc_buffers;
87 
88  static void RegisterReflection() {
89  namespace refl = tvm::ffi::reflection;
90  refl::ObjectDef<PrimFuncFrameNode>()
91  .def_ro("name", &PrimFuncFrameNode::name)
92  .def_ro("args", &PrimFuncFrameNode::args)
93  .def_ro("is_private", &PrimFuncFrameNode::is_private)
94  .def_ro("ret_type", &PrimFuncFrameNode::ret_type)
95  .def_ro("buffer_map", &PrimFuncFrameNode::buffer_map)
96  .def_ro("attrs", &PrimFuncFrameNode::attrs)
97  .def_ro("env_threads", &PrimFuncFrameNode::env_threads)
98  .def_ro("root_alloc_buffers", &PrimFuncFrameNode::root_alloc_buffers);
99  }
100  TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.PrimFuncFrame", PrimFuncFrameNode,
101  TIRFrameNode);
102 
103  public:
108  void ExitWithScope() final;
109 };
110 
116 class PrimFuncFrame : public TIRFrame {
117  public:
118  explicit PrimFuncFrame(ObjectPtr<PrimFuncFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
119  TVM_FFI_ICHECK(data != nullptr);
120  data_ = std::move(data);
121  }
123 };
124 
131  public:
133  ffi::String name;
135  ffi::Array<tvm::tirx::IterVar> iter_vars;
137  ffi::Optional<ffi::Array<tvm::tirx::BufferRegion>> reads;
139  ffi::Optional<ffi::Array<tvm::tirx::BufferRegion>> writes;
141  ffi::Optional<tvm::tirx::Stmt> init;
143  ffi::Array<tvm::tirx::Buffer> alloc_buffers;
145  ffi::Array<tvm::tirx::MatchBufferRegion> match_buffers;
147  ffi::Optional<ffi::Map<ffi::String, Any>> annotations;
149  ffi::Array<PrimExpr> iter_values;
154  ffi::Optional<PrimExpr> predicate;
157 
158  static void RegisterReflection() {
159  namespace refl = tvm::ffi::reflection;
160  refl::ObjectDef<SBlockFrameNode>()
161  .def_ro("name", &SBlockFrameNode::name)
162  .def_ro("iter_vars", &SBlockFrameNode::iter_vars)
163  .def_ro("reads", &SBlockFrameNode::reads)
164  .def_ro("writes", &SBlockFrameNode::writes)
165  .def_ro("init", &SBlockFrameNode::init)
166  .def_ro("alloc_buffers", &SBlockFrameNode::alloc_buffers)
167  .def_ro("match_buffers", &SBlockFrameNode::match_buffers)
168  .def_ro("annotations", &SBlockFrameNode::annotations)
169  .def_ro("iter_values", &SBlockFrameNode::iter_values)
170  .def_ro("predicate", &SBlockFrameNode::predicate)
171  .def_ro("no_realize", &SBlockFrameNode::no_realize);
172  }
173  TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.SSBlockFrame", SBlockFrameNode,
174  TIRFrameNode);
175 
176  public:
181  void ExitWithScope() final;
182 };
183 
190 class SBlockFrame : public TIRFrame {
191  public:
192  explicit SBlockFrame(ObjectPtr<SBlockFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
193  TVM_FFI_ICHECK(data != nullptr);
194  data_ = std::move(data);
195  }
197 };
198 
205  public:
206  static void RegisterReflection() {
207  namespace refl = tvm::ffi::reflection;
208  refl::ObjectDef<BlockInitFrameNode>();
209  }
210  TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.SBlockInitFrame", BlockInitFrameNode,
211  TIRFrameNode);
212 
213  public:
218  void EnterWithScope() final;
223  void ExitWithScope() final;
224 };
225 
231 class BlockInitFrame : public TIRFrame {
232  public:
233  explicit BlockInitFrame(ObjectPtr<BlockInitFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
234  TVM_FFI_ICHECK(data != nullptr);
235  data_ = std::move(data);
236  }
238 };
239 
245 class ForFrameNode : public TIRFrameNode {
246  public:
254  using FMakeForLoop = ffi::TypedFunction<tvm::tirx::Stmt(
255  ffi::Array<tvm::tirx::Var> loop_vars, ffi::Array<Range> loop_extents,
256  ffi::Array<ffi::Optional<PrimExpr>> loop_steps, tvm::tirx::Stmt loop_body)>;
258  ffi::Array<tvm::tirx::Var> vars;
260  ffi::Array<Range> doms;
262  ffi::Array<ffi::Optional<PrimExpr>> steps;
265 
266  static void RegisterReflection() {
267  namespace refl = tvm::ffi::reflection;
268  refl::ObjectDef<ForFrameNode>()
269  .def_ro("vars", &ForFrameNode::vars)
270  .def_ro("doms", &ForFrameNode::doms);
271  // `f_make_for_loop` is not registered as it's not visited.
272  }
273  TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.ForFrame", ForFrameNode, TIRFrameNode);
274 
275  public:
280  void ExitWithScope() final;
281 };
282 
288 class ForFrame : public TIRFrame {
289  public:
290  explicit ForFrame(ObjectPtr<ForFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
291  TVM_FFI_ICHECK(data != nullptr);
292  data_ = std::move(data);
293  }
295 };
296 
304  public:
310  ffi::Array<tvm::tirx::StringImm> message_parts;
311 
312  static void RegisterReflection() {
313  namespace refl = tvm::ffi::reflection;
314  refl::ObjectDef<AssertFrameNode>()
315  .def_ro("condition", &AssertFrameNode::condition)
316  .def_ro("error_kind", &AssertFrameNode::error_kind)
317  .def_ro("message_parts", &AssertFrameNode::message_parts);
318  }
319  TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.AssertFrame", AssertFrameNode,
320  TIRFrameNode);
321 
322  public:
327  void ExitWithScope() final;
328 };
329 
335 class AssertFrame : public TIRFrame {
336  public:
337  explicit AssertFrame(ObjectPtr<AssertFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
338  TVM_FFI_ICHECK(data != nullptr);
339  data_ = std::move(data);
340  }
342 };
343 
349  public:
353  ffi::String attr_key;
356 
357  static void RegisterReflection() {
358  namespace refl = tvm::ffi::reflection;
359  refl::ObjectDef<LaunchThreadFrameNode>()
360  .def_ro("extent", &LaunchThreadFrameNode::extent)
361  .def_ro("attr_key", &LaunchThreadFrameNode::attr_key)
362  .def_ro("iter_var", &LaunchThreadFrameNode::iter_var);
363  }
364  TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.LaunchThreadFrame",
366 
367  public:
372  void ExitWithScope() final;
373 };
374 
380 class LaunchThreadFrame : public TIRFrame {
381  public:
382  explicit LaunchThreadFrame(ObjectPtr<LaunchThreadFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
383  TVM_FFI_ICHECK(data != nullptr);
384  data_ = std::move(data);
385  }
387 };
388 
394 class AttrFrameNode : public TIRFrameNode {
395  public:
397  Any node;
399  ffi::String attr_key;
402 
403  static void RegisterReflection() {
404  namespace refl = tvm::ffi::reflection;
405  refl::ObjectDef<AttrFrameNode>()
406  .def_ro("node", &AttrFrameNode::node)
407  .def_ro("attr_key", &AttrFrameNode::attr_key)
408  .def_ro("value", &AttrFrameNode::value);
409  }
410  TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.AttrFrame", AttrFrameNode,
411  TIRFrameNode);
412 
413  public:
418  void ExitWithScope() final;
419 };
420 
426 class AttrFrame : public TIRFrame {
427  public:
428  explicit AttrFrame(ObjectPtr<AttrFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
429  TVM_FFI_ICHECK(data != nullptr);
430  data_ = std::move(data);
431  }
433 };
434 
440 class WhileFrameNode : public TIRFrameNode {
441  public:
444 
445  static void RegisterReflection() {
446  namespace refl = tvm::ffi::reflection;
447  refl::ObjectDef<WhileFrameNode>().def_ro("condition", &WhileFrameNode::condition);
448  }
449  TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.WhileFrame", WhileFrameNode,
450  TIRFrameNode);
451 
452  public:
457  void ExitWithScope() final;
458 };
459 
465 class WhileFrame : public TIRFrame {
466  public:
467  explicit WhileFrame(ObjectPtr<WhileFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
468  TVM_FFI_ICHECK(data != nullptr);
469  data_ = std::move(data);
470  }
472 };
473 
479 class IfFrameNode : public TIRFrameNode {
480  public:
484  ffi::Optional<ffi::Array<tvm::tirx::Stmt>> then_stmts;
486  ffi::Optional<ffi::Array<tvm::tirx::Stmt>> else_stmts;
487 
488  static void RegisterReflection() {
489  namespace refl = tvm::ffi::reflection;
490  refl::ObjectDef<IfFrameNode>()
491  .def_ro("condition", &IfFrameNode::condition)
492  .def_ro("then_stmts", &IfFrameNode::then_stmts)
493  .def_ro("else_stmts", &IfFrameNode::else_stmts);
494  }
495  TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.IfFrame", IfFrameNode, TIRFrameNode);
496 
497  public:
502  void ExitWithScope() final;
503 };
504 
510 class IfFrame : public TIRFrame {
511  public:
512  explicit IfFrame(ObjectPtr<IfFrameNode> data) : TIRFrame(data) {
513  TVM_FFI_ICHECK(data != nullptr);
514  }
516 };
517 
523 class ThenFrameNode : public TIRFrameNode {
524  public:
525  static void RegisterReflection() {
526  namespace refl = tvm::ffi::reflection;
527  refl::ObjectDef<ThenFrameNode>();
528  }
529  TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.ThenFrame", ThenFrameNode,
530  TIRFrameNode);
531 
532  public:
537  void EnterWithScope() final;
542  void ExitWithScope() final;
543 };
544 
550 class ThenFrame : public TIRFrame {
551  public:
552  explicit ThenFrame(ObjectPtr<ThenFrameNode> data) : TIRFrame(data) {
553  TVM_FFI_ICHECK(data != nullptr);
554  }
556 };
557 
563 class ElseFrameNode : public TIRFrameNode {
564  public:
565  static void RegisterReflection() {
566  namespace refl = tvm::ffi::reflection;
567  refl::ObjectDef<ElseFrameNode>();
568  }
569  TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.ElseFrame", ElseFrameNode,
570  TIRFrameNode);
571 
572  public:
577  void EnterWithScope() final;
582  void ExitWithScope() final;
583 };
584 
590 class ElseFrame : public TIRFrame {
591  public:
592  explicit ElseFrame(ObjectPtr<ElseFrameNode> data) : TIRFrame(data) {
593  TVM_FFI_ICHECK(data != nullptr);
594  }
595 
597 };
598 
599 } // namespace tirx
600 } // namespace ir_builder
601 } // namespace script
602 } // namespace tvm
603 
604 #endif // TVM_SCRIPT_IR_BUILDER_TIR_FRAME_H_
Reference to PrimExprNode.
Definition: expr.h:126
Managed reference to an IRBuilderFrameNode.
Definition: base.h:104
A frame that represents the assert statement. Proceeds if the condition is true, otherwise aborts wit...
Definition: frame.h:303
static void RegisterReflection()
Definition: frame.h:312
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.AssertFrame", AssertFrameNode, TIRFrameNode)
tvm::tirx::StringImm error_kind
The error kind, e.g. "RuntimeError", "TypeError", "ValueError".
Definition: frame.h:308
void ExitWithScope() final
The method called when exiting RAII scope.
ffi::Array< tvm::tirx::StringImm > message_parts
Error message fragments, concatenated at runtime when assertion fails.
Definition: frame.h:310
PrimExpr condition
The PrimExpr to test.
Definition: frame.h:306
Managed reference to AssertFrameNode.
Definition: frame.h:335
AssertFrame(ObjectPtr< AssertFrameNode > data)
Definition: frame.h:337
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(AssertFrame, TIRFrame, AssertFrameNode)
A frame that represents attribute node.
Definition: frame.h:394
ffi::String attr_key
Attribute type key.
Definition: frame.h:399
Any node
The node to annotate the attribute.
Definition: frame.h:397
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.AttrFrame", AttrFrameNode, TIRFrameNode)
void ExitWithScope() final
The method called when exiting RAII scope.
static void RegisterReflection()
Definition: frame.h:403
PrimExpr value
The value of the attribute.
Definition: frame.h:401
Managed reference to AttrFrameNode.
Definition: frame.h:426
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(AttrFrame, TIRFrame, AttrFrameNode)
AttrFrame(ObjectPtr< AttrFrameNode > data)
Definition: frame.h:428
A frame that represents the block initialization statment.
Definition: frame.h:204
void EnterWithScope() final
The method called when entering RAII scope.
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.SBlockInitFrame", BlockInitFrameNode, TIRFrameNode)
static void RegisterReflection()
Definition: frame.h:206
Managed reference to BlockInitFrameNode.
Definition: frame.h:231
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(BlockInitFrame, TIRFrame, BlockInitFrameNode)
BlockInitFrame(ObjectPtr< BlockInitFrameNode > data)
Definition: frame.h:233
A frame that represents else.
Definition: frame.h:563
void EnterWithScope() final
The method called when entering RAII scope.
static void RegisterReflection()
Definition: frame.h:565
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.ElseFrame", ElseFrameNode, TIRFrameNode)
Managed reference to ElseFrameNode.
Definition: frame.h:590
ElseFrame(ObjectPtr< ElseFrameNode > data)
Definition: frame.h:592
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ElseFrame, TIRFrame, ElseFrameNode)
A frame that represents the for loop.
Definition: frame.h:245
ffi::TypedFunction< tvm::tirx::Stmt(ffi::Array< tvm::tirx::Var > loop_vars, ffi::Array< Range > loop_extents, ffi::Array< ffi::Optional< PrimExpr > > loop_steps, tvm::tirx::Stmt loop_body)> FMakeForLoop
Functions that generate loop nests.
Definition: frame.h:256
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.ForFrame", ForFrameNode, TIRFrameNode)
FMakeForLoop f_make_for_loop
The for loop generating function.
Definition: frame.h:264
static void RegisterReflection()
Definition: frame.h:266
ffi::Array< Range > doms
The domains of iteration.
Definition: frame.h:260
ffi::Array< tvm::tirx::Var > vars
The loop variable.
Definition: frame.h:258
void ExitWithScope() final
The method called when exiting RAII scope.
ffi::Array< ffi::Optional< PrimExpr > > steps
The optional steps of iteration.
Definition: frame.h:262
Managed reference to ForFrameNode.
Definition: frame.h:288
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ForFrame, TIRFrame, ForFrameNode)
ForFrame(ObjectPtr< ForFrameNode > data)
Definition: frame.h:290
A frame that represents if statement.
Definition: frame.h:479
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.IfFrame", IfFrameNode, TIRFrameNode)
ffi::Optional< ffi::Array< tvm::tirx::Stmt > > else_stmts
The stetements in the false branch.
Definition: frame.h:486
ffi::Optional< ffi::Array< tvm::tirx::Stmt > > then_stmts
The statements in the true branch.
Definition: frame.h:484
void ExitWithScope() final
The method called when exiting RAII scope.
PrimExpr condition
The condition of the if statement.
Definition: frame.h:482
static void RegisterReflection()
Definition: frame.h:488
Managed reference to IfFrameNode.
Definition: frame.h:510
IfFrame(ObjectPtr< IfFrameNode > data)
Definition: frame.h:512
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(IfFrame, TIRFrame, IfFrameNode)
The LaunchThreadFrameNode.
Definition: frame.h:348
PrimExpr extent
The extent of environment thread.
Definition: frame.h:351
tvm::tirx::IterVar iter_var
The iteration variable.
Definition: frame.h:355
ffi::String attr_key
The attribute key, could be either virtual_thread or thread_extent.
Definition: frame.h:353
void ExitWithScope() final
The method called when exiting RAII scope.
static void RegisterReflection()
Definition: frame.h:357
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.LaunchThreadFrame", LaunchThreadFrameNode, TIRFrameNode)
Managed reference to LaunchThreadFrameNode.
Definition: frame.h:380
LaunchThreadFrame(ObjectPtr< LaunchThreadFrameNode > data)
Definition: frame.h:382
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(LaunchThreadFrame, TIRFrame, LaunchThreadFrameNode)
A frame that represents the PrimFunc containing TIR statements.
Definition: frame.h:69
void ExitWithScope() final
The method called when exiting RAII scope.
ffi::Map< tvm::tirx::Var, tvm::tirx::Buffer > buffer_map
Maps some parameters to specific Buffer data structures.
Definition: frame.h:80
ffi::Optional< Type > ret_type
The return type of the function.
Definition: frame.h:78
ffi::Map< ffi::String, Any > attrs
Additional attributes storing the meta-data.
Definition: frame.h:82
bool is_private
Whether the PrimFunc is annotated as private.
Definition: frame.h:76
static void RegisterReflection()
Definition: frame.h:88
ffi::Optional< ffi::String > name
The name of the block.
Definition: frame.h:72
ffi::Array< tvm::tirx::Var > args
Function parameters.
Definition: frame.h:74
ffi::Map< tvm::tirx::Var, tvm::tirx::IterVar > env_threads
The variable map bound to thread env.
Definition: frame.h:84
ffi::Array< tvm::tirx::Buffer > root_alloc_buffers
The buffer allocated in root block.
Definition: frame.h:86
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.PrimFuncFrame", PrimFuncFrameNode, TIRFrameNode)
Managed reference to PrimFuncFrameNode.
Definition: frame.h:116
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(PrimFuncFrame, TIRFrame, PrimFuncFrameNode)
PrimFuncFrame(ObjectPtr< PrimFuncFrameNode > data)
Definition: frame.h:118
A frame that represents the block.
Definition: frame.h:130
ffi::Optional< ffi::Array< tvm::tirx::BufferRegion > > writes
The write buffer regions of the block.
Definition: frame.h:139
ffi::Array< tvm::tirx::Buffer > alloc_buffers
The buffer allocated in the block.
Definition: frame.h:143
ffi::Optional< ffi::Array< tvm::tirx::BufferRegion > > reads
The read buffer regions of the block.
Definition: frame.h:137
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.SSBlockFrame", SBlockFrameNode, TIRFrameNode)
void ExitWithScope() final
The method called when exiting RAII scope.
ffi::Optional< tvm::tirx::Stmt > init
The init statement of the bolck.
Definition: frame.h:141
ffi::Optional< ffi::Map< ffi::String, Any > > annotations
The annotation of the block.
Definition: frame.h:147
ffi::Optional< PrimExpr > predicate
The predicate of the block realization, the block will only be executed when the predicate is true.
Definition: frame.h:154
ffi::Array< tvm::tirx::IterVar > iter_vars
The variables of the block.
Definition: frame.h:135
static void RegisterReflection()
Definition: frame.h:158
ffi::Array< PrimExpr > iter_values
The corresponding values of the iter vars.
Definition: frame.h:149
bool no_realize
The flag whether to construct BlockRealize or Block.
Definition: frame.h:156
ffi::Array< tvm::tirx::MatchBufferRegion > match_buffers
The match buffer regions.
Definition: frame.h:145
ffi::String name
The name of the block.
Definition: frame.h:133
Managed reference to SBlockFrameNode.
Definition: frame.h:190
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(SBlockFrame, TIRFrame, SBlockFrameNode)
SBlockFrame(ObjectPtr< SBlockFrameNode > data)
Definition: frame.h:192
A base frame that represents the TIR fame with body of statements.
Definition: frame.h:38
TVM_FFI_DECLARE_OBJECT_INFO("script.ir_builder.tirx.TIRFrame", TIRFrameNode, IRBuilderFrameNode)
static void RegisterReflection()
Definition: frame.h:43
ffi::Array< tvm::tirx::Stmt > stmts
The Stmt within in this frame.
Definition: frame.h:41
Managed reference to TIRFrameNode.
Definition: frame.h:55
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(TIRFrame, IRBuilderFrame, TIRFrameNode)
TIRFrame(ObjectPtr< TIRFrameNode > data)
Definition: frame.h:61
A frame that represents then.
Definition: frame.h:523
void EnterWithScope() final
The method called when entering RAII scope.
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.ThenFrame", ThenFrameNode, TIRFrameNode)
static void RegisterReflection()
Definition: frame.h:525
Managed reference to ThenFrameNode.
Definition: frame.h:550
ThenFrame(ObjectPtr< ThenFrameNode > data)
Definition: frame.h:552
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ThenFrame, TIRFrame, ThenFrameNode)
A frame that represents while loop.
Definition: frame.h:440
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.WhileFrame", WhileFrameNode, TIRFrameNode)
PrimExpr condition
The termination condition of while.
Definition: frame.h:443
void ExitWithScope() final
The method called when exiting RAII scope.
static void RegisterReflection()
Definition: frame.h:445
Managed reference to WhileFrameNode.
Definition: frame.h:465
WhileFrame(ObjectPtr< WhileFrameNode > data)
Definition: frame.h:467
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(WhileFrame, TIRFrame, WhileFrameNode)
Iteration Variable, represents an iteration over an integer interval.
Definition: var.h:296
Container of all statements.
Definition: stmt.h:65
Managed reference to StringImmNode.
Definition: expr.h:68
Definition: repr_printer.h:91
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition: analyzer.h:37
TIR statements.