OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1663 Discussions

SegFault in 'PrepareKernelArgs' caused by function call within __kernel



I have encountered an issue compiling my OpenCL kernel using the Intel CPU-only runtime (v16.1.1) on  RHEL 7 (x64).

I've created a MWE in a github gist here

(using pyopencl to compile / setup args, etc.)

Essentially, if my kernel "testkernel" calls the "bad" subkernel (defined as a __kernel function with required work group size), I get this segfault.  If I change the kernel definition to the "good" subkernel (a simple "void" function call) it compiles and runs correctly.  However, the OpenCL standard seems to imply the two should be identical:

>The __kernel (or kernel) 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:

>It is just a regular function call if a __kernel function is called by another kernel function.

In any case, it probably shouldn't be giving me segfaults!



PYOPENCL_CTX='' PYOPENCL_COMPILER_OUTPUT=1 python2.7 broken.opencl

Stack dump:
0.      Running pass 'PrepareKernelArgs' on module 'main'.
Segmentation fault (core dumped)

PYOPENCL_CTX='' PYOPENCL_COMPILER_OUTPUT=1 python2.7 working.opencl

/home/ncurtis/.local/lib/python2.7/site-packages/pyopencl/ CompilerWarning: From-source build succeeded, but resulted in non-empty logs:
Build on <pyopencl.Device 'Intel(R) Xeon(R) CPU E5-4640 v2 @ 2.20GHz' on 'Intel(R) OpenCL' at 0x31b5678> succeeded, but said:

Compilation started
Compilation done
Linking started
Linking done
Device build started
Device build done
Kernel <bad> was successfully vectorized (4)
Kernel <testkernel> was not vectorized
 warn(text, CompilerWarning






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+)

0 Kudos
1 Reply

Has this bug been logged by any chance?  It's been ~a month of no response :/