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.

AM57x OpenCL, kernel linked with C++ library on DSP

Hi,

I have a static library written in C++, and compiled with the ti-cgt-c6000_8.1.0 cl6x compiler. I'd like to call functions within the library via OpenCL. This is analogous to the dsplib_fft OpenCL example, which calls the dsplib library's DSPF_sp_fftSPxSP function.

I am able to build a kernel with the C++ library (with warnings):

warning #10247-D: creating output section ".init_array" without a SECTIONS specification
warning #10247-D: creating output section ".cio" without a SECTIONS specification

But when I en-queue the kernel I get into trouble and an exception is generated:

Warning: Initialized data for objects in .mem_l2 sections will be ignored.
/ti-opencl/host/src/core/dsp/tal/ocl_load/ocl_load.c:118: DLIF_read: Assertion `0' failed.

I can run programs compiled with this library directly on the DSP (uploaded via JTAG debugger). I do not have the ability to rewrite the C++ library (I do have access to the source). What is the best way to leverage this library for parallel processing on the DSP if the TI OpenCL implementation will not support this use case? Specifically, the use case is: dispatch processing from ARM host (running Linux) to DSP, executing C++ library functions on DSP and returning processing results to ARM.

I have proved out the IPC between the ARM host and DSP by building and running the dsplib_fft example from TI, so I think my problem is with trying to use a library written in C++.

Thanks,

Weston

  • The software team have been notified. They will respond here.
  • When I look at the warning I think that something wrong with your memory map. I can guess one of two things -
    1. The code uses L1D which the OpenCL on the ARM does not have access to, or
    2. The code uses L2 memory that either is not defined for the ARM or overwrite area that the ARM is using.

    Here is my suggestion:

    1. Build the DSP kernel and look at the map file. Observe which memory or memories are used
    2. Build the DSP code that uses the C++ code and look at the map file. Compare it to the previous one.
    3. Look at the map file of the C++ and try to find something that looks suspecious

    Please report back to here


    Ran
  • Hi, thank you for the advice Ran,

    The issue ended up being an errant include of iostream in the library code, which should have been ifdef'd out for the DSP build. I learned that objects constructed or destructed outside of any main function will likely result in a similar issue.

    I removed the iostream inclusion for the DSP build and was able to dispatch execution of the C++ library code on the DSP via OpenCL.

    Best Regards,

    Weston