<?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 Compiler crash on byte swap function for ulong in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/Compiler-crash-on-byte-swap-function-for-ulong/m-p/1036360#M3708</link>
    <description>&lt;P&gt;Hi, everybody!&lt;/P&gt;

&lt;P&gt;I found a bit strange bug in OpenCL compiler for Intel HD4000 GPU (and maybe for all Intel GPUs).&lt;/P&gt;

&lt;P&gt;Consider this kernel code:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;ulong reverse( ulong x )
{
    ulong y = x &amp;gt;&amp;gt; 0x38;
    y |= ( ( x &amp;gt;&amp;gt; 0x28 ) &amp;amp; 0x000000000000FF00 );
    y |= ( ( x &amp;gt;&amp;gt; 0x18 ) &amp;amp; 0x0000000000FF0000 );
    y |= ( ( x &amp;gt;&amp;gt; 0x08 ) &amp;amp; 0x00000000FF000000 );
    y |= ( ( x &amp;lt;&amp;lt; 0x08 ) &amp;amp; 0x000000FF00000000 );
    y |= ( ( x &amp;lt;&amp;lt; 0x18 ) &amp;amp; 0x0000FF0000000000 );
    y |= ( ( x &amp;lt;&amp;lt; 0x28 ) &amp;amp; 0x00FF000000000000 );
    y |= x &amp;lt;&amp;lt; 0x38;
    
    return y;
}

ulong reverseHigh( ulong x )
{
    ulong y = x &amp;gt;&amp;gt; 0x38;
    y |= ( ( x &amp;gt;&amp;gt; 0x28 ) &amp;amp; 0x000000000000FF00 );
    y |= ( ( x &amp;gt;&amp;gt; 0x18 ) &amp;amp; 0x0000000000FF0000 );
    y |= ( ( x &amp;gt;&amp;gt; 0x08 ) &amp;amp; 0x00000000FF000000 );
    
    return y;
}

ulong reverseLow( ulong x )
{
    ulong y = x &amp;lt;&amp;lt; 0x38;
    y |= ( ( x &amp;lt;&amp;lt; 0x08 ) &amp;amp; 0x000000FF00000000 );
    y |= ( ( x &amp;lt;&amp;lt; 0x18 ) &amp;amp; 0x0000FF0000000000 );
    y |= ( ( x &amp;lt;&amp;lt; 0x28 ) &amp;amp; 0x00FF000000000000 );
    
    return y;
}

ulong rev( ulong x )
{
    return reverseHigh( x ) | reverseLow( x );
}

__kernel void func( __global ulong* input, __global ulong* output )
{
    uint gid = get_global_id( 0 );
    
    // those 2 functions doesn't compile
    output[ gid ] = reverse( input[ gid ] );
    //output[ gid ] = rev( input[ gid ] );
    
    // this code is work!
    //output[ gid ] = reverseHigh( input[ gid ] ) | reverseLow( input[ gid ] );
}
&lt;/PRE&gt;

&lt;P&gt;Compiler will crash with very strange error:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;fcl build 1 succeeded.
error: Cannot yet select: 0x5e82160: i64 = bswap 0x5f26550 [ORD=5] [ID=25]
  0x5f26550: i64,ch = GHAL3DISD::LOAD64 0x5f262a8, 0x5f26440, 0x5f264c8 [ID=24]
    0x5f262a8: i32,ch = load 0x5e81d20:1, 0x5f26220, 0x5e82050&amp;lt;LD4[%2](align=8)&amp;gt; [ID=21]
      0x5e81d20: i32,ch = llvm.GHAL3D.get.global.id 0x5e81770, 0x5e81fc8, 0x5e81c98 [ORD=1] [ID=11]
        0x5e81770: ch = EntryToken [ORD=1] [ID=0]
        0x5e81fc8: i32 = Constant&amp;lt;77&amp;gt; [ID=5]
        0x5e81c98: i32 = Constant&amp;lt;0&amp;gt; [ORD=1] [ID=3]
// a lot more lines...&lt;/PRE&gt;

&lt;P&gt;This happens if reverse() or rev() functions are used in kernel and doesn't happen, when using the last line of code, which in fact is inlining of rev() function.&lt;/P&gt;

&lt;P&gt;Inline keyword doesn't help.&lt;/P&gt;

&lt;P&gt;I test this code on my Asus notebook and I can't install Intel SDK. It complains for old OpenCL driver. I downloaded the latest beta driver from official site and copied Intel_OpenCL_ICD64.dll (ver. 2.0.0.0), IntelOpenCL64.dll (ver. 10.18.10.3652), Intel_OpenCL_ICD32.dll (ver. 2.0.0.0) and IntelOpenCL32.dll (ver. 10.18.10.3652) to System32 and SysWOW64 folders. The error remains.&lt;/P&gt;

&lt;P&gt;Any help will be appreciated.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 30 Aug 2014 17:56:35 GMT</pubDate>
    <dc:creator>Dmitry_Z_</dc:creator>
    <dc:date>2014-08-30T17:56:35Z</dc:date>
    <item>
      <title>Compiler crash on byte swap function for ulong</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Compiler-crash-on-byte-swap-function-for-ulong/m-p/1036360#M3708</link>
      <description>&lt;P&gt;Hi, everybody!&lt;/P&gt;

&lt;P&gt;I found a bit strange bug in OpenCL compiler for Intel HD4000 GPU (and maybe for all Intel GPUs).&lt;/P&gt;

