|
tvm
|
Generic function that can be specialized on a per-target basis. More...
#include <generic_func.h>
Public Types | |
| using | ContainerType = GenericFuncNode |
Public Types inherited from tvm::runtime::ObjectRef | |
| using | ContainerType = Object |
| type indicate the container type. More... | |
Public Member Functions | |
| GenericFunc () | |
| GenericFunc (ObjectPtr< Object > n) | |
| GenericFunc & | set_default (const runtime::PackedFunc value, bool allow_override=false) |
| Set the default function implementaiton. More... | |
| GenericFunc & | register_func (const std::vector< std::string > &tags, const runtime::PackedFunc value, bool allow_override=false) |
| Register a specialized function. More... | |
| template<typename... Args> | |
| runtime::TVMRetValue | operator() (Args &&... args) const |
| Call generic function by directly passing in unpacked format. More... | |
| void | CallPacked (runtime::TVMArgs args, runtime::TVMRetValue *ret) const |
| Invoke the relevant function for the current target context, set by set_target_context. Arguments are passed in packed format. More... | |
| PackedFunc | GetPacked () const |
| Get the packed function specified for the current target context. More... | |
| GenericFuncNode * | operator-> () |
| access the internal node container More... | |
Public Member Functions inherited from tvm::runtime::ObjectRef | |
| ObjectRef ()=default | |
| default constructor More... | |
| ObjectRef (ObjectPtr< Object > data) | |
| Constructor from existing object ptr. More... | |
| bool | same_as (const ObjectRef &other) const |
| Comparator. More... | |
| bool | operator== (const ObjectRef &other) const |
| Comparator. More... | |
| bool | operator!= (const ObjectRef &other) const |
| Comparator. More... | |
| bool | operator< (const ObjectRef &other) const |
| Comparator. More... | |
| bool | defined () const |
| const Object * | get () const |
| const Object * | operator-> () const |
| bool | unique () const |
| int | use_count () const |
| template<typename ObjectType > | |
| const ObjectType * | as () const |
| Try to downcast the internal Object to a raw pointer of a corresponding type. More... | |
Static Public Member Functions | |
| static GenericFunc | Get (const std::string &name) |
| Find or register the GenericFunc instance corresponding to the give name. More... | |
| static void | RegisterGenericFunc (GenericFunc func, const std::string &name) |
| Add a GenericFunc instance to the registry. More... | |
Friends | |
| struct | Manager |
Additional Inherited Members | |
Static Public Attributes inherited from tvm::runtime::ObjectRef | |
| static constexpr bool | _type_is_nullable = true |
Protected Member Functions inherited from tvm::runtime::ObjectRef | |
| Object * | get_mutable () const |
Static Protected Member Functions inherited from tvm::runtime::ObjectRef | |
| template<typename T > | |
| static T | DowncastNoCheck (ObjectRef ref) |
| Internal helper function downcast a ref without check. More... | |
| static void | FFIClearAfterMove (ObjectRef *ref) |
| Clear the object ref data field without DecRef after we successfully moved the field. More... | |
| template<typename ObjectType > | |
| static ObjectPtr< ObjectType > | GetDataPtr (const ObjectRef &ref) |
| Internal helper function get data_ as ObjectPtr of ObjectType. More... | |
Protected Attributes inherited from tvm::runtime::ObjectRef | |
| ObjectPtr< Object > | data_ |
| Internal pointer that backs the reference. More... | |
Generic function that can be specialized on a per-target basis.
|
inline |
| void tvm::GenericFunc::CallPacked | ( | runtime::TVMArgs | args, |
| runtime::TVMRetValue * | ret | ||
| ) | const |
Invoke the relevant function for the current target context, set by set_target_context. Arguments are passed in packed format.
| args | The arguments to pass to the function. |
| ret | The return value |
|
static |
Find or register the GenericFunc instance corresponding to the give name.
| name | The name of the registered GenericFunc |
| PackedFunc tvm::GenericFunc::GetPacked | ( | ) | const |
Get the packed function specified for the current target context.
|
inline |
Call generic function by directly passing in unpacked format.
| args | Arguments to be passed. |
| Args | arguments to be passed. |
|
inline |
access the internal node container
| GenericFunc& tvm::GenericFunc::register_func | ( | const std::vector< std::string > & | tags, |
| const runtime::PackedFunc | value, | ||
| bool | allow_override = false |
||
| ) |
Register a specialized function.
| tags | The tags for this specialization |
| value | The specialized function |
| allow_override | If true, this call may override previously registered tags. If false, an error will be logged if the call would override previously registered tags. |
|
static |
Add a GenericFunc instance to the registry.
| func | The GenericFunc instance |
| name | The name of the registered GenericFunc |
| GenericFunc& tvm::GenericFunc::set_default | ( | const runtime::PackedFunc | value, |
| bool | allow_override = false |
||
| ) |
Set the default function implementaiton.
| value | The default function |
| allow_override | If true, this call may override a previously registered function. If false, an error will be logged if the call would override a previously registered function. |
|
friend |
1.8.13