Allocation function error in PYNQ v2.7

I have a project running on PYNQ v2.6. I just have ported the program to the newer PYNQ. (I have seen some differences between axi slave calling through overlay function, which is solved and not relevant to this, I hope). Now, the main problem I am having is the repeated allocation of a buffer. It shows an error for allocation.

RuntimeError                              Traceback (most recent call last)
<ipython-input-13-5412c6fea447> in <module>
--> 235             frame = allocate(shape=(int(height/3), int(width/5), 3), dtype=np.uint8, cacheable=True)

/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/ 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/ in allocate(self, shape, dtype, **kwargs)
    291         """
--> 292         return self.default_memory.allocate(shape, dtype, **kwargs)
    294     def reset(self, parser=None, timestamp=None, bitfile_name=None):

/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/pl_server/ in allocate(self, shape, dtype, **kwargs)
    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/ 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/ 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

RuntimeError: Allocate failed: 4294967295

What’s needs to be changed in order to make it work? I just want to remind that, this program has so far no problem running on v2.6.

Edit: There might be a need for these following information:
** First time it always works, from the second time it shows the error.
** In my project, I have used two vdma and DisplayPort output.
** surprisingly, custom i2c IP started working in v2.7 which is controlled by custom axi slave, was not working in v2.6.
** All custom axi slave had to redefine e.g.: controller = overlay.pipeline_top_0.axi_s to controller = overlay.pipeline_top_0
** The project is a video pipeline that supports 60FPS. But the FPS is greatly reducing (~8) if I use the allocate function in the while loop. But If I keep outside the loop it is providing 60FPS, but I can’t achieve my goal to refresh the buffer this way (meant overlays are scrambled)


1 Like

I’m not sure but I think you’re out of memory. Try adding some delay in the loop to see if that works. Or you could use the non-cacheable memory with frame = allocate(shape=(int(height/3), int(width/5), 3), dtype=np.uint8, cacheable=False).

Frank Shrestha

Fresh copy of pynq v2.7. 32GB sd card. Same program on the same board running on v2.6 with another sd card. There is no possibility I can see for either running out of sd card storage neither the RAM on the board. If it is running out of memory, this is related to how v2.7 allocate the buffer.
Still to test your theory I have swapped the memory card, Still same. Also I have tried both program on another zcu104. Same issue.

With non cacheble, the program either hangs or very low fps 15FPS on v2.6. And v2.7 this down to 4-5 if it is running in first try. The problem presist like before.

Edit: I also can’t add delays as I need the 60FPS as my output.


1 Like

I meant the CPU cache memory but seems unlikely if it was fine on the previous image.

Well then, there must be something going on with the new image.