Opencl test (two)

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 1
0x01 0x02 ....0x10
16 16 1
0x11 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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值