<?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 Any update? in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/Is-clBuildProgram-needed-in-conjunction-with/m-p/1021818#M3314</link>
    <description>&lt;P&gt;Any update?&lt;/P&gt;</description>
    <pubDate>Thu, 26 Feb 2015 16:39:56 GMT</pubDate>
    <dc:creator>Logan_J_</dc:creator>
    <dc:date>2015-02-26T16:39:56Z</dc:date>
    <item>
      <title>Is clBuildProgram needed in conjunction with clCreateProgramFromBinary?</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Is-clBuildProgram-needed-in-conjunction-with/m-p/1021815#M3311</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;While trying to develop a standalone for a prior question, I noticed that offline compilation seems to behave differently for CPU and GPU. Per the OpenCL spec, my understanding is that I should be able to reuse compiled kernels (either through ioc32/64 or clCreateProgramFromSource/clBuild). When using a GPU device I can load said precompiled kernel through clCreateProgramFromBinary and be ready to use it. CPU, however, requires me to call clBuild yet again, which from a performance standpoint defeats the purpose of precompiling my kernels.&lt;/P&gt;

&lt;P&gt;I've attached a MSVC 2012 project to reproduce what I'm seeing. Under the release directory are some precompiled kernels that I generated using ioc32. The executable explains how to use it upon running it with no commands. The only thing it doesn't mention is it checks the extension to determine if the input file is a binary file or not. If the file doesn't end in .bin, it assumes its a text .cl file.&lt;/P&gt;

&lt;P&gt;Summary:&lt;/P&gt;

&lt;P&gt;offlineCompileBug.exe CPU Template.cl 0 - Fails (Expected)&lt;BR /&gt;
	offlineCompileBug.exe CPU Template.cl 1 - Succeeds (Expected)&lt;BR /&gt;
	offlineCompileBug.exe GPU Template.gpu.bin 0 - Succeeds (Expected)&lt;BR /&gt;
	offlineCompileBug.exe GPU Template.gpu.bin 1 - Succeeds (Not expected, why does compiling twice work?)&lt;BR /&gt;
	offlineCompileBug.exe CPU Template.cpu.bin 0 - Fails (Unexpected, and I believe is a problem)&lt;BR /&gt;
	offlineCompileBug.exe CPU Template.cpu.bin 1 - Succeeds (Not expected, why does compiling twice work?)&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Feb 2015 23:53:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Is-clBuildProgram-needed-in-conjunction-with/m-p/1021815#M3311</guid>
      <dc:creator>Logan_J_</dc:creator>
      <dc:date>2015-02-24T23:53:55Z</dc:date>
    </item>
    <item>
      <title>Logan,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Is-clBuildProgram-needed-in-conjunction-with/m-p/1021816#M3312</link>
      <description>&lt;P&gt;Logan,&lt;/P&gt;

&lt;P&gt;Funny, that I just created this post:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://software.intel.com/en-us/articles/using-spir-for-fun-and-profit-with-intel-opencl-code-builder" target="_blank"&gt;https://software.intel.com/en-us/articles/using-spir-for-fun-and-profit-with-intel-opencl-code-builder&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;In general, clCreateProgramFromBinary should probably be followed by clBuildProgram, since the binary could be SPIR, in which case it is not fully built. In our GPU case, when you fully prebuild the binary (generate .ir), clBuildProgram does not do much - it is basically a no-op, as evidenced by looking at the build log - it will be empty. In the case of the CPU binary, some linking is still involved at the clBuildProgram step, but compilation step is saved. I will ask the CPU device team whether that is necessary.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Feb 2015 00:37:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Is-clBuildProgram-needed-in-conjunction-with/m-p/1021816#M3312</guid>
      <dc:creator>Robert_I_Intel</dc:creator>
      <dc:date>2015-02-25T00:37:33Z</dc:date>
    </item>
    <item>
      <title>Robert,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Is-clBuildProgram-needed-in-conjunction-with/m-p/1021817#M3313</link>
      <description>&lt;P&gt;Robert,&lt;/P&gt;

&lt;P&gt;Doubly funny, just read it yesterday and was wishing that I had that article two weeks ago. Nicely written and much needed since good SPIR examples are a bit sparse.&lt;/P&gt;

&lt;P&gt;If it helps, the goal is to cache my kernel compilations so I only need to compile the first time my software runs. clBuildProgram is accounting for roughly half of my execution time, so it would be great if the CPU team knows how to avoid it.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Feb 2015 00:57:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Is-clBuildProgram-needed-in-conjunction-with/m-p/1021817#M3313</guid>
      <dc:creator>Logan_J_</dc:creator>
      <dc:date>2015-02-25T00:57:49Z</dc:date>
    </item>
    <item>
      <title>Any update?</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Is-clBuildProgram-needed-in-conjunction-with/m-p/1021818#M3314</link>
      <description>&lt;P&gt;Any update?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Feb 2015 16:39:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Is-clBuildProgram-needed-in-conjunction-with/m-p/1021818#M3314</guid>
      <dc:creator>Logan_J_</dc:creator>
      <dc:date>2015-02-26T16:39:56Z</dc:date>
    </item>
    <item>
      <title>Logan,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Is-clBuildProgram-needed-in-conjunction-with/m-p/1021819#M3315</link>
      <description>&lt;P&gt;Logan,&lt;/P&gt;

&lt;P&gt;I checked with our standards and driver folks: the right thing to do is to always follow&amp;nbsp;&lt;SPAN style="font-size: 12px; line-height: 14.3999996185303px;"&gt;clCreateProgramFromBinary with clBuildProgram. They think the current behavior on the GPU is actually a bug.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Feb 2015 16:56:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Is-clBuildProgram-needed-in-conjunction-with/m-p/1021819#M3315</guid>
      <dc:creator>Robert_I_Intel</dc:creator>
      <dc:date>2015-02-26T16:56:28Z</dc:date>
    </item>
    <item>
      <title>Thanks, I'll adjust my code</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Is-clBuildProgram-needed-in-conjunction-with/m-p/1021820#M3316</link>
      <description>&lt;P&gt;Thanks, I'll adjust my code accordingly.&lt;/P&gt;

&lt;P&gt;Any word though on what to do with the long CPU kernel build times? GPU, even in the presence of said bug, generates the right results quickly. Why can't I do that with CPU, or is there something I'm missing?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Feb 2015 14:22:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Is-clBuildProgram-needed-in-conjunction-with/m-p/1021820#M3316</guid>
      <dc:creator>Logan_J_</dc:creator>
      <dc:date>2015-02-27T14:22:33Z</dc:date>
    </item>
  </channel>
</rss>

