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.

RTOS/PROCESSOR-SDK-AM57X: OpenCL is missing from TI-RTOS Processor SDK v05.01.00.11 for Linux

Part Number: PROCESSOR-SDK-AM57X
Other Parts Discussed in Thread: MATHLIB

Tool/software: TI-RTOS

Hello,

The OpenCL component is missing from the latest TI-RTOS Processor SDK Linux release for AM57x. OpenCL doesn't show up in the manifest for the release but it shows up in the TI-RTOS release notes components table (http://software-dl.ti.com/processor-sdk-rtos/esd/docs/latest/rtos/Release_Specific.html#processor-sdk-v05-01-00. The latest SDK version is also referenced in the TI OpenCL release notes version map (http://downloads.ti.com/mctools/esd/docs/opencl/readme/index.html

  • Hi,

    OpenCL for Cortex-A15/Linux hosts ships in the Processor Linux SDK (PLSDK) and OpenCL for Cortex-A15/TI-RTOS hosts ships in the Processor RTOS SDK (PRSDK). OpenCL/Linux is available in PLSDK 5.1. Unfortunately, a packaging error resulted in OpenCL/TI-RTOS being excluded from the PRSDK 5.1 release. We will investigate if it is feasible for customers to build OpenCL/TI-RTOS from sources and get back to you.

    Ajay

  • Hello,

    I realized that portions of my initial message were cut off due to the URL and/or parenthesis parsing. My apologies for the abrupt ending of that post.

    Other components are also missing from the latest TI-RTOS release installer for the AM57x, according to the manifest: DSPLIB and MATHLIB. There may be more. Can you provide instructions on building these components from sources, as well as instructions on any other missing components?

    Thanks,
    Matt McKee
  • Hi Matt,

       Enclosed please find the scripts on x86 Linux to build OpenCL RTOS package from downloaded Processor SDK RTOS (PRSDK) installation and from git.ti.com.  You should look at "build_env.sh" first and make modifications for your installed PRSDK location.  After that, running "./ocl_rtos_build.sh" should build the OpenCL RTOS package.

       Thanks!

    - Yuan

    $ cat build_env.sh 
    #!/bin/sh
    
    # set these top level environment variables
    export DEFAULT_PSDK_RTOS=/opt/ti/ti-processor-sdk-rtos-am57xx-evm-05.01.00.11-release
    # sudo apt-get install cmake        # if not already installed
    # sudo apt-get install libloki-dev  # if not already installed
    
    
    # derived variables, check package versions, modify if necessary
    export ARM_LLVM_DIR=${PWD}/ti-llvm/install.sysbios
    export X86_LLVM_DIR=${PWD}/ti-llvm/install.x86
    export TI_OCL_CGT_INSTALL=${DEFAULT_PSDK_RTOS}/ti-cgt-c6000_8.2.2
    export GCC_ARM_NONE_TOOLCHAIN=${DEFAULT_PSDK_RTOS}/gcc-arm-none-eabi-6-2017-q1-update
    export OMP_DIR=${DEFAULT_PSDK_RTOS}/openmp_dsp_am57xx_2_06_02_01
    
    export XDC_INSTALL_PATH=${DEFAULT_PSDK_RTOS}/xdctools_3_50_07_20_core
    
    export XDC_DIR=${XDC_INSTALL_PATH}
    export BIOS_DIR=${DEFAULT_PSDK_RTOS}/bios_6_73_00_12
    export IPC_DIR=${DEFAULT_PSDK_RTOS}/ipc_3_50_02_02
    export PDK_DIR=${DEFAULT_PSDK_RTOS}/pdk_am57xx_1_0_12
    export FC_DIR=${DEFAULT_PSDK_RTOS}/framework_components_3_40_02_07
    export EDMA3LLD_DIR=${DEFAULT_PSDK_RTOS}/edma3_lld_2_12_05_30C
    export XDAIS_DIR=${DEFAULT_PSDK_RTOS}/xdais_7_24_00_04
    export PRSDK_AET_DIR=${DEFAULT_PSDK_RTOS}/ctoolslib_2_2_0_0/packages/ti/aet
    
    export RTOS_INSTALL_DIR=${PWD}
    export BIOS_INSTALL_PATH=${PWD}/ti-sysbios-tree
    export IPC_INSTALL_PATH=${PWD}/ti-ipc-tree
    export AET_DIR=${PWD}/ti-aet
    export TI_OCL_INSTALL=${PWD}/ti-opencl/install/am57SYS_BIOS/opencl_rtos_am57xx_01_01_16_01/packages/ti/opencl
    

    $ cat llvm_rtos_build.sh 
    #!/bin/bash
    
    # Follow steps in: http://git.ti.com/opencl/llvm/blobs/release_36_ti/README.ti
    
    #1. Set up directory structure
    #-----------------------------
    mkdir ti-llvm; cd ti-llvm
    git clone git@git.ti.com:opencl/llvm.git
    cd llvm; git checkout release_36_ti
    cd tools; git clone git@git.ti.com:opencl/clang.git
    cd clang; git checkout release_36_ti
    cd ../../..    ### go back to ti-llvm directory
    
    #2. Build with Makefile.ti
    #-------------------------
    
    #2.1 Linux on x86
    ### use your system default gcc-5/g++-5
    CC="gcc-5" CXX="g++-5" CFLAGS="-m64" CXXFLAGS="-m64" \
        make -f llvm/Makefile.ti all.x86 -j4
    ### results in install.x86
    
    #2.3 Cross compile on Linux on x86 (Host, where it is build)
    #    for TI-RTOS on ARM (Target, where built Clang/LLVM are used)
    export PATH=${GCC_ARM_NONE_TOOLCHAIN}/bin:$PATH
    export DESTDIR=${PWD}/install.sysbios
    make -f llvm/Makefile.ti all.sysbios -j4
    ### results in install.sysbios
    

    $ cat ocl_rtos_build.sh 
    #!/bin/sh
    
    CURR_DIR=${PWD}
    
    echo "Setting up env vars"
    . ./build_env.sh
    
    echo "Cloning and building LLVM for RTOS"
    ./llvm_rtos_build.sh
    
    echo "Working around aet naming difference"
    ln -sf ${BIOS_DIR} ti-sysbios-tree
    ln -sf ${IPC_DIR} ti-ipc-tree
    mkdir -p ${AET_DIR}
    cp -r ${PRSDK_AET_DIR}/include ${PRSDK_AET_DIR}/lib ${AET_DIR}
    ln -sf ${AET_DIR}/lib/aetlib.l66_elf ${AET_DIR}/lib/libaet.ae66
    
    echo "Cloning and building OpenCL-RTOS"
    git clone git://git.ti.com/opencl/ti-opencl.git
    cd ti-opencl
    cp makefile ttt; sed 's/ssh:\/\/git@bitbucket.itg.ti.com\/mctools/git:\/\/git.ti.com\/opencl/' ttt > makefile
    make BUILD_AM57=1 BUILD_OS=SYS_BIOS; cd ${CURR_DIR}
    cd ${TI_OCL_INSTALL}/../../../examples; make BUILD_OS=SYS_BIOS; cd ${CURR_DIR}
    
    echo "Built package is in ti-opencl/install/am57SYS_BIOS:"
    ls ti-opencl/install/am57SYS_BIOS
    

  • Matt,

    Additionally, DSPLIB and MATHLIB can be downloaded from the following locations:

    http://www.ti.com/tool/sprc265 (C66X-DSPLIB)
    http://www.ti.com/tool/mathlib (C66X-MATHLIB)
  • Hi Yuan,

    Thank you for the scripts. Unfortunately, the ocl_rtos_build.sh fails due to the lack of access to TI internal Git repos:

    Cloning and building OpenCL-RTOS
    Cloning into 'ti-opencl'...
    remote: Counting objects: 9374, done.
    remote: Compressing objects: 100% (4118/4118), done.
    remote: Total 9374 (delta 6554), reused 7608 (delta 5010)
    Receiving objects: 100% (9374/9374), 22.50 MiB | 1.36 MiB/s, done.
    Resolving deltas: 100% (6554/6554), done.
    Checking connectivity... done.
    mkdir -p build/am57SYS_BIOS
    mkdir -p ti-opencl/install/am57SYS_BIOS/opencl_rtos_am57xx_01_01_16_01/packages/ti/opencl
    git clone --depth 1 ssh://git@bitbucket.itg.ti.com/mctools/opencl-firmware.git
    Cloning into 'opencl-firmware'...
    ssh: Could not resolve hostname bitbucket.itg.ti.com: Name or service not known
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    makefile:133: recipe for target 'opencl-firmware' failed
    make: *** [opencl-firmware] Error 128
    

    Can you provide a fix for this issue or is OpenCL not buildable for customers without access to bitbucket.itg.ti.com?

    Thanks,

    Matt

  • Hi Matt,

        Sorry about that part.  You can patch the ti-opencl/makefile to access the public opencl-firmware:

    diff --git a/makefile b/makefile
    index 9002363..cf640d8 100644
    --- a/makefile
    +++ b/makefile
    @@ -130,7 +130,7 @@ eve_submodule:
            git submodule update --init
     
     opencl-firmware:
    -       git clone --depth 1 ssh://git@bitbucket.itg.ti.com/mctools/opencl-firmware.git
    +       git clone --depth 1 git://git.ti.com/opencl/opencl-firmware.git
     
     change:
            git log --pretty=format:"- %s%n%b" $(TAG).. ; \
    

    - Yuan

  • Hi Matt,

    I also updated the ocl_rtos_build.sh script in the previous post to reflect the makefile patch. If you use the updated script, you don't need to patch the makefile by hand, the script will patch it. Let us know how it goes. Thanks!

    - Yuan
  • Hi Yuan,

    It looks like we're getting closer to a successful but some issues remain:

    make[4]: Entering directory '/home/mmckee/opencl/ti-opencl/host/clocl'
    make[4]: /cgnas/llvm-3.6.0-20170608-x86_64/bin/llvm-config: Command not found
    /bin/sh: /cgnas/llvm-3.6.0-20170608-x86_64/bin/llvm-config: No such file or directory
    /bin/sh: /cgnas/llvm-3.6.0-20170608-x86_64/bin/llvm-config: No such file or directory
    /bin/sh: /cgnas/llvm-3.6.0-20170608-x86_64/bin/llvm-config: No such file or directory
    /bin/sh: /cgnas/llvm-3.6.0-20170608-x86_64/bin/llvm-config: No such file or directory
    In file included from llvmopencl/BarrierTailReplication.cc:25:0:
    llvmopencl/BarrierTailReplication.h:28:30: fatal error: llvm/IR/Function.h: No such file or directory
    compilation terminated.
    llvmopencl/BreakConstantGEPs.cpp:22:31: fatal error: llvm/IR/Constants.h: No such file or directory
    compilation terminated.
    In file included from llvmopencl/BarrierBlock.cc:24:0:
    llvmopencl/BarrierBlock.h:24:32: fatal error: llvm/IR/BasicBlock.h: No such file or directory
    compilation terminated.
    Makefile:93: recipe for target 'x86/BarrierTailReplication.o' failed
    make[4]: *** [x86/BarrierTailReplication.o] Error 1
    make[4]: *** Waiting for unfinished jobs....
    Makefile:90: recipe for target 'x86/BreakConstantGEPs.o' failed
    make[4]: *** [x86/BreakConstantGEPs.o] Error 1
    Makefile:93: recipe for target 'x86/BarrierBlock.o' failed
    make[4]: *** [x86/BarrierBlock.o] Error 1
    llvmopencl/AllocasToEntry.cc:28:31: fatal error: llvm/IR/Constants.h: No such file or directory
    compilation terminated.
    Makefile:93: recipe for target 'x86/AllocasToEntry.o' failed
    make[4]: *** [x86/AllocasToEntry.o] Error 1
    make[4]: Leaving directory '/home/mmckee/opencl/ti-opencl/host/clocl'
    clocl/CMakeFiles/x86_clocl.dir/build.make:60: recipe for target 'clocl/x86/clocl' failed
    make[3]: *** [clocl/x86/clocl] Error 2
    make[3]: Leaving directory '/home/mmckee/opencl/ti-opencl/build/am57SYS_BIOS'
    CMakeFiles/Makefile2:429: recipe for target 'clocl/CMakeFiles/x86_clocl.dir/all' failed
    make[2]: *** [clocl/CMakeFiles/x86_clocl.dir/all] Error 2
    make[2]: Leaving directory '/home/mmckee/opencl/ti-opencl/build/am57SYS_BIOS'
    Makefile:149: recipe for target 'all' failed
    make[1]: *** [all] Error 2
    make[1]: Leaving directory '/home/mmckee/opencl/ti-opencl/build/am57SYS_BIOS'
    makefile:95: recipe for target 'install' failed
    make: *** [install] Error 2

    This error stems from X86_LLVM_DIR not being defined. I added the following to build_env.sh:

    export X86_LLVM_DIR=${PWD}/ti-llvm/build.sysbios/build.native                                        
    

    and the build gets further but encounters other issues that aren't as easy to resolve:

    git clone --depth 1 git://git.ti.com/opencl/opencl-firmware.git
    Cloning into 'opencl-firmware'...
    remote: Counting objects: 9, done.
    remote: Compressing objects: 100% (9/9), done.
    remote: Total 9 (delta 2), reused 0 (delta 0)
    Receiving objects: 100% (9/9), 999.00 KiB | 897.00 KiB/s, done.
    Resolving deltas: 100% (2/2), done.
    Checking connectivity... done.
    cd build/am57SYS_BIOS && cmake -DARM_LLVM_DIR=/home/mmckee/opencl/ti-llvm/install.sysbios -DX86_LLVM_DIR=/home/mmckee/opencl/ti-llvm/build.sysbios/build.native -DCMAKE_TOOLCHAIN_FILE=../host/cmake/CMakeBiosARMToolChain.txt -DBUILD_OS=SYS_BIOS -DRTOS_INSTALL_DIR=/home/mmckee/opencl -DXDC_INSTALL_PATH=/home/mmckee/ti_opencl/xdctools_3_50_07_20_core/packages -DBUILD_TARGET=ARM_AM57 -DOCL_VERSION=1.1.16.01 ../../host && make install
    -- BIOS_INSTALL_PATH: /home/mmckee/opencl/ti-sysbios-tree/packages
    -- Build Target Is  AM57
    -- Install path is /usr/local
    -- LLVM installation is in /home/mmckee/opencl/ti-llvm/install.sysbios
    -- LLVM VERSION 360
    -- LLVM BIN DIR /home/mmckee/opencl/ti-llvm/install.sysbios/bin
    -- LLVM LIB DIR /home/mmckee/opencl/ti-llvm/install.sysbios/lib
    -- LLVM INCLUDE_DIR DIR /home/mmckee/opencl/ti-llvm/install.sysbios/include
    -- LLVM CXX flags: -I/home/mmckee/opencl/ti-llvm/install.sysbios/include  -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -pedantic -Wno-long-long -Wnon-virtual-dtor -Wno-comment -std=c++11 -ffunction-sections -fdata-sections   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
    -- LLVM LD flags: -L/home/mmckee/opencl/ti-llvm/install.sysbios/lib
    -- LLVM core libs: -lLLVMLTO -lLLVMObjCARCOpts -lLLVMLinker -lLLVMBitWriter -lLLVMIRReader -lLLVMAsmParser -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMSparcAsmPrinter -lLLVMR600CodeGen -lLLVMipo -lLLVMVectorize -lLLVMR600AsmParser -lLLVMR600Desc -lLLVMR600Info -lLLVMR600AsmPrinter -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMC6000CodeGen -lLLVMC6000Desc -lLLVMC6000Info -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMAArch64Disassembler -lLLVMAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMAArch64Utils -lLLVMTableGen -lLLVMDebugInfo -lLLVMOption -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMRuntimeDyld -lLLVMLineEditor -lLLVMInstrumentation -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMCodeGen -lLLVMScalarOpts -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport
    -- Found LLVM: /home/mmckee/opencl/ti-llvm/install.sysbios/include
    -- Build OS IS SYS BIOS
    -- Configuring done
    -- Generating done
    CMake Warning:
      Manually-specified variables were not used by the project:
    
        X86_LLVM_DIR
    
    
    -- Build files have been written to: /home/mmckee/opencl/ti-opencl/build/am57SYS_BIOS
    make[1]: Entering directory '/home/mmckee/opencl/ti-opencl/build/am57SYS_BIOS'
    make[2]: Entering directory '/home/mmckee/opencl/ti-opencl/build/am57SYS_BIOS'
    make[3]: Entering directory '/home/mmckee/opencl/ti-opencl/build/am57SYS_BIOS'
    Scanning dependencies of target x86_clocl
    make[3]: Leaving directory '/home/mmckee/opencl/ti-opencl/build/am57SYS_BIOS'
    make[3]: Entering directory '/home/mmckee/opencl/ti-opencl/build/am57SYS_BIOS'
    [  1%] Generating x86/clocl
    make[4]: Entering directory '/home/mmckee/opencl/ti-opencl/host/clocl'
    In file included from llvmopencl/DebugHelpers.cc:28:0:
    llvmopencl/DebugHelpers.h:45:2: warning: extra ‘;’ [-Wpedantic]
     };
      ^
    llvmopencl/DebugHelpers.cc:210:2: warning: extra ‘;’ [-Wpedantic]
     };
      ^
    In file included from llvmopencl/Kernel.cc:33:0:
    llvmopencl/DebugHelpers.h:45:2: warning: extra ‘;’ [-Wpedantic]
     };
      ^
    In file included from /home/mmckee/opencl/ti-llvm/llvm/include/llvm/IR/IntrinsicInst.h:30:0,
                     from llvmopencl/TargetAddressSpaces.cc:31:
    /home/mmckee/opencl/ti-llvm/llvm/include/llvm/IR/Intrinsics.h:40:34: fatal error: llvm/IR/Intrinsics.gen: No such file or directory
    compilation terminated.
    Makefile:93: recipe for target 'x86/TargetAddressSpaces.o' failed
    make[4]: *** [x86/TargetAddressSpaces.o] Error 1
    make[4]: *** Waiting for unfinished jobs....
    In file included from llvmopencl/ParallelRegion.cc:40:0:
    llvmopencl/DebugHelpers.h:45:2: warning: extra ‘;’ [-Wpedantic]
     };
      ^
    make[4]: Leaving directory '/home/mmckee/opencl/ti-opencl/host/clocl'
    clocl/CMakeFiles/x86_clocl.dir/build.make:60: recipe for target 'clocl/x86/clocl' failed
    make[3]: *** [clocl/x86/clocl] Error 2
    make[3]: Leaving directory '/home/mmckee/opencl/ti-opencl/build/am57SYS_BIOS'
    CMakeFiles/Makefile2:429: recipe for target 'clocl/CMakeFiles/x86_clocl.dir/all' failed
    make[2]: *** [clocl/CMakeFiles/x86_clocl.dir/all] Error 2
    make[2]: Leaving directory '/home/mmckee/opencl/ti-opencl/build/am57SYS_BIOS'
    Makefile:149: recipe for target 'all' failed
    make[1]: *** [all] Error 2
    make[1]: Leaving directory '/home/mmckee/opencl/ti-opencl/build/am57SYS_BIOS'
    makefile:95: recipe for target 'install' failed
    make: *** [install] Error 2

    If you have any suggestions on how to proceed, I would appreciate them.

    Thanks,

    Matt McKee

  • Hi Matt,

    Thanks for reporting back. Yes, I had forgotten to build llvm x86_64 in the scripts for clocl_x86_64 build. I have updated the scripts in the previous post to include the following:

    +export X86_LLVM_DIR=${PWD}/ti-llvm/install.x86

    +#2.1 Linux on x86
    +### use your system default gcc-5/g++-5
    +CC="gcc-5" CXX="g++-5" CFLAGS="-m64" CXXFLAGS="-m64" \
    + make -f llvm/Makefile.ti all.x86 -j4
    +### results in install.x86

    Please give the updated scripts another try. Now it will take much longer time (~ 1 hour on my machine), most of which is spent in building the llvm x86_64. You also need to install g++-5 on your linux machine, if not already installed. Let us know how it goes. Thanks!

    - Yuan
  • I was able to successfully build OpenCL in its entirety with these changes and some small tweaks particular to my setup.

    Thanks for your help!

    -Matt McKee
  • Hi Matt,

        Thanks for confirming the result!  We'll try get the OpenCL RTOS package included in the next PSDK RTOS 5.2 release, so that we don't need this extra effort.

    - Yuan