24#ifndef TVM_TARGET_TARGET_KIND_H_
25#define TVM_TARGET_TARGET_KIND_H_
27#include <tvm/ffi/container/map.h>
28#include <tvm/ffi/function.h>
29#include <tvm/ffi/reflection/registry.h>
47 ffi::TypedFunction<ffi::Map<ffi::String, ffi::Any>(ffi::Map<ffi::String, ffi::Any>)>;
64 namespace refl = tvm::ffi::reflection;
65 refl::ObjectDef<TargetKindObj>()
68 refl::AttachFieldFlag::SEqHashIgnore())
70 refl::AttachFieldFlag::SEqHashIgnore());
90 explicit TargetKind(ffi::ObjectPtr<TargetKindObj> data) : ffi::ObjectRef(data) {
91 TVM_FFI_ICHECK(data !=
nullptr);
98 TVM_TIRX_DLL static ffi::Optional<TargetKind>
Get(
const ffi::String& target_kind_name);
109static constexpr const char* kTvmRuntimeCpp =
"c++";
112static constexpr const char* kTvmRuntimeCrt =
"c";
150 ffi::Map<ffi::String, TargetKind> kinds_;
211 template <
typename ValueType,
typename... Traits>
213 kind_->schema_.
def_option<ValueType>(key, std::forward<Traits>(traits)...);
Dynamic config schema for map-like options.
Definition config_schema.h:52
void set_canonicalizer(Canonicalizer f)
Set whole-object canonicalizer.
Definition config_schema.h:97
ConfigSchema & def_option(const ffi::String &key, Traits &&... traits)
Declare a typed option.
Definition config_schema.h:86
Temporary fluent builder for registering a target kind.
Definition target_kind.h:167
TargetKindDef & set_default_keys(std::vector< ffi::String > keys)
Set default target keys.
Definition target_kind.h:189
TargetKindDef & def_option(const ffi::String &key, Traits &&... traits)
Declare a typed target option in the kind's ConfigSchema.
Definition target_kind.h:212
TargetKindDef & set_target_canonicalizer(FTargetCanonicalizer canonicalizer)
Set the canonicalizer used when constructing targets of this kind.
Definition target_kind.h:198
TargetKindDef & set_default_device_type(int device_type)
Set the default DLPack device type.
Definition target_kind.h:180
TargetKindDef(const ffi::String &name)
Register or retrieve the canonical kind with this name.
Definition target_kind.h:173
Target kind, specifies the kind of the target.
Definition target_kind.h:52
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition target_kind.h:73
int default_device_type
Device type of target kind.
Definition target_kind.h:57
ffi::String name
Name of the target kind.
Definition target_kind.h:55
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("target.TargetKind", TargetKindObj, ffi::Object)
friend class TargetInternal
Definition target_kind.h:81
static void RegisterReflection()
Definition target_kind.h:63
ffi::Array< ffi::String > default_keys
Default keys of the target.
Definition target_kind.h:59
FTargetCanonicalizer target_canonicalizer
Function used to canonicalize a JSON target during creation.
Definition target_kind.h:61
Process-wide registry of canonical target kinds, keyed by name.
Definition target_kind.h:117
TVM_TIRX_DLL ffi::Array< ffi::String > ListTargetKinds()
List registered kind names.
TVM_TIRX_DLL ffi::Map< ffi::String, ffi::String > ListTargetKindOptions(const TargetKind &kind)
List declared option names and types for a kind.
TVM_TIRX_DLL ffi::Optional< TargetKind > Get(const ffi::String &name)
Look up a registered kind.
static TVM_TIRX_DLL TargetKindRegistry * Global()
Access the process-wide registry.
TVM_TIRX_DLL TargetKind RegisterOrGet(const ffi::String &name)
Register a name or return its existing canonical kind.
Managed reference class to TargetKindObj.
Definition target_kind.h:88
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(TargetKind, ffi::ObjectRef, TargetKindObj)
static TVM_TIRX_DLL ffi::Optional< TargetKind > Get(const ffi::String &target_kind_name)
Retrieve the TargetKind given its name.
TargetKind(ffi::ObjectPtr< TargetKindObj > data)
Definition target_kind.h:90
friend class TargetInternal
Definition target_kind.h:105
TargetKindObj * operator->()
Mutable access to the container class
Definition target_kind.h:100
Minimal schema for dynamic config canonicalization and validation.
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition attr.h:23
ffi::TypedFunction< ffi::Map< ffi::String, ffi::Any >(ffi::Map< ffi::String, ffi::Any >)> FTargetCanonicalizer
Target canonicalizer applied on instantiation of a given TargetKind.
Definition target_kind.h:47
#define TVM_TIRX_DLL
Definition base.h:83