Compilation target.
More...
#include <target.h>
|
const std::string & | str () const |
| The raw string representation of the target. More...
|
|
Map< String, ffi::Any > | Export () const |
|
Optional< Target > | GetHost () const |
|
int | GetTargetDeviceType () const |
|
bool | HasKey (const std::string &query_key) const |
| Check if the target contains a key. More...
|
|
String | ToDebugString () const |
| Returns a human readable representation of Target which includes all fields, especially the host. Useful for diagnostic messages and debugging. More...
|
|
template<typename TObjectRef > |
Optional< TObjectRef > | GetAttr (const std::string &attr_key, Optional< TObjectRef > default_value=Optional< TObjectRef >(std::nullopt)) const |
| Get an entry from attrs of the target. More...
|
|
template<typename TObjectRef > |
Optional< TObjectRef > | GetAttr (const std::string &attr_key, TObjectRef default_value) const |
| Get an entry from attrs of the target. More...
|
|
template<typename TObjectRef > |
Optional< TObjectRef > | GetFeature (const std::string &feature_key, Optional< TObjectRef > default_value=std::nullopt) const |
| Get a Target feature. More...
|
|
template<typename TObjectRef > |
Optional< TObjectRef > | GetFeature (const std::string &attr_key, TObjectRef default_value) const |
|
std::vector< std::string > | GetKeys () const |
| Get the keys for this target as a vector of string. More...
|
|
std::unordered_set< std::string > | GetLibs () const |
| Get the keys for this target as an unordered_set of string. More...
|
|
| TVM_DECLARE_FINAL_OBJECT_INFO (TargetNode, Object) |
|
Compilation target.
- See also
- Target
◆ Export()
Map<String, ffi::Any> tvm::TargetNode::Export |
( |
| ) |
const |
- Returns
- Export target to JSON-like configuration
◆ GetAttr() [1/2]
template<typename TObjectRef >
Optional<TObjectRef> tvm::TargetNode::GetAttr |
( |
const std::string & |
attr_key, |
|
|
Optional< TObjectRef > |
default_value = Optional<TObjectRef>(std::nullopt) |
|
) |
| const |
|
inline |
Get an entry from attrs of the target.
- Template Parameters
-
TObjectRef | Type of the attribute |
- Parameters
-
attr_key | The name of the attribute key |
default_value | The 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 >
Optional<TObjectRef> tvm::TargetNode::GetAttr |
( |
const std::string & |
attr_key, |
|
|
TObjectRef |
default_value |
|
) |
| const |
|
inline |
Get an entry from attrs of the target.
- Template Parameters
-
TObjectRef | Type of the attribute |
- Parameters
-
attr_key | The name of the attribute key |
default_value | The value returned if the key is not present |
- Returns
- An optional, std::nullopt if not found, otherwise the value found
◆ GetFeature() [1/2]
template<typename TObjectRef >
Optional<TObjectRef> tvm::TargetNode::GetFeature |
( |
const std::string & |
attr_key, |
|
|
TObjectRef |
default_value |
|
) |
| const |
|
inline |
◆ GetFeature() [2/2]
template<typename TObjectRef >
Optional<TObjectRef> tvm::TargetNode::GetFeature |
( |
const std::string & |
feature_key, |
|
|
Optional< TObjectRef > |
default_value = std::nullopt |
|
) |
| const |
|
inline |
Get a Target feature.
- Parameters
-
feature_key | The feature key. |
default_value | The default value if the key does not exist, defaults to nullptr. |
- Returns
- The result
- Template Parameters
-
TOBjectRef | the expected object type. |
- Exceptions
-
Error | if the key exists but the value does not match TObjectRef |
void GetTargetFeature(const Target& target) {
Bool has_feature = target->GetFeature<Bool>("has_feature", false).value();
}
◆ GetHost()
Optional<Target> tvm::TargetNode::GetHost |
( |
| ) |
const |
- Returns
- The Optional<Target> typed target host of the TargetNode
◆ GetKeys()
std::vector<std::string> tvm::TargetNode::GetKeys |
( |
| ) |
const |
Get the keys for this target as a vector of string.
◆ GetLibs()
std::unordered_set<std::string> tvm::TargetNode::GetLibs |
( |
| ) |
const |
Get the keys for this target as an unordered_set of string.
◆ GetTargetDeviceType()
int tvm::TargetNode::GetTargetDeviceType |
( |
| ) |
const |
- Returns
- The device type for this target
◆ HasKey()
bool tvm::TargetNode::HasKey |
( |
const std::string & |
query_key | ) |
const |
Check if the target contains a key.
- Parameters
-
query_key | The string name of the key to be checked |
- Returns
- True if the target's
TargetNode::keys
contains the specified key, False otherwise.
◆ RegisterReflection()
static void tvm::TargetNode::RegisterReflection |
( |
| ) |
|
|
inlinestatic |
◆ str()
const std::string& tvm::TargetNode::str |
( |
| ) |
const |
The raw string representation of the target.
- Returns
- the full device string to pass to codegen::Build
- Note
- It will be deprecated after the Target RFC is fully landed.
◆ ToDebugString()
String tvm::TargetNode::ToDebugString |
( |
| ) |
const |
Returns a human readable representation of Target
which includes all fields, especially the host. Useful for diagnostic messages and debugging.
TODO(mbs): The ReprPrinter version should perhaps switch to this form, however currently code depends on str() and << being the same.
◆ TVM_DECLARE_FINAL_OBJECT_INFO()
tvm::TargetNode::TVM_DECLARE_FINAL_OBJECT_INFO |
( |
TargetNode |
, |
|
|
Object |
|
|
) |
| |
◆ TargetInternal
friend class TargetInternal |
|
friend |
◆ _type_key
constexpr const char* tvm::TargetNode::_type_key = "target.Target" |
|
staticconstexpr |
◆ _type_s_eq_hash_kind
constexpr TVMFFISEqHashKind tvm::TargetNode::_type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode |
|
staticconstexpr |
◆ attrs
Map<String, Any> tvm::TargetNode::attrs |
Collection of attributes.
◆ features
Map<String, Any> tvm::TargetNode::features |
◆ host
Optional<ObjectRef> tvm::TargetNode::host |
◆ keys
Array<String> tvm::TargetNode::keys |
◆ kind
The kind of the target device.
◆ tag
String tvm::TargetNode::tag |
Tag of the target, can be empty.
The documentation for this class was generated from the following file: