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.

EVE/VCOP/KernelC : one byte load store is possible or not?

Hello,

I am writing program in kernel-C. Trying to load & store 1byte data value.

Eg: If input :  17 18 19 20 21       output : 0 0 0 0 0

desire output : 18 0 0 0 0

I tried using onept() for load & store. But output results : 17 18 19 0 0

so, want to know which operation can i use to produce the desired output.

Regards

Surbhi

  • Hello,

    I am writing program in kernel-C. Trying to load & store 1byte data value.

    Eg: If input :  17  18  19  20  21 ......  31  32

                           33  34  35  36  37 ...... 47  48

        output : 0 0 0 0 0 ........ 0 0

                      0 0 0 0 0 ........ 0 0

    desire output : 18  0  0  0  0  ......  0  31

                               34  0  0  0  0  ...... 0  47

    I tried using onept() for load & store. But output results :

    17  18  19   0   0   0   0   0   0   0   0   0   0   0   0  30
    31  32   0   0   0   0   0   0   0   0   0   0   0   0   0   0

    so, want to know which operation can i use to produce the desired output.


    Regards

    Surbhi



  • Surbhi,
    Can you share your kernel C loop?

    Regards,
    Anshu
  • #define ELEMSZ_IN sizeof(*input)
    #define ELEMSZ_OUT sizeof(*output)

    for(int col= 0;col < img_height-1; col++)
    {
    __agen AddrIn = col*ELEMSZ_IN;
    __agen AddrOut = col*ELEMSZ_OUT;
    Vin1= (input+img_width+1)[AddrIn].onept();
    Vin2= (input+img_width+(img_width-2))[AddrIn].onept();

    (output+img_width)[AddrOut].onept() = Vin1;
    (output+img_width+(img_width-1))[AddrOut].onept() = Vin2;
    }
  • One issue I see is that AddrIn and AddrOut should be set to:

    __agen AddrIn = col*img_width*ELEMSZ_IN;

    __agen AddrOut = col*img_width*ELEMSZ_OUT;

    Also you should use ELMSZ_IN or ELMSZ_OUT when adding offsets to addresses input and output:

    Vin1= (input+(img_width+1)*ELMSZ_IN)[AddrIn].onept();
    Vin2= (input+(img_width+(img_width-2))*ELMSZ_IN)[AddrIn].onept();

    (output+img_width*ELMSZ_OUT)[AddrOut].onept() = Vin1;
    (output+(img_width+(img_width-1))*ELMSZ_OUT)[AddrOut].onept() = Vin2;

    I am not sure if adding img_width is the right thing to do, because according to the output pattern you described, it should be:

    Vin1= (input+ELMSZ_IN)[AddrIn].onept();
    Vin2= (input+(img_width-2)*ELMSZ_IN)[AddrIn].onept();

    (output)[AddrOut].onept() = Vin1;
    (output+(img_width-1)*ELMSZ_OUT)[AddrOut].onept() = Vin2;

  • Hi victor,

    I tried with your code but compilation error occur while using ELMSZ_IN or ELMSZ_OUT for load & store i.e
    Vin1= (input+ELMSZ_IN)[AddrIn].onept();
    Vin2= (input+(img_width-2)*ELMSZ_IN)[AddrIn].onept();

    (output)[AddrOut].onept() = Vin1;
    (output+(img_width-1)*ELMSZ_OUT)[AddrOut].onept() = Vin2;
    or,
    Vin1= (input+(img_width+1)*ELMSZ_IN)[AddrIn].onept();
    Vin2= (input+(img_width+(img_width-2))*ELMSZ_IN)[AddrIn].onept();

    (output+img_width*ELMSZ_OUT)[AddrOut].onept() = Vin1;
    (output+(img_width+(img_width-1))*ELMSZ_OUT)[AddrOut].onept() = Vin2;

    I have attached the log:
    >> Compilation failure
    subdir_rules.mk:7: recipe for target 'Solution.obj' failed
    "Solution.c", line 32: error #20: identifier "ELMSZ_OUT" is undefined
    "Solution.c", line 36: error #20: identifier "ELMSZ_IN" is undefined
    2 errors detected in the compilation of "Solution.c".


    Regards
    Surbhi
  • Hi Surbhi,

    Please make sure, you have included these lines at the beginning of the *.k file:

    #define ELEMSZ_IN sizeof(*input) 
    #define ELEMSZ_OUT sizeof(*output)

    regards,

    Victor

  • yes it is their. I have mentioned in the previous post.
  • Surbhi,
    Can you share your .k file. Its difficult to comment why you are getting these build error based on the information provided here.

    Regards,
    Anshu
  • Surbhi,
    Can you update us on this query? Were you able to progress on this?

    Regards,
    Anshu
  • Anshu,

    Thank you for your help. the problem was solved with few modifications.

    Regards
    Surbhi