This patch series provides an implementation of the global code motion algorithm. The first 6 patches are fixups for pre-existing bugs in NIR, the next 2 are add features needed by GCM, and the last two add GCM and turn it on in i965. Shader-db numbers are as follows:
total NIR instructions in shared programs: 2045293 -> 2044661 (-0.03%) NIR instructions in affected programs: 425878 -> 425246 (-0.15%) helped: 662 HURT: 1084 total FS instructions in shared programs: 4284416 -> 4288217 (0.09%) FS instructions in affected programs: 1442457 -> 1446258 (0.26%) helped: 2646 HURT: 4227 GAINED: 72 LOST: 70 Given that it actually hurts things a bit, we probably don't want to turn it on at the moment. My best guess as to why it's hurting things is that it moves instructions into ifs and keeps us from doing our select peephole. We need to come up with a solution for this, but I'm not too worried about it. The branch can be found here: http://cgit.freedesktop.org/~jekstrand/mesa/log/?h=review/nir-gcm Jason Ekstrand (10): nir: use nir_foreach_ssa_def for indexing ssa defs nir: Properly clean up CF nodes when we remove them nir/validate: Validate if_uses on registers nir/validate: Validate SSA defs the same way we do for registers nir/from_ssa: Don't try to read an invalid instruction nir: Make nir_[cf_node/instr]_[prev/next] return null if at the end nir/dominance: Also record the dominance depth nir: Add an instruction index nir: Add a global code motion (GCM) pass i965/nir: Use Global Code Motion src/glsl/Makefile.sources | 1 + src/glsl/nir/nir.c | 96 ++++-- src/glsl/nir/nir.h | 37 ++- src/glsl/nir/nir_dominance.c | 9 +- src/glsl/nir/nir_from_ssa.c | 2 +- src/glsl/nir/nir_opt_gcm.c | 499 +++++++++++++++++++++++++++++++ src/glsl/nir/nir_validate.c | 141 +++++++-- src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 2 + 8 files changed, 737 insertions(+), 50 deletions(-) create mode 100644 src/glsl/nir/nir_opt_gcm.c -- 2.2.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev