Bug 102274

Summary: assertion failure in ir_validate.cpp:240
Product: Mesa Reporter: Brian Paul <brianp>
Component: glsl-compilerAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: major    
Priority: medium CC: t_arceri
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Brian Paul 2017-08-17 14:06:48 UTC
I think this is a recent regression but I haven't had time to bisect it yet.

The piglit tests fs-ldexp.shader_test and vs-ldexp.shader_test fail:

$ bin/shader_runner tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-ldexp.shader_test -auto
shader_runner: ../../../src/compiler/glsl/ir_validate.cpp:240: virtual ir_visitor_status {anonymous}::ir_validate::visit_leave(ir_expression*): Assertion `ir->operands[i] == __null' failed.
Aborted
Comment 1 Brian Paul 2017-08-17 17:30:57 UTC
I bisected the regression to this commit:

commit e2e2c5abd279df1b3aa99c52b81c9cb48fea35fb
Author: Timothy Arceri <tarceri@itsqueeze.com>
Date:   Wed Aug 9 13:34:02 2017 +1000

    glsl: calculate number of operands in an expression once
    
    Extra validation is added to ir_validate to make sure this is
    always updated to the correct numer of operands, as passes like
    lower_instructions modify the instructions directly rather then
    generating a new one.
    
    The reduction in time is so small that it is not really
    measurable. However callgrind was reporting this function as
    being called just under 34 million times while compiling the
    Deus Ex shaders (just pre-linking was profiled) with 0.20%
    spent in this function.
    
    v2:
     - make num_operands a unit8_t
     - fix unsigned/signed mismatches
    
    Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Comment 2 Timothy Arceri 2017-08-18 02:09:35 UTC
Fixed by:

commit c03eefdf843098c93c8e95856e0e482a60915590
Author: Timothy Arceri <tarceri@itsqueeze.com>
Date:   Fri Aug 18 09:32:15 2017 +1000

    glsl: set old ldexp operand to NULL when lowering
    
    This fixes an assert during IR validation in LLVMpipe.
    
    Fixes: e2e2c5abd279 (glsl: calculate number of operands in an expression once)
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102274
    Reviewed-by: Brian Paul <brianp@vmware.com>
    Tested-by: Brian Paul <brianp@vmware.com>

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.