Mesa Developers Discuss LTO'ing + PGO'ing Builds For Greater Performance
Making use of Link-Time Optimizations (LTO) and Profile Guided Optimizations (PGO) is currently being talked about by Mesa developers for their release builds in potentially squeezing out better performance.
Dieter Nützel shared that when using LTO and PGO compiler optimizations on Mesa, he's able to get RadeonSI's binary size 40% smaller and 16~20% faster for this OpenGL driver. Link-time optimizations are about as the name implies running optimization passes during the linker phase when able to analyze the to-be-produced binary in full rather than the individual object files in order to allow for more inter-procedural optimizations on the whole program.
Profile guided optimizations entail first creating a tentative build with special instrumentation, running that build while collecting samples to analyze hot/cold code-paths, etc, and then to provide that feedback to the compiler in order for it to better optimize the actual final build based upon that (ideally real-world) profile information. PGO'ing binaries can generally be a significant help for performance assuming the collected profiles are accurate.
LTO+PGO helps the likes of Mozilla Firefox release builds already, Clear Linux optimizations, and more. Mesa developers are loosely talking about whether they could employ these optimizations for allowing faster release builds.
The barrier for LTO'ing is relatively low but for PGO'ing they would need to be running various OpenGL and Vulkan applications during the build process in order for generating the profile data. That becomes more complicated with the different drivers and given the wide nature of graphics APIs and software/games difficult to ensure the PGO data is accurate enough to help out all users.
Anyhow, it will be interesting to see where this discussion leads and if at least in the short-term they recommend LTO optimizations and in the longer-term they can come up with a sane approach for PGO'ing Mesa.
Dieter Nützel shared that when using LTO and PGO compiler optimizations on Mesa, he's able to get RadeonSI's binary size 40% smaller and 16~20% faster for this OpenGL driver. Link-time optimizations are about as the name implies running optimization passes during the linker phase when able to analyze the to-be-produced binary in full rather than the individual object files in order to allow for more inter-procedural optimizations on the whole program.
Profile guided optimizations entail first creating a tentative build with special instrumentation, running that build while collecting samples to analyze hot/cold code-paths, etc, and then to provide that feedback to the compiler in order for it to better optimize the actual final build based upon that (ideally real-world) profile information. PGO'ing binaries can generally be a significant help for performance assuming the collected profiles are accurate.
LTO+PGO helps the likes of Mozilla Firefox release builds already, Clear Linux optimizations, and more. Mesa developers are loosely talking about whether they could employ these optimizations for allowing faster release builds.
The barrier for LTO'ing is relatively low but for PGO'ing they would need to be running various OpenGL and Vulkan applications during the build process in order for generating the profile data. That becomes more complicated with the different drivers and given the wide nature of graphics APIs and software/games difficult to ensure the PGO data is accurate enough to help out all users.
Anyhow, it will be interesting to see where this discussion leads and if at least in the short-term they recommend LTO optimizations and in the longer-term they can come up with a sane approach for PGO'ing Mesa.
43 Comments