[Mesa-dev] [PATCH 07/12] nir: Don't use ffma in nir_lower_wpos_ytransform().

Kenneth Graunke kenneth at whitecape.org
Fri May 20 01:41:35 UTC 2016


On Thursday, May 19, 2016 12:57:44 PM PDT Rob Clark wrote:
> On Wed, May 18, 2016 at 6:00 PM, Kenneth Graunke <kenneth at whitecape.org> 
wrote:
> > ffma is an explicitly fused multiply add with higher precision.
> > The optimizer will take care of promoting mul/add to fma when
> > it's beneficial to do so.
> >
> > This fixes failures on Gen4-5 when using this pass, as those platforms
> > don't actually implement fma().
> 
> hmm, we can't rely on the opt-algebraic pass to do this?
> 
> BR,
> -R

We can rely on either nir_opt_algebraic (with the fuse_ffma flag set)
or brw_nir_opt_peephole_ffma() (if someone wants to move it to
src/compiler/nir and use it) to fuse add+mul into ffma.

However, we can't rely on nir_opt_algebraic to split up ffma into
mul+add for us.  We made it stop doing that a little while ago,
so that the GLSL fma() built-in is always higher precision.  (The
thinking is that if apps didn't care, they would just write (a*b+c),
and that splitting fma() is pretty bunk...and splitting and reassembling
so fma() has /inconsistent/ precision is even more bunk...)

I suppose I could just set lower_ffma in i965's nir_compiler_options
for Gen < 6 where we don't have a MAD instruction (and don't support
the GLSL fma() built-in function, either).  That might be more sensible.

--Ken
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160519/984b926b/attachment.sig>


More information about the mesa-dev mailing list