[Mesa-dev] [PATCH 07/12] nir: Don't use ffma in nir_lower_wpos_ytransform().
Rob Clark
robdclark at gmail.com
Fri May 20 13:20:33 UTC 2016
On Thu, May 19, 2016 at 9:41 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> 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.
hmm, I did kinda like the fact that it was pretty easy to compare the
tgsi and nir versions of emit_wpos_adjustment() side by side.. at
least if there was ever a fix made to one it should be straightforward
to port to the other. But otoh the tgsi version has more or less
existed forever so I guess the odds of that are low. And I don't have
a better idea about fma precision. So:
Reviewed-by: Rob Clark <robdclark at gmail.com>
(Although perhaps NIR should really just have both fmad and ffma
instructions.. since, some hw has lower precision mad..)
BR,
-R
> --Ken
More information about the mesa-dev
mailing list