[Mesa-dev] [PATCH 0/9] Optimize min/max expressions
Petri Latvala
petri.latvala at intel.com
Tue Jul 29 02:36:30 PDT 2014
Continuing the tale of fixing
https://bugs.freedesktop.org/show_bug.cgi?id=76861
Instead of making an IR expression type for mid3, I implemented an
optimization pass that optimizes general min/max expression trees, by
dropping operands that are proven to never be selected as the final
result.
This optimization pass not only improves code generated from mid3(),
but also other sources of such min/max trees, such as clamp(), or
plain min() and max(). Commit message for patch 1/9 contains shader-db
instruction count results, repeated here:
total instructions in shared programs: 4293603 -> 4293575 (-0.00%)
instructions in affected programs: 1188 -> 1160 (-2.36%)
GAINED: 0
LOST: 0
Serious Sam 3 and Guacamelee were improved, Dungeon Defenders was made
a bit worse. There was a max(foo, 0.0) in the shader where the 0.0
constant was dropped, which then resulted in shorter IR code but
longer shader binary.
No changes in piglit results. Patch 9 adds unit tests for the pass.
Petri Latvala (9):
glsl: Optimize min/max expression trees
glsl: Fix directory handling in optimization-test
glsl: Refactor the python test case generator
glsl: Make compare_ir sort expression operands for commutative
operations
glsl: Generalize assignment and declaration IR sexp creation functions
glsl: Add const_vec4 IR sexp creation function to
test_case_generator.py
glsl: Add min and max IR sexp creation functions to
test_case_generator.py
glsl: Add support for do_minmax_prune in test_optpass
glsl: Add tests for minmax prune
src/glsl/Makefile.sources | 1 +
src/glsl/glsl_parser_extras.cpp | 1 +
src/glsl/ir_optimization.h | 1 +
src/glsl/opt_minmax.cpp | 395 ++++++++++++++++++++++++
src/glsl/test_optpass.cpp | 2 +
src/glsl/tests/compare_ir | 4 +-
src/glsl/tests/lower_jumps/create_test_cases.py | 336 +++-----------------
src/glsl/tests/minmax/.gitignore | 3 +
src/glsl/tests/minmax/create_test_cases.py | 151 +++++++++
src/glsl/tests/optimization-test | 2 +-
src/glsl/tests/sexps.py | 37 +++
src/glsl/tests/test_case_generator.py | 325 +++++++++++++++++++
12 files changed, 960 insertions(+), 298 deletions(-)
create mode 100644 src/glsl/opt_minmax.cpp
create mode 100644 src/glsl/tests/minmax/.gitignore
create mode 100644 src/glsl/tests/minmax/create_test_cases.py
create mode 100644 src/glsl/tests/test_case_generator.py
--
2.0.1
More information about the mesa-dev
mailing list