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

Chuck Atkins chuck.atkins at kitware.com
Tue May 31 14:34:57 UTC 2016

I've been using lto for the past several weeks not for performance reasons
but to reduce the resulting binary size which has grown to be rather
substantial.  I usually set "-flto -ffat-lto-objects
-flto-odr-type-merging" in the CFLAGS and CXXFLAGS env vars prior to
configure and have yet to experience any problems with the files in mapi./

- Chuck

On Tue, May 31, 2016 at 3:42 AM, Eero Tamminen <eero.t.tamminen at intel.com>

> 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.
> How much, depends on:
> - How CPU bound the 3D benchmark is and do those CPU bottlenecks hit cases
> where LTO can actually help
> - What's the CPU/GPU balance on the given given HW
>   (more visible on more CPU bound HW)
> - What GCC version is used
>   (newer GCC versions provide more benefit with LTO)
> And it should not hurt performance (at least if one is using "performance"
> frequency policy, or fixed CPU frequency, instead of "powersave" one.
> "Powersave" can drop CPU frequency dramatically when use-case drop its CPU
> usage and large enough CPU freq drop can make things slower).
>         - Eero
> _______________________________________________
> 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/f7fd5ccd/attachment.html>

More information about the mesa-dev mailing list