https://bugs.freedesktop.org/show_bug.cgi?id=93748
Bug ID: 93748 Summary: [r600g]OpenCL driver causes ImageMagick to segfault Product: Mesa Version: git Hardware: x86-64 (AMD64) OS: Linux (All) Status: NEW Severity: normal Priority: medium Component: Drivers/Gallium/r600 Assignee: dri-devel@lists.freedesktop.org Reporter: nixscripter@gmail.com QA Contact: dri-devel@lists.freedesktop.org
Created attachment 121096 --> https://bugs.freedesktop.org/attachment.cgi?id=121096&action=edit Output of /usr/bin/display
If I compile ImageMagick with OpenCL support, and use the display utility to view any image, the program segfaults before anything is rendered with the attached LLVM error.
I'm using ImageMagick 6.2.9.6, though it has failed on several previous versions also.
The relevant piece of source code is in magick/accelerate.c, a gigantic list of OpenCL stuff (which I must admit I am ill-equipped to read). The function it complains about, GenerateNoiseImage, seems to start on line 428.
I'm using LLVM r254897 from SVN, and Mesa commit 9214664 (r74971).
My card is: Advanced Micro Devices, Inc. [AMD/ATI] Juniper PRO [Radeon HD 6750]
Please let me know if you need more information.
https://bugs.freedesktop.org/show_bug.cgi?id=93748
--- Comment #1 from Jan Vesely jan.vesely@rutgers.edu --- Hi,
I had trouble locating the kernel. There's a git repo nd 6.9.X.Y release tarballs. Unfortunately imagemagick does not tag releases. Do you know the git commit that corresponds to to 6.2.9.6?
posting the corresponding __kernel function would suffice too.
https://bugs.freedesktop.org/show_bug.cgi?id=93748
--- Comment #2 from nixscripter@gmail.com --- Created attachment 121124 --> https://bugs.freedesktop.org/attachment.cgi?id=121124&action=edit GenerateNoiseImage kernel
Here is their kernel. It's rather ugly.
It has a lot of macros (like ClamptoQuantum) and functions running on the host (mwcGenerateDifferentialNoise is elsewhere in the same file), but perhaps if it's an LLVM assembler bug those don't matter.
The initialization code for the OpenCL context, by the way, is entirely separate and also rather ugly (I presume so they can load it early and "drop it in" when needed).
Here is a link to the source of my exact version (which I know is old, sorry about that) so you can look at any surrounding context necessary:
http://distfiles.icmpv6.org/distfiles/ImageMagick-6.9.2-6.tar.xz
Note that this kernel can be found in magick/accelerate-private.h -- the error pointing to magick/accelerate.c is where the kernel is initialized.
https://bugs.freedesktop.org/show_bug.cgi?id=93748
nixscripter@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #121096|0 |1 is obsolete| |
--- Comment #3 from nixscripter@gmail.com --- Created attachment 124178 --> https://bugs.freedesktop.org/attachment.cgi?id=124178&action=edit AddNoise backtrace for IMv7 Git
In order to assist with this issue, I tried upgrading to the Git Version of Imagemagick, available on GitHub:
https://github.com/ImageMagick/ImageMagick
ImageMagick master commit 5fb7d58 still fails with LLVM revision 264388 and Mesa commit 511ce29. (I upgrade to the latest revisions every week or two, just in case this issue could be fixed without me noticing.)
However, the traceback is now quite different, and the image does display -- for just a moment while they do some operation subsequently which makes it segfault. Now it's in the AddNose kernel.
Hopefully the source version will make the issue easier to reproduce/debug.
https://bugs.freedesktop.org/show_bug.cgi?id=93748
--- Comment #4 from nixscripter@gmail.com --- Oh, and before I forget, The AddNoise kernel is in MagickCore/accelerate.c, starting on line 499.
https://bugs.freedesktop.org/show_bug.cgi?id=93748
--- Comment #5 from nixscripter@gmail.com --- Correction, make that MagickCore/accelerate-kernels-private.h, starting on line 798. (Argh...)
https://bugs.freedesktop.org/show_bug.cgi?id=93748
--- Comment #6 from Jan Vesely jan.vesely@rutgers.edu --- based on the LLVM dump something is trying to do v2 load.
Do you know what noise type is used? Guassian noise in that kernel uses sinpi and cospi which use v2float (float load is the same as int).
can you try newer llvm version? proper constant address space loads were implemented in r269481. it fixed builtin functions that rely on tables, like sinpi/cospi.
https://bugs.freedesktop.org/show_bug.cgi?id=93748
nixscripter@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|[r600g]OpenCL driver causes |[r600g]OpenCL driver causes |ImageMagick to segfault |ImageMagick display command | |to segfault Status|NEW |RESOLVED Resolution|--- |FIXED
https://bugs.freedesktop.org/show_bug.cgi?id=93748
--- Comment #7 from nixscripter@gmail.com --- I upgraded LLVM to r271203, past the version you suggested, and it does indeed fix the issue! Thanks!
Closing as FIXED.
dri-devel@lists.freedesktop.org