Bug 102021 - ir validation assert on valid GLSL
Summary: ir validation assert on valid GLSL
Status: RESOLVED MOVED
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-03 07:08 UTC by Dave Airlie
Modified: 2019-09-18 19:45 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
test to demonstrate error. (1.12 KB, text/plain)
2017-08-03 07:08 UTC, Dave Airlie
Details
hacky attempt at fixing it. (1.34 KB, patch)
2017-08-03 07:38 UTC, Dave Airlie
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Airlie 2017-08-03 07:08:19 UTC
Created attachment 133219 [details]
test to demonstrate error.

I've written a cut down test that shows a problem virgl hits.

It triggers an assert in the validation that the ir->type and ir->operands[0]->type for an abs op are the same and they aren't.

  temp0[1].x = float(inversesqrt( abs(temp0[0]).x));
  temp0[1].y = float(inversesqrt( abs(temp0[0]).y));

is the construct that the compiler squashes incorrectly.

Not sure what pass is responsible for this yet.
Comment 1 Dave Airlie 2017-08-03 07:22:28 UTC
ah looks like do_vectorize

START GLSL optimization do_vectorize
(
(declare (location=0 shader_out ) vec4 gl_Position)
(declare (shader_in ) (array vec4 3) vertex)
(declare (shader_out ) vec4 temp)
(declare (temporary ) vec4 temp0_0)
(declare (temporary ) vec4 temp0_1)
( function main
  (signature void
    (parameters
    )
    (
      (assign  (xyzw) (var_ref temp0_0)  (array_ref (var_ref vertex) (constant int (0)) ) ) 
      (assign  (xy) (var_ref temp0_1)  (expression vec2 rsq (swiz xy (expression vec2 abs (var_ref temp0_0) ) )) ) 
      (assign  (xyzw) (var_ref gl_Position)  (array_ref (var_ref vertex) (constant int (0)) ) ) 
      (assign  (xyzw) (var_ref temp)  (var_ref temp0_1) ) 
      (emit-vertex (constant int (0)) )

    ))

)
Comment 2 Dave Airlie 2017-08-03 07:25:22 UTC
START GLSL optimization optimize_split_arrays
(
(declare (location=0 shader_out ) vec4 gl_Position)
(declare (shader_in ) (array vec4 3) vertex)
(declare (shader_out ) vec4 temp)
(declare (temporary ) vec4 temp0_0)
(declare (temporary ) vec4 temp0_1)
( function main
  (signature void
    (parameters
    )
    (
      (assign  (xyzw) (var_ref temp0_0)  (array_ref (var_ref vertex) (constant int (0)) ) ) 
      (assign  (x) (var_ref temp0_1)  (expression float rsq (swiz x (expression vec4 abs (var_ref temp0_0) ) )) ) 
      (assign  (y) (var_ref temp0_1)  (expression float rsq (swiz y (expression vec4 abs (var_ref temp0_0) ) )) ) 
      (assign  (xyzw) (var_ref gl_Position)  (array_ref (var_ref vertex) (constant int (0)) ) ) 
      (assign  (xyzw) (var_ref temp)  (var_ref temp0_1) ) 
      (emit-vertex (constant int (0)) )

    ))

previous IR before bad opt.
Comment 3 Dave Airlie 2017-08-03 07:38:41 UTC
Created attachment 133221 [details] [review]
hacky attempt at fixing it.
Comment 4 GitLab Migration User 2019-09-18 19:45:55 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/813.


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.