[Mesa-dev] [PATCH 0/5] NIR CSE performance improvements

Connor Abbott cwabbott0 at gmail.com
Fri May 22 11:24:47 PDT 2015


This series implements an API that lets us use a hash set in the CSE
pass, which fixes the performance problem while getting most of the code
for Global Value Numbering (GVN) on top of GCM into the tree and
actively used. The first three patches are taken from Jason's rebase of
my GVN series, and patch 4 is modified from the original patch 4 to
expose a slightly lower-level API (details in the patch itself). Patch
5 then rewrites the CSE pass to use the API introduced in patch 4. Note
that the API could be just as easily adapted to implement
nir_value_number() from the original patch 4.

Perf numbers are in patch 5, but for those that prefer pretty pictures,
I've uploaded a few graphs:

http://people.freedesktop.org/~cwabbott0/cse-series/perf-before.svg
http://people.freedesktop.org/~cwabbott0/cse-series/perf-after.svg

where you can clearly see how CSE goes from taking up almost all the
time spent in nir_optimize() to less than half (but still a significant
amount).

This series is also available at

git://people.freedesktop.org/~cwabbott0/mesa nir-cse-hash

Connor Abbott (5):
  nir: split out instruction comparison functions
  nir: constify nir_ssa_alu_instr_src_components()
  nir: constify instruction comparison functions
  nir: add a helper for finding duplicate instructions
  nir/cse: use the instr_hash helper

 src/glsl/Makefile.sources        |   3 +
 src/glsl/nir/nir.c               |  27 -----
 src/glsl/nir/nir.h               |   5 +-
 src/glsl/nir/nir_instr_compare.c | 179 +++++++++++++++++++++++++++
 src/glsl/nir/nir_instr_hash.c    | 255 +++++++++++++++++++++++++++++++++++++++
 src/glsl/nir/nir_instr_hash.h    |  36 ++++++
 src/glsl/nir/nir_opt_cse.c       | 255 ++++-----------------------------------
 7 files changed, 500 insertions(+), 260 deletions(-)
 create mode 100644 src/glsl/nir/nir_instr_compare.c
 create mode 100644 src/glsl/nir/nir_instr_hash.c
 create mode 100644 src/glsl/nir/nir_instr_hash.h

-- 
2.1.0



More information about the mesa-dev mailing list