This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5716: OpenCL issue on DSP

Part Number: AM5716

Tool/software: Linux

Dear TI Experts,

We using a open source decode library which is called zbar, during our test, we integrate the source code to AM5716 platform,

we need the DSP to run the decode library,  to allow general standard C functions to be called from OpenCL C kernels can be used to dispatch code on the DSP's that make use of TI's BIOS APIs, we follow the link:
http://downloads.ti.com/mctools/esd/docs/opencl/extensions/bios-apis.html

By using BIOS API, we can get the example code to demo the shared buffer between DSP and ARM.

So We compiler the zbar source code with cl6x (ti-cgt-c6000-v8.1.0) for the zbar library, then compiler the kernel to call the zbar library, all the code run on DSP.

The decode library compiler with ARM A15, it can decode the raw data buffer correctly:

root@am57xx-evm:~/TestZbar# ./TestZbar                                          
n = 1                                                                           
                                                                                
decoded QR-Code symbol "http123Ⲳ���456"                                         
len = 14                                

From the up log, we can get raw data buffer was decoded correctly, but with the same code, it will failed with DSP.

During the code compiler, it was passed:

env PATH=/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/x86_64-arago-linux/usr/share/ti/cgt-c6x/bin:/home/nemo/bin:/home/nemo/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/x86_64-arago-linux/usr/bin /home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/clocl -t -I./ kernel.cl dsp.obj zbar.obj
warning #10247-D: creating output section ".cio" without a SECTIONS
   specification
Compiling host.cpp
/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf-g++ -c -O3 -I./persistent_common -D__linux__ "--sysroot=/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi" -I/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi/usr/include -I/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi/usr/include host.cpp
Compiling persistent_common/host_assist.cpp
/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf-g++ -c -O3 -I./persistent_common -D__linux__ "--sysroot=/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi" -I/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi/usr/include -I/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi/usr/include persistent_common/host_assist.cpp
Linking TestMain
/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf-g++ -O3 -I./persistent_common -D__linux__ "--sysroot=/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi" -I/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi/usr/include -I/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi/usr/include host.o host_assist.o "--sysroot=/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi" -L/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi/usr/lib -L/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi/lib -L/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi/usr/lib -Wl,-rpath-link,/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi/lib -Wl,-rpath-link,/home/nemo/ti-processor-sdk-linux-rt-am57xx-evm-03.03.00.04/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi/usr/lib -lOpenCL -locl_util -o TestMain

When We running it on the DSP, it will throw the e

root@am57xx-evm:~/TestZbar# ./TestMain 
Host Start
[ 2824.341461] omap_hwmod: mmu0_dsp1: _wait_target_disable failed
[ 2824.352219] omap-iommu 40d01000.mmu: 40d01000.mmu: version 3.0
[ 2824.354754] systemd-journald[189]: Failed to send WATCHDOG=1 notification med
[ 2824.375737] omap-iommu 40d02000.mmu: 40d02000.mmu: version 3.0
[core 0] DSP RUN

It seems hang on DSP. 

zbar.DSP_ccs_v8.1.0.zipzbar.DSP_ccs_v8.1.0.zip

  • Hi, Xinping,

    The way I understand OpenCL extension on "Calling TI BIOS APIs from OpenCL C Kernels" is that it only supports those BIOS and IPC APIs listed in the document. I don't think it supports any library. I am checking with developer if there is any way around. Once I hear back, I'll post it back here.

    Rex

  • Hi, Xinping,

    Is the function wrapped in OpenCL wrapper in the OpenCL Kernel? Please take a look at the simple exampe in

    http://downloads.ti.com/mctools/esd/docs/opencl/examples/overview.html#ccode-example

    Rex

  • Hi Rex, 

    Yes, the function is wrapped in OpenCL wrapper in the OpenCL Kernel:

    void Connect_Decoder(global unsigned char *buf, int size);
    kernel void wrapper(global unsigned char *buf, int size)
    { 
       int wg_id = get_group_id(0);
       Connect_Decoder(&buf[wg_id * size], size); 
    }

    The wrapper is included in kernel.cl code refer to the attached code zbar.DSP_ccs_v8.1.0.zip.
    We call the decode function in dsp.c code:
    ...
    #include "ti/sysbios/BIOS.h"
    #include "ti/sysbios/knl/Clock.h"
    #include "ti/sysbios/knl/Task.h"
    #include "shared.h"
    #include "zbar.h"
    ...
    void Connect_Decoder(unsigned char *buf, int size)
    {
       printf("RUN DSP\n");	
       Zbar_Test((void* )data_buf,280,280);	
       // *completion_code = APP_OK;
    }

    The data_buf is our raw data buffer with the size 280 * 280 char. 

    Many Thanks!

    Nemo

  • Hi, Xinping/Nemo,

    The error you get probably means the DSP has crashed, and caused DSP hang. You can check the remoteproc trace file, "cat /sys/kernel/debug/remoteproc/remoteproc2/trace0", to see if any memory protection error being reported or if the DSP is still up running. You will need to debug the DSP program. You can instrument the DSP code with a few printf and see where program hangs or halts.

    I also noticed that you are using PSDK 3.3 release. It is too old and we stopped supporting it. The latest PSDK is release 5.3. Please upgrade to the latest. We only support one version back. Release 6.0 will be out soon. By that time, 5.x will still be supported, but not any version older than 5.x.

    Rex