Re: [Mesa-dev] [PATCH 4/9] gallium-tgsi: add TGSI_OPCODE_{FMA-POPCNT-MSB-LSB} description

2014-01-07 Thread Maxence Le Doré
For this reason, GLSL 4.0 introduces the 'precise' qualifier. I invite you to take a look at this article. 2014/1/6 Roland Scheidegger srol...@vmware.com: Am 05.01.2014 01:34, schrieb Maxence Le Doré: FMA(a,b,c) keeps extra precision (usually 1 more bit of mantissa, afaik) for the result a*b

Re: [Mesa-dev] [PATCH 4/9] gallium-tgsi: add TGSI_OPCODE_{FMA-POPCNT-MSB-LSB} description

2014-01-07 Thread Maxence Le Doré
I forgot the link : http://www.geeks3d.com/20120106/precise-qualifier-in-glsl-and-nvidia-geforce-cards/ 2014/1/7 Maxence Le Doré maxence.led...@gmail.com: For this reason, GLSL 4.0 introduces the 'precise' qualifier. I invite you to take a look at this article. 2014/1/6 Roland Scheidegger

Re: [Mesa-dev] [PATCH 4/9] gallium-tgsi: add TGSI_OPCODE_{FMA-POPCNT-MSB-LSB} description

2014-01-07 Thread Roland Scheidegger
Yes that is certainly related. I'm actually not entirely sure what is allowed in glsl by default as OpenGL seems to have some lax rules regarding precision in any case (float calculations not required but allowed to use denorms, at least earlier versions weren't required to support Infs neither

Re: [Mesa-dev] [PATCH 4/9] gallium-tgsi: add TGSI_OPCODE_{FMA-POPCNT-MSB-LSB} description

2014-01-07 Thread Marek Olšák
FYI, Evergreen has dedicated instructions for both MAD and FMA. FMA seems to be available on DX11 chips only. Marek On Tue, Jan 7, 2014 at 8:20 PM, Roland Scheidegger srol...@vmware.com wrote: Yes that is certainly related. I'm actually not entirely sure what is allowed in glsl by default as

Re: [Mesa-dev] [PATCH 4/9] gallium-tgsi: add TGSI_OPCODE_{FMA-POPCNT-MSB-LSB} description

2014-01-07 Thread Roland Scheidegger
Yes, and I guess just about all GPUs can do that. For llvmpipe we'd be vaguely interested in being able to do opencl-style MAD with undefined rounding as FMA since (x86) cpus never have MAD but may have FMA. I am not sure actually though this is ok for d3d10 - interestingly d3d10 has only MAD for

Re: [Mesa-dev] [PATCH 4/9] gallium-tgsi: add TGSI_OPCODE_{FMA-POPCNT-MSB-LSB} description

2014-01-07 Thread Vadim Girlin
On Tue, 2014-01-07 at 21:49 +0100, Marek Olšák wrote: FYI, Evergreen has dedicated instructions for both MAD and FMA. FMA seems to be available on DX11 chips only. FWIW, not all evergreen chips support FMA, only high-end chips that support FP64 (I guess cypress only), according to the isa docs:

Re: [Mesa-dev] [PATCH 4/9] gallium-tgsi: add TGSI_OPCODE_{FMA-POPCNT-MSB-LSB} description

2014-01-06 Thread Roland Scheidegger
Am 05.01.2014 01:34, schrieb Maxence Le Doré: FMA(a,b,c) keeps extra precision (usually 1 more bit of mantissa, afaik) for the result a*b and add this to c, to finally produce a IEEE754 32bit float result. MAD(a,b,c) product a IEEE754 32bit float product a*b and add it to C. So, fma can

[Mesa-dev] [PATCH 4/9] gallium-tgsi: add TGSI_OPCODE_{FMA-POPCNT-MSB-LSB} description

2014-01-04 Thread Maxence Le Doré
From: Maxence Le Doré Maxence Le Doré --- src/gallium/auxiliary/tgsi/tgsi_info.c | 16 src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h | 6 ++ src/gallium/include/pipe/p_shader_tokens.h | 9 - 3 files changed, 30 insertions(+), 1 deletion(-) diff --git

Re: [Mesa-dev] [PATCH 4/9] gallium-tgsi: add TGSI_OPCODE_{FMA-POPCNT-MSB-LSB} description

2014-01-04 Thread Marek Olšák
How is FMA different from MAD? Please document the new opcodes in src/gallium/docs/source/tgsi.rst. Marek On Sun, Jan 5, 2014 at 12:42 AM, Maxence Le Doré maxence.led...@gmail.com wrote: From: Maxence Le Doré Maxence Le Doré --- src/gallium/auxiliary/tgsi/tgsi_info.c | 16

Re: [Mesa-dev] [PATCH 4/9] gallium-tgsi: add TGSI_OPCODE_{FMA-POPCNT-MSB-LSB} description

2014-01-04 Thread Maxence Le Doré
FMA(a,b,c) keeps extra precision (usually 1 more bit of mantissa, afaik) for the result a*b and add this to c, to finally produce a IEEE754 32bit float result. MAD(a,b,c) product a IEEE754 32bit float product a*b and add it to C. So, fma can be slightly more accurate. An accuracy that is