24 #ifndef TVM_RELAY_DATAFLOW_MATCHER_H_ 25 #define TVM_RELAY_DATAFLOW_MATCHER_H_ 31 #include <unordered_map> 37 class DFPatternCallback;
54 v->Visit(
"pattern", &pattern);
55 v->Visit(
"require_type", &require_type);
56 v->Visit(
"rewrite_once", &rewrite_once);
59 static constexpr
const char*
_type_key =
"DFPatternCallbackNode";
123 #endif // TVM_RELAY_DATAFLOW_MATCHER_H_ bool require_type
Require InferType to be run before the callback.
Definition: dataflow_matcher.h:49
TVM_DECLARE_BASE_OBJECT_INFO(DFPatternCallbackNode, Object)
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
bool rewrite_once
Run the callback only once.
Definition: dataflow_matcher.h:51
base class of all object containers.
Definition: object.h:167
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
Expr PartitionPattern(DFPattern pattern, Expr expr, Map< String, ObjectRef > attrs, PackedFunc check)
Partition all matches of a DFPattern inside an Expr into separate Function calls. ...
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
static constexpr const char * _type_key
Definition: dataflow_matcher.h:59
Managed reference to RelayExprNode.
Definition: expr.h:433
#define TVM_DEFINE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:713
Managed reference to dataflow patterns.
Definition: dataflow_pattern.h:50
Base class of all object reference.
Definition: object.h:511
DFPattern pattern
Pattern this callback matches.
Definition: dataflow_matcher.h:45
Expr InferType(const Expr &expr)
Infer the type of an expression.
A pattern language for matching dataflow properties.
Managed reference class to IRModuleNode.
Definition: module.h:348
Base type of all dataflow pattern callbacks.
Definition: dataflow_matcher.h:42
Map container of NodeRef->NodeRef in DSL graph. Map implements copy on write semantics, which means map is mutable but copy will happen when array is referenced in more than two places.
Definition: map.h:1271
A set of passes for operating on pattern graphs.
Packed function is a type-erased function. The arguments are passed by packed format.
Definition: packed_func.h:138
bool MatchPattern(DFPattern pattern, Expr expr)
Determine if a pattern matches an expression.
Expr RewritePatterns(Array< DFPatternCallback > callbacks, Expr expr, IRModule mod=IRModule())
Rewrite an expression based on some number of DFPatternCallbacks.
tvm::PrimExpr mod(const tvm::PrimExpr &a, const tvm::PrimExpr &b)
Definition: broadcast.h:290
Managed reference to dataflow pattern callbacks.
Definition: dataflow_matcher.h:67
IRModuleFrame IRModule()
The IRModule declaration statement.
void VisitAttrs(tvm::AttrVisitor *v)
Definition: dataflow_matcher.h:53