<p dir="ltr">I just remembered the existence of this series so<br>
I went ahead and tried it on top of today's master.<br>
With NIR enabled there is no benefit at all, didn't try without NIR.<br>
I've marked it as rejected in patchwork, so it's not floating around in there.</p>
<div class="gmail_quote">3. jan. 2015 20.21 skrev "Thomas Helland" <<a href="mailto:thomashelland90@gmail.com">thomashelland90@gmail.com</a>>:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I couple months ago i posted a series for expanding the get_range<br>
function in minmax_pruning with support for more operations.<br>
So I've been hacking on this during my spare time in Christmas.<br>
I've now gotten to a point where I think this is not getting us<br>
anywhere, and I need some opinions from other devs to prove me wrong.<br>
<br>
As it stands only a couple of these patches yield any results,<br>
and IMHO only the first patch is merge-material until we can<br>
confirm that this is actually gonna give is significant improvements.<br>
The first patch gives noticeable improvements on shader-db since<br>
we are no longer messing up our saturate-detection.<br>
<br>
Patches up to patch 9 are quite small, and patch 5 yeilds<br>
some benefit one some Dungeon Defenders shaders that do max(exp, 0).<br>
These might be merge-material to, due to their small size.<br>
However the benefits of patch 5 could easily be had with<br>
a 10-line patch to opt_algebraic, and that's the only one showing<br>
any benefit on my collection of shaders.<br>
<br>
Patches 10-19 take on more complexity, with no apparent benefit.<br>
I feel theres not adequate return on investement for the code to be<br>
sitting around bloating the codebase.<br>
<br>
The last three patches are RFC only, as we at least need to rename<br>
the file to something more generic before merging them.<br>
<br>
There is still room for improvement, but I'm not sure its worth it.<br>
Maybe someone can do a shader-db run that proves me wrong?<br>
My shader-db is dominated by TF2, DOTA2, Portal,<br>
Brutal Legend and Dungeon Defenders. Maybe non-Source-engine<br>
games show some benefit from this series?<br>
<br>
I'm not comfortable with how this might mess up our shaders.<br>
It gets hard to verify that things end up complying to spec,<br>
and that we are not doing something wrong.<br>
Some lerp-instructions got removed in Brutal Legend<br>
(it could be guaranteed that the operation would be saturated to 1),<br>
and while I could tell it was likely that the pass was doing the<br>
right thing, it was not easily confirmable. This worries me.<br>
<br>
IMHO we need to do better for this to be worth it.<br>
I added a print to the get_range function to gather some stats:<br>
2 million calls are made to get_range on my shader-db run.<br>
500'000 of these are expressions, 2'000 of these are unsupported.<br>
350'000 of these are constants.<br>
So our coverage in get_range is less than 50%.<br>
Is there anything more we could get/know the range of?<br>
<br>
Thomas Helland (22):<br>
glsl: Reorder optimization-passes<br>
glsl: Move common code to ir_constant_util.h<br>
glsl: Add a IS_CONSTANT macro<br>
glsl: Change to using switch-case in get_range<br>
glsl: Add sqrt, rsq, exp, exp2 to get_range<br>
glsl: Add sin, cos and sign to get_range<br>
glsl: Add saturate to get_range<br>
glsl: Add abs to get_range<br>
glsl: Add ir_unop_neg to get_range<br>
glsl: Add ir_binop_add to get_range<br>
glsl: Add ir_binop_mul to get_range<br>
glsl: Add ir_binop_sub to get_range<br>
glsl: Add ir_binop_pow to get_range<br>
glsl: Add ir_triop_fma to get_range<br>
glsl: Add ir_triop_lrp to get_range<br>
glsl: Add ir_binop_dot to get_range<br>
glsl: Add log and log2 to get_range<br>
glsl: Add ir_unop_rcp to get_range<br>
glsl: Add a saturate range optimization<br>
glsl: Optimize some cases of undefined behaviour.<br>
glsl: Add a range based comparison opt-pass<br>
glsl: Remove useless abs based on range analysis<br>
<br>
src/glsl/glsl_parser_extras.cpp | 2 +-<br>
src/glsl/ir_constant_util.h | 110 +++++++++<br>
src/glsl/opt_algebraic.cpp | 93 +-------<br>
src/glsl/opt_minmax.cpp | 495 ++++++++++++++++++++++++++++++++++++++--<br>
4 files changed, 589 insertions(+), 111 deletions(-)<br>
create mode 100644 src/glsl/ir_constant_util.h<br>
<br>
--<br>
2.2.1<br>
<br>
</blockquote></div>