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_search.c | |
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_search.c')
-rw-r--r-- | src/compiler/nir/nir_search.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_search.c b/src/compiler/nir/nir_search.c index de5a8d25ada..d126319b256 100644 --- a/src/compiler/nir/nir_search.c +++ b/src/compiler/nir/nir_search.c @@ -39,6 +39,7 @@ struct match_state { uint8_t comm_op_direction; unsigned variables_seen; nir_alu_src variables[NIR_SEARCH_MAX_VARIABLES]; + struct hash_table *range_ht; }; static bool @@ -297,7 +298,8 @@ match_value(const nir_search_value *value, nir_alu_instr *instr, unsigned src, instr->src[src].src.ssa->parent_instr->type != nir_instr_type_load_const) return false; - if (var->cond && !var->cond(instr, src, num_components, new_swizzle)) + if (var->cond && !var->cond(state->range_ht, instr, + src, num_components, new_swizzle)) return false; if (var->type != nir_type_invalid && @@ -621,6 +623,7 @@ UNUSED static void dump_value(const nir_search_value *val) nir_ssa_def * nir_replace_instr(nir_builder *build, nir_alu_instr *instr, + struct hash_table *range_ht, const nir_search_expression *search, const nir_search_value *replace) { @@ -634,6 +637,7 @@ nir_replace_instr(nir_builder *build, nir_alu_instr *instr, struct match_state state; state.inexact_match = false; state.has_exact_alu = false; + state.range_ht = range_ht; STATIC_ASSERT(sizeof(state.comm_op_direction) * 8 >= NIR_SEARCH_MAX_COMM_OPS); |