<?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 OpenCL compiler flags in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/OpenCL-compiler-flags/m-p/1020379#M3259</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I want to influence optimization flags of OpenCL. As I'm not aware of optimization flags, that do not influence correctness, that are available for the online compiler I have decided to use the offline compiler. I have found that Intel OpenCL kernel builder is able to generate llvm code beside IR code. As there is Intel LLVM Optimizer, i.e., oclopt, which could generate bit code, i.e., .bc file, which is not a final binary. This file cannot be used directly in the OpenCL program, i.e., cannot be read with clCreateProgramWithBinary as it returns&lt;/P&gt;

&lt;PRE class="brush:plain;"&gt;Stack dump:
0.	Running pass 'Intel OpenCL DuplicateCalledKernels' on module 'Program'.&lt;/PRE&gt;

&lt;P&gt;followed by segmentation fault.&lt;/P&gt;

&lt;P&gt;Now I'm interested in the following:&lt;/P&gt;

&lt;P&gt;1. How to generate the binary that can be used with clCreateProgramWithBinary but generated with different optimization switches from llvm optimizer? Does Intel provide missing compiler chain from Optimizer to Binary generation, tool(s) that can take output of llvm optimizer, i.e., bit code, and generate a binary?&lt;/P&gt;

&lt;P&gt;2. Are there environment flags or any other mechanism to influence the optimizer with online compilation and/or offline compilation of OpenCL codes?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thank you in advance for your effort.&lt;/P&gt;

&lt;P&gt;Looking forward for your response.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;Robert&lt;/P&gt;</description>
    <pubDate>Thu, 11 Dec 2014 18:47:20 GMT</pubDate>
    <dc:creator>Robert_M_3</dc:creator>
    <dc:date>2014-12-11T18:47:20Z</dc:date>
    <item>
      <title>OpenCL compiler flags</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/OpenCL-compiler-flags/m-p/1020379#M3259</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I want to influence optimization flags of OpenCL. As I'm not aware of optimization flags, that do not influence correctness, that are available for the online compiler I have decided to use the offline compiler. I have found that Intel OpenCL kernel builder is able to generate llvm code beside IR code. As there is Intel LLVM Optimizer, i.e., oclopt, which could generate bit code, i.e., .bc file, which is not a final binary. This file cannot be used directly in the OpenCL program, i.e., cannot be read with clCreateProgramWithBinary as it returns&lt;/P&gt;

&lt;PRE class="brush:plain;"&gt;Stack dump:
0.	Running pass 'Intel OpenCL DuplicateCalledKernels' on module 'Program'.&lt;/PRE&gt;

&lt;P&gt;followed by segmentation fault.&lt;/P&gt;

&lt;P&gt;Now I'm interested in the following:&lt;/P&gt;

&lt;P&gt;1. How to generate the binary that can be used with clCreateProgramWithBinary but generated with different optimization switches from llvm optimizer? Does Intel provide missing compiler chain from Optimizer to Binary generation, tool(s) that can take output of llvm optimizer, i.e., bit code, and generate a binary?&lt;/P&gt;

&lt;P&gt;2. Are there environment flags or any other mechanism to influence the optimizer with online compilation and/or offline compilation of OpenCL codes?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thank you in advance for your effort.&lt;/P&gt;

&lt;P&gt;Looking forward for your response.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;Robert&lt;/P&gt;</description>
      <pubDate>Thu, 11 Dec 2014 18:47:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/OpenCL-compiler-flags/m-p/1020379#M3259</guid>
      <dc:creator>Robert_M_3</dc:creator>
      <dc:date>2014-12-11T18:47:20Z</dc:date>
    </item>
    <item>
      <title>I tried the following:</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/OpenCL-compiler-flags/m-p/1020380#M3260</link>
      <description>&lt;P&gt;I tried the following:&lt;/P&gt;

&lt;P&gt;ioc64 -cmd=build -input=drawbox.cl -device=gpu -spir64=drawbox.bc -bo="-cl-std=CL1.2"&lt;/P&gt;

&lt;P&gt;oclopt -strip drawbox.bc &amp;gt; drawbox_stripped.bc&lt;/P&gt;

&lt;P&gt;You should be able to load both SPIR files (.bc) with clCreateProgramWithBinary.&lt;/P&gt;

&lt;P&gt;Try oclopt --help for the list of all available optimization options.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2014 02:16:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/OpenCL-compiler-flags/m-p/1020380#M3260</guid>
      <dc:creator>Robert_I_Intel</dc:creator>
      <dc:date>2014-12-12T02:16:25Z</dc:date>
    </item>
    <item>
      <title>Thank you a lot, this works!</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/OpenCL-compiler-flags/m-p/1020381#M3261</link>
      <description>&lt;P&gt;Thank you a lot, this works!&lt;/P&gt;

&lt;P&gt;Before I was trying to do it with the following:&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;ioc64 -cmd=build -input=add.cl -device=cpu -simd=sse42 -llvm
oclopt -o=add_offline add.ll&lt;/PRE&gt;

&lt;P&gt;but unfortunately loading of the file that was returned by oclopt didn't work out.&lt;/P&gt;

&lt;P&gt;The binary file was missing some information from the header and the footer, probably ELF information, compared to the bit stream returned by clGetProgramInfo or by offline compiler IR.&lt;/P&gt;

&lt;P&gt;I will then in the future generate spir code instead of llvm ir.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;Robert&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2014 09:16:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/OpenCL-compiler-flags/m-p/1020381#M3261</guid>
      <dc:creator>Robert_M_3</dc:creator>
      <dc:date>2014-12-12T09:16:28Z</dc:date>
    </item>
  </channel>
</rss>

