dsp check buffers count (#6509)

This commit is contained in:
nimlgen
2024-09-14 10:16:58 +03:00
committed by GitHub
parent ee5902d347
commit 052bf43ed4
+2
View File
@@ -32,6 +32,8 @@ class DSPProgram:
def __del__(self): os.remove(self.filepath.name)
def __call__(self, *bufs, vals:Tuple[int, ...]=(), wait=False):
if len(bufs) >= 16: raise RuntimeError(f"Too many buffers to execute: {len(bufs)}")
pra, fds, attrs, _ = rpc_prep_args(ins=[var_vals_mv:=memoryview(bytearray((len(bufs) + len(vals)) * 4))],
outs=[timer:=memoryview(bytearray(8)).cast('Q')], in_fds=[b.share_info.fd for b in bufs])
var_vals_mv.cast('i')[:] = array.array('i', tuple(b.size for b in bufs) + vals)