tvm
analysis.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 
27 #ifndef TVM_IR_ANALYSIS_H_
28 #define TVM_IR_ANALYSIS_H_
29 
30 #include <tvm/ir/expr.h>
31 #include <tvm/ir/module.h>
32 #include <tvm/node/functor.h>
34 
35 namespace tvm {
36 namespace ir {
37 
39  public:
40  /* \brief Functor to be registered for IR types
41  *
42  * Should be implemented for each `BaseFunc` subclass.
43  * Implementation should call `CalleeCollector::Mark` for each
44  * `GlobalVar` in the function.
45  */
46  using FType = NodeFunctor<void(const ObjectRef&, CalleeCollector*)>;
47  TVM_DLL static FType& vtable() {
48  static FType inst;
49  return inst;
50  }
51 
52  virtual ~CalleeCollector() {}
53 
54  /* \brief Collect the GlobalVar in a function */
55  virtual void Mark(GlobalVar gvar) = 0;
56 };
57 
59 
60 } // namespace ir
61 } // namespace tvm
62 
63 #endif // TVM_IR_ANALYSIS_H_
Runtime Array container types.
Managed reference to GlobalVarNode.
Definition: expr.h:487
Managed reference class to IRModuleNode.
Definition: module.h:366
A dynamically dispatched functor on the type of the first argument.
Definition: functor.h:64
Definition: analysis.h:38
virtual ~CalleeCollector()
Definition: analysis.h:52
virtual void Mark(GlobalVar gvar)=0
static FType & vtable()
Definition: analysis.h:47
Map container of NodeRef->NodeRef in DSL graph. Map implements copy on write semantics,...
Definition: map.h:1271
Base class of all object reference.
Definition: object.h:519
Defines the Functor data structures.
Base expr nodes in TVM.
IRModule that holds the functions and type definitions.
Map< GlobalVar, Array< GlobalVar > > CollectCallMap(const IRModule &mod)
tvm::PrimExpr mod(const tvm::PrimExpr &a, const tvm::PrimExpr &b)
Definition: broadcast.h:290
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36