24 #ifndef TVM_RELAX_STRUCT_INFO_FUNCTOR_H_
25 #define TVM_RELAX_STRUCT_INFO_FUNCTOR_H_
36 template <
typename FStructInfo>
40 #define STRUCT_INFO_FUNCTOR_DEFAULT \
42 return VisitStructInfoDefault_(op, std::forward<Args>(args)...); \
45 #define TVM_STRUCT_INFO_FUNCTOR_DISPATCH(OP) \
46 vtable.template set_dispatch<OP>([](const ObjectRef& n, TSelf* self, Args... args) { \
47 return self->VisitStructInfo_(static_cast<const OP*>(n.get()), std::forward<Args>(args)...); \
50 template <
typename R,
typename... Args>
68 return VisitStructInfo(n, std::forward<Args>(args)...);
77 TVM_FFI_ICHECK(n.defined());
79 return vtable(n,
this, std::forward<Args>(args)...);
97 TVM_FFI_THROW(InternalError) <<
"Do not have a default for " << op->GetTypeKey();
103 static FStructInfo InitVTable() {
118 #undef TVM_STRUCT_INFO_FUNCTOR_DISPATCH
A dynamically dispatched functor on the type of the first argument.
Definition: functor.h:65
Reference to PrimExprNode.
Definition: expr.h:126
Managed reference to RelaxExprNode.
Definition: expr.h:441
Structure information about function.
Definition: struct_info.h:263
Opaque object.
Definition: struct_info.h:39
Primitive value.
Definition: struct_info.h:62
StructInfo of shape value.
Definition: struct_info.h:97
Definition: struct_info_functor.h:51
virtual R VisitStructInfo_(const FuncStructInfoNode *op, Args... args)
Definition: struct_info_functor.h:94
virtual R VisitStructInfo_(const TensorStructInfoNode *op, Args... args)
Definition: struct_info_functor.h:88
virtual R VisitStructInfo_(const PrimStructInfoNode *op, Args... args)
Definition: struct_info_functor.h:84
virtual R VisitStructInfoDefault_(const Object *op, Args...)
Definition: struct_info_functor.h:96
virtual R VisitStructInfo_(const ShapeStructInfoNode *op, Args... args)
Definition: struct_info_functor.h:86
virtual R VisitStructInfo(const StructInfo &n, Args... args)
The functor call.
Definition: struct_info_functor.h:76
virtual R VisitStructInfo_(const TupleStructInfoNode *op, Args... args)
Definition: struct_info_functor.h:92
virtual R VisitStructInfo_(const ObjectStructInfoNode *op, Args... args)
Definition: struct_info_functor.h:82
virtual ~StructInfoFunctor()
virtual destructor
Definition: struct_info_functor.h:60
virtual R VisitStructInfo_(const distributed::DTensorStructInfoNode *op, Args... args)
Definition: struct_info_functor.h:90
R result_type
the result type of this functor
Definition: struct_info_functor.h:58
R operator()(const StructInfo &n, Args... args)
Same as call.
Definition: struct_info_functor.h:67
Definition: struct_info_functor.h:37
StructInfoMutator that mutates struct info.
Definition: struct_info_functor.h:142
StructInfo VisitStructInfo_(const TupleStructInfoNode *op) override
StructInfo VisitStructInfo_(const FuncStructInfoNode *op) override
StructInfo VisitStructInfo_(const ObjectStructInfoNode *op) override
StructInfo VisitStructInfo_(const ShapeStructInfoNode *op) override
StructInfo VisitStructInfo_(const PrimStructInfoNode *op) override
virtual Expr VisitStructInfoExprField(const Expr &expr)
Definition: struct_info_functor.h:154
StructInfo VisitStructInfo_(const distributed::DTensorStructInfoNode *op) override
virtual PrimExpr VisitStructInfoExprField(const PrimExpr &expr)
Definition: struct_info_functor.h:155
StructInfo VisitStructInfo_(const TensorStructInfoNode *op) override
A struct info visitor.
Definition: struct_info_functor.h:123
void VisitStructInfo_(const FuncStructInfoNode *op) override
virtual void VisitStructInfoExprField(const PrimExpr &expr)
Definition: struct_info_functor.h:136
void VisitStructInfo_(const TupleStructInfoNode *op) override
void VisitStructInfo_(const ObjectStructInfoNode *op) override
virtual void VisitStructInfoExprField(const Expr &expr)
Definition: struct_info_functor.h:135
void VisitStructInfo_(const PrimStructInfoNode *op) override
void VisitStructInfo_(const distributed::DTensorStructInfoNode *op) override
void VisitStructInfo_(const ShapeStructInfoNode *op) override
void VisitStructInfo_(const TensorStructInfoNode *op) override
Managed reference to StructInfoNode.
Definition: expr.h:132
StructInfo of Tensor.
Definition: struct_info.h:144
StructInfo of Tuple.
Definition: struct_info.h:221
StructInfo of DTensor (Distributed Tensor).
Definition: struct_info.h:116
Struct info for DTensor (Distributed Tensor)
Defines the Functor data structures.
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition: analyzer.h:37
#define STRUCT_INFO_FUNCTOR_DEFAULT
Definition: struct_info_functor.h:40
#define TVM_STRUCT_INFO_FUNCTOR_DISPATCH(OP)
Definition: struct_info_functor.h:45