Previously, the GLSL compiler successfully parsed the "invariant" and "precise" keywords and set bits on the variables, but we never did anything with them. This series adds code to propagate "invariant" and "precise" all the way thorugh NIR and bail in unsafe optimizations if we see it. The GLSL code sort-of tries to keep the two separate on the off chance that some of the gallium people want to do something more interesting with them. In NIR, we take a more scorched-earth policy and introduce a concept of an "exact" ALU operation.
This fixes the remaining dEQP tests for "invariant". It probably also fixes the ES 3.1 CTS tests for "precise" but I haven't actually tried it. Jason Ekstrand (12): nir: Add an "exact" bit to nir_alu_instr nir/builder: Add a flag for setting exact nir/search: Propagate exactness into newly created expressions nir/algebraic: Allow for flagging operations as being inexact nir/algebraic: Flag inexact optimizations nir/cse: Properly handle nir_ssa_def.exact i965/peephole_ffma: Don't fuse exact adds nir/alu_to_scalar: Propagate the "exact" bit glsl: Add a pass to propagate the "invariant" and "precise" qualifiers glsl/opt_algebraic: Don't handle invariant or precise trees glsl/rebalance_tree: Don't handle invariant or precise trees nir/glsl: Propagate invariant into NIR alu ops src/compiler/Makefile.sources | 1 + src/compiler/glsl/glsl_parser_extras.cpp | 1 + src/compiler/glsl/ir_optimization.h | 1 + src/compiler/glsl/opt_algebraic.cpp | 16 ++ src/compiler/glsl/opt_rebalance_tree.cpp | 16 ++ src/compiler/glsl/propagate_invariance.cpp | 125 ++++++++++++++++ src/compiler/nir/glsl_to_nir.cpp | 2 + src/compiler/nir/nir.h | 11 ++ src/compiler/nir/nir_algebraic.py | 9 +- src/compiler/nir/nir_builder.h | 9 ++ src/compiler/nir/nir_clone.c | 1 + src/compiler/nir/nir_instr_set.c | 16 +- src/compiler/nir/nir_lower_alu_to_scalar.c | 1 + src/compiler/nir/nir_opt_algebraic.py | 165 +++++++++++---------- src/compiler/nir/nir_print.c | 2 + src/compiler/nir/nir_search.c | 13 +- src/compiler/nir/nir_search.h | 6 + .../drivers/dri/i965/brw_nir_opt_peephole_ffma.c | 4 +- 18 files changed, 312 insertions(+), 87 deletions(-) create mode 100644 src/compiler/glsl/propagate_invariance.cpp -- 2.5.0.400.gff86faf _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev