24 #ifndef TVM_TARGET_TAG_H_
25 #define TVM_TARGET_TAG_H_
27 #include <tvm/ffi/reflection/registry.h>
46 refl::ObjectDef<TargetTagNode>()
54 uint32_t AttrRegistryIndex()
const {
return index_; }
56 ffi::String AttrRegistryName()
const {
return name; }
60 template <
typename,
typename>
78 TVM_DLL
static ffi::Optional<Target>
Get(
const ffi::String& target_tag_name);
83 TVM_DLL
static ffi::Map<ffi::String, Target>
ListTags();
91 TVM_DLL
static Target AddTag(ffi::String name, ffi::Map<ffi::String, Any> config,
bool override);
129 tag_->index_ = reg_index;
131 template <
typename,
typename>
137 tag_->
config = std::move(config);
142 tag_->
config.Set(key, value);
147 if (tag_->
name.empty()) {
153 #define TVM_TARGET_TAG_REGISTER_VAR_DEF \
154 static DMLC_ATTRIBUTE_UNUSED ::tvm::TargetTagRegEntry& __make_##TargetTag
161 #define TVM_REGISTER_TARGET_TAG(TargetTagName) \
162 TVM_STR_CONCAT(TVM_TARGET_TAG_REGISTER_VAR_DEF, __COUNTER__) = \
163 ::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
ffi::String name
Name of the target.
Definition: tag.h:40
ffi::Map< ffi::String, Any > config
Config map to generate the target.
Definition: tag.h:42
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("target.TargetTag", TargetTagNode, Object)
TargetTagRegEntry & set_config(ffi::Map< ffi::String, Any > config)
Set the config dict corresponding to the target tag.
Definition: tag.h:136
TargetTagRegEntry & with_config(ffi::String key, Any value)
Add a key-value pair to the config dict.
Definition: tag.h:141
TargetTagRegEntry & set_name()
Set name of the TargetTag to be the same as registry if it is empty.
Definition: tag.h:146
static TargetTagRegEntry & RegisterOrGet(const ffi::String &target_tag_name)
Register or get a new entry.
Managed reference class to TargetTagNode.
Definition: tag.h:71
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(TargetTag, ObjectRef, TargetTagNode)
static ffi::Map< ffi::String, Target > ListTags()
List all names of the existing target tags.
static ffi::Optional< Target > Get(const ffi::String &target_tag_name)
Retrieve the Target given it the name of target tag.
static Target AddTag(ffi::String name, ffi::Map< ffi::String, Any > config, bool override)
Add a tag into the registry.
Managed reference class to TargetNode.
Definition: target.h:192
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.