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.

Timer intrinsics and clacc

My C66 timer won't compile under clacc

 /* TI DSP C66 intrinics  */
#include <c6x.h>

/* A gettimeofday routine to give access to the wall
   clock timer on most UNIX-like systems.  */

double mysecond(void)
{
    return ((double)_itoll(TSCH, TSCL) * 1.0e-9);
}

cl6x --abi=elfabi --openmp --cbe -I/opt/ti/c6000_7.6.0B1/include -O3 -I/opt/ti/openmp_dsp_2_01_12_00/packages/ti/runtime/openmp stream_dsp.c
"stream_dsp.c", line 418: error: identifier "TSCH" is undefined
"stream_dsp.c", line 418: error: identifier "TSCL" is undefined
2 errors detected in the compilation of "stream_dsp.c".

This is confirmed to be defined in c6x.h and this code has compiled previously directly with cl6x.  Seems that clacc is improperly filtering DSP intrinsics prior to compilation with cl6x


This is probably related to similar issue with instruction intrinsics unable to be used to optimize FIR function with clacc. 

  • Resolved problem thru experimentation. 


    Placed code with Ti intrinsics into separate DSP C source module, to be compiled directly by cl6x compiler into resultant obj module. Intention is use obj to link (not compile) using clacc, similar to a library. 

    Added dummy function with same name into ARM source.  This seems to be required else the linkage fails. 

    Then added the separated obj module into the clacc processing list (near DSPlib type library archive).  This succesfully links cl6x compiled code (containing pure DSP code, intrinsics) into the openMPacc target application. 

    So there seems to be a valid method to link "pure" DSP code (compiled with cl6x) into clacc. 

  • Stephen,

    You can use the __clock and __clock64 functions documented at http://processors.wiki.ti.com/index.php/OpenCL_User%27s_Guide#TI_OpenCL_Extensions to get access to TSCL/TSCH without having to reference the registers in your code.

    I've also responded your original post on using intrinsics with clacc.

    Ajay