tvm
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
tvm::TargetObj Class Reference

Compilation target. More...

#include <target.h>

Inheritance diagram for tvm::TargetObj:
Collaboration diagram for tvm::TargetObj:

Public Member Functions

 TargetObj (TargetKind kind)
 
 TargetObj (ffi::UnsafeInit tag)
 
TVM_TIRX_DLL const std::string & str () const
 The JSON string representation of the target.
 
TVM_TIRX_DLL ffi::Map< ffi::String, ffi::Any > ToConfig () const
 
TVM_TIRX_DLL ffi::Optional< Target > GetHost () const
 
TVM_TIRX_DLL int GetTargetDeviceType () const
 
TVM_TIRX_DLL bool HasKey (const std::string &query_key) const
 Check if the target contains a key.
 
template<typename TObjectRef >
ffi::Optional< TObjectRef > GetAttr (const std::string &attr_key, ffi::Optional< TObjectRef > default_value=ffi::Optional< TObjectRef >(std::nullopt)) const
 Get an entry from attrs of the target.
 
template<typename TObjectRef >
ffi::Optional< TObjectRef > GetAttr (const std::string &attr_key, TObjectRef default_value) const
 Get an entry from attrs of the target.
 
 TVM_FFI_DECLARE_OBJECT_INFO_FINAL ("target.Target", TargetObj, ffi::Object)
 

Static Public Member Functions

static void RegisterReflection ()
 

Public Attributes

TargetKind kind
 The kind of the target device.
 
ffi::Optional< ffi::ObjectRef > host
 Target host information, must be Target type.
 
ffi::String tag
 Tag of the target, can be empty.
 
ffi::Array< ffi::String > keys
 Keys for this target.
 
ffi::Map< ffi::String, Any > attrs
 Collection of attributes (includes feature.* keys set by canonicalizer)
 

Static Public Attributes

static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode
 

Friends

class TargetInternal
 

Detailed Description

Compilation target.

See also
Target

Constructor & Destructor Documentation

◆ TargetObj() [1/2]

tvm::TargetObj::TargetObj ( TargetKind  kind)
inlineexplicit

◆ TargetObj() [2/2]

tvm::TargetObj::TargetObj ( ffi::UnsafeInit  tag)
inlineexplicit

Member Function Documentation

◆ GetAttr() [1/2]

template<typename TObjectRef >
ffi::Optional< TObjectRef > tvm::TargetObj::GetAttr ( const std::string &  attr_key,
ffi::Optional< TObjectRef >  default_value = ffi::Optional<TObjectRef>(std::nullopt) 
) const
inline

Get an entry from attrs of the target.

Template Parameters
TObjectRefType of the attribute
Parameters
attr_keyThe name of the attribute key
default_valueThe value returned if the key is not present
Returns
An optional, std::nullopt if not found, otherwise the value found

◆ GetAttr() [2/2]

template<typename TObjectRef >
ffi::Optional< TObjectRef > tvm::TargetObj::GetAttr ( const std::string &  attr_key,
TObjectRef  default_value 
) const
inline

Get an entry from attrs of the target.

Template Parameters
TObjectRefType of the attribute
Parameters
attr_keyThe name of the attribute key
default_valueThe value returned if the key is not present
Returns
An optional, std::nullopt if not found, otherwise the value found

◆ GetHost()

TVM_TIRX_DLL ffi::Optional< Target > tvm::TargetObj::GetHost ( ) const
Returns
The ffi::Optional<Target> typed target host of the TargetObj

◆ GetTargetDeviceType()

TVM_TIRX_DLL int tvm::TargetObj::GetTargetDeviceType ( ) const
Returns
The device type for this target

◆ HasKey()

TVM_TIRX_DLL bool tvm::TargetObj::HasKey ( const std::string &  query_key) const

Check if the target contains a key.

Parameters
query_keyThe string name of the key to be checked
Returns
True if the target's TargetObj::keys contains the specified key, False otherwise.

◆ RegisterReflection()

static void tvm::TargetObj::RegisterReflection ( )
inlinestatic

◆ str()

TVM_TIRX_DLL const std::string & tvm::TargetObj::str ( ) const

The JSON string representation of the target.

Returns
JSON string of the target configuration (e.g. {"kind": "llvm", "mcpu": "cortex-a53"})

◆ ToConfig()

TVM_TIRX_DLL ffi::Map< ffi::String, ffi::Any > tvm::TargetObj::ToConfig ( ) const
Returns
Export target to JSON-like configuration

◆ TVM_FFI_DECLARE_OBJECT_INFO_FINAL()

tvm::TargetObj::TVM_FFI_DECLARE_OBJECT_INFO_FINAL ( "target.Target"  ,
TargetObj  ,
ffi::Object   
)

Friends And Related Symbol Documentation

◆ TargetInternal

friend class TargetInternal
friend

Member Data Documentation

◆ _type_s_eq_hash_kind

constexpr TVMFFISEqHashKind tvm::TargetObj::_type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode
staticconstexpr

◆ attrs

ffi::Map<ffi::String, Any> tvm::TargetObj::attrs

Collection of attributes (includes feature.* keys set by canonicalizer)

◆ host

ffi::Optional<ffi::ObjectRef> tvm::TargetObj::host

Target host information, must be Target type.

◆ keys

ffi::Array<ffi::String> tvm::TargetObj::keys

Keys for this target.

◆ kind

TargetKind tvm::TargetObj::kind

The kind of the target device.

◆ tag

ffi::String tvm::TargetObj::tag

Tag of the target, can be empty.


The documentation for this class was generated from the following file: