25 #ifndef TVM_TIR_SCHEDULE_BLOCK_SCOPE_H_ 26 #define TVM_TIR_SCHEDULE_BLOCK_SCOPE_H_ 30 #include <unordered_map> 68 v->Visit(
"seq_index", &seq_index);
71 static constexpr
const char*
_type_key =
"tir.StmtSRef";
77 this->parent =
nullptr;
88 template <
typename StmtType>
90 if (stmt !=
nullptr && stmt->
IsInstance<StmtType>()) {
91 return static_cast<const StmtType*
>(
stmt);
130 TVM_DLL
static StmtSRef InlineMark();
142 TVM_DLL
static StmtSRef RootMark();
174 v->Visit(
"src", &src);
175 v->Visit(
"dst", &dst);
176 v->Visit(
"kind", &kind);
179 static constexpr
const char*
_type_key =
"tir.Dependency";
228 bool stage_pipeline{
false};
232 static constexpr
const char*
_type_key =
"tir.BlockScope";
273 #endif // TVM_TIR_SCHEDULE_BLOCK_SCOPE_H_ StmtSRef src
The source of the dependency relation.
Definition: block_scope.h:167
static constexpr const char * _type_key
Definition: block_scope.h:71
Base node of all statements.
Definition: stmt.h:38
A tuple (src, dst, kind) representing certain types of dependency. For example, (A, B, kRAW) means block B depends on block A, and the dependency kind is read-after-write, which means block B reads the result written by block A.
Definition: block_scope.h:164
#define TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:758
ObjectRef equal functor.
Definition: object.h:634
StmtSRefNode * parent
The parent sref.
Definition: block_scope.h:58
std::unordered_map< Buffer, Array< StmtSRef >, ObjectPtrHash, ObjectPtrEqual > buffer_writers
The mapping from the buffer to the blocks who write it.
Definition: block_scope.h:218
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
std::unordered_map< StmtSRef, Array< Dependency >, ObjectPtrHash, ObjectPtrEqual > dst2deps
Lookup table for the dst of dependencies.
Definition: block_scope.h:216
void VisitAttrs(AttrVisitor *v)
Definition: block_scope.h:173
Managed reference to StmtSRefNode.
Definition: block_scope.h:102
base class of all object containers.
Definition: object.h:167
#define TVM_DEFINE_MUTABLE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:744
bool IsInstance() const
Definition: object.h:829
Managed reference to BlockScopeNode.
Definition: block_scope.h:255
Visitor class to get the attributes of an AST/IR node. The content is going to be called for each fie...
Definition: reflection.h:52
Managed reference to DependencyNode.
Definition: block_scope.h:187
std::unordered_map< StmtSRef, Array< Dependency >, ObjectPtrHash, ObjectPtrEqual > src2deps
Lookup table for the src of dependencies.
Definition: block_scope.h:214
const StmtNode * stmt
The block or for stmt the object refers to.
Definition: block_scope.h:56
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
ObjectRef hash functor.
Definition: object.h:624
void Reset()
Reset the object inplace to the invalid state.
Definition: block_scope.h:75
An object with 1-to-1 correspondence with each block reference in the sref tree. This data structure ...
Definition: block_scope.h:207
An object that refers to schedulable elements (block/for-loop) in TensorIR, aka "sref".
Definition: block_scope.h:49
DepKind
Type of dependency. Right now we have 4 types of dependencies 1) Read-after-write (kRAW) 2) Write-aft...
Definition: block_scope.h:152
Base class of all object reference.
Definition: object.h:511
DepKind kind
The dependency kind.
Definition: block_scope.h:171
TVM_DECLARE_FINAL_OBJECT_INFO(StmtSRefNode, Object)
StmtSRef dst
The destination of the dependency relation.
Definition: block_scope.h:169
int64_t seq_index
If the statement the sref points to is an element of a SeqStmt in the AST, then seq_index is set to i...
Definition: block_scope.h:63
void VisitAttrs(AttrVisitor *v)
Definition: block_scope.h:65
IterVar is opaque,.
Definition: var.h:227
#define TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:728
const StmtType * StmtAs() const
Get the referenced statement with proper type checking. It serves the same purpose as ObjectRef::as...
Definition: block_scope.h:89
void VisitAttrs(AttrVisitor *v)
Definition: block_scope.h:230