<?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 Quote:Jeffrey M. (Intel) in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/structs-and-compiler-optimizations/m-p/1120194#M5481</link>
    <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Jeffrey M. (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Could we summarize your request as that you are looking for better inlining of address calculations instead of executing access_func for each work item?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Yes that is correct. The code has to be written this way, because it is generated &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px;"&gt;automatically&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt;. As I mentioned in my first post, the NVIDIA compiler is able to do the optimization. Maybe the optimization can be supported by additional keywords?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Jun 2017 08:42:11 GMT</pubDate>
    <dc:creator>Richard_S_7</dc:creator>
    <dc:date>2017-06-05T08:42:11Z</dc:date>
    <item>
      <title>structs and compiler optimizations</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/structs-and-compiler-optimizations/m-p/1120192#M5479</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have a question concerning the usage of structs. My current kernel accesses two buffers using a struct in the following way:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;struct pair {
    float first;
    float second;
};

inline const float f(const struct pair param) {
    return param.first * param.second;
}

inline const struct pair access_func(__global float const * const a, __global float const * const b, const int i) {
    struct pair res = {
            a&lt;I&gt;,
            b&lt;I&gt;
    };
    return res;
}

// slow
__kernel ...(__global float const * const a, __global float const * const b)
{
 // ...
 
 x = f( access_func( a, b, i ) );
 
 // ...
}&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;When I alter the kernel in the following way it runs much faster:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;// fast
__kernel ...(__global float const * const a, __global float const * const b)
{
 // ...
 
 x = a&lt;I&gt; * b[ i ];
 
 // ...
}&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;Is there a way to let the compiler do this optimization? The NVIDIA compiler seems to be able to do this, since I don't see a difference in runtime on a GPU.&lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jun 2017 10:23:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/structs-and-compiler-optimizations/m-p/1120192#M5479</guid>
      <dc:creator>Richard_S_7</dc:creator>
      <dc:date>2017-06-03T10:23:20Z</dc:date>
    </item>
    <item>
      <title>As I'm understanding your</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/structs-and-compiler-optimizations/m-p/1120193#M5480</link>
      <description>&lt;P&gt;As I'm understanding your code, the issue seems to be at least partially about the access function. &amp;nbsp;Could we summarize your request as that you are looking for better inlining of address calculations instead of executing access_func for each work item?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 06:57:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/structs-and-compiler-optimizations/m-p/1120193#M5480</guid>
      <dc:creator>Jeffrey_M_Intel1</dc:creator>
      <dc:date>2017-06-05T06:57:08Z</dc:date>
    </item>
    <item>
      <title>Quote:Jeffrey M. (Intel)</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/structs-and-compiler-optimizations/m-p/1120194#M5481</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Jeffrey M. (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Could we summarize your request as that you are looking for better inlining of address calculations instead of executing access_func for each work item?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Yes that is correct. The code has to be written this way, because it is generated &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px;"&gt;automatically&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt;. As I mentioned in my first post, the NVIDIA compiler is able to do the optimization. Maybe the optimization can be supported by additional keywords?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 08:42:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/structs-and-compiler-optimizations/m-p/1120194#M5481</guid>
      <dc:creator>Richard_S_7</dc:creator>
      <dc:date>2017-06-05T08:42:11Z</dc:date>
    </item>
  </channel>
</rss>

