https://bugs.freedesktop.org/show_bug.cgi?id=79504
Priority: medium Bug ID: 79504 Assignee: dri-devel@lists.freedesktop.org Summary: LLVM error on fragment shader Severity: normal Classification: Unclassified OS: Linux (All) Reporter: kyle@klkblake.com Hardware: x86-64 (AMD64) Status: NEW Version: git Component: Drivers/Gallium/radeonsi Product: Mesa
Created attachment 100230 --> https://bugs.freedesktop.org/attachment.cgi?id=100230&action=edit fragment shader
After compiling the attached shader and making it current, calling glClear() causes the process to crash with this error:
LLVM ERROR: Cannot select: 0x314a010: v16f32 = bitcast 0x3185250 [ORD=347] [ID=224] 0x3185250: v16i32 = BUILD_VECTOR 0x3153680, 0x3153780, 0x3153880, 0x3153980, 0x3187b70, 0x3187970, 0x3097a00, 0x3097800, 0x3097600, 0x3097400, 0x3097200, 0x3097000, 0x3096e00, 0x3096c00, 0x3185550, 0x314b520 [ORD=347] [ID=222] ... <snip> ...
(full error attached)
I'm using the latest git version (3fc72f2ec601cb758d69cf2933dd6268d1a80c5b).
https://bugs.freedesktop.org/show_bug.cgi?id=79504
--- Comment #1 from Kyle Blake kyle@klkblake.com --- Created attachment 100231 --> https://bugs.freedesktop.org/attachment.cgi?id=100231&action=edit simple vertex shader
https://bugs.freedesktop.org/show_bug.cgi?id=79504
--- Comment #2 from Kyle Blake kyle@klkblake.com --- Created attachment 100232 --> https://bugs.freedesktop.org/attachment.cgi?id=100232&action=edit full error log
https://bugs.freedesktop.org/show_bug.cgi?id=79504
--- Comment #3 from Kyle Blake kyle@klkblake.com --- Created attachment 100233 --> https://bugs.freedesktop.org/attachment.cgi?id=100233&action=edit output of glxinfo
https://bugs.freedesktop.org/show_bug.cgi?id=79504
--- Comment #4 from Michel Dänzer michel@daenzer.net --- Can you also attach code or post instructions for reproducing the problem with this fragment shader?
https://bugs.freedesktop.org/show_bug.cgi?id=79504
--- Comment #5 from Kyle Blake kyle@klkblake.com --- Created attachment 100273 --> https://bugs.freedesktop.org/attachment.cgi?id=100273&action=edit testcase
Compile with gcc test.c -lGL -lglut. Depends on freeglut for context creation. Requires raycast.vert and raycast.frag to be in the working directory.
https://bugs.freedesktop.org/show_bug.cgi?id=79504
--- Comment #6 from Michel Dänzer michel@daenzer.net --- Thanks, but unfortunately, this results in an assertion failure during glCompileShader() for me.
Can you attach the stderr output from running this on your end with R600_DEBUG=ps?
https://bugs.freedesktop.org/show_bug.cgi?id=79504
--- Comment #7 from Kyle Blake kyle@klkblake.com --- Created attachment 100277 --> https://bugs.freedesktop.org/attachment.cgi?id=100277&action=edit stderr output with R600_DEBUG=ps
https://bugs.freedesktop.org/show_bug.cgi?id=79504
--- Comment #8 from Michel Dänzer michel@daenzer.net --- I can reproduce the shader compilation failure with LLVM 3.4, but it seems to compile fine here with current LLVM Git/SVN.
https://bugs.freedesktop.org/show_bug.cgi?id=79504
--- Comment #9 from Kyle Blake kyle@klkblake.com --- Yeah, it compiles with LLVM git here. However, when run, it locks up X for a few seconds, displays some snow, and then locks up the kernel. I'm still working on tracking down a minimal testcase for it, but at least replacing the main while loop with this:
child = texelFetch(octree, int(root)).x;
still allows the bug to manifest. Setting child to a constant value does not. Setting the output of the entire shader to texelFetch(octree, int(root)).x at the top and immediately returning displays the correct image, so the texture is correct.
https://bugs.freedesktop.org/show_bug.cgi?id=79504
--- Comment #10 from Kyle Blake kyle@klkblake.com --- Created attachment 100512 --> https://bugs.freedesktop.org/attachment.cgi?id=100512&action=edit full testcase
Sorry for the delay. Attached is a new test case that actually uses the shaders. When it calls glDrawElements(), everything goes to hell, triggering random segfault, graphics memory corruption, and kernel panics.
https://bugs.freedesktop.org/show_bug.cgi?id=79504
Michel Dänzer michel@daenzer.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Assignee|dri-devel@lists.freedesktop |idr@freedesktop.org |.org | QA Contact| |intel-3d-bugs@lists.freedes | |ktop.org Component|Drivers/Gallium/radeonsi |glsl-compiler
--- Comment #11 from Michel Dänzer michel@daenzer.net --- I run into the assertion failure below in the GLSL compiler. That should be addressed first.
test2: ../../../src/glsl/ir_validate.cpp:436: virtual ir_visitor_status {anonymous}::ir_validate::visit_leave(ir_expression*): Assertion `ir->operands[0]->type == ir->operands[1]->type' failed.
Program received signal SIGABRT, Aborted. 0x00007ffff75973a9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 56 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 0x00007ffff75973a9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 0x00007ffff759a4c8 in __GI_abort () at abort.c:89 #2 0x00007ffff75904c6 in __assert_fail_base (fmt=0x7ffff76c7668 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7ffff44c6b40 "ir->operands[0]->type == ir->operands[1]->type", file=file@entry=0x7ffff44ee9d8 "../../../src/glsl/ir_validate.cpp", line=line@entry=436, function=function@entry=0x7ffff44efd80 <(anonymous namespace)::ir_validate::visit_leave(ir_expression*)::__PRETTY_FUNCTION__> "virtual ir_visitor_status {anonymous}::ir_validate::visit_leave(ir_expression*)") at assert.c:92 #3 0x00007ffff7590572 in __GI___assert_fail (assertion=0x7ffff44c6b40 "ir->operands[0]->type == ir->operands[1]->type", file=0x7ffff44ee9d8 "../../../src/glsl/ir_validate.cpp", line=436, function=0x7ffff44efd80 <(anonymous namespace)::ir_validate::visit_leave(ir_expression*)::__PRETTY_FUNCTION__> "virtual ir_visitor_status {anonymous}::ir_validate::visit_leave(ir_expression*)") at assert.c:101 #4 0x00007ffff42e57b1 in (anonymous namespace)::ir_validate::visit_leave (this=<optimized out>, ir=<optimized out>) at ../../../src/glsl/ir_validate.cpp:436 #5 0x00007ffff42e2fdf in ir_assignment::accept (this=0xaaa360, v=0x7fffffffe420) at ../../../src/glsl/ir_hv_accept.cpp:308 #6 0x00007ffff42e2a16 in visit_list_elements (v=v@entry=0x7fffffffe420, l=l@entry=0xaa95e8, statement_list=statement_list@entry=true) at ../../../src/glsl/ir_hv_accept.cpp:56 #7 0x00007ffff42e3204 in ir_if::accept (this=0xaa95c0, v=0x7fffffffe420) at ../../../src/glsl/ir_hv_accept.cpp:391 #8 0x00007ffff42e2a16 in visit_list_elements (v=v@entry=0x7fffffffe420, l=l@entry=0x732698, statement_list=statement_list@entry=true) at ../../../src/glsl/ir_hv_accept.cpp:56 #9 0x00007ffff42e2b79 in ir_function_signature::accept (this=0x732650, v=0x7fffffffe420) at ../../../src/glsl/ir_hv_accept.cpp:116 #10 0x00007ffff42e2a16 in visit_list_elements (v=v@entry=0x7fffffffe420, l=l@entry=0x7324f8, statement_list=statement_list@entry=false) at ../../../src/glsl/ir_hv_accept.cpp:56 #11 0x00007ffff42e2be7 in ir_function::accept (this=0x7324d0, v=0x7fffffffe420) at ../../../src/glsl/ir_hv_accept.cpp:128 #12 0x00007ffff42e2a16 in visit_list_elements (v=v@entry=0x7fffffffe420, l=l@entry=0x6cc4a0, statement_list=statement_list@entry=true) at ../../../src/glsl/ir_hv_accept.cpp:56 #13 0x00007ffff42e293f in ir_hierarchical_visitor::run (this=this@entry=0x7fffffffe420, instructions=instructions@entry=0x6cc4a0) at ../../../src/glsl/ir_hierarchical_visitor.cpp:309 #14 0x00007ffff42e7ae0 in validate_ir_tree (instructions=0x6cc4a0) at ../../../src/glsl/ir_validate.cpp:817 #15 0x00007ffff42d3d2b in _mesa_glsl_compile_shader (ctx=ctx@entry=0x7ffff7fd4010, shader=shader@entry=0x6c1ea0, dump_ast=dump_ast@entry=false, dump_hir=dump_hir@entry=false) at ../../../src/glsl/glsl_parser_extras.cpp:1470 #16 0x00007ffff41aa481 in compile_shader (ctx=0x7ffff7fd4010, shaderObj=<optimized out>) at ../../../src/mesa/main/shaderapi.c:850 #17 0x0000000000401c4f in create_shader () #18 0x0000000000402073 in init_resources () #19 0x00000000004027ec in main ()
https://bugs.freedesktop.org/show_bug.cgi?id=79504
Timothy Arceri t_arceri@yahoo.com.au changed:
What |Removed |Added ---------------------------------------------------------------------------- Assignee|idr@freedesktop.org |dri-devel@lists.freedesktop | |.org QA Contact|intel-3d-bugs@lists.freedes |dri-devel@lists.freedesktop |ktop.org |.org Component|glsl-compiler |Drivers/Gallium/radeonsi
--- Comment #16 from Timothy Arceri t_arceri@yahoo.com.au --- Test program no longer hits any issues in the glsl compiler, and program runs on i965. The program says My First Triangle but has a couple of squares, I'm assuming that's just an issue with the program rather than Mesa.
Reassigning to radeonsi for further testing.
https://bugs.freedesktop.org/show_bug.cgi?id=79504
Michel Dänzer michel@daenzer.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|NEW |RESOLVED
--- Comment #17 from Michel Dänzer michel@daenzer.net --- Thanks guys. Works for me with radeonsi as well now, if it still doesn't for you Kyle, please reopen with current glxinfo output.
https://bugs.freedesktop.org/show_bug.cgi?id=79504
--- Comment #18 from Kyle Blake kyle@klkblake.com --- Confirming that it works for me.
dri-devel@lists.freedesktop.org