title: speedup when using float4, opencl
body: <p>I have the following opencl kernel function to get the column sum of a image.</p>
  
  <pre><code>__kernel void columnSum(__global float* src,__global float* dst,int srcCols,
                              int srcRows,int srcStep,int dstStep)   
  {
  
      const int x = get_global_id(0);
      srcStep &gt;&gt;= 2;
      dstStep &gt;&gt;= 2;
  
      if (x &lt; srcCols)
      {
          int srcIdx = x ;
          int dstIdx = x ;
  
          float sum = 0;
  
          for (int y = 0; y &lt; srcRows; ++y)
          {
              sum += src[srcIdx];
              dst[dstIdx] = sum;
              srcIdx += srcStep;
              dstIdx += dstStep;
          }
      }
  }
  </code></pre>
  
  <p>I assign that each thread process a column here so that a lot of threads can get the column_sum of each column in parallel.</p>
  
  <p>I also use float4 to rewrite the above kernel so that each thread can read 4 elements in a row at one time from the source image, which is shown below.</p>
  
  <pre><code>__kernel void columnSum(__global float* src,__global float* dst,int srcCols,
                              int srcRows,int srcStep,int dstStep)
  {
  
      const int x = get_global_id(0);
  
      srcStep &gt;&gt;= 2;
      dstStep &gt;&gt;= 2;
      if (x &lt; srcCols/4)
      {
          int srcIdx = x ;
          int dstIdx = x ;
  
          float4 sum = (float4)(0.0f, 0.0f, 0.0f, 0.0f);
  
          for (int y = 0; y &lt; srcRows; ++y)
          {
              float4 temp2;
              temp2 = vload4(0, &amp;src[4 * srcIdx]);
              sum = sum + temp2;
  
              vstore4(sum, 0, &amp;dst[4 * dstIdx]);
  
              srcIdx += (srcStep/4);
              dstIdx += (dstStep/4);
          }
      }
  }
  </code></pre>
  
  <p>In this case, theoretically, I think the time consumed by the second kernel to process a image should be 1/4 of the time consumed by the first kernel function. However, no matter how large the image is, the two kernels almost consume the same time. I don't know why. Can you guys give me some ideas? T</p>