diff options
author | Ian Romanick <[email protected]> | 2018-03-14 16:25:07 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2018-03-26 08:50:43 -0700 |
commit | 2c643fd978c43205b9620820038ba6246ed045e2 (patch) | |
tree | 069bbd027d4c0e87c0428a6aa714373250340990 /src/compiler | |
parent | cd635d149b23f0522cb1a73d6a007851896883e3 (diff) |
nir: Don't condition 'a-b < 0' -> 'a < b' on is_not_used_by_conditional
Now that i965 recognizes that a-b generates the same conditions as 'a <
b', there is no reason to condition this transformation on 'is not used
by conditional.'
Since this was the only user of the is_not_used_by_conditional function,
delete it.
All Gen6+ platforms had similar results. (Skylake shown)
total instructions in shared programs: 14400775 -> 14400595 (<.01%)
instructions in affected programs: 36712 -> 36532 (-0.49%)
helped: 182
HURT: 26
helped stats (abs) min: 1 max: 2 x̄: 1.13 x̃: 1
helped stats (rel) min: 0.15% max: 1.82% x̄: 0.70% x̃: 0.62%
HURT stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel) min: 0.24% max: 1.02% x̄: 0.82% x̃: 0.90%
95% mean confidence interval for instructions value: -0.97 -0.76
95% mean confidence interval for instructions %-change: -0.59% -0.43%
Instructions are helped.
total cycles in shared programs: 532929592 -> 532926345 (<.01%)
cycles in affected programs: 478660 -> 475413 (-0.68%)
helped: 187
HURT: 22
helped stats (abs) min: 2 max: 200 x̄: 20.99 x̃: 18
helped stats (rel) min: 0.23% max: 24.10% x̄: 1.48% x̃: 1.03%
HURT stats (abs) min: 1 max: 214 x̄: 30.86 x̃: 11
HURT stats (rel) min: 0.01% max: 23.06% x̄: 3.12% x̃: 0.86%
95% mean confidence interval for cycles value: -19.50 -11.57
95% mean confidence interval for cycles %-change: -1.42% -0.58%
Cycles are helped.
GM45 and Iron Lake had similar results. (Iron Lake shown)
total cycles in shared programs: 177851578 -> 177851810 (<.01%)
cycles in affected programs: 24408 -> 24640 (0.95%)
helped: 2
HURT: 4
helped stats (abs) min: 4 max: 4 x̄: 4.00 x̃: 4
helped stats (rel) min: 0.42% max: 0.47% x̄: 0.44% x̃: 0.44%
HURT stats (abs) min: 24 max: 108 x̄: 60.00 x̃: 54
HURT stats (rel) min: 0.52% max: 1.62% x̄: 1.04% x̃: 1.02%
95% mean confidence interval for cycles value: -7.75 85.08
95% mean confidence interval for cycles %-change: -0.39% 1.49%
Inconclusive result (value mean confidence interval includes 0).
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/nir_opt_algebraic.py | 4 | ||||
-rw-r--r-- | src/compiler/nir/nir_search_helpers.h | 15 |
2 files changed, 1 insertions, 18 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index b9565cea7b7..96232f0e549 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -208,9 +208,7 @@ optimizations = [ # fmax. If b is > 1.0, the bcsel will be replaced with a b2f. (('fmin', ('b2f', a), '#b'), ('bcsel', a, ('fmin', b, 1.0), ('fmin', b, 0.0))), - # ignore this opt when the result is used by a bcsel or if so we can make - # use of conditional modifiers on supported hardware. - (('flt(is_not_used_by_conditional)', ('fadd(is_used_once)', a, ('fneg', b)), 0.0), ('flt', a, b)), + (('flt', ('fadd(is_used_once)', a, ('fneg', b)), 0.0), ('flt', a, b)), (('fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)), (('~bcsel', ('flt', b, a), b, a), ('fmin', a, b)), diff --git a/src/compiler/nir/nir_search_helpers.h b/src/compiler/nir/nir_search_helpers.h index 2e3bd137d6d..2d399bd5dcd 100644 --- a/src/compiler/nir/nir_search_helpers.h +++ b/src/compiler/nir/nir_search_helpers.h @@ -170,19 +170,4 @@ is_not_used_by_if(nir_alu_instr *instr) return list_empty(&instr->dest.dest.ssa.if_uses); } -static inline bool -is_not_used_by_conditional(nir_alu_instr *instr) -{ - if (!is_not_used_by_if(instr)) - return false; - - nir_foreach_use(use, &instr->dest.dest.ssa) { - if (use->parent_instr->type == nir_instr_type_alu && - nir_instr_as_alu(use->parent_instr)->op == nir_op_bcsel) - return false; - } - - return true; -} - #endif /* _NIR_SEARCH_ */ |