Opencl test (two)

来源:互联网 发布:我的世界0.14.1js大全 编辑:程序博客网 时间:2024/05/20 13:37

1.program.s is an Assembly language file which applyed PAAG.In program.s file ';' means that it is note.the colour of note may be different.

2.Instruction :

    set1: the value of setl was acquired by passing symbol table

              eg:r4=simpleVecAdd.get_global_id.0

                     explain:

                           frame function.call function.arguments

                           get_global_id(0) was defined in the library file.

                            It means the global threading id map simulation PAAG PE0,PE1,......

                            if there is one get_global_id ,it is one maintain,two get_global_id ,two maintain.

              eg:r5 = simpleVecAdd.1

                       explain:

                            formation: function.count(count = the address or subscript(index) of arguments)

                                                In function ,the default variable 0,1,2,3......

                                                eg:void simpleVecAdd(_global int * OutputC,

                                                                                         _global int* inputA,

                                                                                         _global int * inputB)

                                                       default OutputC 0,inputA 1,inputB 2

      beq a b c ;if(a>=b) pc=c

                         else       pc++

     bne a b c ;if(a!=b) pc=c

                        else pc++

    ldptr p0 r3;p0=r3 the value is coming from variable

   mov r246 r3;r246=r3

   bge  r3 r7 LBB;if(r3>=r7) pc=LBB

                              else         pc++

                               LBB is line-mark

                              bge b:branch

                                       g:greater than 

                                       e:equal to 

   addi r5 r5 2;r5=r5 +2

    mult r3 r5 r3; r3=r3*r5

    mvf  r6 p0;将下标为p0的值赋值给r6,r6=[p0]

    mvt p0 r3;将让r3的值传入下标为p0的数,[p0]=r3

   



arg.data 

 The first count---16 representative what?

 The second count---0 representative the first address 

 The third count---1 representative the count of line

 


FlyGenRegisterInfo.inc

      r representative interger the span is r0---r249

     p representative the special register the span is p0 ---p7

     f representative float the span is f0--f249



Note: delete flyclModuo need '-rf'

           rm -rf flyclModuo


In openvx.cpp file

     

memobjs[2]=clCreateBuffer(context,CL_MEME_READ_ONLY | CL_MEM_COPY_HOST_PTR,sizeof(cl_int)*WIDTH*HEIGHT,input,&err);memobjs[1]=clCreateBuffer(context,CL_MEME_READ_ONLY | CL_MEM_COPY_HOST_PTR,sizeof(cl_int)*WIDTH*HEIGHT,input2,&err);memobjs[0]=clCreateBuffer(context,CL_MEME_READ_ONLY | CL_MEM_COPY_HOST_PTR,sizeof(cl_int)*WIDTH*HEIGHT,NULL,&err);

<pre name="code" class="html">err = clSetKernelArg(kernel1,1,sizeof(cl_mem),(void*)&memobjs[0]);err |= clSetKernelArg(kernel1,2,sizeof(cl_mem),(void*)&memobjs[1]);err |= clSetKernelArg(kernel1,3,sizeof(cl_mem),(void*)&memobjs[2]);err |= clSetKernelArg(kernel1,3,sizeof(cl_mem),(void*)&dim);

16 0 10x01 0x02 ....0x1016 16 10x11 0x12 ......0x20

The result :

inputA  map memeobjs[2] address 1~15 default 0

inputB  map memeobjs[1] address 16~31 default 1

output  map memeobjs[0] address 3~47  default 2














0 0