Bug 55151 - Mesa fails to optimize the sum of multiple vector multiplications into a matrix multiplication
Summary: Mesa fails to optimize the sum of multiple vector multiplications into a matr...
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: 8.0
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Ian Romanick
QA Contact:
Depends on:
Reported: 2012-09-20 15:07 UTC by Samuel Rødal
Modified: 2019-09-18 19:44 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Description Samuel Rødal 2012-09-20 15:07:43 UTC
vec3(v.z*nf1+v.y*nf2+v.x*nf3) could be optimized as v.zyx * mat3(nf1, nf2, nf3)

This gives a significant performance improvement at least on r600.
Comment 1 Samuel Rødal 2012-09-20 15:19:38 UTC
Sorry, that should be mat3(nf1, nf2, nf3) * v.zyx.

Example change from real-world example implementing this optimization:

     1.7 -    fragment+='vec3 _nrm = normalize(vec3(norm2.z*nf1+norm2.y*nf2+norm2.x*nf3)*2.0-1.0);';
     1.8 +    fragment+='vec3 _nrm = normalize(mat3(nf3, nf2, nf1)*norm2.xyz*2.0-1.0);';
Comment 2 Petri Latvala 2014-11-05 11:10:59 UTC
Removing dependency from i965-perf. Those two expressions produce the same code in the i965 backend.
Comment 3 GitLab Migration User 2019-09-18 19:44:54 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/796.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.