24 #ifndef TVM_TARGET_TAG_H_
25 #define TVM_TARGET_TAG_H_
27 #include <tvm/ffi/reflection/registry.h>
46 refl::ObjectDef<TargetTagNode>()
51 static constexpr
const char*
_type_key =
"target.TargetTag";
57 uint32_t AttrRegistryIndex()
const {
return index_; }
59 String AttrRegistryName()
const {
return name; }
63 template <
typename,
typename>
81 TVM_DLL
static Optional<Target>
Get(
const String& target_tag_name);
94 TVM_DLL
static Target AddTag(String name, Map<String, Any> config,
bool override);
132 tag_->index_ = reg_index;
134 template <
typename,
typename>
140 tag_->
config = std::move(config);
145 tag_->
config.Set(key, value);
150 if (tag_->
name.empty()) {
156 #define TVM_TARGET_TAG_REGISTER_VAR_DEF \
157 static DMLC_ATTRIBUTE_UNUSED ::tvm::TargetTagRegEntry& __make_##TargetTag
164 #define TVM_REGISTER_TARGET_TAG(TargetTagName) \
165 TVM_STR_CONCAT(TVM_TARGET_TAG_REGISTER_VAR_DEF, __COUNTER__) = \
166 ::tvm::TargetTagRegEntry::RegisterOrGet(TargetTagName).set_name()
Attribute map used in registry.
Generic attribute map.
Definition: attr_registry_map.h:38
Definition: instruction.h:30
A target tag.
Definition: tag.h:37
static void RegisterReflection()
Definition: tag.h:44
TVM_DECLARE_FINAL_OBJECT_INFO(TargetTagNode, Object)
static constexpr const char * _type_key
Definition: tag.h:51
String name
Name of the target.
Definition: tag.h:40
Map< String, Any > config
Config map to generate the target.
Definition: tag.h:42
static TargetTagRegEntry & RegisterOrGet(const String &target_tag_name)
Register or get a new entry.
TargetTagRegEntry & set_name()
Set name of the TargetTag to be the same as registry if it is empty.
Definition: tag.h:149
TargetTagRegEntry & set_config(Map< String, Any > config)
Set the config dict corresponding to the target tag.
Definition: tag.h:139
TargetTagRegEntry & with_config(String key, Any value)
Add a key-value pair to the config dict.
Definition: tag.h:144
Managed reference class to TargetTagNode.
Definition: tag.h:74
TVM_DEFINE_OBJECT_REF_METHODS(TargetTag, ObjectRef, TargetTagNode)
static Map< String, Target > ListTags()
List all names of the existing target tags.
static Target AddTag(String name, Map< String, Any > config, bool override)
Add a tag into the registry.
static Optional< Target > Get(const String &target_tag_name)
Retrieve the Target given it the name of target tag.
Managed reference class to TargetNode.
Definition: target.h:191
Definition: repr_printer.h:91
Performance counters for profiling via the PAPI library.
Definition: analyzer.h:37
Definitions and helper macros for IR/AST nodes.
Compilation target object.