tensil-ai / tensil

Open source machine learning accelerators
https://www.tensil.ai
Other
356 stars 29 forks source link

pynq z2 error #27

Closed minisparrow closed 2 years ago

minisparrow commented 2 years ago

when i run demo case on pynq z2 board, there some errors below, could you help me pls? overlay = Overlay('/home/xilinx/tensil_pynqz2.bit') tcu = Driver(pynqz1, overlay.axi_dma_0)

` in 1 overlay = Overlay('/home/xilinx/tensil_pynqz2.bit') ----> 2 tcu = Driver(pynqz1, overlay.axi_dma_0)

/home/xilinx/tcu_pynq/driver.py in init(self, arch, axi_dma_instr, axi_dma_sample, dma_buffer_size, debug) 101 ) 102 ) --> 103 self.buffer = pynq.allocate((buffer_size,), dtype=self.axi_data_type) 104 # allocate DRAMs within buffer 105 self.allocator = Allocator(self.buffer, debug=self.debug)

/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/buffer.py in allocate(shape, dtype, target, kwargs) 170 if target is None: 171 target = Device.active_device --> 172 return target.allocate(shape, dtype, kwargs)

/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/pl_server/device.py in allocate(self, shape, dtype, kwargs) 290 291 """ --> 292 return self.default_memory.allocate(shape, dtype, kwargs) 293 294 def reset(self, parser=None, timestamp=None, bitfile_name=None):

/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/pl_server/xrt_device.py in allocate(self, shape, dtype, kwargs) 167 168 """ --> 169 buf = _xrt_allocate(shape, dtype, self.device, self.idx, kwargs) 170 buf.memory = self 171 return buf

/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/pl_server/xrt_device.py in _xrt_allocate(shape, dtype, device, memidx, cacheable, pointer, cache) 122 bo, buf, device_address = pointer 123 else: --> 124 bo = device.allocate_bo(size, memidx, cacheable) 125 buf = device.map_bo(bo) 126 device_address = device.get_device_address(bo)

/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/pl_server/xrt_device.py in allocate_bo(self, size, idx, cacheable) 412 xrt.xclBOKind.XCL_BO_DEVICE_RAM, idx) 413 if bo >= 0x80000000: --> 414 raise RuntimeError("Allocate failed: " + str(bo)) 415 return bo 416

RuntimeError: Allocate failed: 4294967295`

tdb-alcorn commented 2 years ago

This error is coming from the pynq library and it's saying that there was insufficient contiguous memory (CMA) available to allocate the buffers needed by the TCU. One way this can happen is when too much CMA has been previously allocated for some reason. Can you try restarting your pynq z2 board and running it again?

If that doesn't work, can you pass the debug flag to the Driver? i.e.

overlay = Overlay('/home/xilinx/tensil_pynqz2.bit') tcu = Driver(pynqz1, overlay.axi_dma_0, debug=True)
minisparrow commented 2 years ago

This error is coming from the pynq library and it's saying that there was insufficient contiguous memory (CMA) available to allocate the buffers needed by the TCU. One way this can happen is when too much CMA has been previously allocated for some reason. Can you try restarting your pynq z2 board and running it again?

If that doesn't work, can you pass the debug flag to the Driver? i.e.

overlay = Overlay('/home/xilinx/tensil_pynqz2.bit') tcu = Driver(pynqz1, overlay.axi_dma_0, debug=True)

thanks very much, after restarting the board it works. thanks. :)

tdb-alcorn commented 2 years ago

Great, glad to help!