[Mesa-dev] [PATCH 00/10] [RFC] Probably useless algebraic optimizations
Thomas Helland
thomashelland90 at gmail.com
Tue Jul 15 15:27:08 PDT 2014
So, a little update on these patches.
I've written some shaders for hitting each
specific case in the patch-series.
This shows that:
Patch 1 (X - X) == 0, and
Patch 9 (A - neg(B)) == A + B
have no effect at all.
The rest of the patches do indeed have
a positive effect on the special-case shader.
If anyone wants to have a look at the shaders
then let me know. I could always put them
in a dropbox-folder, or github, or something.
The report from shader-db (sorted by patch-number):
Patch 2:
helped: shaders/mine/a_or_nota.shader_test fs16: 16 -> 5 (-68.75%)
helped: shaders/mine/a_or_nota.shader_test fs8: 16 -> 5 (-68.75%)
helped: shaders/mine/a_or_nota.shader_test vs: 11 -> 5 (-54.55%)
Patch 3:
helped: shaders/mine/a_and_nota.shader_test fs16: 16 -> 5 (-68.75%)
helped: shaders/mine/a_and_nota.shader_test fs8: 16 -> 5 (-68.75%)
helped: shaders/mine/a_and_nota.shader_test vs: 11 -> 5 (-54.55%)
Patch 4:
helped: shaders/mine/or_and.shader_test fs16: 16 -> 14 (-12.50%)
helped: shaders/mine/or_and.shader_test fs8: 16 -> 14 (-12.50%)
helped: shaders/mine/or_and.shader_test vs: 11 -> 10 (-9.09%)
Patch 5:
helped: shaders/mine/minOver.shader_test fs16: 8 -> 5 (-37.50%)
helped: shaders/mine/minOver.shader_test fs8: 8 -> 5 (-37.50%)
helped: shaders/mine/minOver.shader_test vs: 6 -> 5 (-16.67%)
helped: shaders/mine/minUnder.shader_test fs16: 8 -> 5 (-37.50%)
helped: shaders/mine/minUnder.shader_test fs8: 8 -> 5 (-37.50%)
helped: shaders/mine/minUnder.shader_test vs: 6 -> 5 (-16.67%)
Patch 6
helped: shaders/mine/maxOver.shader_test fs16: 8 -> 5 (-37.50%)
helped: shaders/mine/maxOver.shader_test fs8: 8 -> 5 (-37.50%)
helped: shaders/mine/maxOver.shader_test vs: 6 -> 5 (-16.67%)
helped: shaders/mine/maxUnder.shader_test fs16: 8 -> 5 (-37.50%)
helped: shaders/mine/maxUnder.shader_test fs8: 8 -> 5 (-37.50%)
helped: shaders/mine/maxUnder.shader_test vs: 6 -> 5 (-16.67%)
Patch 7:
helped: shaders/mine/loglog.shader_test fs16: 17 -> 11 (-35.29%)
helped: shaders/mine/loglog.shader_test fs8: 17 -> 11 (-35.29%)
helped: shaders/mine/loglog.shader_test vs: 7 -> 6 (-14.29%)
Patch 8:
helped: shaders/mine/expexp.shader_test fs16: 17 -> 11 (-35.29%)
helped: shaders/mine/expexp.shader_test fs8: 17 -> 11 (-35.29%)
helped: shaders/mine/expexp.shader_test vs: 7 -> 6 (-14.29%)
Patch 10:
helped: shaders/mine/pow0x.shader_test fs16: 8 -> 5 (-37.50%)
helped: shaders/mine/pow0x.shader_test fs8: 8 -> 5 (-37.50%)
helped: shaders/mine/pow0x.shader_test vs: 6 -> 5 (-16.67%)
helped: shaders/mine/powx-1.shader_test fs16: 11 -> 5 (-54.55%)
helped: shaders/mine/powx-1.shader_test fs8: 11 -> 5 (-54.55%)
helped: shaders/mine/powx-1.shader_test vs: 7 -> 5 (-28.57%)
helped: shaders/mine/powx0.shader_test fs16: 8 -> 5 (-37.50%)
helped: shaders/mine/powx0.shader_test fs8: 8 -> 5 (-37.50%)
helped: shaders/mine/powx0.shader_test vs: 6 -> 5 (-16.67%)
2014-07-15 0:22 GMT+02:00 <thomashelland90 at gmail.com>:
> From: Thomas Helland <thomashelland90 at gmail.com>
>
> When writing that A || (A && B) patch some
> days ago I also wrote some other patches
> that have no impact on my collection of shaders.
> (shader-db + Some TF2 and Portal-shaders).
> No reduction in instruction count, and no
> significant increase in compilation time.
>
> I decided to put them up here anyway, as
> with your collection of shaders maybe YMMV.
>
> These are mostly RFC-quality, and not all are
> as complete and nicely formatted as they could be.
> Possibly some are also implemented incorrectly.
> (I'm still trying to get a good understanding of
> the buildup of the ir, the visitors, etc)
>
> Feel free to do with these patches as you please;
> Ignore, test, review, flame, make cookies...
>
> Thomas Helland (10):
> glsl: Optimize X - X -> 0
> glsl: Optimize !A || A == 1
> glsl: Optimize !A && A == 0
> glsl: Optimize (A || B) && A == A
> glsl: Optimize min(-8, sin(x)) == -8 and similar
> glsl: Optimize max(8, sin(x)) == 8 and similar
> glsl: Optimize log(x) + log(y) == log(x*y)
> glsl: Optimize exp(x)*exp(y) == exp(x+y)
> glsl: Optimize A - neg(B) == A + B and neg(A) - B == neg(A + B)
> glsl: Optimize some more pow() special cases
>
> src/glsl/opt_algebraic.cpp | 152
> +++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 152 insertions(+)
>
> --
> 2.0.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140716/abd4e5fb/attachment-0001.html>
More information about the mesa-dev
mailing list