24 #ifndef TVM_IR_GLOBAL_VAR_SUPPLY_H_
25 #define TVM_IR_GLOBAL_VAR_SUPPLY_H_
27 #include <tvm/ffi/reflection/registry.h>
33 #include <unordered_map>
53 std::unordered_map<std::string, GlobalVar> name_to_var_map = {});
81 refl::ObjectDef<GlobalVarSupplyNode>();
87 static constexpr
const char*
_type_key =
"ir.GlobalVarSupply";
92 std::unordered_map<std::string, GlobalVar> name_to_var_map_;
107 std::unordered_map<std::string, GlobalVar> name_to_var_map = {});
GlobalVarSupply can be used to generate unique GlobalVars.
Definition: global_var_supply.h:40
void ReserveGlobalVar(const GlobalVar &var, bool allow_conflict=false)
Reserves an existing GlobalVar with this supply.
static constexpr const char * _type_key
Definition: global_var_supply.h:87
TVM_DECLARE_FINAL_OBJECT_INFO(GlobalVarSupplyNode, Object)
NameSupply name_supply_
The NameSupply used to generate unique name hints to GlobalVars.
Definition: global_var_supply.h:85
static void RegisterReflection()
Definition: global_var_supply.h:79
GlobalVar FreshGlobal(String name, bool add_prefix=true)
Generates a unique GlobalVar from this supply.
GlobalVarSupplyNode()
Empty constructor. Will use an empty NameSupply.
Definition: global_var_supply.h:45
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,...
GlobalVarSupplyNode(NameSupply name_supply, std::unordered_map< std::string, GlobalVar > name_to_var_map={})
Constructor.
Managed reference class to GlobalVarSupplyNode.
Definition: global_var_supply.h:99
GlobalVarSupply(const Array< IRModule > &modules)
Constructs a supply from an array of IRModules. GlobalVars generated by this supply are guaranteed no...
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(GlobalVarSupply, ObjectRef, GlobalVarSupplyNode)
GlobalVarSupply(const IRModule module)
Constructs a GlobalVarSupply from an IRModule. GlobalVars generated by this supply are guaranteed not...
GlobalVarSupply(const NameSupply &name_supply=NameSupply(), std::unordered_map< std::string, GlobalVar > name_to_var_map={})
Constructor.
Managed reference to GlobalVarNode.
Definition: expr.h:489
Managed reference class to IRModuleNode.
Definition: module.h:257
Managed reference class to NameSupplyNode.
Definition: name_supply.h:110
IRModule that holds the functions and type definitions.
NameSupply that can be used to generate unique variable names.
Definition: repr_printer.h:91
Var var(std::string name_hint, DataType t=DataType::Int(32))
Construct a new Var expression.
Performance counters for profiling via the PAPI library.
Definition: analyzer.h:37