[Mesa-dev] [PATCH 0/9] i965: Remove unneeded algebraic optimizations

Jason Ekstrand jason at jlekstrand.net
Fri Mar 18 00:47:47 UTC 2016


On Thu, Mar 17, 2016 at 10:21 AM, Jason Ekstrand <jason at jlekstrand.net>
wrote:

> This little series prepares the backend compiler for invariant and precise
> by removing any potentially unsafe optimizations.  The easiest
> implementation for invariant and precise seems to be the same: Don't change
> the semantics of invariant or precise values.  This means that we need to
> track what values are invariant or precise and be very careful how we
> optimize them.  In the backend, it's easier to just not do those
> optimizations than to try and plumb that information through accurately.
> Fortunately, NIR is doing a good enough job that this can be done with a
> minimum of shader-db damage.
>

There has been some discussion on patches on the ML and in the cube as to
how much we want to delete.  According to my (admittedly a bit dated)
shader-db, we can delete quite a lot without really hurting much.  However,
not everyone seems comfortable with this.  I don't much care about deleting
everything I just decided to try it and see what happens.  Here are the
things I think we do need to do:

 1) Get rid of RCP+RSQ
 2) Stop constant-folding RCP
 3) Make opt_vector_float correct regardless of opt_algebraic handling
mov.sat of immediates.

I think (1) and (2) are enough for getting "invariant" and "precise"
correct.  The bugs in opt_vector_float I think are real, but my patches to
fix them are equally bogus.

The rest of the series is just deleting potentially dead code.  I don't
care too much either way on that.  To summarize, the other potentially
deletable things are:

 1) the MAD optimization in fs_opt_algebraic
 2) the SEL.sat optimization (both fs and vec4)
 3) the trivial floating-point algebraic optimizations (most of these are
probably precise-safe but they aren't doing anything)
 4) MOV.sat on immediates

Opinions?
--Jason


> Jason Ekstrand (9):
>   i965/fs: Remove the RCP+RSQ peephole
>   nir/algebraic: Add two more fsat optimizations
>   i965/fs: Get rid of the sel.sat peephole
>   i965/fs: Get rid of all remaining algebraic optimizations for floats
>   i965/fs: Don't constant-fold RCP
>   i965/vec4: Don't constant propagate saturated values
>   i965/vec4: Don't allow type conversion in opt_vector_float
>   i965/vec4: Handle saturated constants in opt_vector_float
>   i965/vec4: Disable algebraic optimizations on floats
>
>  src/compiler/nir/nir_opt_algebraic.py              |   2 +
>  src/mesa/drivers/dri/i965/brw_fs.cpp               | 119
> ++++-----------------
>  .../drivers/dri/i965/brw_fs_copy_propagation.cpp   |  15 ---
>  src/mesa/drivers/dri/i965/brw_vec4.cpp             |  49 ++++-----
>  .../drivers/dri/i965/brw_vec4_copy_propagation.cpp |   3 +
>  5 files changed, 41 insertions(+), 147 deletions(-)
>
> --
> 2.5.0.400.gff86faf
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160317/54f56c4c/attachment.html>


More information about the mesa-dev mailing list