&lt;P&gt;Consider this kernel code:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;ulong reverse( ulong x )
{
    ulong y = x &amp;gt;&amp;gt; 0x38;
    y |= ( ( x &amp;gt;&amp;gt; 0x28 ) &amp;amp; 0x000000000000FF00 );
    y |= ( ( x &amp;gt;&amp;gt; 0x18 ) &amp;amp; 0x0000000000FF0000 );
    y |= ( ( x &amp;gt;&amp;gt; 0x08 ) &amp;amp; 0x00000000FF000000 );
    y |= ( ( x &amp;lt;&amp;lt; 0x08 ) &amp;amp; 0x000000FF00000000 );
    y |= ( ( x &amp;lt;&amp;lt; 0x18 ) &amp;amp; 0x0000FF0000000000 );
    y |= ( ( x &amp;lt;&amp;lt; 0x28 ) &amp;amp; 0x00FF000000000000 );
    y |= x &amp;lt;&amp;lt; 0x38;
    
    return y;
}

ulong reverseHigh( ulong x )
{
    ulong y = x &amp;gt;&amp;gt; 0x38;
    y |= ( ( x &amp;gt;&amp;gt; 0x28 ) &amp;amp; 0x000000000000FF00 );
    y |= ( ( x &amp;gt;&amp;gt; 0x18 ) &amp;amp; 0x0000000000FF0000 );
    y |= ( ( x &amp;gt;&amp;gt; 0x08 ) &amp;amp; 0x00000000FF000000 );
    
    return y;
}

ulong reverseLow( ulong x )
{
    ulong y = x &amp;lt;&amp;lt; 0x38;
    y |= ( ( x &amp;lt;&amp;lt; 0x08 ) &amp;amp; 0x000000FF00000000 );
    y |= ( ( x &amp;lt;&amp;lt; 0x18 ) &amp;amp; 0x0000FF0000000000 );
    y |= ( ( x &amp;lt;&amp;lt; 0x28 ) &amp;amp; 0x00FF000000000000 );
    
    return y;
}

ulong rev( ulong x )
{
    return reverseHigh( x ) | reverseLow( x );
}

__kernel void func( __global ulong* input, __global ulong* output )
{
    uint gid = get_global_id( 0 );
    
    // those 2 functions doesn't compile
    output[ gid ] = reverse( input[ gid ] );
    //output[ gid ] = rev( input[ gid ] );
    
    // this code is work!
    //output[ gid ] = reverseHigh( input[ gid ] ) | reverseLow( input[ gid ] );
}
&lt;/PRE&gt;

&lt;P&gt;Compiler will crash with very strange error:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;fcl build 1 succeeded.
error: Cannot yet select: 0x5e82160: i64 = bswap 0x5f26550 [ORD=5] [ID=25]
  0x5f26550: i64,ch = GHAL3DISD::LOAD64 0x5f262a8, 0x5f26440, 0x5f264c8 [ID=24]
    0x5f262a8: i32,ch = load 0x5e81d20:1, 0x5f26220, 0x5e82050&amp;lt;LD4[%2](align=8)&amp;gt; [ID=21]
      0x5e81d20: i32,ch = llvm.GHAL3D.get.global.id 0x5e81770, 0x5e81fc8, 0x5e81c98 [ORD=1] [ID=11]
        0x5e81770: ch = EntryToken [ORD=1] [ID=0]
        0x5e81fc8: i32 = Constant&amp;lt;77&amp;gt; [ID=5]
        0x5e81c98: i32 = Constant&amp;lt;0&amp;gt; [ORD=1] [ID=3]
// a lot more lines...&lt;/PRE&gt;

&lt;P&gt;This happens if reverse() or rev() functions are used in kernel and doesn't happen, when using the last line of code, which in fact is inlining of rev() function.&lt;/P&gt;

&lt;P&gt;Inline keyword doesn't help.&lt;/P&gt;

&lt;P&gt;I test this code on my Asus notebook and I can't install Intel SDK. It complains for old OpenCL driver. I downloaded the latest beta driver from official site and copied Intel_OpenCL_ICD64.dll (ver. 2.0.0.0), IntelOpenCL64.dll (ver. 10.18.10.3652), Intel_OpenCL_ICD32.dll (ver. 2.0.0.0) and IntelOpenCL32.dll (ver. 10.18.10.3652) to System32 and SysWOW64 folders. The error remains.&lt;/P&gt;

&lt;P&gt;Any help will be appreciated.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Aug 2014 17:56:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Compiler-crash-on-byte-swap-function-for-ulong/m-p/1036360#M3708</guid>
      <dc:creator>Dmitry_Z_</dc:creator>
      <dc:date>2014-08-30T17:56:35Z</dc:date>
    </item>
    <item>
      <title>Thanks for this report.  I've</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Compiler-crash-on-byte-swap-function-for-ulong/m-p/1036361#M3709</link>
      <description>&lt;P&gt;Thanks for this report. &amp;nbsp;I've been able to reproduce at least some of the behavior you've described, and it certainly looks like it could be a bug. &amp;nbsp;We'll investigate and get back to you with more details.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Sep 2014 05:18:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Compiler-crash-on-byte-swap-function-for-ulong/m-p/1036361#M3709</guid>
      <dc:creator>Jeffrey_M_Intel1</dc:creator>
      <dc:date>2014-09-03T05:18:33Z</dc:date>
    </item>
  </channel>
</rss>

