tvm
Public Member Functions | Static Public Member Functions | Friends | List of all members
tvm::VirtualDevice Class Reference

Managed reference class to VirtualDeviceNode. More...

#include <virtual_device.h>

Inheritance diagram for tvm::VirtualDevice:
Collaboration diagram for tvm::VirtualDevice:

Public Member Functions

 VirtualDevice (int device_type_int=kInvalidDeviceType, int virtual_device_id=-1, Target target={}, MemoryScope memory_scope={})
 Construct a virtual device. More...
 
 TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS (VirtualDevice, ObjectRef, VirtualDeviceNode)
 
- 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 Objectget () const
 
const Objectoperator-> () const
 
bool unique () const
 
int use_count () const
 
template<typename ObjectType , typename = std::enable_if_t<std::is_base_of_v<Object, ObjectType>>>
const ObjectType * as () const
 Try to downcast the internal Object to a raw pointer of a corresponding type. More...
 
template<typename ObjectRefType , typename = std::enable_if_t<std::is_base_of_v<ObjectRef, ObjectRefType>>>
Optional< ObjectRefType > as () const
 Try to downcast the ObjectRef to a Optional<T> of the requested type. More...
 

Static Public Member Functions

static VirtualDevice FullyUnconstrained ()
 Returns the unique fully unconstrained VirtualDevice. More...
 
static VirtualDevice ForDeviceType (DLDeviceType device_type, int virtual_device_id=-1)
 Returns the VirtualDevice for device_type and (if not -1) virtual_device_id. The target and memory scope will be unconstrained. More...
 
static VirtualDevice ForDeviceType (int device_type, int virtual_device_id=-1)
 
static VirtualDevice ForDeviceType (const Integer &device_type, int virtual_device_id=-1)
 
static VirtualDevice ForDevice (const Device &device)
 Returns the VirtualDevice for device. More...
 
static VirtualDevice ForDeviceAndTarget (const Device &device, Target target)
 Returns the VirtualDevice for device and target. More...
 
static VirtualDevice ForTarget (Target target)
 Returns the VirtualDevice for target. More...
 
static VirtualDevice ForMemoryScope (MemoryScope memory_scope)
 Returns the VirtualDevice for memory_scope alone. More...
 
static VirtualDevice ForDeviceTargetAndMemoryScope (const Device &device, Target target, MemoryScope memory_scope)
 Returns the VirtualDevice for device, target and memory_scope. More...
 
static Optional< VirtualDeviceJoin (const VirtualDevice &lhs, const VirtualDevice &rhs)
 Returns the 'join' of lhs and rhs. The result will agree pointwise with lhs and rhs on all their constrained fields. Returns the null optional if no such join exists, ie there's disagreement on at least one constrained field. More...
 
static VirtualDevice Default (const VirtualDevice &lhs, const VirtualDevice &rhs)
 Returns the 'default' of lhs and rhs. The result will be lhs, except any unconstrained fields in lhs will take their value from rhs. Always well-defined. More...
 

Friends

class VirtualDeviceCache
 

Additional Inherited Members

- Public Types inherited from tvm::runtime::ObjectRef
using ContainerType = Object
 type indicate the container type. More...
 
- Static Public Attributes inherited from tvm::runtime::ObjectRef
static constexpr bool _type_is_nullable = true
 
- Protected Member Functions inherited from tvm::runtime::ObjectRef
Objectget_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< Objectdata_
 Internal pointer that backs the reference. More...
 

Detailed Description

Managed reference class to VirtualDeviceNode.

Constructor & Destructor Documentation

◆ VirtualDevice()

tvm::VirtualDevice::VirtualDevice ( int  device_type_int = kInvalidDeviceType,
int  virtual_device_id = -1,
Target  target = {},
MemoryScope  memory_scope = {} 
)
explicit

Construct a virtual device.

Parameters
device_type_intThe device type for the virtual device, or kInvalidDeviceType if unconstrained. If target is defined then must match its target->GetTargetDeviceType().
virtual_device_idThe device id for the virtual device, or -1 if unconstrained.
targetThe target describing how to compile for the virtual device, or null if unconstrained.
memory_scopeThe memory scope w.r.t. the virtual device which holds data, or "" if unconstrained.

Member Function Documentation

◆ Default()

static VirtualDevice tvm::VirtualDevice::Default ( const VirtualDevice lhs,
const VirtualDevice rhs 
)
static

Returns the 'default' of lhs and rhs. The result will be lhs, except any unconstrained fields in lhs will take their value from rhs. Always well-defined.

◆ ForDevice()

static VirtualDevice tvm::VirtualDevice::ForDevice ( const Device device)
inlinestatic

Returns the VirtualDevice for device.

◆ ForDeviceAndTarget()

static VirtualDevice tvm::VirtualDevice::ForDeviceAndTarget ( const Device device,
Target  target 
)
inlinestatic

Returns the VirtualDevice for device and target.

◆ ForDeviceTargetAndMemoryScope()

static VirtualDevice tvm::VirtualDevice::ForDeviceTargetAndMemoryScope ( const Device device,
Target  target,
MemoryScope  memory_scope 
)
inlinestatic

Returns the VirtualDevice for device, target and memory_scope.

◆ ForDeviceType() [1/3]

static VirtualDevice tvm::VirtualDevice::ForDeviceType ( const Integer device_type,
int  virtual_device_id = -1 
)
inlinestatic

◆ ForDeviceType() [2/3]

static VirtualDevice tvm::VirtualDevice::ForDeviceType ( DLDeviceType  device_type,
int  virtual_device_id = -1 
)
inlinestatic

Returns the VirtualDevice for device_type and (if not -1) virtual_device_id. The target and memory scope will be unconstrained.

◆ ForDeviceType() [3/3]

static VirtualDevice tvm::VirtualDevice::ForDeviceType ( int  device_type,
int  virtual_device_id = -1 
)
inlinestatic

◆ ForMemoryScope()

static VirtualDevice tvm::VirtualDevice::ForMemoryScope ( MemoryScope  memory_scope)
inlinestatic

Returns the VirtualDevice for memory_scope alone.

◆ ForTarget()

static VirtualDevice tvm::VirtualDevice::ForTarget ( Target  target)
inlinestatic

Returns the VirtualDevice for target.

◆ FullyUnconstrained()

static VirtualDevice tvm::VirtualDevice::FullyUnconstrained ( )
static

Returns the unique fully unconstrained VirtualDevice.

◆ Join()

static Optional<VirtualDevice> tvm::VirtualDevice::Join ( const VirtualDevice lhs,
const VirtualDevice rhs 
)
static

Returns the 'join' of lhs and rhs. The result will agree pointwise with lhs and rhs on all their constrained fields. Returns the null optional if no such join exists, ie there's disagreement on at least one constrained field.

◆ TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS()

tvm::VirtualDevice::TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS ( VirtualDevice  ,
ObjectRef  ,
VirtualDeviceNode   
)

Friends And Related Function Documentation

◆ VirtualDeviceCache

friend class VirtualDeviceCache
friend

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