tvm
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
tvm::runtime::MemoryScope Class Reference

A registered memory space, independent of backend allocation policy. More...

#include <memory_scope.h>

Inheritance diagram for tvm::runtime::MemoryScope:
Collaboration diagram for tvm::runtime::MemoryScope:

Public Member Functions

 MemoryScope ()
 Default to the global memory space.
 
 MemoryScope (const ffi::String &name)
 Look up a registered name; never implicitly register it.
 
const ffi::String & name () const
 Return the canonical spelling.
 
bool operator== (const MemoryScope &other) const
 
bool operator!= (const MemoryScope &other) const
 
 TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE (MemoryScope, ffi::Enum, MemoryScopeObj)
 

Static Public Member Functions

static bool IsDefined (const ffi::String &name)
 Test whether a name is registered, without initializing memory scopes.
 
static TVM_RUNTIME_DLL MemoryScope Get (const ffi::String &name)
 Look up a registered name. Unknown names raise ValueError.
 
static MemoryScope Register (const ffi::String &name)
 Register a new name. Duplicate names raise ValueError.
 
static TVM_RUNTIME_DLL const MemoryScope & Global ()
 Return the canonical global singleton.
 

Detailed Description

A registered memory space, independent of backend allocation policy.

Register extensions with ffi::reflection::EnumDef<MemoryScopeObj>("my.scope"). Registration order has no semantic meaning. A backend must explicitly support a scope before it can allocate storage in that space.

Constructor & Destructor Documentation

◆ MemoryScope() [1/2]

tvm::runtime::MemoryScope::MemoryScope ( )
inline

Default to the global memory space.

◆ MemoryScope() [2/2]

tvm::runtime::MemoryScope::MemoryScope ( const ffi::String &  name)
inlineexplicit

Look up a registered name; never implicitly register it.

Member Function Documentation

◆ Get()

static TVM_RUNTIME_DLL MemoryScope tvm::runtime::MemoryScope::Get ( const ffi::String &  name)
static

Look up a registered name. Unknown names raise ValueError.

◆ Global()

static TVM_RUNTIME_DLL const MemoryScope & tvm::runtime::MemoryScope::Global ( )
static

Return the canonical global singleton.

◆ IsDefined()

static bool tvm::runtime::MemoryScope::IsDefined ( const ffi::String &  name)
inlinestatic

Test whether a name is registered, without initializing memory scopes.

◆ name()

const ffi::String & tvm::runtime::MemoryScope::name ( ) const
inline

Return the canonical spelling.

◆ operator!=()

bool tvm::runtime::MemoryScope::operator!= ( const MemoryScope &  other) const
inline

◆ operator==()

bool tvm::runtime::MemoryScope::operator== ( const MemoryScope &  other) const
inline

◆ Register()

static MemoryScope tvm::runtime::MemoryScope::Register ( const ffi::String &  name)
inlinestatic

Register a new name. Duplicate names raise ValueError.

◆ TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE()

tvm::runtime::MemoryScope::TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE ( MemoryScope  ,
ffi::Enum  ,
MemoryScopeObj   
)

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