Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-17 Thread Ian Romanick
On 01/12/2017 02:47 PM, Matteo Bruni wrote: > 2017-01-12 23:41 GMT+01:00 Axel Davy : >>> Do you refer to the d3d9 MAD or the hardware instruction? If the >>> former, just generating MUL and ADD separately should do the trick. In >>> the latter case, I guess that means the "NaN

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-14 Thread Axel Davy
On 13/01/2017 19:06, Nicolai Hähnle wrote: On 13.01.2017 18:53, Jason Ekstrand wrote: On Fri, Jan 13, 2017 at 8:43 AM, Marek Olšák > wrote: On Fri, Jan 13, 2017 at 5:25 PM, Jason Ekstrand >

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-13 Thread Axel Davy
On 13/01/2017 19:50, Matteo Bruni wrote: 2017-01-13 3:37 GMT+01:00 Ilia Mirkin : On Thu, Jan 12, 2017 at 9:13 PM, Jason Ekstrand wrote: Unless, of course, it's controlled by the same hardware bit... Clearly, we can can give you abs on rsq without

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-13 Thread Matteo Bruni
2017-01-13 3:37 GMT+01:00 Ilia Mirkin : > On Thu, Jan 12, 2017 at 9:13 PM, Jason Ekstrand wrote: >> Unless, of course, it's controlled by the same hardware bit... Clearly, we >> can can give you abs on rsq without denorm flushing (easy shader hacks) but

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-13 Thread Nicolai Hähnle
On 13.01.2017 18:53, Jason Ekstrand wrote: On Fri, Jan 13, 2017 at 8:43 AM, Marek Olšák > wrote: On Fri, Jan 13, 2017 at 5:25 PM, Jason Ekstrand > wrote: > On Fri, Jan 13, 2017 at 4:05 AM,

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-13 Thread Jason Ekstrand
On Fri, Jan 13, 2017 at 8:43 AM, Marek Olšák wrote: > On Fri, Jan 13, 2017 at 5:25 PM, Jason Ekstrand > wrote: > > On Fri, Jan 13, 2017 at 4:05 AM, Marek Olšák wrote: > >> > >> On Fri, Jan 13, 2017 at 3:37 AM, Ilia Mirkin

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-13 Thread Marek Olšák
On Fri, Jan 13, 2017 at 5:25 PM, Jason Ekstrand wrote: > On Fri, Jan 13, 2017 at 4:05 AM, Marek Olšák wrote: >> >> On Fri, Jan 13, 2017 at 3:37 AM, Ilia Mirkin wrote: >> > On Thu, Jan 12, 2017 at 9:13 PM, Jason Ekstrand

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-13 Thread Jason Ekstrand
On Fri, Jan 13, 2017 at 4:05 AM, Marek Olšák wrote: > On Fri, Jan 13, 2017 at 3:37 AM, Ilia Mirkin wrote: > > On Thu, Jan 12, 2017 at 9:13 PM, Jason Ekstrand > wrote: > >> Unless, of course, it's controlled by the same hardware

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-13 Thread Marek Olšák
On Fri, Jan 13, 2017 at 3:37 AM, Ilia Mirkin wrote: > On Thu, Jan 12, 2017 at 9:13 PM, Jason Ekstrand wrote: >> Unless, of course, it's controlled by the same hardware bit... Clearly, we >> can can give you abs on rsq without denorm flushing (easy

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-12 Thread Ilia Mirkin
On Thu, Jan 12, 2017 at 9:13 PM, Jason Ekstrand wrote: > Unless, of course, it's controlled by the same hardware bit... Clearly, we > can can give you abs on rsq without denorm flushing (easy shader hacks) but > not the other way around. OK, so somehow I missed that

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-12 Thread Jason Ekstrand
On Jan 12, 2017 4:56 PM, "Ilia Mirkin" wrote: On Thu, Jan 12, 2017 at 7:46 PM, Matt Turner wrote: > On Thu, Jan 12, 2017 at 3:20 PM, Ilia Mirkin wrote: >> On Thu, Jan 12, 2017 at 6:04 PM, Nicolai Hähnle wrote:

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-12 Thread Matt Turner
On Thu, Jan 12, 2017 at 4:56 PM, Ilia Mirkin wrote: > On Thu, Jan 12, 2017 at 7:46 PM, Matt Turner wrote: >> On Thu, Jan 12, 2017 at 3:20 PM, Ilia Mirkin wrote: >>> On Thu, Jan 12, 2017 at 6:04 PM, Nicolai Hähnle

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-12 Thread Ilia Mirkin
On Thu, Jan 12, 2017 at 7:46 PM, Matt Turner wrote: > On Thu, Jan 12, 2017 at 3:20 PM, Ilia Mirkin wrote: >> On Thu, Jan 12, 2017 at 6:04 PM, Nicolai Hähnle wrote: >>> On 12.01.2017 23:46, Ilia Mirkin wrote: On Thu, Jan 12,

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-12 Thread Matt Turner
On Thu, Jan 12, 2017 at 3:20 PM, Ilia Mirkin wrote: > On Thu, Jan 12, 2017 at 6:04 PM, Nicolai Hähnle wrote: >> On 12.01.2017 23:46, Ilia Mirkin wrote: >>> >>> On Thu, Jan 12, 2017 at 4:03 PM, Matteo Bruni >>> wrote:

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-12 Thread Marek Olšák
On Fri, Jan 13, 2017 at 12:43 AM, Nicolai Hähnle wrote: > On 13.01.2017 00:20, Ilia Mirkin wrote: >> >> On Thu, Jan 12, 2017 at 6:04 PM, Nicolai Hähnle >> wrote: >>> >>> On 12.01.2017 23:46, Ilia Mirkin wrote: On Thu, Jan 12, 2017 at 4:03

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-12 Thread Nicolai Hähnle
On 13.01.2017 00:20, Ilia Mirkin wrote: On Thu, Jan 12, 2017 at 6:04 PM, Nicolai Hähnle wrote: On 12.01.2017 23:46, Ilia Mirkin wrote: On Thu, Jan 12, 2017 at 4:03 PM, Matteo Bruni wrote: So, what would be really nice to have is a GLSL

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-12 Thread Ilia Mirkin
On Thu, Jan 12, 2017 at 6:04 PM, Nicolai Hähnle wrote: > On 12.01.2017 23:46, Ilia Mirkin wrote: >> >> On Thu, Jan 12, 2017 at 4:03 PM, Matteo Bruni >> wrote: >>> >>> So, what would be really nice to have is a GLSL extension for some >>> kind of

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-12 Thread Nicolai Hähnle
On 12.01.2017 23:46, Ilia Mirkin wrote: On Thu, Jan 12, 2017 at 4:03 PM, Matteo Bruni wrote: So, what would be really nice to have is a GLSL extension for some kind of switch to select the requested behavior WRT NaN. For example a three-way option with "don't generate

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-12 Thread Matteo Bruni
2017-01-12 23:41 GMT+01:00 Axel Davy : >> Do you refer to the d3d9 MAD or the hardware instruction? If the >> former, just generating MUL and ADD separately should do the trick. In >> the latter case, I guess that means the "NaN switch" should also >> affect code generation

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-12 Thread Ilia Mirkin
On Thu, Jan 12, 2017 at 4:03 PM, Matteo Bruni wrote: > So, what would be really nice to have is a GLSL extension for some > kind of switch to select the requested behavior WRT NaN. For example a > three-way option with "don't generate NaN in arithmetic operations", > "do

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-12 Thread Axel Davy
On 12/01/2017 23:09, Matteo Bruni wrote: 2017-01-12 22:54 GMT+01:00 Axel Davy : Preventing NaN from being generated is not sufficient to fix the 0*inf = 0 issue. For example radeonsi does convert all NaN to zeros via a hardware setting. But 0*inf = 0 behaviour should be also

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-12 Thread Matteo Bruni
2017-01-12 22:54 GMT+01:00 Axel Davy : > > Preventing NaN from being generated is not sufficient to fix the 0*inf = 0 > issue. > > For example radeonsi does convert all NaN to zeros via a hardware setting. > > But 0*inf = 0 behaviour should be also in mad, and with the NaN to

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-12 Thread Matteo Bruni
2017-01-12 22:25 GMT+01:00 Roland Scheidegger : > Is there actually a formal requirement that d3d9 hw never generates > NaNs? I think d3d9 is very lacking in spec there - if that is specified > somewhere I've never seen it... Maybe just everybody is expecting no > NaNs there

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-12 Thread Axel Davy
On 12/01/2017 22:03, Matteo Bruni wrote: 2017-01-11 19:09 GMT+01:00 Jason Ekstrand : Another reason why I'm not a huge fan is that there is some momentum in the industry to make GLSL better defined with respect to NaN. I don't know that anything will ever come of it

Re: [Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-12 Thread Roland Scheidegger
Am 12.01.2017 um 22:03 schrieb Matteo Bruni: > 2017-01-11 19:09 GMT+01:00 Jason Ekstrand : >> Another reason why I'm not a huge fan is that there is some momentum in the >> industry to make GLSL better defined with respect to NaN. I don't know that >> anything will ever come

[Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

2017-01-12 Thread Matteo Bruni
2017-01-11 19:09 GMT+01:00 Jason Ekstrand : > Another reason why I'm not a huge fan is that there is some momentum in the > industry to make GLSL better defined with respect to NaN. I don't know that > anything will ever come of it (because it may break apps) but if