[Mesa-dev] [PATCH] nir: mark dsqrt/drsqrt/drcp implementation as exact

Connor Abbott cwabbott0 at gmail.com
Thu Apr 28 15:35:52 UTC 2016


On Thu, Apr 28, 2016 at 11:26 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> On Thu, Apr 28, 2016 at 11:21 AM, Connor Abbott <cwabbott0 at gmail.com> wrote:
>> On Thu, Apr 28, 2016 at 11:20 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>>> What if the existing operations were already exact?
>>
>> They aren't -- the builder makes them non-exact by default, and we
>> initialize the builder ourselves in this pass.
>
> Hmmmmmm... OK. I'm just thinking of the case
>
> precise c  = op(a, b)
>
> And op gets lowered. The resulting operations should also be exact. If
> that's what's happening, then all's well.

The resulting operations should be exact regardless of whether the
original one was exact -- they're relying on the extra precision that
fma() gives us in order to get the right precision in the result, and
like in GLSL, there's no guarantee that a non-exact fma won't be split
into multiply + add. Once we lower the operation, the compiler can't
really apply any optimizations to the operation as a whole (except
maybe constant folding) so it basically becomes exact anyways.

>
>   -ilia


More information about the mesa-dev mailing list