<?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 mad() for float always returns 0 in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/mad-for-float-always-returns-0/m-p/799215#M776</link>
    <description>Hey,&lt;BR /&gt;&lt;BR /&gt;Thanks for the detailed report. We will investigate the issue and fix it.&lt;BR /&gt;&lt;BR /&gt;Boaz</description>
    <pubDate>Thu, 24 Feb 2011 21:21:56 GMT</pubDate>
    <dc:creator>Boaz_O_Intel</dc:creator>
    <dc:date>2011-02-24T21:21:56Z</dc:date>
    <item>
      <title>mad() for float always returns 0</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/mad-for-float-always-returns-0/m-p/799213#M774</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;after manually converting most multiply-add expressions in my kernel to mad() calls for testing, the Intel OpenCL implementation started to return wrong results, although the implementations by other vendors work fine. Try this code in the offline compiler tool coming with SDK 1.1.0.0 (64-bit):&lt;BR /&gt;&lt;BR /&gt;__kernel void a(int2 in_res,float2 pos)&lt;BR /&gt;{&lt;BR /&gt; int2 coord=convert_int2(pos); &lt;BR /&gt; float2 t=pos-convert_float2(coord),s=1.0f-t;&lt;BR /&gt;&lt;BR /&gt; //volatile float value=mad(t.x,t.y,s.x);&lt;BR /&gt; volatile float value=t.x*t.y+s.x;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;The above will create correct code, something like&lt;BR /&gt;&lt;BR /&gt;_a: # @a&lt;BR /&gt;# BB#0:&lt;BR /&gt; sub RSP, 36&lt;BR /&gt; movq XMM0, QWORD PTR [RSP + 84]&lt;BR /&gt; cvttps2dq XMM1, XMM0&lt;BR /&gt; cvtdq2ps XMM1, XMM1&lt;BR /&gt; subps XMM0, XMM1&lt;BR /&gt; movss XMM1, DWORD PTR [RIP + LCPI3_0]&lt;BR /&gt; subss XMM1, XMM0&lt;BR /&gt; pshufd XMM2, XMM0, 1&lt;BR /&gt; mulss XMM2, XMM0&lt;BR /&gt; addss XMM2, XMM1&lt;BR /&gt; movss DWORD PTR [RSP + 32], XMM2&lt;BR /&gt; add RSP, 36&lt;BR /&gt; ret&lt;BR /&gt;&lt;BR /&gt;for the non-vectorized version. If you use the commented-out mad() call instead, I get this (again for the non-vectorized version):&lt;BR /&gt;&lt;BR /&gt;_a: # @a&lt;BR /&gt;# BB#0:&lt;BR /&gt; sub RSP, 36&lt;BR /&gt; mov DWORD PTR [RSP + 32], 0&lt;BR /&gt; add RSP, 36&lt;BR /&gt; ret&lt;BR /&gt;&lt;BR /&gt;So a constant value of 0 is written to "value", which seems quite wrong to me ;-)&lt;BR /&gt;&lt;BR /&gt;The auto-vectorized versions suffer from the same bug, by the way.&lt;BR /&gt;&lt;BR /&gt;PS: Interestingly, passing "-cl-mad-enable" to the compiler does not change anything, it does not make the issue appear for the first version.</description>
      <pubDate>Thu, 17 Feb 2011 15:50:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/mad-for-float-always-returns-0/m-p/799213#M774</guid>
      <dc:creator>sschuberth</dc:creator>
      <dc:date>2011-02-17T15:50:31Z</dc:date>
    </item>
    <item>
      <title>mad() for float always returns 0</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/mad-for-float-always-returns-0/m-p/799214#M775</link>
      <description>Hm, no reply yet? Can any Intel official reproduce the issue?</description>
      <pubDate>Wed, 23 Feb 2011 06:25:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/mad-for-float-always-returns-0/m-p/799214#M775</guid>
      <dc:creator>sschuberth</dc:creator>
      <dc:date>2011-02-23T06:25:17Z</dc:date>
    </item>
    <item>
      <title>mad() for float always returns 0</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/mad-for-float-always-returns-0/m-p/799215#M776</link>
      <description>Hey,&lt;BR /&gt;&lt;BR /&gt;Thanks for the detailed report. We will investigate the issue and fix it.&lt;BR /&gt;&lt;BR /&gt;Boaz</description>
      <pubDate>Thu, 24 Feb 2011 21:21:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/mad-for-float-always-returns-0/m-p/799215#M776</guid>
      <dc:creator>Boaz_O_Intel</dc:creator>
      <dc:date>2011-02-24T21:21:56Z</dc:date>
    </item>
  </channel>
</rss>

