OpenCL CPU Drivers Bug

OpenCL CPU Drivers Bug

Hello,

Overview:
I am running a SYCL kernel where I render/raytrace ~500 sphere objects on a 1200x800 image framebuffer size, so work items = 1200 * 800 and work group size = 8 * 8.
This runs perfectly on my iGPU (HD Graphics 530). However, when I tried to run it on the CPU (Core i7-6700K), I get an **internal compiler error**.

Note #1: I am not trying to access memory in constant address space since I've had an issue with this on intel CPUs before (possibly due to large sizes).

Note #2: Interestingly enough, I am successful when I run the kernel with a lot less spheres thrown in the computation.

Flow of the program compilation and execution:

source -> codeplay's compute++ -> spir -> raytracer -> intel opencl driver -> crash

The crash is caused when running the program on intel cpu caused by the intel opencl runtimes.
I have also tested on a mobile i7 8550U CPU, where the program crashes as well, but runs fine on the SoC's iGPU (HD Graphics 620). Basically, the same behaviour and output.

Output from the compiler:

Stack dump:
0. Running pass 'Intel OpenCL Vectorizer' on module 'main'.
1. Running pass 'Intel OpenCL VectorizerCore' on function ''
2. Running pass 'PacketizeFunction' on function ''
Segmentation fault (core dumped)

And more specific:

**Internal compiler error** Cannot select: 0x28f5920: v8f32 = vselect 0x296c260, 0x2968288, 0x28f6278
  0x296c260: v8f32,ch = CopyFromReg 0x1255fc8, Register:v8f32 %700
    0x296c0c0: v8f32 = Register %700
  0x2968288: v8f32 = bitcast 0x28f5b90
    0x28f5b90: v8i32 = BUILD_VECTOR Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>
      0x296dc00: i32 = Constant<0>
      0x296dc00: i32 = Constant<0>
      0x296dc00: i32 = Constant<0>
      0x296dc00: i32 = Constant<0>
      0x296dc00: i32 = Constant<0>
      0x296dc00: i32 = Constant<0>
      0x296dc00: i32 = Constant<0>
      0x296dc00: i32 = Constant<0>
  0x28f6278: v8f32,ch = CopyFromReg 0x1255fc8, Register:v8f32 %874
    0x29332a0: v8f32 = Register %874
In function: SYCL_class_kernels__render_kernel_1200__800__10__488_
Please report the issue on Intel OpenCL forum
https://software.intel.com/en-us/forums/opencl for assistance.
 Stack dump:
0.  Running pass 'Function Pass Manager' on module 'main'.
1.  Running pass 'X86 DAG->DAG Instruction Selection' on function ''

And a backtrace from gdb:

Thread 1 "sycl-rayt" received signal SIGSEGV, Segmentation fault.
0x00007ffee2775308 in llvm::VectorType::get(llvm::Type*, unsigned int) ()
   from /opt/intel/system_studio_2019/opencl_compilers_and_libraries_18.1.0.013/linux/compiler/lib/intel64_lin/libOclCpuBackEnd.so
(gdb) bt
#0  0x00007ffee2775308 in llvm::VectorType::get(llvm::Type*, unsigned int) ()
   from /opt/intel/system_studio_2019/opencl_compilers_and_libraries_18.1.0.013/linux/compiler/lib/intel64_lin/libOclCpuBackEnd.so
#1  0x00007ffee25aa3f5 in intel::PacketizeFunction::createDummyVectorVal (this=this@entry=0xe86930,
    origValue=origValue@entry=0x1c3d848, vectorVal=vectorVal@entry=0x7fffffff6d40)
    at /netbatch/donb41412_00/runDir/93/20180921_000000/llvm/projects/opencl/backend/vectorizer/Packetizer/PacketizerInstData.cpp:368
#2  0x00007ffee25ab22e in intel::PacketizeFunction::obtainVectorizedValue (this=this@entry=0xe86930,
    retValue=retValue@entry=0x7fffffff6d40, origValue=0x1c3d848, origInst=origInst@entry=0x1d190e8)
    at /netbatch/donb41412_00/runDir/93/20180921_000000/llvm/projects/opencl/backend/vectorizer/Packetizer/PacketizerInstData.cpp:144
#3  0x00007ffee25a2f5c in intel::PacketizeFunction::packetizeInstruction (this=this@entry=0xe86930,
    SI=0x1d190e8)
    at /netbatch/donb41412_00/runDir/93/20180921_000000/llvm/projects/opencl/backend/vectorizer/Packetizer/Packetizer.cpp:2659
#4  0x00007ffee25a6691 in intel::PacketizeFunction::dispatchInstructionToPacketize (
    this=this@entry=0xe86930, I=0x1d190e8)
    at /netbatch/donb41412_00/runDir/93/20180921_000000/llvm/projects/opencl/backend/vectorizer/Packetizer/Packetizer.cpp:695
#5  0x00007ffee25a751c in intel::PacketizeFunction::runOnFunction (this=0xe86930, F=...)
    at /netbatch/donb41412_00/runDir/93/20180921_000000/llvm/projects/opencl/backend/vectorizer/Packetizer/Packetizer.cpp:234
