FS#58996 - ocl-icd: segfault, triggered with ImageMagick.

Attached to Project: Arch Linux
Opened by Oid Maps (dreieck) - Wednesday, 13 June 2018, 07:36 GMT
Last edited by Doug Newgard (Scimmia) - Friday, 15 June 2018, 04:54 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture x86_64
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Having the package `extra/ocl-icd` installed makes ImageMagick SIGABRT/ segfault.

It looks like the error is in `/usr/lib/libOpenCL.so`.

Steps to reproduce:

* Have `extra/imagemagick` installed.
* Have `extra/ocl-icd` installed.
* Get an example image, e.g. http://imagemagick.org/image/wizard.png
* Convert the image with `resize`:

`convert wizard.png -resize 16x16 wizard.jpg`

The output of this command on `stderr` is `Aborted`, exitcode is 134. The operation has been carried out, though. Also `mogrify` is affected.

This has happend with many ImageMagick versions in the last months or year. Current version: 7.0.7-39.

If `ocl-icd` is not installed (but `opencl-mesa` still is), the operation succeeds.

The output of `convert -version`:
Version: ImageMagick 7.0.7-39 Q16 x86_64 2018-06-11 https://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: https://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenCL OpenMP
Delegates (built-in): bzlib cairo fontconfig freetype gslib jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps raw rsvg tiff webp wmf x xml zlib

The output of `clinfo`:

Number of platforms 2
Platform Name Intel(R) OpenCL
Platform Vendor Intel(R) Corporation
Platform Version OpenCL 1.2 LINUX
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_depth_images cl_khr_3d_image_writes cl_intel_exec_by_local_thread cl_khr_spir cl_khr_fp64
Platform Extensions function suffix INTEL

Platform Name Clover
Platform Vendor Mesa
Platform Version OpenCL 1.1 Mesa 18.0.4
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd
Platform Extensions function suffix MESA

Platform Name Intel(R) OpenCL
Number of devices 1
Device Name Intel(R) Core(TM)2 Solo CPU U3500 @ 1.40GHz
Device Vendor Intel(R) Corporation
Device Vendor ID 0x8086
Device Version OpenCL 1.2 (Build 25)
Driver Version 1.2.0.25
Device OpenCL C Version OpenCL C 1.2
Device Type CPU
Device Profile FULL_PROFILE
Device Available Yes
Compiler Available Yes
Linker Available Yes
Max compute units 1
Max clock frequency 1400MHz
Device Partition (core)
Max number of sub-devices 1
Supported partition types by counts, equally, by names (Intel)
Supported affinity domains (n/a)
Max work item dimensions 3
Max work item sizes 8192x8192x8192
Max work group size 8192
Preferred work group size multiple <getWGsizes:1171: create context : error -2>
Preferred / native vector sizes
char 1 / 16
short 1 / 8
int 1 / 4
long 1 / 2
half 0 / 0 (n/a)
float 1 / 4
double 1 / 2 (cl_khr_fp64)
Half-precision Floating-point support (n/a)
Single-precision Floating-point support (core)
Denormals Yes
Infinity and NANs Yes
Round to nearest Yes
Round to zero No
Round to infinity No
IEEE754-2008 fused multiply-add No
Support is emulated in software No
Correctly-rounded divide and sqrt operations No
Double-precision Floating-point support (cl_khr_fp64)
Denormals Yes
Infinity and NANs Yes
Round to nearest Yes
Round to zero Yes
Round to infinity Yesconvert wizard.png -resize 16x16 wizard.jpg`
IEEE754-2008 fused multiply-add Yes
Support is emulated in software No
Address bits 64, Little-Endian
Global memory size 8312324096 (7.741GiB)
Error Correction support No
Max memory allocation 2078081024 (1.935GiB)
Unified memory for Host and Device Yes
Minimum alignment for any data type 128 bytes
Alignment of base address 1024 bits (128 bytes)
Global Memory cache type Read/Write
Global Memory cache size 3145728 (3MiB)
Global Memory cache line size 64 bytes
Image support Yes
Max number of samplers per kernel 480
Max size for 1D images from buffer 129880064 pixels
Max 1D or 2D image array size 2048 images
Max 2D image size 16384x16384 pixels
Max 3D image size 2048x2048x2048 pixels
Max number of read image args 480
Max number of write image args 480
Local memory type Global
Local memory size 32768 (32KiB)
Max number of constant args 480
Max constant buffer size 131072 (128KiB)
Max size of kernel argument 3840 (3.75KiB)
Queue properties
Out-of-order execution Yes
Profiling Yes
Local thread execution (Intel) Yes
Prefer user sync for interop No
Profiling timer resolution 1ns
Execution capabilities
Run OpenCL kernels Yes
Run native kernels Yes
SPIR versions 1.2
printf() buffer size 1048576 (1024KiB)
Built-in kernels (n/a)
Device Extensions cl_khr_icd cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_depth_images cl_khr_3d_image_writes cl_intel_exec_by_local_thread cl_khr_spir cl_khr_fp64

Platform Name Clover
Number of devices 0

NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) Intel(R) OpenCL
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) Success [INTEL]
clCreateContext(NULL, ...) [default] <checkNullCtx:2758: create context with device from default platform : error -2>
clCreateContext(NULL, ...) [other] <checkNullCtx:2758: create context with device from default platform : error -2>
clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) No devices available in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices available in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) No devices available in platform

ICD loader properties
ICD loader Name OpenCL ICD Loader
ICD loader Vendor OCL Icd free software
ICD loader Version 2.2.12
ICD loader Profile OpenCL 2.2

`gdb` backtrace of the failing command:

`gdb convert`, at the prompt typing `run wizard.png -resize 16x16 wizard.jpg`. Output:

Starting program: /usr/bin/convert wizard.png -resize 16x16 wizard.jpg
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()

At the prompt, typing `bt`. Output:

#0 0x0000000000000000 in ?? ()
#1 0x00007ffff00e0b94 in clReleaseContext () from /usr/lib/libOpenCL.so
#2 0x00007ffff7619cfe in ?? () from /usr/lib/libMagickCore-7.Q16HDRI.so.6
#3 0x00007ffff761cc97 in ?? () from /usr/lib/libMagickCore-7.Q16HDRI.so.6
#4 0x00007ffff7608d27 in MagickCoreTerminus () from /usr/lib/libMagickCore-7.Q16HDRI.so.6
#5 0x000055555555518b in ?? ()
#6 0x00007ffff6bf79a7 in __libc_start_main () from /usr/lib/libc.so.6
#7 0x0000555555554f1a in ?? ()

The file `/usr/lib/libOpenCL.so` is owned by `extra/ocl-icd`.

Removing `ocl-icd` also removes `/usr/lib/libOpenCL.so`. `convert wizard.png -resize 16x16 wizard.jpg` runs fine then. Also, recompiling ImageMagick without OpenCL makes it work fine. Recompiling ImageMagick without HDRI does not have an effect on this error.

This bug has been originally reported to ImageMagick: http://github.com/ImageMagick/ImageMagick/issues/1134.
This task depends upon

Closed by  Doug Newgard (Scimmia)
Friday, 15 June 2018, 04:54 GMT
Reason for closing:  Not a bug
Comment by Oid Maps (dreieck) - Wednesday, 13 June 2018, 08:22 GMT
OK. It has to do with `intel-compute-runtime`, some Intel OpenCL implementation. If I remove that, it works (though I have only Mesa OpenCL then).

Loading...