Bug 66331 - WebGL water demo crashes LLVM
Summary: WebGL water demo crashes LLVM
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/r600 (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-28 16:18 UTC by Grigori Goronzy
Modified: 2014-02-05 01:46 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Dump with R600_DEBUG=ps,vs,fs (43.53 KB, text/plain)
2013-06-28 16:18 UTC, Grigori Goronzy
Details
Dump with R600_DEBUG=ps,vs,fs (297.17 KB, text/plain)
2013-10-12 21:25 UTC, Dieter Nützel
Details
webgl-water.png (815.77 KB, image/png)
2014-02-01 23:27 UTC, Dieter Nützel
Details

Description Grigori Goronzy 2013-06-28 16:18:55 UTC
Created attachment 81647 [details]
Dump with R600_DEBUG=ps,vs,fs

The WebGL demo http://madebyevan.com/webgl-water/ crashes r600g with LLVM enabled:

firefox: /home/greg/build/llvm-3.3.src/include/llvm/CodeGen/MachineInstr.h:272: llvm::MachineOperand& llvm::MachineInstr::getOperand(unsigned int): Assertion `i < getNumOperands() && "getOperand() out of range!"' failed.
Stack dump:
0.	Running pass 'Function Pass Manager' on module 'tgsi'.
1.	Running pass 'R600 Emit Clause Markers Pass' on function '@main'
Aborted (core dumped)

This happens both with LLVM 3.3 and latest code from SVN. I tried to dump a detailed log, but it actually crashes in a different place when dumping the shaders - might be related though. Log is attached.
Comment 1 Dieter Nützel 2013-10-12 20:40:11 UTC
With current Mesa CVS (10.0.0! ;-) on RV730 AGP I get this,too.

Pure LLVM (3.3 stable) bug, NOT sb.

setenv R600_DEBUG nollvm
Works OK.

Nice link, Grigori!

Application: konqueror (4.11.2)
KDE Platform Version: 4.11.2
Qt Version: 4.8.5
Operating System: Linux 3.12.0-rc3-1-desktop i686
Distribution: "openSUSE 12.3 (i586)"

-- Backtrace:
Application: Konqueror (konqueror), signal: Segmentation fault
Using host libthread_db library "/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0xb4948740 (LWP 31205))]

[-]
Thread 1 (Thread 0xb4948740 (LWP 31205)):
[KCrash Handler]
#5  getInterval (Idx=..., this=<optimized out>, instr=0xb9f03d8, Reg=<optimized out>, this=<optimized out>, this=<optimized out>, LI=0x0, this=<optimized out>, Reg=<optimized out>) at /usr/src/debug/llvm-3.3/include/llvm/CodeGen/LiveIntervalAnalysis.h:184
#6  llvm::ScheduleDAGInstrs::addVRegUseDeps (this=0x0, SU=0xffffffff, OperIdx=<optimized out>) at /usr/src/debug/llvm-3.3/lib/CodeGen/ScheduleDAGInstrs.cpp:414
#7  0xaac05890 in llvm::ScheduleDAGInstrs::buildSchedGraph (this=0xb9dd2c0, AA=<optimized out>, RPTracker=0x800) at /usr/src/debug/llvm-3.3/lib/CodeGen/ScheduleDAGInstrs.cpp:776
#8  0xaab364dc in llvm::DefaultVLIWScheduler::schedule (this=0xb9dd2c0) at /usr/src/debug/llvm-3.3/lib/CodeGen/DFAPacketizer.cpp:124
#9  0xaab367c9 in llvm::VLIWPacketizerList::PacketizeMIs (this=0xbf8abf58, MBB=<optimized out>, BeginItr=..., EndItr=...) at /usr/src/debug/llvm-3.3/lib/CodeGen/DFAPacketizer.cpp:164
#10 0xab228426 in llvm::R600Packetizer::runOnMachineFunction (this=<optimized out>, Fn=...) at /usr/src/debug/llvm-3.3/lib/Target/R600/R600Packetizer.cpp:444
#11 0xaab98bb5 in llvm::MachineFunctionPass::runOnFunction (this=0xb92d3f8, F=...) at /usr/src/debug/llvm-3.3/lib/CodeGen/MachineFunctionPass.cpp:33
#12 0xaa6d3307 in llvm::FPPassManager::runOnFunction (this=0x16, F=...) at /usr/src/debug/llvm-3.3/lib/IR/PassManager.cpp:1530
#13 0xaa6d3530 in llvm::FPPassManager::runOnModule (this=0xb8700b0, M=...) at /usr/src/debug/llvm-3.3/lib/IR/PassManager.cpp:1550
#14 0xaa6d37d9 in llvm::MPPassManager::runOnModule (this=0xb919068, M=...) at /usr/src/debug/llvm-3.3/lib/IR/PassManager.cpp:1608
#15 0xaa6d3fa1 in llvm::PassManagerImpl::run (this=0xb915bd0, M=...) at /usr/src/debug/llvm-3.3/lib/IR/PassManager.cpp:1703
#16 0xaa6d4157 in llvm::PassManager::run (this=0xbf8ac168, M=...) at /usr/src/debug/llvm-3.3/lib/IR/PassManager.cpp:1738
#17 0xaa7be651 in LLVMTargetMachineEmit (T=<optimized out>, M=0xb7602a8, OS=..., codegen=<optimized out>, ErrorMessage=<optimized out>) at /usr/src/debug/llvm-3.3/lib/Target/TargetMachineC.cpp:194
#18 0xaa7be7a3 in LLVMTargetMachineEmitToMemoryBuffer (T=0xb913c70, M=0xb7602a8, codegen=LLVMObjectFile, ErrorMessage=0xbf8ac230, OutMemBuf=<optimized out>) at /usr/src/debug/llvm-3.3/lib/Target/TargetMachineC.cpp:220
#19 0xab724406 in radeon_llvm_compile () from /usr/lib/dri/updates/r600_dri.so
#20 0xab71f012 in r600_llvm_compile () from /usr/lib/dri/updates/r600_dri.so
#21 0xab6cf917 in r600_shader_from_tgsi () from /usr/lib/dri/updates/r600_dri.so
#22 0xab6d0b55 in r600_pipe_shader_create () from /usr/lib/dri/updates/r600_dri.so
#23 0xab6e261d in r600_shader_select () from /usr/lib/dri/updates/r600_dri.so
#24 0xab6e27d4 in r600_create_shader_state () from /usr/lib/dri/updates/r600_dri.so
#25 0xab4dbc33 in st_translate_fragment_program () from /usr/lib/dri/updates/r600_dri.so
#26 0xab4dc7f6 in st_get_fp_variant () from /usr/lib/dri/updates/r600_dri.so
#27 0xab4a451c in update_fp () from /usr/lib/dri/updates/r600_dri.so
#28 0xab4a119e in st_validate_state () from /usr/lib/dri/updates/r600_dri.so
#29 0xab4b62bc in st_draw_vbo () from /usr/lib/dri/updates/r600_dri.so
#30 0xab489f65 in vbo_handle_primitive_restart () from /usr/lib/dri/updates/r600_dri.so
#31 0xab48ba67 in vbo_validated_drawrangeelements () from /usr/lib/dri/updates/r600_dri.so
#32 0xab48be4c in vbo_exec_DrawElements () from /usr/lib/dri/updates/r600_dri.so
#33 0xb1e9fb9f in ?? () from /usr/lib/libQtWebKit.so.4
#34 0xb1e901f5 in ?? () from /usr/lib/libQtWebKit.so.4
#35 0xb2059430 in ?? () from /usr/lib/libQtWebKit.so.4
#36 0xb254792b in ?? () from /usr/lib/libQtWebKit.so.4
#37 0xb252d109 in ?? () from /usr/lib/libQtWebKit.so.4
#38 0xfffffffb in ?? ()
#39 0xb25cd05e in JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) () from /usr/lib/libQtWebKit.so.4
#40 0xad25a0cc in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
Comment 2 Dieter Nützel 2013-10-12 21:11:59 UTC
(In reply to comment #1)
> With current Mesa CVS (10.0.0! ;-) on RV730 AGP I get this,too.
> 
> Pure LLVM (3.3 stable) bug, NOT sb.
> 
> setenv R600_DEBUG nollvm
> Works OK.
> 
> Nice link, Grigori!
> 
> Application: konqueror (4.11.2)
> KDE Platform Version: 4.11.2
> Qt Version: 4.8.5
> Operating System: Linux 3.12.0-rc3-1-desktop i686
> Distribution: "openSUSE 12.3 (i586)"

Hopefully better (with LLVM source) trace run:

Program received signal SIGSEGV, Segmentation fault.
llvm::ScheduleDAGInstrs::addVRegUseDeps (this=0x0, SU=0xffffffff, OperIdx=<optimized out>)
    at /usr/src/debug/llvm-3.3/lib/CodeGen/ScheduleDAGInstrs.cpp:414
414       LiveRangeQuery LRQ(LIS->getInterval(Reg), LIS->getInstructionIndex(MI));
(gdb) list
409       MachineInstr *MI = SU->getInstr();                                                        
410       unsigned Reg = MI->getOperand(OperIdx).getReg();                                          
411                                                                                                 
412       // Lookup this operand's reaching definition.                                             
413       assert(LIS && "vreg dependencies requires LiveIntervals");                                
414       LiveRangeQuery LRQ(LIS->getInterval(Reg), LIS->getInstructionIndex(MI));                  
415       VNInfo *VNI = LRQ.valueIn();                                                              
416                                                                                                 
417       // VNI will be valid because MachineOperand::readsReg() is checked by caller.             
418       assert(VNI && "No value to read by operand");                                             
(gdb) info registers 
eax            0xad55d20        181755168                                                           
ecx            0x0      0                                                                           
edx            0x0      0                                                                           
ebx            0xad33d000       -1389113344                                                         
esp            0xbfff6f40       0xbfff6f40                                                          
ebp            0x0      0x0                                                                         
esi            0xad441f8        181682680                                                           
edi            0xad55d20        181755168                                                           
eip            0xad2e747d                                                                           
    0xad2e747d <llvm::ScheduleDAGInstrs::addVRegUseDeps(llvm::SUnit*, unsigned int)+77>             
eflags         0x210246 [ PF ZF IF RF ID ]                                                          
cs             0x73     115                                                                         
ss             0x7b     123                                                                         
ds             0x7b     123                                                                         
es             0x7b     123                                                                         
fs             0x0      0                                                                           
gs             0x33     51                                                                          
(gdb) bt                                                                                            
#0  llvm::ScheduleDAGInstrs::addVRegUseDeps (this=0x0, SU=0xffffffff, OperIdx=<optimized out>)      
    at /usr/src/debug/llvm-3.3/lib/CodeGen/ScheduleDAGInstrs.cpp:414                                
#1  0xad2e9890 in llvm::ScheduleDAGInstrs::buildSchedGraph (this=0xad55d20, AA=<optimized out>,     
    RPTracker=0x700) at /usr/src/debug/llvm-3.3/lib/CodeGen/ScheduleDAGInstrs.cpp:776               
#2  0xad21a4dc in llvm::DefaultVLIWScheduler::schedule (this=0xad55d20)                             
    at /usr/src/debug/llvm-3.3/lib/CodeGen/DFAPacketizer.cpp:124                                    
#3  0xad21a7c9 in llvm::VLIWPacketizerList::PacketizeMIs (this=0xbfff7368, MBB=<optimized out>,     
    BeginItr=..., EndItr=...) at /usr/src/debug/llvm-3.3/lib/CodeGen/DFAPacketizer.cpp:164          
#4  0xad90f426 in llvm::R600Packetizer::runOnMachineFunction (this=<optimized out>, Fn=...)         
    at /usr/src/debug/llvm-3.3/lib/Target/R600/R600Packetizer.cpp:444                               
#5  0xad27cbb5 in llvm::MachineFunctionPass::runOnFunction (this=0xac81dd0, F=...)
    at /usr/src/debug/llvm-3.3/lib/CodeGen/MachineFunctionPass.cpp:33
#6  0xacdb7307 in llvm::FPPassManager::runOnFunction (this=0x36, F=...)
    at /usr/src/debug/llvm-3.3/lib/IR/PassManager.cpp:1530
#7  0xacdb7530 in llvm::FPPassManager::runOnModule (this=0xaba13d8, M=...)
    at /usr/src/debug/llvm-3.3/lib/IR/PassManager.cpp:1550
#8  0xacdb77d9 in llvm::MPPassManager::runOnModule (this=0xac6db08, M=...)
    at /usr/src/debug/llvm-3.3/lib/IR/PassManager.cpp:1608
#9  0xacdb7fa1 in llvm::PassManagerImpl::run (this=0xac6a1e0, M=...)
    at /usr/src/debug/llvm-3.3/lib/IR/PassManager.cpp:1703
#10 0xacdb8157 in llvm::PassManager::run (this=0xbfff7578, M=...)
    at /usr/src/debug/llvm-3.3/lib/IR/PassManager.cpp:1738
#11 0xacea2651 in LLVMTargetMachineEmit (T=<optimized out>, M=0xaaed0c0, OS=..., 
    codegen=<optimized out>, ErrorMessage=<optimized out>)
    at /usr/src/debug/llvm-3.3/lib/Target/TargetMachineC.cpp:194
#12 0xacea27a3 in LLVMTargetMachineEmitToMemoryBuffer (T=0xac68280, M=0xaaed0c0, codegen=
    LLVMObjectFile, ErrorMessage=0xbfff7640, OutMemBuf=<optimized out>)
    at /usr/src/debug/llvm-3.3/lib/Target/TargetMachineC.cpp:220
#13 0xade1c7d6 in radeon_llvm_compile () from /usr/lib/dri/updates/r600_dri.so
---Type <return> to continue, or q <return> to quit---
#14 0xade173e2 in r600_llvm_compile () from /usr/lib/dri/updates/r600_dri.so
#15 0xaddc80f7 in r600_shader_from_tgsi () from /usr/lib/dri/updates/r600_dri.so
#16 0xaddc9335 in r600_pipe_shader_create () from /usr/lib/dri/updates/r600_dri.so
#17 0xadddadfd in r600_shader_select () from /usr/lib/dri/updates/r600_dri.so
#18 0xadddafb4 in r600_create_shader_state () from /usr/lib/dri/updates/r600_dri.so
#19 0xadbd4413 in st_translate_fragment_program () from /usr/lib/dri/updates/r600_dri.so
#20 0xadbd4fd6 in st_get_fp_variant () from /usr/lib/dri/updates/r600_dri.so
#21 0xadb9ccfc in update_fp () from /usr/lib/dri/updates/r600_dri.so
#22 0xadb9997e in st_validate_state () from /usr/lib/dri/updates/r600_dri.so
#23 0xadbaea9c in st_draw_vbo () from /usr/lib/dri/updates/r600_dri.so
#24 0xadb82745 in vbo_handle_primitive_restart () from /usr/lib/dri/updates/r600_dri.so
#25 0xadb84247 in vbo_validated_drawrangeelements () from /usr/lib/dri/updates/r600_dri.so
#26 0xadb8462c in vbo_exec_DrawElements () from /usr/lib/dri/updates/r600_dri.so
#27 0xb2775b9f in ?? () from /usr/lib/libQtWebKit.so.4
#28 0xb27661f5 in ?? () from /usr/lib/libQtWebKit.so.4
#29 0xb292f430 in ?? () from /usr/lib/libQtWebKit.so.4
#30 0xb2e1d92b in ?? () from /usr/lib/libQtWebKit.so.4
#31 0xb2e03109 in ?? () from /usr/lib/libQtWebKit.so.4
#32 0xfffffffb in ?? ()
#33 0xb2ea305e in JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) () from /usr/lib/libQtWebKit.so.4
#34 0xb0b5ea4c in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
Comment 3 Dieter Nützel 2013-10-12 21:25:20 UTC
Created attachment 87534 [details]
Dump with R600_DEBUG=ps,vs,fs
Comment 4 vincent 2013-10-27 22:08:42 UTC
Does it work with llvm 3.4svn ? Here it seems llvm can compile the shader without crashing.
Comment 5 Dieter Nützel 2013-10-28 23:41:36 UTC
Sorry,

I haven't have LLVM SVN on this system.

-Dieter
Comment 6 Grigori Goronzy 2013-10-29 00:49:16 UTC
It seems to work fine with current LLVM trunk now.
Comment 7 Dieter Nützel 2013-10-29 02:20:46 UTC
Is a backport possible for stable (3.3)?
Couldn't switch all to devel...;-)
Comment 8 Dieter Nützel 2014-02-01 23:26:04 UTC
OK, now I'm on

openSUSE 13.1
kernel 3.13.1
LLVM 3.4 ;-)
Mesa git-c849ecc
r600g (RV730 AGP)

Works so far, but...
...reflection corruption, see attachment.

With R600_DEBUG=nollvm it is fine.
Comment 9 Dieter Nützel 2014-02-01 23:27:40 UTC
Created attachment 93202 [details]
webgl-water.png
Comment 10 Kertesz Laszlo 2014-02-02 06:51:08 UTC
I have llvm from git compiled a week or so and the rest of the stack yesterday and use a 8570D IGP and the demo works fine on Seamonkey 2.23 with or without llvm (Seamonkey uses the Firefox engine). I have layers.acceleration.force-enabled set to true.

Older versions of llvm had some issues with this demo, crashed the browser or specular lighting was missing.
Comment 11 Dieter Nützel 2014-02-05 01:46:44 UTC
I said that I have 3.4 final (current stable)...

Anyway, it is FIXED, now! - GREAT job!

openSUSE 13.1
kernel 3.13.1
LLVM 3.4 ;-)
Mesa 10.1.0-devel (git-16215a9)
--- The first r600g geom shader (OpenGL 3.3) tree. --- But I have to patch my kernel...;-)
r600g (RV730 AGP)
Konqueror 4.12.2 (KDE 4.12.2)

Could be CLOSED, now.


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.