#6  0x00007ffee274cf83 in llvm::FPPassManager::runOnFunction(llvm::Function&) ()
   from /opt/intel/system_studio_2019/opencl_compilers_and_libraries_18.1.0.013/linux/compiler/lib/intel64_lin/libOclCpuBackEnd.so
#7  0x00007ffee274d07e in llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&) ()
   from /opt/intel/system_studio_2019/opencl_compilers_and_libraries_18.1.0.013/linux/compiler/lib/intel64_lin/libOclCpuBackEnd.so
#8  0x00007ffee274d4e1 in llvm::legacy::FunctionPassManager::run(llvm::Function&) ()
   from /opt/intel/system_studio_2019/opencl_compilers_and_libraries_18.1.0.013/linux/compiler/lib/intel64_lin/libOclCpuBackEnd.so
#9  0x00007ffee2584ff0 in intel::VectorizerCore::runOnFunction (this=0x1ad9100, F=...)
    at /netbatch/donb41412_00/runDir/93/20180921_000000/llvm/projects/opencl/backend/vectorizer/Utils/VectorizerCore.cpp:347
#10 0x00007ffee274cf83 in llvm::FPPassManager::runOnFunction(llvm::Function&) ()
   from /opt/intel/system_studio_2019/opencl_compilers_and_libraries_18.1.0.013/linux/compiler/lib/intel64_lin/libOclCpuBackEnd.so
#11 0x00007ffee274d07e in llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&) ()
   from /opt/intel/system_studio_2019/opencl_compilers_and_libraries_18.1.0.013/linux/compiler/lib/intel64_lin/libOclCpuBackEnd.so
#12 0x00007ffee274d4e1 in llvm::legacy::FunctionPassManager::run(llvm::Function&) ()
   from /opt/intel/system_studio_2019/opencl_compilers_and_libraries_18.1.0.013/linux/compiler/lib/intel64_lin/libOclCpuBackEnd.so
#13 0x00007ffee2580fae in intel::Vectorizer::runOnModule (this=0x1b7e4b0, M=...)
    at /netbatch/donb41412_00/runDir/93/20180921_000000/llvm/projects/opencl/backend/vectorizer/VolcanoWrapper/Main.cpp:148
#14 0x00007ffee274d92e in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()
   from /opt/intel/system_studio_2019/opencl_compilers_and_libraries_18.1.0.013/linux/compiler/lib/intel64_lin/libOclCpuBackEnd.so
#15 0x00007ffee252cc4c in Intel::OpenCL::DeviceBackend::Optimizer::Optimize (
    this=this@entry=0x7fffffff9ac0)
    at /netbatch/donb41412_00/runDir/93/20180921_000000/llvm/projects/opencl/backend/optimizer/Optimizer.cpp:794
#16 0x00007ffee250be44 in Intel::OpenCL::DeviceBackend::Compiler::BuildProgram (
    this=this@entry=0x11148b8, pModule=pModule@entry=0x1ac87e0, pResult=pResult@entry=0x7fffffff9e20)
    at /netbatch/donb41412_00/runDir/93/20180921_000000/llvm/projects/opencl/backend/ocl_cpu_backend/Compiler.cpp:424

...

Core i7-6700K OpenCL support details:

OpenCL (Intel's OpenCL SDK):
 CL_DEVICE_VERSION                      : OpenCL 2.1
 CL_DRIVER_VERSION                      : 18.1.0.0920
 IL_VERSION                                     : SPIR-V_1.0
 SPIR_VERSION                                 : 1.2

SYCL (Codeplay's ComputeCpp):
  CL_DEVICE_NAME                          : Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
  CL_DEVICE_VENDOR                      : Intel(R) Corporation
  CL_DRIVER_VERSION                     : 18.1.0.0920
  CL_DEVICE_TYPE                            : CL_DEVICE_TYPE_CPU

ComputeCpp compiler flags:

compute++ flags - -O2;-mllvm;-inline-threshold=1000;-intelspirmetadata;-sycl-target;spir64

I am inclined to think it is a bug, therefore reporting it as such and would like to know if there is a workaround to this.
If any additional information is required, please let me know.

Update:
ComputeCpp CE v1.1.2
running on Ubuntu 18.04

Many thanks in advance!

Kind regards,
Georgi

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi GeorgiM,

Thanks for taking the time to report your observations with such good detail. I'll be sending you a private message to see how we can further follow up. Otherwise can provide some more info?:

  • As far as platform info goes what distro are you using?
  • What ComputeCPP version is in use?
  • Can you share the source toward a reproducer? If you are privileged to share the source i.e. it's not proprietary or license constrained it can be shared on the forum here. 

Issue has been documented internally. Case number 4903.

Thanks,

-MichaelC

Thanks for the updates... For Intel reviewers see internal reference number 4903.

 

-MichaelC

Leave a Comment

Please sign in to add a comment. Not a member? Join today