Bug 107879 - crash happens when link program
Summary: crash happens when link program
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Jason Ekstrand
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords: bisected, regression
Depends on:
Blocks:
 
Reported: 2018-09-10 04:30 UTC by xinghua
Modified: 2018-09-19 19:52 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
verpixshader.c (3.61 KB, text/x-csrc)
2018-09-10 04:30 UTC, xinghua
Details
attachment-17105-0.html (1.73 KB, text/html)
2018-09-19 07:04 UTC, Yang Gu
Details
attachment-8396-0.html (1.70 KB, text/html)
2018-09-19 19:52 UTC, Jason Ekstrand
Details

Description xinghua 2018-09-10 04:30:42 UTC
Created attachment 141498 [details]
verpixshader.c

This issue happens on chrome when run this case, https://www.khronos.org/registry/webgl/sdk/tests/conformance2/glsl3/short-circuiting-in-loop-condition.html?webglVersion=2&quiet=0
But I also reproduced it when writing a simple case.
Steps:
1. Download the attached file, and use "gcc -o verpixshader verpixshader.c -lX11 -lepoxy" to build target file.
2. run "./verpixshader", crash happens.

Note: It seems a regression of latest mesa code. And the crash stack is as below,
Thread 1 "verpixshader" received signal SIGSEGV, Segmentation fault.
validate_intrinsic_instr (state=<optimized out>, instr=0x555555ed4210) at nir/nir_validate.c:525
525	      validate_assert(state, dst->type == src->type);
(gdb) bt
#0  validate_intrinsic_instr (state=<optimized out>, instr=0x555555ed4210) at nir/nir_validate.c:525
#1  validate_instr (state=<optimized out>, instr=0x555555ed4210) at nir/nir_validate.c:631
#2  validate_block (state=<optimized out>, block=0x555555ef5680) at nir/nir_validate.c:713
#3  validate_cf_node (node=0x555555ef5680, state=<optimized out>) at nir/nir_validate.c:877
#4  0x00007ffff37f428b in validate_function_impl (state=<optimized out>, impl=<optimized out>) at nir/nir_validate.c:1095
#5  validate_function (state=0x7fffffffd940, func=0x55555590d690) at nir/nir_validate.c:1113
#6  nir_validate_shader (shader=shader@entry=0x555555ec4610) at nir/nir_validate.c:1224
#7  0x00007ffff3a32bdd in brw_nir_optimize (nir=nir@entry=0x555555ec4610, compiler=compiler@entry=0x55555579bf50, is_scalar=is_scalar@entry=true, allow_copies=allow_copies@entry=true)
    at compiler/brw_nir.c:584
#8  0x00007ffff3a34d45 in brw_preprocess_nir (compiler=0x55555579bf50, nir=nir@entry=0x555555ec4610) at compiler/brw_nir.c:685
#9  0x00007ffff38651c7 in brw_create_nir (brw=brw@entry=0x5555558c8e60, shader_prog=shader_prog@entry=0x555555903e60, prog=prog@entry=0x555555908330, stage=stage@entry=MESA_SHADER_FRAGMENT, 
    is_scalar=<optimized out>) at brw_program.c:106
#10 0x00007ffff38595b1 in brw_link_shader (ctx=0x5555558c8e60, shProg=0x555555903e60) at brw_link.cpp:267
#11 0x00007ffff36524e7 in _mesa_glsl_link_shader (ctx=ctx@entry=0x5555558c8e60, prog=prog@entry=0x555555903e60) at program/ir_to_mesa.cpp:3180
#12 0x00007ffff355075c in link_program (no_error=<optimized out>, shProg=<optimized out>, ctx=<optimized out>) at main/shaderapi.c:1211
#13 link_program_error (ctx=0x5555558c8e60, shProg=0x555555903e60) at main/shaderapi.c:1296
#14 0x00007ffff3550a97 in _mesa_LinkProgram (programObj=<optimized out>) at main/shaderapi.c:1789
#15 0x00005555555550ee in main ()
Comment 1 Tapani Pälli 2018-09-10 06:38:59 UTC
I've bisected this to quite old commit

--- 8< ---
commit 152057b138d58370f6b90406b07b2604439fabb7
Author: Jason Ekstrand <jason.ekstrand@intel.com>
Date:   Mon Mar 19 18:00:14 2018 -0700

    i965: Move nir_lower_deref_instrs to right before locals_to_regs
    
    Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
    Acked-by: Rob Clark <robdclark@gmail.com>
    Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
    Acked-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Comment 2 Jason Ekstrand 2018-09-19 07:02:31 UTC
This is fixed by the following commit in master:

commit 864c780566b8782c4fc69b4337db768223717bd8
Author: Jason Ekstrand <jason.ekstrand@intel.com>
Date:   Tue Sep 11 12:55:45 2018 -0500

    nir/opt_if: Re-materialize derefs in use blocks before peeling loops
    
    Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107879
    Cc: "18.2" <mesa-stable@lists.freedesktop.org>
Comment 3 Yang Gu 2018-09-19 07:04:57 UTC
Created attachment 141651 [details]
attachment-17105-0.html

Yang is OOO from Sep 17 to 20. Please expect slow response.
Comment 4 Mark Janes 2018-09-19 19:35:00 UTC
Jason: does this regression deserve a piglit test?
Comment 5 Jason Ekstrand 2018-09-19 19:52:49 UTC
Created attachment 141653 [details]
attachment-8396-0.html

We could scrape the shader and make a glslparser test out of it

On September 19, 2018 21:35:01 bugzilla-daemon@freedesktop.org wrote:
>
> Comment # 4 on bug 107879 from Mark JanesJason: does this regression 
> deserve a piglit test?
>
> You are receiving this mail because:You are the assignee for the bug.


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.