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.

PROCESSOR-SDK-J784S4: tiovx

Part Number: PROCESSOR-SDK-J784S4

Tool/software:

Hi there,

Can tiovx be called in a ccs project to run on dsp c7x? Could you provide an example code? Which includes and linker settings should be done?

Or is tiovx designed for a72 cores?

Best

  • Hello Teknik,

    Due to India holiday, responses will be delayed by a day or two.

    Josue

  • Hi,

    Tiovx has the HOST as A72, i.e. all the allocations of buffers is done by A72 (HLOS). Only the kernel is executed on the target. 

    So we would need A72 HLOS here for buffer allocations.

    Regards,

    Nikhil

  • So, basically can we say that one needs to work on A72 to use dsp cores with tiovx.

    Then, what about vxlib? Or directly working on c7x dsp cores?

  • Hi,

    So, basically can we say that one needs to work on A72 to use dsp cores with tiovx.

    Yes, correct.

    Then, what about vxlib? Or directly working on c7x dsp cores?

    vxlibs are utilized in a c7x kernel running on the C7x target. But to provide the buffers required for this libs, you would require A72 in a TIOVX framework

    Regards,

    Nikhil

  • this code is provided in the vxlib_09_02_00_04 folder. Can I use this code in my code composer project which i believe directly works on c7x target?

    #include "VXLIB_bufParams.h"
    #include "VXLIB_types.h"
    #include "vxlib.h"
    #include <cstdio>
    #include <stdint.h>
    
    #define height (3)
    #define width (3)
    
    /******************************************************************************/
    /*                                                                            */
    /* main                                                                       */
    /*                                                                            */
    /******************************************************************************/
    
    int main(void)
    {
    
       // clang-format off
    
      // Setup input and output buffers for single- and double-precision datatypes
       uint8_t in0[] = {100, 50, 0,
    		            255, 25, 40,
                        65, 80, 120};
    
       uint8_t in1[] = {100, 75, 5,
    		            55, 15, 60,
    		            40, 100, 10};
       
       uint8_t out[] = {0, 0, 0,
    		            0, 0, 0,
    		            0, 0, 0};
    
       // clang-format on
    
       // handles and struct for call to kernel
       VXLIB_STATUS           status;
       VXLIB_absDiff_InitArgs kerInitArgs;
       int32_t                handleSize = VXLIB_absDiff_getHandleSize(&kerInitArgs);
       VXLIB_kernelHandle     handle     = malloc(handleSize);
    
       VXLIB_bufParams2D_t bufParamsIn0, bufParamsIn1, bufParamsOut;
    
       // fill in input and output buffer parameters
       bufParamsIn0.data_type = VXLIB_UINT8;
       bufParamsIn0.dim_x     = width;
       bufParamsIn0.dim_y     = height;
       bufParamsIn0.stride_y  = width * sizeof(uint8_t);
    
       bufParamsIn1.data_type = VXLIB_UINT8;
       bufParamsIn1.dim_x     = width;
       bufParamsIn1.dim_y     = height;
       bufParamsIn1.stride_y  = width * sizeof(uint8_t);
    
       bufParamsOut.data_type = VXLIB_UINT8;
       bufParamsOut.dim_x     = width;
       bufParamsOut.dim_y     = height;
       bufParamsOut.stride_y  = width * sizeof(uint8_t);
    
       kerInitArgs.funcStyle = VXLIB_FUNCTION_OPTIMIZED;
    
       status = VXLIB_SUCCESS;
    
       // init checkparams
       if (status == VXLIB_SUCCESS)
          status = VXLIB_absDiff_init_checkParams(handle, &bufParamsIn0, &bufParamsIn1, &bufParamsOut, &kerInitArgs);
    
       // init
       if (status == VXLIB_SUCCESS)
          status = VXLIB_absDiff_init(handle, &bufParamsIn0, &bufParamsIn1, &bufParamsOut, &kerInitArgs);
    
       // exec checkparams
       if (status == VXLIB_SUCCESS)
          VXLIB_absDiff_exec_checkParams(handle, in0, in1, out);
    
       // exec
       if (status == VXLIB_SUCCESS)
          status = VXLIB_absDiff_exec(handle, in0, in1, out);
    
       printf("UINT8 DATA");
       // print results
       for (size_t i = 0; i < height; i++) {
          printf("\n\n");
          for (size_t j = 0; j < width; j++) {
             printf("%d, ", out[i * width + j]);
          }
       }
       printf("\n\n");
    
       // clang-format off
    
      // Setup input and output buffers for single- and double-precision datatypes
       int16_t in0_16[] = {32767, 10000, 5000,
    		            20000, 25000, 400,
                        6500, 800, 1200};
    
       int16_t in1_16[] = {-32767, -7500, 500,
    		            -5500, 150, 600,
    		            400, 100, -10};
       
       int16_t out_16[] = {0, 0, 0,
    		            0, 0, 0,
    		            0, 0, 0};
    
       // clang-format on
    
       // fill in input and output buffer parameters
       bufParamsIn0.data_type = VXLIB_INT16;
       bufParamsIn0.dim_x     = width;
       bufParamsIn0.dim_y     = height;
       bufParamsIn0.stride_y  = width * sizeof(int16_t);
    
       bufParamsIn1.data_type = VXLIB_INT16;
       bufParamsIn1.dim_x     = width;
       bufParamsIn1.dim_y     = height;
       bufParamsIn1.stride_y  = width * sizeof(int16_t);
    
       bufParamsOut.data_type = VXLIB_INT16;
       bufParamsOut.dim_x     = width;
       bufParamsOut.dim_y     = height;
       bufParamsOut.stride_y  = width * sizeof(int16_t);
    
       kerInitArgs.funcStyle = VXLIB_FUNCTION_OPTIMIZED;
    
       status = VXLIB_SUCCESS;
    
       // init checkparams
       if (status == VXLIB_SUCCESS)
          status = VXLIB_absDiff_init_checkParams(handle, &bufParamsIn0, &bufParamsIn1, &bufParamsOut, &kerInitArgs);
    
       // init
       if (status == VXLIB_SUCCESS)
          status = VXLIB_absDiff_init(handle, &bufParamsIn0, &bufParamsIn1, &bufParamsOut, &kerInitArgs);
    
       // exec checkparams
       if (status == VXLIB_SUCCESS)
          VXLIB_absDiff_exec_checkParams(handle, in0_16, in1_16, out_16);
    
       // exec
       if (status == VXLIB_SUCCESS)
          status = VXLIB_absDiff_exec(handle, in0_16, in1_16, out_16);
    
       printf("INT16 DATA");
       // print results
       for (size_t i = 0; i < height; i++) {
          printf("\n\n");
          for (size_t j = 0; j < width; j++) {
             printf("%d, ", out_16[i * width + j]);
          }
       }
       printf("\n\n");
    
       free(handle);
    
       return 0;
    }

  • Oh.. ok, Yes. you can run these in no-boot mode on CCS as standalone examples on C7x.

    Please note that this is not TIOVX. These are independent DSP based examples.

    Please find the build instructions here 

    VXLIB User Guide: Ubuntu 22.04 Build Instructions for VXLIB

    Regards,

    Nikhil

  • Please find the build instructions here 

    VXLIB User Guide: Ubuntu 22.04 Build Instructions for VXLIB

    What do I need this for?

    Thanks,

    Teknik

  • To run VXLIB kernels examples for C7x target on CCS, you would require the .out file of the program which can be generated using the above build steps.

    I assume this is your usecase?

    Regards,

    Nikhil

  • vxlib_09_02_00_04 has dilate kernel. What about erosion? I could not see it. How possibly it is not included?

  • Hi,

    Only the below kernels are available in the SDK currently. under vxlib_09_02_00_04 

    VXLIB User Guide: VXLIB kernels (ti.com)

    vxlib_09_02_00_04 are optimized implementation of vxlib for C7x core.

    For the kernels not available here, we have a "vxlib" in the SDK.

    This package implements OpenVX v1.1 low level kernels cross compiled for C7x DSP

    VXLIB Function Reference

    Regards,

    Nikhil

  • Hi Nikhil,

    Thank you for your quick response.

    I am using vxlib_09_02_00_04 for dilation. And, I am going to use vxlib for erosion purposes. However, there are lots of file in the sdk source. Such as, VXLIB_dilate_3x3_i8u_o8u.h, VXLIB_dilate_3x3_i8u_o8u_cn.c, VXLIB_dilate_3x3_i8u_o8u_idat.c ...
    what is _cn for, or idat for? which one I should use? Or there is a c66 folder, it is a bit confusing. Can you guide me, or is there any tutorial or example code? 

    Best,
    Tenik

  • Hi Teknik,

    This is a duplicate question to something you have already posted here: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1417095/processor-sdk-j784s4-vxlib

    Your question has been answered there. 

    Best,

    Asha