<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic auto-vectorization question in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/auto-vectorization-question/m-p/1115791#M5397</link>
    <description>&lt;P&gt;can someone comment on my question posted in the below link? especially regarding my Question#1?&lt;/P&gt;

&lt;P&gt;&lt;A href="https://forums.khronos.org/showthread.php/13009-Vectorization-on-various-opencl-implementations" target="_blank"&gt;https://forums.khronos.org/showthread.php/13009-Vectorization-on-various-opencl-implementations&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
    <pubDate>Fri, 18 Mar 2016 04:31:51 GMT</pubDate>
    <dc:creator>QFang1</dc:creator>
    <dc:date>2016-03-18T04:31:51Z</dc:date>
    <item>
      <title>auto-vectorization question</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/auto-vectorization-question/m-p/1115791#M5397</link>
      <description>&lt;P&gt;can someone comment on my question posted in the below link? especially regarding my Question#1?&lt;/P&gt;

&lt;P&gt;&lt;A href="https://forums.khronos.org/showthread.php/13009-Vectorization-on-various-opencl-implementations" target="_blank"&gt;https://forums.khronos.org/showthread.php/13009-Vectorization-on-various-opencl-implementations&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 04:31:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/auto-vectorization-question/m-p/1115791#M5397</guid>
      <dc:creator>QFang1</dc:creator>
      <dc:date>2016-03-18T04:31:51Z</dc:date>
    </item>
    <item>
      <title>Hi,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/auto-vectorization-question/m-p/1115792#M5398</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Intel OpenCL compiler for the Intel(R) Processor Graphics will compile your kernel SIMD32 (if it is really small one and uses upto 128 bytes or private memory&amp;nbsp;per work item), SIMD16 (medium kernel with between 129 and upto 256 bytes of private memory per work item) or SIMD8 (large kernel with between 257 and upto 512 bytes of private memory per work item), meaning that either 32, 16, or 8 work items will be packed onto a hardware thread. This is the autovectorization that we do. The thing is, in a lot of cases, reading and writing data is much&amp;nbsp;more efficient when you deal with float4s (uint4s, int4s or uchar16s, etc.) - our architecture's sweet spot. In addition, many times you can benefit from more computational density per work item.&lt;/P&gt;

&lt;P&gt;I cannot answer for NVidia and AMD, since I am not very familiar with their architectures. Maybe someone else&amp;nbsp;can chime in.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 15:59:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/auto-vectorization-question/m-p/1115792#M5398</guid>
      <dc:creator>Robert_I_Intel</dc:creator>
      <dc:date>2016-03-18T15:59:57Z</dc:date>
    </item>
    <item>
      <title>Quote:Robert Ioffe (Intel)</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/auto-vectorization-question/m-p/1115793#M5399</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Robert Ioffe (Intel) wrote:&lt;BR /&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;The thing is, in a lot of cases, reading and writing data is much&amp;nbsp;more efficient when you deal with float4s (uint4s, int4s or uchar16s, etc.) - our architecture's sweet spot. In addition, many times you can benefit from more computational density per work item&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;hi Robert, thanks for the comment. in fact, the lines that I had to manually vectorize indeed operate on float4 data structures, but somehow, the CPU OCL did not recognize those could be SIMDed. see&lt;/P&gt;

&lt;P&gt;&lt;A href="https://github.com/fangq/mcxcl/commit/4bcfebdf37fb36fba56fd9bb46c12771e21a64b1#diff-3e7bff849d973dfbbbf2ff6591ee8862L216" target="_blank"&gt;https://github.com/fangq/mcxcl/commit/4bcfebdf37fb36fba56fd9bb46c12771e21a64b1#diff-3e7bff849d973dfbbbf2ff6591ee8862L216&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I even added the fourth components (htime[0].w) to facilitate Intel OCL to recognize and auto-vectorize the function, but did not seem to help. Running the function with the below lines still give me the slow speed. I am not sure why the CPU driver fail to vectorize the below lines.&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;      htime[0].x=fabs(floor(p0[0].x)+(v[0].x&amp;gt;0.f)-p0[0].x);
      htime[0].y=fabs(floor(p0[0].y)+(v[0].y&amp;gt;0.f)-p0[0].y);
      htime[0].z=fabs(floor(p0[0].z)+(v[0].z&amp;gt;0.f)-p0[0].z);
      htime[0].w=fabs(floor(p0[0].w)+(v[0].w&amp;gt;0.f)-p0[0].w);

      htime[0].x=fabs(native_divide(htime[0].x,v[0].x));
      htime[0].y=fabs(native_divide(htime[0].y,v[0].y));
      htime[0].z=fabs(native_divide(htime[0].z,v[0].z));
      htime[0].w=fabs(native_divide(htime[0].w,v[0].w));&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Mar 2016 03:52:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/auto-vectorization-question/m-p/1115793#M5399</guid>
      <dc:creator>QFang1</dc:creator>
      <dc:date>2016-03-19T03:52:00Z</dc:date>
    </item>
  </channel>
</rss>

