diff options
author | Eric Anholt <[email protected]> | 2019-09-23 15:40:46 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2019-10-04 19:15:01 +0000 |
commit | c23db0df1893ee755d7c4ed182ba734a019afe43 (patch) | |
tree | 592cea258d9ba7363ba843d16a4310722ff78d8d /src/compiler/nir/nir_algebraic.py | |
parent | 7025dbe794b53b030ae0a3cb55217ea831a810d9 (diff) |
nir: Keep the range analysis HT around intra-pass until we make a change.
This lets us memoize range analysis work across instructions. Reduces
runtime of shader-db on Intel by -30.0288% +/- 2.1693% (n=3).
Fixes: 405de7ccb6cb ("nir/range-analysis: Rudimentary value range analysis pass")
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_algebraic.py')
-rw-r--r-- | src/compiler/nir/nir_algebraic.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py index fe66952ba16..1645ec50fcd 100644 --- a/src/compiler/nir/nir_algebraic.py +++ b/src/compiler/nir/nir_algebraic.py @@ -1155,6 +1155,7 @@ ${pass_name}_pre_block(nir_block *block, uint16_t *states) static bool ${pass_name}_block(nir_builder *build, nir_block *block, + struct hash_table *range_ht, const uint16_t *states, const bool *condition_flags) { bool progress = false; @@ -1181,7 +1182,8 @@ ${pass_name}_block(nir_builder *build, nir_block *block, const struct transform *xform = &${pass_name}_state${i}_xforms[i]; if (condition_flags[xform->condition_offset] && !(xform->search->inexact && ignore_inexact) && - nir_replace_instr(build, alu, xform->search, xform->replace)) { + nir_replace_instr(build, alu, range_ht, xform->search, xform->replace)) { + _mesa_hash_table_clear(range_ht, NULL); progress = true; break; } @@ -1210,14 +1212,17 @@ ${pass_name}_impl(nir_function_impl *impl, const bool *condition_flags) */ uint16_t *states = calloc(impl->ssa_alloc, sizeof(*states)); + struct hash_table *range_ht = _mesa_pointer_hash_table_create(NULL); + nir_foreach_block(block, impl) { ${pass_name}_pre_block(block, states); } nir_foreach_block_reverse(block, impl) { - progress |= ${pass_name}_block(&build, block, states, condition_flags); + progress |= ${pass_name}_block(&build, block, range_ht, states, condition_flags); } + ralloc_free(range_ht); free(states); if (progress) { |