1 ##################################################
2 Why do I get an assertion failure from malloc_ddr?
3 ##################################################
5 Application execution fails with the following error message:
7 .. code:: shell
9 tidl: device_alloc.h:31: T* tidl::malloc_ddr(size_t) [with T = char; size_t = unsigned int]: Assertion `val != nullptr' failed
11 Allocations not freed
12 +++++++++++++++++++++
13 One possible reason is that previous runs of the application were aborted (e.g. using :kbd:`Ctrl-C`) and did not release their allocations. Use the ``ti-mct-heap-check`` command with "-c" option to clean up.
15 .. code:: bash
17 root@am57xx-evm:~# ti-mct-heap-check -c
18 -- ddr_heap1 ------------------------------
19 Addr : 0xa2000000
20 Size : 0xa000000
21 Avail: 0xa000000
22 Align: 0x80
23 -----------------------------------------
25 .. _opencl-global-memory:
27 Insufficient OpenCL global memory
28 +++++++++++++++++++++++++++++++++
29 Another possible reason is that total memory requirement specified in the ``Configuration`` using NETWORK_HEAP_SIZE and PARAM_HEAP_SIZE exceeds default memory available for OpenCL. Follow the instructions below to increase the amount of CMEM (contiguous memory available for OpenCL) from 192MB (0xc000000) to 384MB (0x18000000):
31 .. code:: bash
33 $ sudo apt-get install device-tree-compiler # In case dtc is not already installed
34 $ scp root@am57:/boot/am57xx-evm-reva3.dtb .
35 $ dtc -I dtb -O dts am57xx-evm-reva3.dtb -o am57xx-evm-reva3.dts
36 $ cp am57xx-evm-reva3.dts am57xx-evm-reva3.dts.orig
37 $ # increase cmem block size
38 $ diff -u am57xx-evm-reva3.dts.orig am57xx-evm-reva3.dts
39 --- am57xx-evm-reva3.dts.orig 2018-01-11 14:47:51.491572739 -0600
40 +++ am57xx-evm-reva3.dts 2018-01-16 15:43:33.981431971 -0600
41 @@ -5657,7 +5657,7 @@
42 };
44 cmem_block_mem@a0000000 {
45 - reg = <0x0 0xa0000000 0x0 0xc000000>;
46 + reg = <0x0 0xa0000000 0x0 0x18000000>;
47 no-map;
48 status = "okay";
49 linux,phandle = <0x13c>;
50 @@ -5823,7 +5823,7 @@
51 cmem_block@0 {
52 reg = <0x0>;
53 memory-region = <0x13c>;
54 - cmem-buf-pools = <0x1 0x0 0xc000000>;
55 + cmem-buf-pools = <0x1 0x0 0x18000000>;
56 };
58 cmem_block@1 {
59 $ dtc -I dts -O dtb am57xx-evm-reva3.dts -o am57xx-evm-reva3.dtb
60 $ scp am57xx-evm-reva3.dtb root@am57:/boot/
61 # reboot to make memory changes effective (run "cat /proc/iomem" to check)
63 For further details, refer the OpenCL User's Guide, section :ref:`Changing DDR3 Partition for OpenCL <opencl:CHANGE_DDR3_PARTITION_FOR_OPENCL>`