<?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 SegFault in 'PrepareKernelArgs' caused by function call within __kernel in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/SegFault-in-PrepareKernelArgs-caused-by-function-call-within/m-p/1160252#M6304</link>
    <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;I have encountered an issue compiling my OpenCL kernel using the Intel CPU-only runtime (v16.1.1) on&amp;nbsp; RHEL 7 (x64).&lt;/P&gt;

&lt;P&gt;I've created a MWE in a github gist &lt;A href="https://gist.github.com/arghdos/d6b4da9317dfc5daa88eb0c732a145d5"&gt;here&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;(using pyopencl to compile / setup args, etc.)&lt;/P&gt;

&lt;P&gt;Essentially, if my kernel "testkernel" calls the "bad" subkernel (defined as a __kernel function with required work group size), I get this segfault.&amp;nbsp; If I change the kernel definition to the "good" subkernel (a simple "void" function call) it compiles and runs correctly.&amp;nbsp; However, the &lt;A href="https://www.khronos.org/registry/OpenCL/sdk/1.0/docs/man/xhtml/functionQualifiers.html"&gt;OpenCL standard&lt;/A&gt; seems to imply the two should be identical:&lt;/P&gt;

&lt;P&gt;&amp;gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: verdana, sans-serif; font-size: 16px;"&gt;The&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="function" style="font-size: 16px; color: rgb(0, 0, 0); font-variant-numeric: normal !important; font-weight: bold !important; font-stretch: normal !important; line-height: normal !important; font-family: verdana, sans-serif !important;"&gt;__kernel&lt;/CODE&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: verdana, sans-serif; font-size: 16px;"&gt;&amp;nbsp;(or&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="function" style="font-size: 16px; color: rgb(0, 0, 0); font-variant-numeric: normal !important; font-weight: bold !important; font-stretch: normal !important; line-height: normal !important; font-family: verdana, sans-serif !important;"&gt;kernel&lt;/CODE&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: verdana, sans-serif; font-size: 16px;"&gt;) qualifier declares a function to be a kernel that can be executed by an application on an OpenCL device(s). The following rules apply to functions that are declared with this qualifier:&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: verdana, sans-serif; font-size: 16px;"&gt;It is just a regular function call if a&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="function" style="font-size: 16px; color: rgb(0, 0, 0); font-variant-numeric: normal !important; font-weight: bold !important; font-stretch: normal !important; line-height: normal !important; font-family: verdana, sans-serif !important;"&gt;__kernel&lt;/CODE&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: verdana, sans-serif; font-size: 16px;"&gt;&amp;nbsp;function is called by another kernel function.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;In any case, it probably shouldn't be giving me segfaults!&lt;/P&gt;

&lt;P&gt;------------------------------------------------------------------------------------------&lt;/P&gt;

&lt;P&gt;output:&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-family:monospace"&gt;&lt;SPAN style="color: rgb(0, 0, 0);"&gt;PYOPENCL_CTX='' PYOPENCL_COMPILER_OUTPUT=1 python2.7 test.py broken.opencl&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-family:monospace"&gt;&lt;SPAN style="color: rgb(0, 0, 0);"&gt;Stack dump: &lt;/SPAN&gt;&lt;BR /&gt;
	0. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Running pass 'PrepareKernelArgs' on module 'main'.&lt;BR /&gt;
	Segmentation fault (core dumped)&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: monospace; font-size: 10.569px;"&gt;PYOPENCL_CTX='' PYOPENCL_COMPILER_OUTPUT=1 python2.7 test.py working.opencl&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-family:monospace"&gt;&lt;SPAN style="color: rgb(0, 0, 0);"&gt;/home/ncurtis/.local/lib/python2.7/site-packages/pyopencl/cffi_cl.py:1502: CompilerWarning: From-source build succeeded, but resulted in non-empty logs: &lt;/SPAN&gt;&lt;BR /&gt;
	Build on &amp;lt;pyopencl.Device 'Intel(R) Xeon(R) CPU E5-4640 v2 @ 2.20GHz' on 'Intel(R) OpenCL' at 0x31b5678&amp;gt; succeeded, but said:&lt;BR /&gt;
	&lt;BR /&gt;
	Compilation started&lt;BR /&gt;
	Compilation done&lt;BR /&gt;
	Linking started&lt;BR /&gt;
	Linking done&lt;BR /&gt;
	Device build started&lt;BR /&gt;
	Device build done&lt;BR /&gt;
	Kernel &amp;lt;bad&amp;gt; was successfully vectorized (4)&lt;BR /&gt;
	Kernel &amp;lt;testkernel&amp;gt; was not vectorized&lt;BR /&gt;
	Done.&lt;BR /&gt;
	&amp;nbsp;warn(text, CompilerWarning&lt;/SPAN&gt;&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;

&lt;P&gt;------------------------------------------------------------------------------------------------------&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Nick&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;p.s. any update on a new release of the CPU-only runtime?? It would be nice to get some of the bugfixes applied (and even better to try out OCL 2.0+)&lt;/P&gt;</description>
    <pubDate>Mon, 20 Nov 2017 22:41:30 GMT</pubDate>
    <dc:creator>Nicholas_C_1</dc:creator>
    <dc:date>2017-11-20T22:41:30Z</dc:date>
    <item>
      <title>SegFault in 'PrepareKernelArgs' caused by function call within __kernel</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/SegFault-in-PrepareKernelArgs-caused-by-function-call-within/m-p/1160252#M6304</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;I have encountered an issue compiling my OpenCL kernel using the Intel CPU-only runtime (v16.1.1) on&amp;nbsp; RHEL 7 (x64).&lt;/P&gt;

&lt;P&gt;I've created a MWE in a github gist &lt;A href="https://gist.github.com/arghdos/d6b4da9317dfc5daa88eb0c732a145d5"&gt;here&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;(using pyopencl to compile / setup args, etc.)&lt;/P&gt;

&lt;P&gt;Essentially, if my kernel "testkernel" calls the "bad" subkernel (defined as a __kernel function with required work group size), I get this segfault.&amp;nbsp; If I change the kernel definition to the "good" subkernel (a simple "void" function call) it compiles and runs correctly.&amp;nbsp; However, the &lt;A href="https://www.khronos.org/registry/OpenCL/sdk/1.0/docs/man/xhtml/functionQualifiers.html"&gt;OpenCL standard&lt;/A&gt; seems to imply the two should be identical:&lt;/P&gt;

&lt;P&gt;&amp;gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: verdana, sans-serif; font-size: 16px;"&gt;The&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="function" style="font-size: 16px; color: rgb(0, 0, 0); font-variant-numeric: normal !important; font-weight: bold !important; font-stretch: normal !important; line-height: normal !important; font-family: verdana, sans-serif !important;"&gt;__kernel&lt;/CODE&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: verdana, sans-serif; font-size: 16px;"&gt;&amp;nbsp;(or&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="function" style="font-size: 16px; color: rgb(0, 0, 0); font-variant-numeric: normal !important; font-weight: bold !important; font-stretch: normal !important; line-height: normal !important; font-family: verdana, sans-serif !important;"&gt;kernel&lt;/CODE&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: verdana, sans-serif; font-size: 16px;"&gt;) qualifier declares a function to be a kernel that can be executed by an application on an OpenCL device(s). The following rules apply to functions that are declared with this qualifier:&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: verdana, sans-serif; font-size: 16px;"&gt;It is just a regular function call if a&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="function" style="font-size: 16px; color: rgb(0, 0, 0); font-variant-numeric: normal !important; font-weight: bold !important; font-stretch: normal !important; line-height: normal !important; font-family: verdana, sans-serif !important;"&gt;__kernel&lt;/CODE&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: verdana, sans-serif; font-size: 16px;"&gt;&amp;nbsp;function is called by another kernel function.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;In any case, it probably shouldn't be giving me segfaults!&lt;/P&gt;

&lt;P&gt;------------------------------------------------------------------------------------------&lt;/P&gt;

&lt;P&gt;output:&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-family:monospace"&gt;&lt;SPAN style="color: rgb(0, 0, 0);"&gt;PYOPENCL_CTX='' PYOPENCL_COMPILER_OUTPUT=1 python2.7 test.py broken.opencl&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-family:monospace"&gt;&lt;SPAN style="color: rgb(0, 0, 0);"&gt;Stack dump: &lt;/SPAN&gt;&lt;BR /&gt;
	0. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Running pass 'PrepareKernelArgs' on module 'main'.&lt;BR /&gt;
	Segmentation fault (core dumped)&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: monospace; font-size: 10.569px;"&gt;PYOPENCL_CTX='' PYOPENCL_COMPILER_OUTPUT=1 python2.7 test.py working.opencl&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-family:monospace"&gt;&lt;SPAN style="color: rgb(0, 0, 0);"&gt;/home/ncurtis/.local/lib/python2.7/site-packages/pyopencl/cffi_cl.py:1502: CompilerWarning: From-source build succeeded, but resulted in non-empty logs: &lt;/SPAN&gt;&lt;BR /&gt;
	Build on &amp;lt;pyopencl.Device 'Intel(R) Xeon(R) CPU E5-4640 v2 @ 2.20GHz' on 'Intel(R) OpenCL' at 0x31b5678&amp;gt; succeeded, but said:&lt;BR /&gt;
	&lt;BR /&gt;
	Compilation started&lt;BR /&gt;
	Compilation done&lt;BR /&gt;
	Linking started&lt;BR /&gt;
	Linking done&lt;BR /&gt;
	Device build started&lt;BR /&gt;
	Device build done&lt;BR /&gt;
	Kernel &amp;lt;bad&amp;gt; was successfully vectorized (4)&lt;BR /&gt;
	Kernel &amp;lt;testkernel&amp;gt; was not vectorized&lt;BR /&gt;
	Done.&lt;BR /&gt;
	&amp;nbsp;warn(text, CompilerWarning&lt;/SPAN&gt;&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;

&lt;P&gt;------------------------------------------------------------------------------------------------------&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Nick&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;p.s. any update on a new release of the CPU-only runtime?? It would be nice to get some of the bugfixes applied (and even better to try out OCL 2.0+)&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2017 22:41:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/SegFault-in-PrepareKernelArgs-caused-by-function-call-within/m-p/1160252#M6304</guid>
      <dc:creator>Nicholas_C_1</dc:creator>
      <dc:date>2017-11-20T22:41:30Z</dc:date>
    </item>
    <item>
      <title>Has this bug been logged by</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/SegFault-in-PrepareKernelArgs-caused-by-function-call-within/m-p/1160253#M6305</link>
      <description>&lt;P&gt;Has this bug been logged by any chance?&amp;nbsp; It's been ~a month of no response :/&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 14:44:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/SegFault-in-PrepareKernelArgs-caused-by-function-call-within/m-p/1160253#M6305</guid>
      <dc:creator>Nicholas_C_1</dc:creator>
      <dc:date>2017-12-08T14:44:52Z</dc:date>
    </item>
  </channel>
</rss>

