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...
Status: NEW
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: 2014-11-05 11:10 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Note You need to log in before you can comment on or make changes to this bug.
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.

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.