# Allocate fails with error

**URL:** <https://discuss.pynq.io/t/allocate-fails-with-error/7911>\
**Category:** Support\
**Created:** [January 7, 2025, 11:16pm UTC](https://discuss.pynq.io/t/allocate-fails-with-error/7911 "2025-01-07T23:16:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karthick\_Ramu](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/karthick_ramu/32/6563_2.png) [@Karthick\_Ramu](https://discuss.pynq.io/u/Karthick_Ramu)\
**Post date:** [January 7, 2025, 11:16pm UTC](https://discuss.pynq.io/t/allocate-fails-with-error/7911/1 "2025-01-07T23:16:20Z")

</div>

PYNQ Version =3.0.1  
Board = Zynq Mini ITX XC7Z045

Code snippet  
import traceback  
import numpy as np  
from pynq import allocate  
from pynq import Overlay

overlays = Overlay(“./pynq/overlays/dma.bit”, download=False)  
dma = overlays.ADC\_DAC\_DMA  
input\_buffer = allocate(shape=(5,), dtype=‘u4’)  
output\_buffer = allocate(shape=(5,), dtype=‘u4’)

Error:  
oot@pynq:/home/xilinx/daffodil-app# python dma.py  
XRT build version: 2.13.0  
Build hash: f5505e402c2ca1ffe45eb6d3a9399b23a0dc8776  
Build date: 2022-10-21 17:40:17  
Git branch: temp  
PID: 6450  
UID: 0  
[Tue Jan 7 17:21:21 2025 GMT]  
HOST:  
EXE: /usr/bin/python3.10  
[XRT] ERROR: boost::filesystem::directory\_iterator::construct: No such file or directory: “/dev/dri/by-path/”  
Traceback (most recent call last):  
File “/home/xilinx/daffodil-app/dma.py”, line 8, in   
input\_buffer = allocate(shape=(5,), dtype=‘u4’)  
File “/home/xilinx/daffodil-app/pynq/buffer.py”, line 158, in allocate  
return target.allocate(shape, dtype, \*\*kwargs)  
File “/home/xilinx/daffodil-app/pynq/pl\_server/device.py”, line 145, in allocate  
return self.default\_memory.allocate(shape, dtype, \*\*kwargs)  
File “/home/xilinx/daffodil-app/pynq/pl\_server/xrt\_device.py”, line 156, in allocate  
buf = \_xrt\_allocate(shape, dtype, self.device, self.idx, \*\*kwargs)  
File “/home/xilinx/daffodil-app/pynq/pl\_server/xrt\_device.py”, line 104, in \_xrt\_allocate  
bo = device.allocate\_bo(size, memidx, cacheable)  
File “/home/xilinx/daffodil-app/pynq/pl\_server/xrt\_device.py”, line 410, in allocate\_bo  
raise RuntimeError("Allocate failed: " + str(bo))  
RuntimeError: Allocate failed: 4294967274

---

<div class="post-metadata">

**Author:** ![marioruiz](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/marioruiz/32/2177_2.png) [@marioruiz](https://discuss.pynq.io/u/marioruiz)\
**Post date:** [January 8, 2025, 12:31pm UTC](https://discuss.pynq.io/t/allocate-fails-with-error/7911/2 "2025-01-08T12:31:39Z")

</div>

Hi @Karthick_Ramu,

Looks like you built your own PYNQ SD card image for this board.  
This error could be because the reserved CMA memory is not part of the device tree.

If you check the `dmesg` log, you may find more information.

Have you tried MMIO access?

Mario

---

<div class="post-metadata">

**Author:** ![Karthick\_Ramu](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/karthick_ramu/32/6563_2.png) [@Karthick\_Ramu](https://discuss.pynq.io/u/Karthick_Ramu)\
**Post date:** [January 8, 2025, 5:09pm UTC](https://discuss.pynq.io/t/allocate-fails-with-error/7911/3 "2025-01-08T17:09:10Z")

</div>

My device tree does have DMA in it

ADC\_DAC\_DMA\_axi\_dma\_0: dma@4101c000 {  
#dma-cells = \<1\>;  
clock-names = “s\_axi\_lite\_aclk”, “m\_axi\_mm2s\_aclk”;  
clocks = \<&clkc 15\>, \<&clkc 15\>;  
compatible = “xlnx,axi-dma-7.1”, “xlnx,axi-dma-1.00.a”;  
interrupt-names = “mm2s\_introut”;  
interrupt-parent = \<&intc\>;  
interrupts = \<0 32 4\>;  
reg = \<0x4101c000 0x1000\>;  
xlnx,addrwidth = \<0x20\>;  
xlnx,sg-length-width = \<0xe\>;  
dma-channel@4101c000 {  
compatible = “xlnx,axi-dma-mm2s-channel”;  
dma-channels = \<0x1\>;  
interrupts = \<0 32 4\>;  
xlnx,datawidth = \<0x20\>;  
xlnx,device-id = \<0x0\>;  
};

No I have not tried MMIO

---

<div class="post-metadata">

**Author:** ![marioruiz](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/marioruiz/32/2177_2.png) [@marioruiz](https://discuss.pynq.io/u/marioruiz)\
**Post date:** [January 8, 2025, 7:33pm UTC](https://discuss.pynq.io/t/allocate-fails-with-error/7911/4 "2025-01-08T19:33:37Z")

</div>

I am referring to the CMA (Contiguous Memory Allocation) entry, not DMA.  
`allocate` needs CMA.

Did you check `dmesg`?

---

<div class="post-metadata">

**Author:** ![Karthick\_Ramu](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/karthick_ramu/32/6563_2.png) [@Karthick\_Ramu](https://discuss.pynq.io/u/Karthick_Ramu)\
**Post date:** [January 8, 2025, 9:02pm UTC](https://discuss.pynq.io/t/allocate-fails-with-error/7911/5 "2025-01-08T21:02:58Z")

</div>

There is no entry for CMA in device tree. Can you show me an example of how it looks?

Here is my dmesg entry

[0.000000] Memory: 892868K/1048576K available (9216K kernel code, 326K rwdata, 2540K rodata, 1024K init, 294K bss, 24636K reserved, 131072K cma-reserved, 131072K highmem)

Also , what does XRT error below mean  
XRT] ERROR: boost::filesystem::directory\_iterator::construct: No such file or directory: “/dev/dri/by-path/”

---

<div class="post-metadata">

**Author:** ![marioruiz](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/marioruiz/32/2177_2.png) [@marioruiz](https://discuss.pynq.io/u/marioruiz)\
**Post date:** [January 9, 2025, 11:26am UTC](https://discuss.pynq.io/t/allocate-fails-with-error/7911/6 "2025-01-09T11:26:30Z")

</div>

You can find information here:

[https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841683/Linux+Reserved+Memory](https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841683/Linux+Reserved+Memory)

I will also suggest you check `dmesg` to see if CMA is enabled as it can also be defined in the kernel boot args.

> Also , what does XRT error below mean  
> XRT] ERROR: boost::filesystem::directory\_iterator::construct: No such file or directory: “/dev/dri/by-path/”

> [@Pynq Throwing Boost Exception, /dev/dri/by-path/is missing](https://discuss.pynq.io/t/pynq-throwing-boost-exception-dev-dri-by-path-is-missing/4874/2):
>
> Hi Doug, Could you share your .spec file that you used to generate the image? And what version of PYNQ are you using? The /dev/dri/by-path directory is related to the zocl driver, it is responsible for accelerator memory allocation (kinda like OpenCL), which is why it appears in the path usually associated with graphics cards. My guess is your .spec is either missing the xrt package or there’s some version mismatch between pynq and xrt. Thanks Shawn

Does `xbutil examine` show any device found?

---

<div class="post-metadata">

**Author:** ![Karthick\_Ramu](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/karthick_ramu/32/6563_2.png) [@Karthick\_Ramu](https://discuss.pynq.io/u/Karthick_Ramu)\
**Post date:** [January 9, 2025, 4:29pm UTC](https://discuss.pynq.io/t/allocate-fails-with-error/7911/7 "2025-01-09T16:29:11Z")

</div>

System Configuration  
OS Name : Linux  
Release : 5.15.19-xilinx-v2022.1  
Version : #1 SMP PREEMPT Mon Apr 11 17:52:14 UTC 2022  
Machine : armv7l  
CPU Cores : 2  
Memory : 1000 MB  
Distribution : PynqLinux, based on Ubuntu 22.04  
GLIBC : 2.35  
Model : unknown

XRT  
Version : 2.13.0  
Branch : temp  
Hash : f5505e402c2ca1ffe45eb6d3a9399b23a0dc8776  
Hash Date : 2022-10-21 17:40:17  
ZOCL : 2.13.0, f5505e402c2ca1ffe45eb6d3a9399b23a0dc8776

Devices present  
0 devices found  
BDF : Shell Platform UUID Device ID Device Ready\*

- Devices that are not ready will have reduced functionality when using XRT tools

---

<div class="post-metadata">

**Author:** ![Karthick\_Ramu](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/karthick_ramu/32/6563_2.png) [@Karthick\_Ramu](https://discuss.pynq.io/u/Karthick_Ramu)\
**Post date:** [January 9, 2025, 5:23pm UTC](https://discuss.pynq.io/t/allocate-fails-with-error/7911/8 "2025-01-09T17:23:10Z")

</div>

XRT is in my .spec file  
STAGE4\_PACKAGES\_7z045\_daffodil2 := xrt pynq ethernet precached\_metadata

XRT and ZOCL has same version.  
What other compatibility should I check?

---

<div class="post-metadata">

**Author:** ![Karthick\_Ramu](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/karthick_ramu/32/6563_2.png) [@Karthick\_Ramu](https://discuss.pynq.io/u/Karthick_Ramu)\
**Post date:** [February 12, 2025, 5:48pm UTC](https://discuss.pynq.io/t/allocate-fails-with-error/7911/9 "2025-02-12T17:48:27Z")

</div>

I still have this problem. Is there any solution to this.
