Marek Has Taken To Improving Mesa's GLSL Compiler Performance
Written by Michael Larabel in Mesa on 9 October 2016 at 09:22 AM EDT. 42 Comments
MESA --
With catching up on the OpenGL extensions, Marek Olšák of AMD has been spending a fair amount of time on performance optimizations for the AMD's open-source OpenGL driver and some code that benefits Mesa as a whole too. One of his latest patch series is on optimizing Mesa's GLSL compiler performance.

Marek has been working to speed up the compilation time of the GL Shading Language (GLSL) compiler in Mesa by reducing malloc calls by about 63%. With less malloc calls, the compile times are better and there is less heap threashing.

Marek explained of the design change, "It's done by switching memory allocations in the GLSL compiler to my new linear allocator that allocates out of a fixed-sized buffer with a monotonically increasing offset. If more buffers are needed, it chains them. The new allocator is used in all places where short-lived allocations are used with a high number of malloc calls. The series also contains other improvements not related to the new allocator that also improve compile times."

This work complements the patches by Marek last month for using Jemalloc in Mesa, also in the name of greater performance.

Test results show that this latest patch series is almost fast enough to match the performance of using Mesa with jemalloc, already a big improvement over libc's malloc. But when switching to using jemalloc and these 15 new patches, the performance is even better. Shader-db was used as the test-case and compared to a 54 second out-of-the-box time right now, with this series plus jemalloc it drops down to 40 seconds!

The current 15 patches to rework the GLSL memroy allocation can be found on the Mesa mailing list and touch several hundred lines of code. However, this work probably won't be merged to Mesa Git in the next few days for making the next Mesa release -- there are some concerns on the Intel side with potential issues with their driver until they can better handle undefined memory, etc.
Related News
About The Author
Author picture

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter or contacted via MichaelLarabel.com.

Popular News This Week