tvm
Loading...
Searching...
No Matches
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/exec_scope.h>
25#include <tvm/tirx/stmt.h>
26
27#include <utility>
28
29namespace tvm {
30namespace script {
31namespace ir_builder {
32namespace tirx {
33
40 public:
42 ffi::Array<tvm::tirx::Stmt> stmts;
43
44 static void RegisterReflection() {
45 namespace refl = tvm::ffi::reflection;
46 refl::ObjectDef<TIRFrameNode>().def_ro("stmts", &TIRFrameNode::stmts);
47 }
48 TVM_FFI_DECLARE_OBJECT_INFO("script.ir_builder.tirx.TIRFrame", TIRFrameNode, IRBuilderFrameNode);
49};
50
56class TIRFrame : public IRBuilderFrame {
57 public:
59
60 protected:
61 TIRFrame() = default;
62 explicit TIRFrame(ffi::ObjectPtr<TIRFrameNode> data) : IRBuilderFrame(data) {}
63};
64
71 public:
73 ffi::Optional<ffi::String> name;
75 ffi::Array<tvm::tirx::Var> args;
79 ffi::Optional<Type> ret_type;
81 ffi::Map<tvm::tirx::Var, tvm::tirx::BufferVar> buffer_map;
83 ffi::Map<ffi::String, Any> attrs;
85 ffi::Map<tvm::tirx::Var, tvm::tirx::IterVar> env_threads;
87 ffi::Array<tvm::tirx::BufferVar> root_alloc_buffers;
88
89 // TIR utils
92 bool s_tir;
95
96 static void RegisterReflection() {
97 namespace refl = tvm::ffi::reflection;
98 refl::ObjectDef<PrimFuncFrameNode>()
99 .def_ro("name", &PrimFuncFrameNode::name)
100 .def_ro("args", &PrimFuncFrameNode::args)
101 .def_ro("is_private", &PrimFuncFrameNode::is_private)
102 .def_ro("ret_type", &PrimFuncFrameNode::ret_type)
103 .def_ro("buffer_map", &PrimFuncFrameNode::buffer_map)
104 .def_ro("attrs", &PrimFuncFrameNode::attrs)
105 .def_ro("env_threads", &PrimFuncFrameNode::env_threads)
106 .def_ro("root_alloc_buffers", &PrimFuncFrameNode::root_alloc_buffers)
107 .def_ro("s_tir", &PrimFuncFrameNode::s_tir)
108 .def_ro("persistent", &PrimFuncFrameNode::persistent);
109 }
110 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.PrimFuncFrame", PrimFuncFrameNode,
112
113 public:
119};
120
127 public:
128 explicit PrimFuncFrame(ffi::ObjectPtr<PrimFuncFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
129 TVM_FFI_ICHECK(data != nullptr);
130 data_ = std::move(data);
131 }
133};
134
141 public:
143 ffi::String name;
145 ffi::Array<tvm::tirx::IterVar> iter_vars;
147 ffi::Optional<ffi::Array<tvm::tirx::BufferRegion>> reads;
149 ffi::Optional<ffi::Array<tvm::tirx::BufferRegion>> writes;
151 ffi::Optional<tvm::tirx::Stmt> init;
153 ffi::Array<tvm::tirx::BufferVar> alloc_buffers;
155 ffi::Array<tvm::tirx::MatchBufferRegion> match_buffers;
157 ffi::Optional<ffi::Map<ffi::String, Any>> annotations;
159 ffi::Array<PrimExpr> iter_values;
164 ffi::Optional<PrimExpr> predicate;
167
168 static void RegisterReflection() {
169 namespace refl = tvm::ffi::reflection;
170 refl::ObjectDef<SBlockFrameNode>()
171 .def_ro("name", &SBlockFrameNode::name)
172 .def_ro("iter_vars", &SBlockFrameNode::iter_vars)
173 .def_ro("reads", &SBlockFrameNode::reads)
174 .def_ro("writes", &SBlockFrameNode::writes)
175 .def_ro("init", &SBlockFrameNode::init)
176 .def_ro("alloc_buffers", &SBlockFrameNode::alloc_buffers)
177 .def_ro("match_buffers", &SBlockFrameNode::match_buffers)
178 .def_ro("annotations", &SBlockFrameNode::annotations)
179 .def_ro("iter_values", &SBlockFrameNode::iter_values)
180 .def_ro("predicate", &SBlockFrameNode::predicate)
181 .def_ro("no_realize", &SBlockFrameNode::no_realize);
182 }
183 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.SSBlockFrame", SBlockFrameNode,
185
186 public:
192};
193
201 public:
202 explicit SBlockFrame(ffi::ObjectPtr<SBlockFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
203 TVM_FFI_ICHECK(data != nullptr);
204 data_ = std::move(data);
205 }
207};
208
215 public:
216 static void RegisterReflection() {
217 namespace refl = tvm::ffi::reflection;
218 refl::ObjectDef<BlockInitFrameNode>();
219 }
220 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.SBlockInitFrame", BlockInitFrameNode,
222
223 public:
233 void ExitWithScope() final;
234};
235
242 public:
243 explicit BlockInitFrame(ffi::ObjectPtr<BlockInitFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
244 TVM_FFI_ICHECK(data != nullptr);
245 data_ = std::move(data);
246 }
248};
249
256 public:
264 using FMakeForLoop = ffi::TypedFunction<tvm::tirx::Stmt(
265 ffi::Array<tvm::tirx::Var> loop_vars, ffi::Array<Range> loop_extents,
266 ffi::Array<ffi::Optional<PrimExpr>> loop_steps, tvm::tirx::Stmt loop_body)>;
268 ffi::Array<tvm::tirx::Var> vars;
270 ffi::Array<Range> doms;
272 ffi::Array<ffi::Optional<PrimExpr>> steps;
275
276 static void RegisterReflection() {
277 namespace refl = tvm::ffi::reflection;
278 refl::ObjectDef<ForFrameNode>()
279 .def_ro("vars", &ForFrameNode::vars)
280 .def_ro("doms", &ForFrameNode::doms);
281 // `f_make_for_loop` is not registered as it's not visited.
282 }
283 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.ForFrame", ForFrameNode, TIRFrameNode);
284
285 public:
291};
292
299 public:
300 explicit ForFrame(ffi::ObjectPtr<ForFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
301 TVM_FFI_ICHECK(data != nullptr);
302 data_ = std::move(data);
303 }
305};
306
314 public:
320 ffi::Array<tvm::prim::StringImm> message_parts;
321
322 static void RegisterReflection() {
323 namespace refl = tvm::ffi::reflection;
324 refl::ObjectDef<AssertFrameNode>()
325 .def_ro("condition", &AssertFrameNode::condition)
326 .def_ro("error_kind", &AssertFrameNode::error_kind)
327 .def_ro("message_parts", &AssertFrameNode::message_parts);
328 }
329 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.AssertFrame", AssertFrameNode,
331
332 public:
338};
339
346 public:
347 explicit AssertFrame(ffi::ObjectPtr<AssertFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
348 TVM_FFI_ICHECK(data != nullptr);
349 data_ = std::move(data);
350 }
352};
353
359 public:
363 ffi::String attr_key;
366
367 static void RegisterReflection() {
368 namespace refl = tvm::ffi::reflection;
369 refl::ObjectDef<LaunchThreadFrameNode>()
370 .def_ro("extent", &LaunchThreadFrameNode::extent)
371 .def_ro("attr_key", &LaunchThreadFrameNode::attr_key)
372 .def_ro("iter_var", &LaunchThreadFrameNode::iter_var);
373 }
374 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.LaunchThreadFrame",
376
377 public:
383};
384
391 public:
392 explicit LaunchThreadFrame(ffi::ObjectPtr<LaunchThreadFrameNode> data)
393 : TIRFrame(ffi::UnsafeInit{}) {
394 TVM_FFI_ICHECK(data != nullptr);
395 data_ = std::move(data);
396 }
398};
399
406 public:
410 ffi::String attr_key;
413
414 static void RegisterReflection() {
415 namespace refl = tvm::ffi::reflection;
416 refl::ObjectDef<AttrFrameNode>()
417 .def_ro("node", &AttrFrameNode::node)
418 .def_ro("attr_key", &AttrFrameNode::attr_key)
419 .def_ro("value", &AttrFrameNode::value);
420 }
421 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.AttrFrame", AttrFrameNode,
423
424 public:
430};
431
438 public:
439 explicit AttrFrame(ffi::ObjectPtr<AttrFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
440 TVM_FFI_ICHECK(data != nullptr);
441 data_ = std::move(data);
442 }
444};
445
452 public:
455
456 static void RegisterReflection() {
457 namespace refl = tvm::ffi::reflection;
458 refl::ObjectDef<WhileFrameNode>().def_ro("condition", &WhileFrameNode::condition);
459 }
460 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.WhileFrame", WhileFrameNode,
462
463 public:
469};
470
477 public:
478 explicit WhileFrame(ffi::ObjectPtr<WhileFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
479 TVM_FFI_ICHECK(data != nullptr);
480 data_ = std::move(data);
481 }
483};
484
490class IfFrameNode : public TIRFrameNode {
491 public:
495 ffi::Optional<ffi::Array<tvm::tirx::Stmt>> then_stmts;
497 ffi::Optional<ffi::Array<tvm::tirx::Stmt>> else_stmts;
498
499 static void RegisterReflection() {
500 namespace refl = tvm::ffi::reflection;
501 refl::ObjectDef<IfFrameNode>()
502 .def_ro("condition", &IfFrameNode::condition)
503 .def_ro("then_stmts", &IfFrameNode::then_stmts)
504 .def_ro("else_stmts", &IfFrameNode::else_stmts);
505 }
506 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.IfFrame", IfFrameNode, TIRFrameNode);
507
508 public:
514};
515
522 public:
523 explicit IfFrame(ffi::ObjectPtr<IfFrameNode> data) : TIRFrame(data) {
524 TVM_FFI_ICHECK(data != nullptr);
525 }
527};
528
535 public:
536 static void RegisterReflection() {
537 namespace refl = tvm::ffi::reflection;
538 refl::ObjectDef<ThenFrameNode>();
539 }
540 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.ThenFrame", ThenFrameNode,
542
543 public:
553 void ExitWithScope() final;
554};
555
562 public:
563 explicit ThenFrame(ffi::ObjectPtr<ThenFrameNode> data) : TIRFrame(data) {
564 TVM_FFI_ICHECK(data != nullptr);
565 }
567};
568
575 public:
576 static void RegisterReflection() {
577 namespace refl = tvm::ffi::reflection;
578 refl::ObjectDef<ElseFrameNode>();
579 }
580 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.ElseFrame", ElseFrameNode,
582
583 public:
593 void ExitWithScope() final;
594};
595
602 public:
603 explicit ElseFrame(ffi::ObjectPtr<ElseFrameNode> data) : TIRFrame(data) {
604 TVM_FFI_ICHECK(data != nullptr);
605 }
606
608};
609
611 public:
618
619 static void RegisterReflection() {
620 namespace refl = tvm::ffi::reflection;
621 refl::ObjectDef<DeclBufferFrameNode>()
622 .def_ro("buffer", &DeclBufferFrameNode::buffer)
623 .def_ro("data", &DeclBufferFrameNode::data)
624 .def_ro("allocated", &DeclBufferFrameNode::allocated);
625 }
626 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.DeclBufferFrame", DeclBufferFrameNode,
628
629 public:
631};
632
634 public:
635 explicit DeclBufferFrame(ffi::ObjectPtr<DeclBufferFrameNode> data) : TIRFrame(data) {
636 TVM_FFI_ICHECK(data != nullptr);
637 }
639};
640
642 public:
644 ffi::Map<ffi::String, tvm::tirx::BufferVar> workspace;
646 ffi::Map<ffi::String, ffi::Any> config;
648 ffi::Optional<ffi::String> dispatch{std::nullopt};
649
650 static void RegisterReflection() {
651 namespace refl = tvm::ffi::reflection;
652 refl::ObjectDef<ComposeOpFrameNode>()
653 .def_ro("workspace", &ComposeOpFrameNode::workspace)
654 .def_ro("config", &ComposeOpFrameNode::config)
655 .def_ro("dispatch", &ComposeOpFrameNode::dispatch);
656 }
657 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.ComposeOpFrame", ComposeOpFrameNode,
659
660 public:
662};
663
665 public:
666 explicit ComposeOpFrame(ffi::ObjectPtr<ComposeOpFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
667 TVM_FFI_ICHECK(data != nullptr);
668 data_ = std::move(data);
669 }
671};
673 public:
676
677 static void RegisterReflection() {
678 namespace refl = tvm::ffi::reflection;
679 refl::ObjectDef<AllocBufferFrameNode>().def_ro("buffer", &AllocBufferFrameNode::buffer);
680 }
681
682 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.AllocBufferFrame", AllocBufferFrameNode,
684
685 public:
687};
688
690 public:
691 explicit AllocBufferFrame(ffi::ObjectPtr<AllocBufferFrameNode> data)
692 : TIRFrame(ffi::UnsafeInit{}) {
693 TVM_FFI_ICHECK(data != nullptr);
694 data_ = std::move(data);
695 }
697};
698
705 public:
707 ffi::String message;
709 ffi::Map<ffi::String, ffi::Any> attrs;
710
711 static void RegisterReflection() {
712 namespace refl = tvm::ffi::reflection;
713 refl::ObjectDef<HintFrameNode>()
714 .def_ro("message", &HintFrameNode::message)
715 .def_ro("attrs", &HintFrameNode::attrs);
716 }
717 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.HintFrame", HintFrameNode,
719
720 public:
722};
723
730 public:
731 explicit HintFrame(ffi::ObjectPtr<HintFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
732 TVM_FFI_ICHECK(data != nullptr);
733 data_ = std::move(data);
734 }
736};
737
738} // namespace tirx
739} // namespace ir_builder
740} // namespace script
741} // namespace tvm
742
743#endif // TVM_TIRX_SCRIPT_BUILDER_FRAME_H_
Managed reference to ExprNode.
Definition base_expr.h:335
Typed reference/view over any Expr whose ExprNode::ty is PrimType.
Definition base_expr.h:401
RAII wrapper function to enter and exit a context object similar to python's with syntax.
Definition with_context.h:59
Managed reference to StringImmNode.
Definition expr.h:68
Managed reference to an IRBuilderFrameNode.
Definition base.h:103
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.AllocBufferFrame", AllocBufferFrameNode, TIRFrameNode)
tvm::tirx::BufferVar buffer
The allocated buffer.
Definition frame.h:675
void ExitWithScope() final
The method called when exiting RAII scope.
static void RegisterReflection()
Definition frame.h:677
AllocBufferFrame(ffi::ObjectPtr< AllocBufferFrameNode > data)
Definition frame.h:691
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(AllocBufferFrame, TIRFrame, AllocBufferFrameNode)
A frame that represents the assert statement. Proceeds if the condition is true, otherwise aborts wit...
Definition frame.h:313
static void RegisterReflection()
Definition frame.h:322
ffi::Array< tvm::prim::StringImm > message_parts
Error message fragments, concatenated at runtime when assertion fails.
Definition frame.h:320
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.AssertFrame", AssertFrameNode, TIRFrameNode)
void ExitWithScope() final
The method called when exiting RAII scope.
tvm::prim::StringImm error_kind
The error kind, e.g. "RuntimeError", "TypeError", "ValueError".
Definition frame.h:318
PrimExpr condition
The PrimExpr to test.
Definition frame.h:316
Managed reference to AssertFrameNode.
Definition frame.h:345
AssertFrame(ffi::ObjectPtr< AssertFrameNode > data)
Definition frame.h:347
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(AssertFrame, TIRFrame, AssertFrameNode)
A frame that represents attribute node.
Definition frame.h:405
ffi::String attr_key
Attribute type key.
Definition frame.h:410
Any node
The node to annotate the attribute.
Definition frame.h:408
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:414
PrimExpr value
The value of the attribute.
Definition frame.h:412
Managed reference to AttrFrameNode.
Definition frame.h:437
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(AttrFrame, TIRFrame, AttrFrameNode)
AttrFrame(ffi::ObjectPtr< AttrFrameNode > data)
Definition frame.h:439
A frame that represents the block initialization statment.
Definition frame.h:214
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:216
Managed reference to BlockInitFrameNode.
Definition frame.h:241
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(BlockInitFrame, TIRFrame, BlockInitFrameNode)
BlockInitFrame(ffi::ObjectPtr< BlockInitFrameNode > data)
Definition frame.h:243
ffi::Map< ffi::String, tvm::tirx::BufferVar > workspace
The workspace of the compose op.
Definition frame.h:644
static void RegisterReflection()
Definition frame.h:650
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.ComposeOpFrame", ComposeOpFrameNode, TIRFrameNode)
ffi::Map< ffi::String, ffi::Any > config
The config of the compose op.
Definition frame.h:646
void ExitWithScope() final
The method called when exiting RAII scope.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ComposeOpFrame, TIRFrame, ComposeOpFrameNode)
ComposeOpFrame(ffi::ObjectPtr< ComposeOpFrameNode > data)
Definition frame.h:666
static void RegisterReflection()
Definition frame.h:619
bool allocated
The buffer allocated or not.
Definition frame.h:617
Expr data
Physical pointer expression backing the declaration.
Definition frame.h:615
tvm::tirx::BufferVar buffer
The declared buffer.
Definition frame.h:613
void ExitWithScope() final
The method called when exiting RAII scope.
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.DeclBufferFrame", DeclBufferFrameNode, TIRFrameNode)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(DeclBufferFrame, TIRFrame, DeclBufferFrameNode)
DeclBufferFrame(ffi::ObjectPtr< DeclBufferFrameNode > data)
Definition frame.h:635
A frame that represents else.
Definition frame.h:574
void EnterWithScope() final
The method called when entering RAII scope.
static void RegisterReflection()
Definition frame.h:576
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.ElseFrame", ElseFrameNode, TIRFrameNode)
Managed reference to ElseFrameNode.
Definition frame.h:601
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ElseFrame, TIRFrame, ElseFrameNode)
ElseFrame(ffi::ObjectPtr< ElseFrameNode > data)
Definition frame.h:603
A frame that represents the for loop.
Definition frame.h:255
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:266
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:274
static void RegisterReflection()
Definition frame.h:276
ffi::Array< Range > doms
The domains of iteration.
Definition frame.h:270
ffi::Array< tvm::tirx::Var > vars
The loop variable.
Definition frame.h:268
void ExitWithScope() final
The method called when exiting RAII scope.
ffi::Array< ffi::Optional< PrimExpr > > steps
The optional steps of iteration.
Definition frame.h:272
Managed reference to ForFrameNode.
Definition frame.h:298
ForFrame(ffi::ObjectPtr< ForFrameNode > data)
Definition frame.h:300
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ForFrame, TIRFrame, ForFrameNode)
A frame that represents a hint directive for the sketch language.
Definition frame.h:704
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.HintFrame", HintFrameNode, TIRFrameNode)
ffi::String message
The free-form hint message string.
Definition frame.h:707
static void RegisterReflection()
Definition frame.h:711
ffi::Map< ffi::String, ffi::Any > attrs
Optional structured key-value attributes.
Definition frame.h:709
void ExitWithScope() final
The method called when exiting RAII scope.
Managed reference to HintFrameNode.
Definition frame.h:729
HintFrame(ffi::ObjectPtr< HintFrameNode > data)
Definition frame.h:731
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(HintFrame, TIRFrame, HintFrameNode)
A frame that represents if statement.
Definition frame.h:490
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:497
ffi::Optional< ffi::Array< tvm::tirx::Stmt > > then_stmts
The statements in the true branch.
Definition frame.h:495
void ExitWithScope() final
The method called when exiting RAII scope.
PrimExpr condition
The condition of the if statement.
Definition frame.h:493
static void RegisterReflection()
Definition frame.h:499
Managed reference to IfFrameNode.
Definition frame.h:521
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(IfFrame, TIRFrame, IfFrameNode)
IfFrame(ffi::ObjectPtr< IfFrameNode > data)
Definition frame.h:523
The LaunchThreadFrameNode.
Definition frame.h:358
PrimExpr extent
The extent of environment thread.
Definition frame.h:361
tvm::tirx::IterVar iter_var
The iteration variable.
Definition frame.h:365
ffi::String attr_key
The attribute key, could be either virtual_thread or thread_extent.
Definition frame.h:363
void ExitWithScope() final
The method called when exiting RAII scope.
static void RegisterReflection()
Definition frame.h:367
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.LaunchThreadFrame", LaunchThreadFrameNode, TIRFrameNode)
Managed reference to LaunchThreadFrameNode.
Definition frame.h:390
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(LaunchThreadFrame, TIRFrame, LaunchThreadFrameNode)
LaunchThreadFrame(ffi::ObjectPtr< LaunchThreadFrameNode > data)
Definition frame.h:392
A frame that represents the PrimFunc containing TIR statements.
Definition frame.h:70
bool s_tir
Whether this PrimFunc uses s_tir semantics (root SBlock wrap, parser layout default = None)....
Definition frame.h:92
void ExitWithScope() final
The method called when exiting RAII scope.
ffi::Map< tvm::tirx::Var, tvm::tirx::BufferVar > buffer_map
Maps some parameters to specific buffer data structures.
Definition frame.h:81
ffi::Optional< Type > ret_type
The return type of the function.
Definition frame.h:79
ffi::Map< ffi::String, Any > attrs
Additional attributes storing the meta-data.
Definition frame.h:83
ffi::Array< tvm::tirx::BufferVar > root_alloc_buffers
The buffer allocated in root block.
Definition frame.h:87
bool is_private
Whether the PrimFunc is annotated as private.
Definition frame.h:77
static void RegisterReflection()
Definition frame.h:96
ffi::Optional< ffi::String > name
The name of the block.
Definition frame.h:73
ffi::Array< tvm::tirx::Var > args
Function parameters.
Definition frame.h:75
bool persistent
Whether it is a persistent kernel.
Definition frame.h:94
ffi::Map< tvm::tirx::Var, tvm::tirx::IterVar > env_threads
The variable map bound to thread env.
Definition frame.h:85
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.PrimFuncFrame", PrimFuncFrameNode, TIRFrameNode)
Managed reference to PrimFuncFrameNode.
Definition frame.h:126
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(PrimFuncFrame, TIRFrame, PrimFuncFrameNode)
PrimFuncFrame(ffi::ObjectPtr< PrimFuncFrameNode > data)
Definition frame.h:128
A frame that represents the block.
Definition frame.h:140
ffi::Optional< ffi::Array< tvm::tirx::BufferRegion > > writes
The write buffer regions of the block.
Definition frame.h:149
ffi::Optional< ffi::Array< tvm::tirx::BufferRegion > > reads
The read buffer regions of the block.
Definition frame.h:147
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:151
ffi::Optional< ffi::Map< ffi::String, Any > > annotations
The annotation of the block.
Definition frame.h:157
ffi::Optional< PrimExpr > predicate
The predicate of the block realization, the block will only be executed when the predicate is true.
Definition frame.h:164
ffi::Array< tvm::tirx::BufferVar > alloc_buffers
The buffer allocated in the block.
Definition frame.h:153
ffi::Array< tvm::tirx::IterVar > iter_vars
The variables of the block.
Definition frame.h:145
static void RegisterReflection()
Definition frame.h:168
ffi::Array< PrimExpr > iter_values
The corresponding values of the iter vars.
Definition frame.h:159
bool no_realize
The flag whether to construct BlockRealize or Block.
Definition frame.h:166
ffi::Array< tvm::tirx::MatchBufferRegion > match_buffers
The match buffer regions.
Definition frame.h:155
ffi::String name
The name of the block.
Definition frame.h:143
Managed reference to SBlockFrameNode.
Definition frame.h:200
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(SBlockFrame, TIRFrame, SBlockFrameNode)
SBlockFrame(ffi::ObjectPtr< SBlockFrameNode > data)
Definition frame.h:202
A base frame that represents the TIR fame with body of statements.
Definition frame.h:39
TVM_FFI_DECLARE_OBJECT_INFO("script.ir_builder.tirx.TIRFrame", TIRFrameNode, IRBuilderFrameNode)
static void RegisterReflection()
Definition frame.h:44
ffi::Array< tvm::tirx::Stmt > stmts
The Stmt within in this frame.
Definition frame.h:42
Managed reference to TIRFrameNode.
Definition frame.h:56
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(TIRFrame, IRBuilderFrame, TIRFrameNode)
TIRFrame(ffi::ObjectPtr< TIRFrameNode > data)
Definition frame.h:62
A frame that represents then.
Definition frame.h:534
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:536
Managed reference to ThenFrameNode.
Definition frame.h:561
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ThenFrame, TIRFrame, ThenFrameNode)
ThenFrame(ffi::ObjectPtr< ThenFrameNode > data)
Definition frame.h:563
A frame that represents while loop.
Definition frame.h:451
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.WhileFrame", WhileFrameNode, TIRFrameNode)
PrimExpr condition
The termination condition of while.
Definition frame.h:454
void ExitWithScope() final
The method called when exiting RAII scope.
static void RegisterReflection()
Definition frame.h:456
Managed reference to WhileFrameNode.
Definition frame.h:476
WhileFrame(ffi::ObjectPtr< WhileFrameNode > data)
Definition frame.h:478
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(WhileFrame, TIRFrame, WhileFrameNode)
Checked zero-state view over an ordinary VarNode with BufferType.
Definition buffer.h:179
Iteration Variable, represents an iteration over an integer interval.
Definition var.h:194
Container of all statements.
Definition stmt.h:67
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analyzer.h:40
TIR statements.