Re: [Mesa-dev] [PATCH] nir: Optimize double-precision lower_round_even()

2019-01-29 Thread Erik Faye-Lund
On Tue, 2019-01-29 at 14:41 +, Roland Scheidegger wrote: > Am 29.01.19 um 10:10 schrieb Erik Faye-Lund: > > On Mon, 2019-01-28 at 09:31 -0800, Matt Turner wrote: > > > Use the trick of adding and then subtracting 2**52 (52 is the > > > number > > > of > > > explicit mantissa bits a

Re: [Mesa-dev] [PATCH] nir: Optimize double-precision lower_round_even()

2019-01-29 Thread Roland Scheidegger
Am 29.01.19 um 10:10 schrieb Erik Faye-Lund: > On Mon, 2019-01-28 at 09:31 -0800, Matt Turner wrote: >> Use the trick of adding and then subtracting 2**52 (52 is the number >> of >> explicit mantissa bits a double-precision floating-point value has) >> to >> implement round-to-even. >> >> Cuts the

Re: [Mesa-dev] [PATCH] nir: Optimize double-precision lower_round_even()

2019-01-29 Thread Philipp Zabel
On Tue, 2019-01-29 at 10:10 +0100, Erik Faye-Lund wrote: > On Mon, 2019-01-28 at 09:31 -0800, Matt Turner wrote: > > Use the trick of adding and then subtracting 2**52 (52 is the number > > of > > explicit mantissa bits a double-precision floating-point value has) > > to > > implement

Re: [Mesa-dev] [PATCH] nir: Optimize double-precision lower_round_even()

2019-01-29 Thread Erik Faye-Lund
On Mon, 2019-01-28 at 09:31 -0800, Matt Turner wrote: > Use the trick of adding and then subtracting 2**52 (52 is the number > of > explicit mantissa bits a double-precision floating-point value has) > to > implement round-to-even. > > Cuts the number of instructions on SKL of the piglit test >

Re: [Mesa-dev] [PATCH] nir: Optimize double-precision lower_round_even()

2019-01-28 Thread Matt Turner
On Mon, Jan 28, 2019 at 10:25 AM Roland Scheidegger wrote: > > I like it :-). > That said, there's some caveats as discussed on IRC - in particular for > gpus which don't do round-to-nearest-even for ordinary fp64 math (or > rounding mode could be set to something else manually) it won't do the >

Re: [Mesa-dev] [PATCH] nir: Optimize double-precision lower_round_even()

2019-01-28 Thread Roland Scheidegger
I like it :-). That said, there's some caveats as discussed on IRC - in particular for gpus which don't do round-to-nearest-even for ordinary fp64 math (or rounding mode could be set to something else manually) it won't do the right thing. And if you can have fast-math enabled, then it probably

[Mesa-dev] [PATCH] nir: Optimize double-precision lower_round_even()

2019-01-28 Thread Matt Turner
Use the trick of adding and then subtracting 2**52 (52 is the number of explicit mantissa bits a double-precision floating-point value has) to implement round-to-even. Cuts the number of instructions on SKL of the piglit test fs-roundEven-double.shader_test from 109 to 21. ---