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.

TDA2PXEVM: TDA2PXEVM

Part Number: TDA2PXEVM

Hi, 

Sample snippet:

for (int I1 = 0; I1 <  dstBlockHeight; I1++)

{

    for (int I2 = 0; I2 < dstBlockWidth / VCOP_SIMD_WIDTH; I2++)

    {

        AddrSrc = I1 * srcBlockWidth * ELEMINSIZE + I2 * ELEMINSIZE * VCOP_SIMD_WIDTH;

        VInA = (in + 5 * ELEMINSIZE)[AddrSrc];

        VInB = (in + 6 * ELEMINSIZE)[AddrSrc];

        ...

        ...

    }

}

for (int I1 = 0; I1 <  dstBlockHeight; I1++)

{

    for (int I2 = 0; I2 < dstBlockWidth / VCOP_SIMD_WIDTH; I2++)

    {
        AddrSrc = I1 * srcBlockWidth * ELEMINSIZE + I2 * ELEMINSIZE * VCOP_SIMD_WIDTH;

        VInA = (in + 60 * ELEMINSIZE)[AddrSrc];

        VInB = (in + 61 * ELEMINSIZE)[AddrSrc];

        ...

        ...

    }

}
for (int I1 = 0; I1 <  dstBlockHeight; I1++)

{

    for (int I2 = 0; I2 < dstBlockWidth / VCOP_SIMD_WIDTH; I2++)

    {

        AddrSrc = I1 * srcBlockWidth * ELEMINSIZE + I2 * ELEMINSIZE * VCOP_SIMD_WIDTH;

        VInA = (in + 75 * ELEMINSIZE)[AddrSrc];

        VInB = (in + 76 * ELEMINSIZE)[AddrSrc]; 

        ...

        ...

    }

}


The above snippet may repeat for any number of iterations (calculated runtime).

Expected snippet:
void vcop_kernel_sample

(

    __vptr_uint8_arr in,

    __vptr_uint16_arr out,

    unsigned int    num_objects,

)

{

    __vector Vin1, Vin2, Vin3;

    foreach (I0, num_objects, 5)

    {

        for (int I1 = 0; I1 <  dstBlockHeight; I1++)

        {

            for (int I2 = 0; I2 < dstBlockWidth / VCOP_SIMD_WIDTH; I2++)

            {

                AddrSrc = I1 * srcBlockWidth * ELEMINSIZE + I2 * ELEMINSIZE * VCOP_SIMD_WIDTH;

                VInA = (in + 5 * ELEMINSIZE)[AddrSrc];  // LOAD

                VInB = (in + 6 * ELEMINSIZE)[AddrSrc];

                ...

                ...

            }

        }

    }

}

Here I am trying to make the VCOP kernel code generalized with the use of foreach loop.
The problem with the above approach is, the load operation uses different data from different position on each iteration (Eg: 5 and 6 on first iteration , 60 and 61 on second iteration and so on ..).
 Is there any way to incorporate an array data into the loading operation part ? Please suggest a solution for the above scenario.

  • Hi, 

    A gentle reminder to this question

  • Hi Santhiya,

       Sorry for delay in response. As I understand you need to load from a different location for each iteration of foreach loop. If this is what you are looking for then you can specify the pointer to each iteration of the foreach loop separately. 

     __vptr_uint8_arr dataType expects an array of pointers so you can upfront provide the

    in1[0]  = Pointing to 5th position of buffer

    in2[0]  = Pointing to 6th position of buffer

    in1[1]  = Pointing to 60th position of buffer

    in2[1]  = Pointing to 61st position of buffer

    and so on

    void vcop_kernel_sample( __vptr_uint8_arr in1,__vptr_uint8_arr in2,  __vptr_uint16_arr out,    unsigned int    num_objects)

    foreach (I0, num_objects, 5)

        {

            for (int I1 = 0; I1 <  dstBlockHeight; I1++)

            {

                for (int I2 = 0; I2 < dstBlockWidth / VCOP_SIMD_WIDTH; I2++)

                {

                    AddrSrc = I1 * srcBlockWidth * ELEMINSIZE + I2 * ELEMINSIZE * VCOP_SIMD_WIDTH;

                    VInA = in_1[I0][AddrSrc];  // LOAD

                    VInB = in_2[I0][AddrSrc];

                    ...

                    ...

                }

            }

        }


    Regards,

    Anshu

  • Thanks for the reply Anshu.
    This is what I was looking for and it worked.