Bug: convert: clBuildProgram failed. (-11) @ warning/opencl.c/CompileOpenCLKernel/1395

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
bensto
Posts: 31
Joined: 2012-07-02T00:32:10-07:00
Authentication code: 13

Bug: convert: clBuildProgram failed. (-11) @ warning/opencl.c/CompileOpenCLKernel/1395

Post by bensto »

When I want to convert (resize) a *.png image under 64bit Win7 then sometimes (mostly but not always) the following error appears:

convert: clBuildProgram failed. (-11) @ warning/opencl.c/CompileOpenCLKernel/1395.

Hmm, ImageMagick worked fine with the same command on the same computer in the past.

So this bug must be added in the last version(s).

Whats wrong?

Ben
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Bug: convert: clBuildProgram failed. (-11) @ warning/opencl.c/CompileOpenCLKernel/1395

Post by snibgo »

What version of IM?

That is a warning, not an error. I expect IM still does whatever you asked it to. Does it?

I don't know what has changed. Perhaps IM didn't report when clBuildProgram failed, and now it does.
snibgo's IM pages: im.snibgo.com
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Bug: convert: clBuildProgram failed. (-11) @ warning/opencl.c/CompileOpenCLKernel/1395

Post by magick »

ImageMagick leverages your GPU, if available, to speed up certain image processing operations. If the GPU is not available, or if the OpenCL kernel fails to build or to run, ImageMagick reverts to the CPU algorithm to complete the operation. You should be getting expected results despite the GPU fail.
bensto
Posts: 31
Joined: 2012-07-02T00:32:10-07:00
Authentication code: 13

Re: Bug: convert: clBuildProgram failed. (-11) @ warning/opencl.c/CompileOpenCLKernel/1395

Post by bensto »

yes, it looks like as if I am getting the desired result....but approx 20 times slower.
For resizing a photo tooks now ~10seconds (in comparison to 0.5 seconds before).

So what causes the fallback from GPU to CPU?

I did not change something extraordinary in my 64bit Win7 system in comparison to times when it runs in GPU mode.

It must be from inside the (newer) versions of ImageMagick.

Can I somehow tell IM (with cmdline parameter) to use GPU algorithms rather than CPU?

How?

Thank you
Ben
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Bug: convert: clBuildProgram failed. (-11) @ warning/opencl.c/CompileOpenCLKernel/1395

Post by fmw42 »

I am not an expert on this, but see https://imagemagick.org/script/architecture.php
Note, that under Windows, you might have an issue with TDR (Timeout Detection and Recovery of GPUs). Its purpose is to detect runaway tasks hanging the GPU by using an execution time threshold. For some older low-end GPUs running the OpenCL filters in ImageMagick, longer execution times might trigger the TDR mechanism and pre-empt the GPU image filter. When this happens, ImageMagick automatically falls back to the CPU code path and returns the expected results. To avoid pre-emption, increase the TdrDelay registry key.
bensto
Posts: 31
Joined: 2012-07-02T00:32:10-07:00
Authentication code: 13

Re: Bug: convert: clBuildProgram failed. (-11) @ warning/opencl.c/CompileOpenCLKernel/1395

Post by bensto »

On my 64bit Win7 system I found no TdrDelay registry entry.

Furthermore I wonder why this warning appears only recently.
In the past IM worked WITHOUT TdrDelay change.

What was changed in IM?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Bug: convert: clBuildProgram failed. (-11) @ warning/opencl.c/CompileOpenCLKernel/1395

Post by magick »

We just released ImageMagick version 7.0.8-64. Does the problem you reported persist with this release? If so, add -debug accelerate to your command line and post the log results here.
bensto
Posts: 31
Joined: 2012-07-02T00:32:10-07:00
Authentication code: 13

Re: Bug: convert: clBuildProgram failed. (-11) @ warning/opencl.c/CompileOpenCLKernel/1395

Post by bensto »

with new version 64 IM crashes (on 64bit Win7) with popup message:

ImageMagick Studio library and utility program has stopped working
A problem caused the program to stop working correctly, Please close the program.

I downloaded and used "ImageMagick-7.0.8-64-portable-Q16-x64.zip"

When I add the "-debug" flag as suggested into the following command:

convert" "D:\work\Screenshot_20190906-180124.png" -resize x800 -debug -quality 97 "D:\work\Screenshot_20190906-180124.png"

I got the output:

convert: UnrecognizedEventType `-quality' @ error/convert.c/ConvertImageCommand/1254.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Bug: convert: clBuildProgram failed. (-11) @ warning/opencl.c/CompileOpenCLKernel/1395

Post by dlemstra »

You should add "-debug accelerate"
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
bensto
Posts: 31
Joined: 2012-07-02T00:32:10-07:00
Authentication code: 13

Re: Bug: convert: clBuildProgram failed. (-11) @ warning/opencl.c/CompileOpenCLKernel/1395

Post by bensto »

Sorry.

convert" "D:\work\Screenshot_20190906-180124.png" -resize x800 -debug accelerate -quality 97 "D:\work\Screenshot_20190906-180124.png"

yields:

2019-09-10T05:38:26+00:00 0:00.029 0.031u 7.0.8 Accelerate convert[6044]: opencl.c/GetOpenCLCacheDirectory/375/Accelerate
Using cache directory: "C:\Users\Ben\AppData\Local\ImageMagick"


...before crash

cache directory: "C:\Users\Ben\AppData\Local\ImageMagick" exists
Post Reply