Skip to content

Commit 2ad4c72

Browse files
authored
fixing <4KB buffer allocation issue (#1500)
1 parent 6ea63cf commit 2ad4c72

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pynq/pl_server/xrt_device.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,14 @@ def allocate_bo(self, size, idx, cacheable):
335335
flags = pyxrt.bo.flags.normal
336336
if cacheable:
337337
flags = pyxrt.bo.flags.cacheable
338+
339+
# Workaround for XRT v2.17 4KB threshold issue:
340+
# Small buffers (<4KB) get 64-bit addresses, large buffers (>=4KB) get 32-bit addresses
341+
# Force minimum allocation of 8KB to ensure 32-bit addresses for DMA compatibility
342+
actual_size = max(size, 8192) # 8KB minimum
343+
338344
try:
339-
bo = pyxrt.bo(self.handle, size, flags,idx)
345+
bo = pyxrt.bo(self.handle, actual_size, flags, idx)
340346
except Exception as e:
341347
raise RuntimeError(f"BO allocation failed: {e}")
342348
if bo is None:

0 commit comments

Comments
 (0)