Bug 56437

Summary: LLVM ERROR: Cannot select: target intrinsic %llvm.AMDIL.mad when running Heaven
Product: Mesa Reporter: Bruno Jacquet (Xaapyks) <maxijac>
Component: Drivers/Gallium/r600Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: backtrace
Possible fix

Description Bruno Jacquet (Xaapyks) 2012-10-26 17:44:36 UTC
Heaven sometimes crashes when loading with an error output :
LLVM ERROR: Cannot select: target intrinsic %llvm.AMDIL.mad

I can partially reproduce this bug.
It happens from time to time on Heaven start.

To reproduce it I use the Heaven launcher (using Archlinux AUR package), just untick fullscreen checkbox and choose 1024x768 and click run.
If the crash is not triggered I close the unigine render window and just click once again "Run" and so on.

It happens about once every 10 runs when I test. (I know it's not convenient at all to reproduce it but it is a very rare bug...) I also had it once with Heroes of Newerth.

using R600_LLVM=0, radeon seems to be not hit by this problem.

Using git head and r600g on BARTS HD6870.

I might also add that I use these env vars (some are probably outdated...)
R600_ENABLE_S3TC=1
R600_GLSL130=1
R600_STREAMOUT=1

Using Xorg 1.13 and linux 3.6.3
Comment 1 Bruno Jacquet (Xaapyks) 2012-10-26 18:13:39 UTC
I was unclear about LLVM:
I am using the llvm glsl backend when I trigger this error.
Comment 2 Andy Furniss 2012-10-26 22:57:03 UTC
I saw this yesterday after rebuilding Mesa and running nexuiz.
Running again worked without error. 
This is the second time I've seen it, the first was a couple of weeks ago, again after a rebuild of mesa this time with etqw.

I couldn't reproduce, but did get more output -

LLVM ERROR: Cannot select: target intrinsic %llvm.AMDIL.mad
Stack dump:
0.      Running pass 'Function Pass Manager' on module 'tgsi'.
1.      Running pass 'AMDGPU DAG->DAG Pattern Instruction Selection' on function '@main'

I am using llvm 3.1 on HD4890.
Comment 3 Michel Dänzer 2012-10-29 17:18:36 UTC
Does the environment variable DRAW_USE_LLVM=0 work around the problem as well?

Can you get a backtrace for the crash?
Comment 4 Bruno Jacquet (Xaapyks) 2012-10-29 20:13:16 UTC
I could reproduce the crash with DRAW_USE_LLVM=0.

I did not manage to get a backtrace. I probably need to recompile LLVM with debug.
I'll do it when I have time.
Comment 5 Bruno Jacquet (Xaapyks) 2012-10-29 22:23:29 UTC
So I recompiled LLVM with debug symbols but I can't seem to get a backtrace...
Looks like it's because the libGL is loaded via dlopen or something like that.

Any hints on how to procedd with gdb ? I tried to use symbol-file and load libLLVM then setting a breakpoint where it prints the error but is didn't stop when it ran this code...
Comment 6 Michel Dänzer 2012-10-30 10:30:02 UTC
(In reply to comment #5)

How are you specifying the breakpoint location? IME it's most reliable to specify the source code file and line, e.g. foobar.c:42
Comment 7 Bruno Jacquet (Xaapyks) 2012-10-30 13:43:53 UTC
(In reply to comment #6)
This is what I did and it never halted on the breakpoint.

I'll try again when I have time.
Comment 8 Michel Dänzer 2012-10-30 16:05:25 UTC
(In reply to comment #7)
> This is what I did and it never halted on the breakpoint.

After the problem occurs, does 'info breakpoints' show that gdb was able to actually resolve the breakpoint location?
Comment 9 Bruno Jacquet (Xaapyks) 2012-10-30 19:44:48 UTC
Created attachment 69326 [details]
backtrace
Comment 10 Bruno Jacquet (Xaapyks) 2012-10-30 19:45:40 UTC
Finally got it!
Comment 11 Bruno Jacquet (Xaapyks) 2012-10-30 19:47:57 UTC
this was checked with llvm 3.1 and mesa b3921e1f53833420e0a0fd581f741744e7957a05
Comment 12 Tom Stellard 2012-10-30 20:51:50 UTC
Created attachment 69334 [details]
Possible fix

This is a strange bug.  There must be a race condition somewhere.  Does this patch help?  If it doesn't, can you reproduce this with an LLVM 3.2 tree:

git fetch git://people.freedesktop.org/~tstellar/llvm master
Comment 13 Tom Stellard 2012-10-31 15:27:57 UTC
(In reply to comment #12)
> Created attachment 69334 [details]
> Possible fix
> 
> This is a strange bug.  There must be a race condition somewhere.  Does this
> patch help?  If it doesn't, can you reproduce this with an LLVM 3.2 tree:
> 
> git fetch git://people.freedesktop.org/~tstellar/llvm master

I should add you need to build the branch of LLVM with --enable-experimental-targets=AMDGPU
Comment 14 Bruno Jacquet (Xaapyks) 2012-10-31 17:26:03 UTC
(In reply to comment #12)
> Created attachment 69334 [details]
> Possible fix
> 
> This is a strange bug.  There must be a race condition somewhere.  Does this
> patch help?  If it doesn't, can you reproduce this with an LLVM 3.2 tree:
> 
> git fetch git://people.freedesktop.org/~tstellar/llvm master

With your patch applied I can't seem to reproduce the crash.
Comment 15 Bruno Jacquet (Xaapyks) 2013-04-05 20:46:31 UTC
Not seen in a while with vanilla mesa, closing.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.