[Mesa-dev] [PATCH] mesa: Enable LTO compilation

Aaron Watry awatry at gmail.com
Wed Jun 1 02:56:52 UTC 2016


On Tue, May 31, 2016 at 4:57 PM, Martin Peres <martin.peres at free.fr> wrote:

> On 31/05/16 10:42, Eero Tamminen wrote:
>
>> Hi,
>>
>> On 30.05.2016 20:57, Rob Clark wrote:
>>
>>> On Mon, May 30, 2016 at 1:39 PM, Matt Turner <mattst88 at gmail.com> wrote:
>>>
>>>> On Mon, May 30, 2016 at 10:28 AM, ⚛ <0xe2.0x9a.0x9b at gmail.com> wrote:
>>>>
>>>>> This patch enables compilation with -flto.
>>>>>
>>>>> The performance benefits of LTO (GCC 4.9 & 6.1) are about 1% for
>>>>> glxgears.
>>>>> Performance changes in OpenGL games haven't been measured yet, my
>>>>> feeling is
>>>>> that they are negligible.
>>>>>
>>>> Without a compelling reason, I don't think the build system should be
>>>> adding compiler flags like this.
>>>>
>>>> -flto makes debugging impossible, at least the last time I tried it
>>>> with gcc. I don't think that's something we would want enabled
>>>> whenever it's supported.
>>>>
>>> It would be interesting to know what gains it brings in scenarios less
>>> synthetic than glxgears..  my suspicion is that we have been doing
>>> manual lto forever (ie. use of static-inline fxn's where it matters).
>>> If it turns out to be a significant gain, I wouldn't be against it.
>>> Although perhaps only for non-debug builds..
>>>
>> Martin did some testing with LTO last year for a real customer 3D
>> benchmark that was partly CPU bound.  In that case there were actually
>> several percent performance improvements.
>>
>
> Definitely was the case on some machines. However, I used GCC 5.X to get
> it to work reliably and one GCC 5 release was clearly improving the
> performance.
>
> I stopped making LTO builds because it took too long to compile when
> bisecting performance issues.  I should try again now that gcc has
> "link-time parallelization (enabled using -flto=n)". If it scales with the
> number of threads, then linking mesa will not take 3 minutes anymore but
> ~45seconds or a normal quad core machine.
>
>
I did some tests on my work laptop earlier today (i7 Haswell Quad Mobile),
and my build time from no LTO to -flto=8 went from 3m18s to do autogen.sh
with arguments && make -j8 check to about 3m45s. This is with the GCC 5.3.1
that comes stock with ubuntu xenial (16.04).  The build overhead wasn't
that bad, and the binary size reduction was pretty significant (35+MB to
17MB for i965_dri.so if memory serves). I haven't done benchmarks of the
resulting executables yet, but I could if someone is interested in the
results.

--Aaron


>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160531/b911aab3/attachment.html>


More information about the mesa-dev mailing list