MCPcopy
hub / github.com/tinygrad/tinygrad / __init__

Method __init__

tinygrad/runtime/ops_dsp.py:149–159  ·  view source on GitHub ↗
(self, device:str="")

Source from the content-addressed store, hash-verified

147
148class DSPDevice(Compiled):
149 def __init__(self, device:str=""):
150 if getenv("MOCKDSP"): super().__init__(device, DSPAllocator(self), [MockDSPRenderer], MockDSPProgram)
151 else:
152 self.ion_fd = os.open('/dev/ion', os.O_RDONLY)
153 super().__init__(device, DSPAllocator(self), [DSPRenderer], functools.partial(DSPProgram, self))
154 fastrpc_shell = memoryview(bytearray(pathlib.Path('/dsp/cdsp/fastrpc_shell_3').read_bytes()))
155 self.shell_buf = self.allocator.alloc(round_up(fastrpc_shell.nbytes, 0x1000), BufferSpec(nolru=True))
156 ctypes.memmove(self.shell_buf.va_addr, mv_address(fastrpc_shell), fastrpc_shell.nbytes)
157
158 self.init_dsp()
159 RPCListener(self).start()
160
161 def open_lib(self, lib):
162 self.binded_lib, self.binded_lib_off = lib, 0

Callers

nothing calls this directly

Calls 12

init_dspMethod · 0.95
getenvFunction · 0.90
round_upFunction · 0.90
BufferSpecClass · 0.90
mv_addressFunction · 0.90
DSPAllocatorClass · 0.85
RPCListenerClass · 0.85
read_bytesMethod · 0.80
__init__Method · 0.45
openMethod · 0.45
allocMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected