flushCache

29 views
Skip to first unread message

Reza Baharani

unread,
Feb 18, 2019, 9:14:43 PM2/18/19
to Spatial Users
Hi,
I compiled the MatMult_outer sample for ZCU102 Rev 1.1. The compilation has been done successfully, however, when I run ./Top, the program gives me following error:
root@zcu102:~/matmul# ./Top 1 1 1
[WARNING]: DELITE_NUM_THREADS undefined, defaulting to 1
Executing with 1 thread(s)
placing fringeScalarBase at 7f97903000
placing fringeMemBase at 7f77597000
placing resetHandshakePtr at 7f978f3000
sudo: unable to resolve host zcu102
/lib/firmware ~/matmul
Flashing bitstream...
sudo: unable to resolve host zcu102
~/matmul
accel.bit.bin bitstream loaded onto fpga!
[malloc] virtAddr = 7f77597000, physAddr = 20000000
Allocate mem of size x369*x370 at 0x20000000
[malloc] virtAddr = 7f77597040, physAddr = 20000040
Allocate mem of size x372*x373 at 0x20000040
[malloc] virtAddr = 7f77597080, physAddr = 20000080
Allocate mem of size x375*x376 at 0x20000080
[memcpy HOST -> FPGA] devmem = 20000000, hostmem = 0x2b761f70, size = 4
[memcpy HOST -> FPGA] devmem = 20000040, hostmem = 0x2b761fb0, size = 4
[memcpy HOST -> FPGA] devmem = 20000080, hostmem = 0x2b761ff0, size = 4
[malloc] virtAddr = 7f775970c0, physAddr = 200000c0
[memcpy] dummyBuf = 0x200000c0, (phys = c8a690c0), arraySize = 2621440
Segmentation fault (core dumped)

I inspected and I realized the cause of the error is in the file: FringeContexZCU.h:305:"dummyBuf[i] = 10;" inside of the "void flushCache(uint32_t kb)" function. It seems that line 301: "int *dummyBuf = (int*) malloc(arraySize * sizeof(int));" cannot allocate memory, alought it gives back the address. If I changed the code to "int *dummyBuf = new int [arraySize];" the program continues the execution, however result are different and the assertion at the end of the program fails.
I cloned the spatial from this repository "https://github.com/stanford-ppl/spatial".
Any help would be appreciated.

Matt F

unread,
Feb 19, 2019, 1:53:03 PM2/19/19
to Spatial Users
Hi Reza,

Is this a matmult app from one of our examples or one that you wrote?  If it is one of ours, the three input args are the dimensions of the matrices, and we tile by 16 or 64 or something along those lines if I remember correctly, so that may explain why the answer is wrong. 

For the cache flush issue, I'm not sure what would cause this.  I think what you changed should be ok, and if it isn't, I would expect a few random bursts to look messed up in matrix multiply but most of them to be correct.  I don't think this will solve the issue, but maybe it is related to cma.  You can check your cmdline args (`cat /proc/cmdline`).  We use `cma=256M cdns,mmio,0xFF000000,115200n8 root=/dev/mmcblk0p2 rw rootwait`.  You can boot into uboot and use setenv and saveenv to change these. 

Reza Baharani

unread,
Feb 20, 2019, 1:09:38 PM2/20/19
to Spatial Users
Thanks for the reply. It seems the kernel also should be compiled with the new CMA value, and then the value should be added to bootargs. I am wondering if you are able to send me a link of the pre-built image that you have used for ZCU102 board.
I would appreciate any help.
Thanks,
Reza,

Matt F

unread,
Feb 20, 2019, 2:41:26 PM2/20/19
to Spatial Users

Here are a few notes about what to do once you get booted into the OS

        Over serial, after you get the login screen there are still lots of kernel prints so don't be fooled
        Also, for some reason you can't see command line input in the terminal.  Vim is still fine though
        Make ssh faster by doing both of the debug steps at the end of the doc, even if you don't think you need to.  These steps are:
        1) Fix the "host not found zcu102" error when you run sudo by pasting this into /etc/hosts:
            127.0.0.1    localhost.localdomain localhost
             127.0.1.1    my-machine
         sudo may hang the first time. 
         Also remember to edit /etc/hostname
        2) Also do this:
            #> rm /etc/apt/apt.conf # remove proxy configs from apt-*
            #> vim .bashrc # remove the last lines which set “http_proxy” and “https_proxy”
            #> vim /etc/resolv.conf # add, at the top, a network DNS or use Google’s “nameserver 8.8.8.8”
            #> So /etc/resolv.conf should be:
                nameserver 171.67.1.234
                nameserver 171.64.1.234
                search stanford.edu # For use @ stanford

Reza Baharani

unread,
Feb 21, 2019, 2:39:05 PM2/21/19
to Spatial Users
Thanks for the reply. I cross-compiled the petalinux and I changed the bootargs to have cma=256M. This time whenever I run the ./Top, it flashes the FPGA successfully however after loading the bit file the whole system will be crashed. I think the problem should be in hardware design itself. Are you using the same HDF file as provided here https://drive.google.com/drive/folders/0B8-S_nAzTew_bFNFVzlsdWMyUmM? What was your hardware design? Did you have a specific hardware block that you map the bit file to that IP?

Matt F

unread,
Feb 22, 2019, 2:13:02 PM2/22/19
to Spatial Users
Hi.  We actually just use the pre-built image they link to on that guide, called ZCU102_Ubuntu_Desktop.zip, and dd it onto an SD card.   I tried compiling petalinux from scratch before and I got behavior similar to what you describe.  I was never able to figure it out so I just went with the pre-built image that they provide and changed the bootargs directly by going into u-boot and rewriting the env variable.
Reply all
Reply to author
Forward
0 new messages