Mesa (master): nir: Add a flag for lowering ffma.
Eric Anholt
anholt at kemper.freedesktop.org
Wed Feb 18 22:57:23 UTC 2015
Module: Mesa
Branch: master
Commit: e5ecf8e4272522e1950d1d4318df19377bf49ae1
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e5ecf8e4272522e1950d1d4318df19377bf49ae1
Author: Eric Anholt <eric at anholt.net>
Date: Fri Jan 30 13:49:48 2015 -0800
nir: Add a flag for lowering ffma.
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%)
v2: Rebase to master (no TGSI->NIR present)
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org> (v1)
---
src/glsl/nir/nir.h | 1 +
src/glsl/nir/nir_opt_algebraic.py | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index 6448d4a..7be1abb 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 8d5c03b..83a02b6 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)),
More information about the mesa-commit
mailing list