24 #ifndef TVM_IR_GLOBAL_VAR_SUPPLY_H_ 25 #define TVM_IR_GLOBAL_VAR_SUPPLY_H_ 28 #include <unordered_map> 52 std::unordered_map<std::string, GlobalVar> name_to_var_map = {});
83 static constexpr
const char*
_type_key =
"GlobalVarSupply";
89 std::unordered_map<std::string, GlobalVar> name_to_var_map_;
104 std::unordered_map<std::string, GlobalVar> name_to_var_map = {});
118 TVM_DLL
explicit GlobalVarSupply(
const IRModule module);
125 #endif // TVM_IR_GLOBAL_VAR_SUPPLY_H_ Managed reference class to GlobalVarSupplyNode.
Definition: global_var_supply.h:96
IRModule that holds the functions and type definitions.
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
GlobalVarSupplyNode()
Empty constructor. Will use an empty NameSupply.
Definition: global_var_supply.h:44
NameSupply name_supply_
The NameSupply used to generate unique name hints to GlobalVars.
Definition: global_var_supply.h:81
TVM_DECLARE_FINAL_OBJECT_INFO(GlobalVarSupplyNode, Object)
GlobalVar FreshGlobal(String name, bool add_prefix=true)
Generates a unique GlobalVar from this supply.
static constexpr const bool _type_has_method_sequal_reduce
Definition: global_var_supply.h:84
base class of all object containers.
Definition: object.h:167
#define TVM_DEFINE_MUTABLE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:744
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
void VisitAttrs(AttrVisitor *v)
Definition: global_var_supply.h:78
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
void ReserveGlobalVar(const GlobalVar &var, bool allow_conflict=false)
Reserves an existing GlobalVar with this supply.
Managed reference to GlobalVarNode.
Definition: expr.h:477
GlobalVarSupply can be used to generate unique GlobalVars.
Definition: global_var_supply.h:39
Reference to string objects.
Definition: string.h:98
Managed reference class to NameSupplyNode.
Definition: name_supply.h:108
Var var(std::string name_hint, DataType t=DataType::Int(32))
Construct a new Var expression.
Base class of all object reference.
Definition: object.h:511
Managed reference class to IRModuleNode.
Definition: module.h:348
static constexpr const char * _type_key
Definition: global_var_supply.h:83
static constexpr const bool _type_has_method_shash_reduce
Definition: global_var_supply.h:85
NameSupply that can be used to generate unique variable names.
GlobalVar UniqueGlobalFor(const String &name, bool add_prefix=true)
Looks up for a GlobalVar with the given name in this supply. If no entry is found, creates one, places it in the cache and returns it.