MCPcopy Create free account
hub / github.com/apache/tvm / RPCSession

Class RPCSession

python/tvm/rpc/client.py:36–253  ·  view source on GitHub ↗

RPC Client session module Do not directly create the object, call connect

Source from the content-addressed store, hash-verified

34
35
36class RPCSession:
37 """RPC Client session module
38
39 Do not directly create the object, call connect
40 """
41
42 # pylint: disable=invalid-name
43 def __init__(self, sess):
44 self._sess = sess
45 self._tbl_index = _ffi_api.SessTableIndex(sess)
46 self._remote_funcs = {}
47
48 def system_lib(self):
49 """Get system-wide library module.
50
51 Returns
52 -------
53 module : runtime.Module
54 The system-wide library module.
55
56 See Also
57 --------
58 tvm.runtime.system_lib
59 """
60 return self.get_function("ffi.SystemLib")()
61
62 def get_function(self, name):
63 """Get function from the session.
64
65 Parameters
66 ----------
67 name : str
68 The name of the function
69
70 Returns
71 -------
72 f : Function
73 The result function.
74 """
75 return self._sess.get_function(name)
76
77 def device(self, dev_type, dev_id=0):
78 """Construct a remote device.
79
80 Parameters
81 ----------
82 dev_type: int or str
83
84 dev_id: int, optional
85
86 Returns
87 -------
88 dev: Device
89 The corresponding encoded remote device.
90 """
91 dev = tvm.runtime.device(dev_type, dev_id)
92 encode = (self._tbl_index + 1) * base.RPC_SESS_MASK
93 dev = tvm.runtime.device(dev.dlpack_device_type() + encode, dev.index)

Callers 1

connectFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…