Arina
April 14, 2021, 7:00am
1
Hello.
I am trying to run VTA on DE10 Nano.
And there is a problem using cma to allocate memory during the tutorial - at running test_benchmark_topi_conv2d.py.
It would help me a lot if you could answer some questions:
Can someone please respond who launched TVM with VTA on de10nano - which version of TVM did you use?
Where did you get the cma allocator?
De10nano has 1GB DDR memory, how much memory do we need to allocate for cma?
Thanks in advance!
mshr-h
April 14, 2021, 12:35pm
2
I ran into the same problem. I tried to enable CMA by compiling Linux kernel but I couldn’t get it.
I tried this instruction and I enabled CMA in the kernel config. Then I booted with the kernel but /dev/cma
doesn’t exist.
Environment:
OS: Angstrom Linux (downloaded from Terasic’s website)
Arina
April 14, 2021, 12:54pm
3
Hello, check do you have /dev/-cma
Also you could check cma module installed:
$ lsmod | grep cma
cma 16384 0
To check available volume of cma:
$ cat /proc/meminfo
mshr-h
April 16, 2021, 12:28am
4
Thank you for helping me.
I don’t see /dev/-cma
. Also I don’t see cma in module.
But I see CmaTotal and CmaTree in /proc/meminfo
.
# ls /dev/
autofs gpiochip0 mmcblk0 ptyp0 ptypc tty0 tty2 tty30 tty41 tty52 tty63 ttyp6 vcs1 vcsa6
block gpiochip1 mmcblk0p1 ptyp1 ptypd tty1 tty20 tty31 tty42 tty53 tty7 ttyp7 vcs2 watchdog
btrfs-control gpiochip2 mmcblk0p2 ptyp2 ptype tty10 tty21 tty32 tty43 tty54 tty8 ttyp8 vcs3 watchdog0
bus i2c-0 mmcblk0p3 ptyp3 ptypf tty11 tty22 tty33 tty44 tty55 tty9 ttyp9 vcs4 zero
char i2c-1 mqueue ptyp4 ram0 tty12 tty23 tty34 tty45 tty56 ttyS0 ttypa vcs5
console initctl network_latency ptyp5 ram1 tty13 tty24 tty35 tty46 tty57 ttyS1 ttypb vcs6
cpu_dma_latency input network_throughput ptyp6 random tty14 tty25 tty36 tty47 tty58 ttyp0 ttypc vcsa
cuse kmem null ptyp7 shm tty15 tty26 tty37 tty48 tty59 ttyp1 ttypd vcsa1
disk kmsg psaux ptyp8 stderr tty16 tty27 tty38 tty49 tty6 ttyp2 ttype vcsa2
fd log ptmx ptyp9 stdin tty17 tty28 tty39 tty5 tty60 ttyp3 ttypf vcsa3
full mem ptp0 ptypa stdout tty18 tty29 tty4 tty50 tty61 ttyp4 urandom vcsa4
fuse memory_bandwidth pts ptypb tty tty19 tty3 tty40 tty51 tty62 ttyp5 vcs vcsa5
# lsmod
Module Size Used by
xt_connmark 16384 2
iptable_nat 16384 0
nf_conntrack_ipv4 16384 3
nf_defrag_ipv4 16384 1 nf_conntrack_ipv4
nf_nat_ipv4 16384 1 iptable_nat
nf_nat 28672 1 nf_nat_ipv4
nf_conntrack 122880 4 nf_conntrack_ipv4,xt_connmark,nf_nat_ipv4,nf_nat
iptable_mangle 16384 1
iptable_filter 16384 0
ip_tables 20480 3 iptable_mangle,iptable_filter,iptable_nat
x_tables 28672 4 iptable_mangle,ip_tables,iptable_filter,xt_connmark
# cat /proc/meminfo | grep Cma
CmaTotal: 16384 kB
CmaFree: 16100 kB
Arina
April 16, 2021, 8:18am
5
Hello Masahiro,
this is the way how I did:
for add cma kernel module, take zImage and cma.ko from here GitHub - liangfu/de10-nano-supplement
copy this zImage to /mnt/boot/ on your de10nano
make a copy of your /mnt/boot/devicetree…… .dts, e.g. “test.dts”
add new section to this test.dts and build test.dtb, then copy test.dtb to /mnt/boot
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
default_cma_pool: default_cma_pool {
compatible = "shared-dma-pool";
reusable;
size = <0x18000000>;
alignment = <0x10000>;
linux,cma-default;
};
};
reboot with new zImage
$ sudo reboot
select uBoot from the menu
=> setenv linux_kernel_image zImage; setenv linux_fdt_image test.dtb; run bootcmd
install cma module
$ sudo insmod cma.ko
check that cma module was installed with lsmod command and check memory with cat /proc/meminfo
mshr-h
April 18, 2021, 5:35am
7
I successfully enabled cma. But I sticked into the cma memory allocation error when I tried to run VTA’s getting started tutorial.
# ./apps/vta_rpc/start_rpc_server.sh
INFO:RPCServer:bind to 0.0.0.0:9091
INFO:RPCServer:connection from ('192.168.10.101', 54884)
INFO:root:Skip reconfig_runtime due to same config.
INFO:root:Loading VTA library: /home/root/workspace/tvm/vta/python/vta/../../../build/libvta.so
INFO:RPCServer:load_module /tmp/tmplz7m5ivo/vadd.o
CMA_API_DEBUG: Opening "/dev/cma" file
CMA_API_DEBUG: Allocating 0x200 bytes of contigous memory
CMA_API_DEBUG: Getting physical address from 0xb2911000
CMA_API_DEBUG: Allocating 0x200 bytes of contigous memory
CMA_API_DEBUG: Getting physical address from 0xb28fc000
CMA_API_DEBUG: Allocating 0x80 bytes of contigous memory
CMA_API_DEBUG: Getting physical address from 0xb253d000
CMA_API_DEBUG: Allocating 0x2000000 bytes of contigous memory
CMA_API_DEBUG: Getting physical address from 0xb053d000
CMA_API_DEBUG: Allocating 0x2000000 bytes of contigous memory
CMA_API_DEBUG: Getting physical address from 0xae53d000
CMA_API_DEBUG: Releasing contigous memory from 0xb2911000
CMA_API_DEBUG: Releasing contigous memory from 0xb28fc000
CMA_API_DEBUG: Releasing contigous memory from 0xb253d000
CMA_API_DEBUG: Releasing contigous memory from 0xae53d000
CMA_API_DEBUG: Releasing contigous memory from 0xb053d000
CMA_API_DEBUG: cma_free - ioctl command unsuccsessful - 0
INFO:RPCServer:Finish serving ('192.168.10.101', 54884)
I’m facing the same issue, did you finally solved it?
The cma memory doesn’t free in any of the tvm-vta examples except for the deploy_classification.py example