[Mesa-dev] [PATCH] nir: Add optional lowering of flrp.
Connor Abbott
cwabbott0 at gmail.com
Wed Mar 25 14:45:12 PDT 2015
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
We should probably use this for Gen4-5 too.
On Wed, Mar 25, 2015 at 5:11 PM, Eric Anholt <eric at anholt.net> wrote:
> ---
>
> I missed this one when I was doing my other lowering bits. I don't
> have ffma, and I certainly don't have flrp.
>
> src/gallium/drivers/vc4/vc4_program.c | 1 +
> src/glsl/nir/nir.h | 1 +
> src/glsl/nir/nir_opt_algebraic.py | 1 +
> 3 files changed, 3 insertions(+)
>
> diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
> index 26816ca..e768b1a 100644
> --- a/src/gallium/drivers/vc4/vc4_program.c
> +++ b/src/gallium/drivers/vc4/vc4_program.c
> @@ -2005,6 +2005,7 @@ nir_to_qir(struct vc4_compile *c)
>
> static const nir_shader_compiler_options nir_options = {
> .lower_ffma = true,
> + .lower_flrp = true,
> .lower_fpow = true,
> .lower_fsat = true,
> .lower_fsqrt = true,
> diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> index 29fe942..7b886e3 100644
> --- a/src/glsl/nir/nir.h
> +++ b/src/glsl/nir/nir.h
> @@ -1365,6 +1365,7 @@ typedef struct nir_function {
>
> typedef struct nir_shader_compiler_options {
> bool lower_ffma;
> + bool lower_flrp;
> bool lower_fpow;
> bool lower_fsat;
> bool lower_fsqrt;
> diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
> index 1ee51a0..20ec4d3 100644
> --- a/src/glsl/nir/nir_opt_algebraic.py
> +++ b/src/glsl/nir/nir_opt_algebraic.py
> @@ -75,6 +75,7 @@ optimizations = [
> (('flrp', a, b, 1.0), b),
> (('flrp', a, a, b), a),
> (('flrp', 0.0, a, b), ('fmul', a, b)),
> + (('flrp', a, b, c), ('fadd', ('fmul', c, ('fsub', b, a)), a), 'options->lower_flrp'),
> (('ffma', a, b, c), ('fadd', ('fmul', a, b), c), 'options->lower_ffma'),
> (('fadd', ('fmul', a, b), c), ('ffma', a, b, c), '!options->lower_ffma'),
> # Comparison simplifications
> --
> 2.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list