24 #ifndef TVM_TARGET_TAG_H_
25 #define TVM_TARGET_TAG_H_
27 #include <tvm/ffi/reflection/registry.h>
45 refl::ObjectDef<TargetTagNode>()
53 uint32_t AttrRegistryIndex()
const {
return index_; }
55 ffi::String AttrRegistryName()
const {
return name; }
59 template <
typename,
typename>
77 TVM_DLL
static ffi::Optional<Target>
Get(
const ffi::String& target_tag_name);
82 TVM_DLL
static ffi::Map<ffi::String, Target>
ListTags();
88 TVM_DLL
static ffi::Optional<ffi::Map<ffi::String, Any>>
GetConfig(
89 const ffi::String& target_tag_name);
97 TVM_DLL
static Target AddTag(ffi::String name, ffi::Map<ffi::String, Any> config,
bool override);
135 tag_->index_ = reg_index;
137 template <
typename,
typename>
143 tag_->
config = std::move(config);
148 tag_->
config.Set(key, value);
153 if (tag_->
name.empty()) {
159 #define TVM_TARGET_TAG_REGISTER_VAR_DEF \
160 static TVM_ATTRIBUTE_UNUSED ::tvm::TargetTagRegEntry& __make_##TargetTag
167 #define TVM_REGISTER_TARGET_TAG(TargetTagName) \
168 TVM_STR_CONCAT(TVM_TARGET_TAG_REGISTER_VAR_DEF, __COUNTER__) = \
169 ::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:36
static void RegisterReflection()
Definition: tag.h:43
ffi::String name
Name of the target.
Definition: tag.h:39
ffi::Map< ffi::String, Any > config
Config map to generate the target.
Definition: tag.h:41
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:142
TargetTagRegEntry & with_config(ffi::String key, Any value)
Add a key-value pair to the config dict.
Definition: tag.h:147
TargetTagRegEntry & set_name()
Set name of the TargetTag to be the same as registry if it is empty.
Definition: tag.h:152
static TargetTagRegEntry & RegisterOrGet(const ffi::String &target_tag_name)
Register or get a new entry.
Managed reference class to TargetTagNode.
Definition: tag.h:70
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.
static ffi::Optional< ffi::Map< ffi::String, Any > > GetConfig(const ffi::String &target_tag_name)
Retrieve the raw config dict for a target tag.
Managed reference class to TargetNode.
Definition: target.h:135
Definition: repr_printer.h:91
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition: analyzer.h:37
Compilation target object.