A Disco interactive session. It allows users to interact with the Disco command queue with various PackedFunc calling convention.
More...
#include <session.h>
|
virtual | ~SessionObj ()=default |
|
template<typename... Args> |
DRef TVM_ALWAYS_INLINE | CallPacked (const DRef &func, Args &&... args) |
| Call a PackedFunc on workers providing variadic arguments. More...
|
|
virtual DRef | CallWithPacked (const TVMArgs &args)=0 |
| Call packed function on each worker using a packed sequence. The calling convention: The first element must be DiscoAction::kCallPacked, The second element must be 0, which will later be updated by the session to return reg_id The thirtd element is the function to be called. More...
|
|
virtual int64_t | GetNumWorkers ()=0 |
| Get the number of workers in the session. More...
|
|
virtual DRef | GetGlobalFunc (const std::string &name)=0 |
| Get a global functions on workers. More...
|
|
virtual void | CopyFromWorker0 (const NDArray &host_array, const DRef &remote_array)=0 |
| Copy an NDArray from worker-0 to the controler-side NDArray. More...
|
|
virtual void | CopyToWorker0 (const NDArray &host_array, const DRef &remote_array)=0 |
| Copy the controler-side NDArray to worker-0. More...
|
|
virtual void | SyncWorker (int worker_id)=0 |
| Synchrnoize the controler with a worker, and it will wait until worker finishes executing this instruction. More...
|
|
virtual void | Shutdown ()=0 |
| Signal all the workers to shutdown. More...
|
|
virtual void | InitCCL (String ccl, IntTuple device_ids)=0 |
| Initialize the data plane between workers. More...
|
|
virtual TVMRetValue | DebugGetFromRemote (int64_t reg_id, int worker_id)=0 |
| Get the value of a register from a remote worker. More...
|
|
virtual void | DebugSetRegister (int64_t reg_id, TVMArgValue value, int worker_id)=0 |
| Set the value of a register on a remote worker. More...
|
|
| TVM_DECLARE_BASE_OBJECT_INFO (SessionObj, Object) |
|
template<typename... Args> |
DRef | CallPacked (const DRef &func, Args &&... args) |
|
uint32_t | type_index () const |
|
std::string | GetTypeKey () const |
|
size_t | GetTypeKeyHash () const |
|
template<typename TargetType > |
bool | IsInstance () const |
|
bool | unique () const |
|
| Object () |
|
| Object (const Object &other) |
|
| Object (Object &&other) |
|
Object & | operator= (const Object &other) |
|
Object & | operator= (Object &&other) |
|
|
virtual void | DeallocReg (int reg_id)=0 |
| Deallocate a register id, kill it on all workers, and append it to free_regs_ . More...
|
|
void | IncRef () |
| developer function, increases reference counter. More...
|
|
void | DecRef () |
| developer function, decrease reference counter. More...
|
|
A Disco interactive session. It allows users to interact with the Disco command queue with various PackedFunc calling convention.
◆ ~SessionObj()
virtual tvm::runtime::SessionObj::~SessionObj |
( |
| ) |
|
|
virtualdefault |
◆ CallPacked() [1/2]
template<typename... Args>
DRef TVM_ALWAYS_INLINE tvm::runtime::SessionObj::CallPacked |
( |
const DRef & |
func, |
|
|
Args &&... |
args |
|
) |
| |
Call a PackedFunc on workers providing variadic arguments.
- Template Parameters
-
Args | In the variadic arguments, the supported types include:
|
- Parameters
-
func | The function to be called. |
args | The variadic arguments. |
- Returns
- The return value of function call
◆ CallPacked() [2/2]
template<typename... Args>
DRef tvm::runtime::SessionObj::CallPacked |
( |
const DRef & |
func, |
|
|
Args &&... |
args |
|
) |
| |
◆ CallWithPacked()
virtual DRef tvm::runtime::SessionObj::CallWithPacked |
( |
const TVMArgs & |
args | ) |
|
|
pure virtual |
Call packed function on each worker using a packed sequence. The calling convention: The first element must be DiscoAction::kCallPacked, The second element must be 0, which will later be updated by the session to return reg_id The thirtd element is the function to be called.
◆ CopyFromWorker0()
virtual void tvm::runtime::SessionObj::CopyFromWorker0 |
( |
const NDArray & |
host_array, |
|
|
const DRef & |
remote_array |
|
) |
| |
|
pure virtual |
Copy an NDArray from worker-0 to the controler-side NDArray.
- Parameters
-
host_array | The array to be copied to worker-0 |
remote_array | The NDArray on worker-0 |
◆ CopyToWorker0()
virtual void tvm::runtime::SessionObj::CopyToWorker0 |
( |
const NDArray & |
host_array, |
|
|
const DRef & |
remote_array |
|
) |
| |
|
pure virtual |
Copy the controler-side NDArray to worker-0.
- Parameters
-
host_array | The array to be copied to worker-0 |
remote_array | The NDArray on worker-0 |
◆ DeallocReg()
virtual void tvm::runtime::SessionObj::DeallocReg |
( |
int |
reg_id | ) |
|
|
protectedpure virtual |
Deallocate a register id, kill it on all workers, and append it to free_regs_
.
◆ DebugGetFromRemote()
virtual TVMRetValue tvm::runtime::SessionObj::DebugGetFromRemote |
( |
int64_t |
reg_id, |
|
|
int |
worker_id |
|
) |
| |
|
pure virtual |
Get the value of a register from a remote worker.
- Parameters
-
reg_id | The id of the register to be fetched. |
worker_id | The id of the worker to be fetched from. |
- Returns
- The value of the register.
◆ DebugSetRegister()
virtual void tvm::runtime::SessionObj::DebugSetRegister |
( |
int64_t |
reg_id, |
|
|
TVMArgValue |
value, |
|
|
int |
worker_id |
|
) |
| |
|
pure virtual |
Set the value of a register on a remote worker.
- Parameters
-
reg_id | The id of the register to be set. |
value | The value to be set. |
worker_id | The id of the worker to be set. |
◆ GetGlobalFunc()
virtual DRef tvm::runtime::SessionObj::GetGlobalFunc |
( |
const std::string & |
name | ) |
|
|
pure virtual |
Get a global functions on workers.
◆ GetNumWorkers()
virtual int64_t tvm::runtime::SessionObj::GetNumWorkers |
( |
| ) |
|
|
pure virtual |
Get the number of workers in the session.
◆ InitCCL()
virtual void tvm::runtime::SessionObj::InitCCL |
( |
String |
ccl, |
|
|
IntTuple |
device_ids |
|
) |
| |
|
pure virtual |
Initialize the data plane between workers.
- Parameters
-
ccl | The name of the communication backend, e.g., nccl, rccl, mpi. |
device_ids | The device ids of the workers. |
◆ Shutdown()
virtual void tvm::runtime::SessionObj::Shutdown |
( |
| ) |
|
|
pure virtual |
Signal all the workers to shutdown.
◆ SyncWorker()
virtual void tvm::runtime::SessionObj::SyncWorker |
( |
int |
worker_id | ) |
|
|
pure virtual |
Synchrnoize the controler with a worker, and it will wait until worker finishes executing this instruction.
- Parameters
-
worker_id | The id of the worker to be synced with. |
- Note
- This function is usually used for worker-0, because it is the only worker that is assumed to collocate with the controler. Syncing with other workers may not be supported.
◆ TVM_DECLARE_BASE_OBJECT_INFO()
◆ DRefObj
◆ SessionObj::FFI
friend struct SessionObj::FFI |
|
friend |
◆ _type_key
constexpr const char* tvm::runtime::SessionObj::_type_key = "runtime.disco.Session" |
|
staticconstexpr |
The documentation for this class was generated from the following file: