vc4 cse/algebraic-disabled stats: total uniforms in shared programs: 13966 -> 13791 (-1.25%) uniforms in affected programs: 435 -> 260 (-40.23%) total instructions in shared programs: 44732 -> 44356 (-0.84%) instructions in affected programs: 9599 -> 9223 (-3.92%) --- src/gallium/drivers/vc4/vc4_program.c | 1 + src/glsl/nir/nir.h | 1 + src/glsl/nir/nir_opt_algebraic.py | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 304cd04..8be2d15 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -2098,6 +2098,7 @@ nir_to_qir(struct vc4_compile *c) } static const nir_shader_compiler_options nir_options = { + .lower_ffma = true, .lower_fpow = true, .lower_fsqrt = true, .lower_negate = true, diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index 0746adf..f7f5d33 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -1327,6 +1327,7 @@ typedef struct nir_function { exec_list_get_head(&(func)->overload_list), node) typedef struct nir_shader_compiler_options { + bool lower_ffma; bool lower_fpow; bool lower_fsqrt; /** lowers fneg and ineg to fsub and isub. */ diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py index 7d5f543..8a14fe0 100644 --- a/src/glsl/nir/nir_opt_algebraic.py +++ b/src/glsl/nir/nir_opt_algebraic.py @@ -71,7 +71,8 @@ optimizations = [ (('flrp', a, b, 1.0), b), (('flrp', a, a, b), a), (('flrp', 0.0, a, b), ('fmul', a, b)), - (('fadd', ('fmul', a, b), c), ('ffma', a, b, c)), + (('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 (('inot', ('flt', a, b)), ('fge', a, b)), (('inot', ('fge', a, b)), ('flt', a, b)), -- 2.1.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev