Tomy

about scatter/gather.

Discussion created by Tomy on Sep 20, 2008
Latest reply on Sep 29, 2008 by MicahVillmow
I'm programming kernel which moves like gatherOP/scatterOP.

Hi, All.

I am programming kernel which moves like gatherOP/scatterOP.

but, scatter kernel doesn't move well.

 

example program:

kernel void sub(float a<>, out float b<>{

           b = a - 100;

}

kernel void gather(float test_index<>, float input1D[], out float gather_data<>{

          gather_data = input1D[test_index];

}

kernel void scatter(float test_index<>, float gather_data<>, out float4 outpu1D[]){

          output1D[test_index] = gather_data;

}

......

          for(i=0;i<4;i++){

                     int index = i * Width;

                     test_index = index;

          }

......

          float stream_index<4>;

          float gather<4>;

          float temp<4>;

          float input1D<Length>;

         

          streamRead(input1D, input_data);

          streamRead(stream_index, test_index);

          gather(stream_index, input1D, gather);

          sub(gather, temp);

          scatter(stream_index,temp,input1D);

          streamWrite(input1D, input_data

The result which executed this program is the next.

./test -x 4 -y 4

input1D:

0.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00

test_index:

0 4 8 12

gather:

0.00 4.00 8.00 12.00

temp:

-100.00 -96.00 -92.00 -88.00

input_data:

-100.00 -100.00 -100.00 -100.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00

 

Movement of scatter kernel is strange.

I expect the following result.

input_data:

-100.00 1.00 2.00 3.00 -96.00 5.00 6.00 7.00 -92.00 9.00 10.00 11.00 -88.00 13.00 14.00 15.00

But I don't knowthe cause of this problem.

Do you know what this problem is?

sorry, me poor english.

thank you.

Outcomes