Overhauling Mesa's GLSL Compiler Performance
We like hearing about performance improvements for Linux and also Linux graphics in general, but when there's something about performance improvements for Linux graphics, it certainly gets us excited and garners our interest. This time we get to report on work being done to Mesa's GLSL compiler, which is now running drastically faster in a branch of Mesa that will be published in about a week.
Intel's Ian Romanick has been working on optimizing GLSL IR and reworking the assembly shader (among other things) after ditching his efforts to write a new GLSL compiler, but VMware's Michal Krol has been rewriting the GLSL compiler pre-processor for Mesa as a step towards improving the GL Shading Language support and making it easier to strap in a new syntax parser in the future.
Once Michal wrote the new pre-processor, the existing syntax parser ended up being a huge bottleneck, and while Ian was going to be writing a new syntax parser, Michal ended up writing a new simple one. This new Mesa GLSL compiler syntax parser is similar in functionality to the "current" one, but it's much simpler and it's very fast.
Benchmarking was done of the new pre-processor and syntax parser for the Mesa GLSL compiler by measuring the time it takes to complete the two steps with an advanced shader. Michal's numbers show an impressive 27x speed-up with the new implementation over the old. Even more impressive, if simply measuring the performance of the new syntax parser, it's a 122x improvement over the current code in Mesa's master Git tree!
This code is being initially funneled into a branch of Mesa that will be called glsl-pp-rework-2 and VMware should make it available in about a week. The mailing list message detailing this pre-processor and syntax parsing work for Mesa's GLSL functionality can be found on mesa3d-dev.
Intel's Ian Romanick has been working on optimizing GLSL IR and reworking the assembly shader (among other things) after ditching his efforts to write a new GLSL compiler, but VMware's Michal Krol has been rewriting the GLSL compiler pre-processor for Mesa as a step towards improving the GL Shading Language support and making it easier to strap in a new syntax parser in the future.
Once Michal wrote the new pre-processor, the existing syntax parser ended up being a huge bottleneck, and while Ian was going to be writing a new syntax parser, Michal ended up writing a new simple one. This new Mesa GLSL compiler syntax parser is similar in functionality to the "current" one, but it's much simpler and it's very fast.
Benchmarking was done of the new pre-processor and syntax parser for the Mesa GLSL compiler by measuring the time it takes to complete the two steps with an advanced shader. Michal's numbers show an impressive 27x speed-up with the new implementation over the old. Even more impressive, if simply measuring the performance of the new syntax parser, it's a 122x improvement over the current code in Mesa's master Git tree!
This code is being initially funneled into a branch of Mesa that will be called glsl-pp-rework-2 and VMware should make it available in about a week. The mailing list message detailing this pre-processor and syntax parsing work for Mesa's GLSL functionality can be found on mesa3d-dev.
10 Comments