Another Potential CPU Optimization For Mesa: Quadratic Probing

Written by Michael Larabel in Mesa on 8 February 2017 at 04:02 PM EST. 58 Comments
MESA
Mesa developer Thomas Helland is looking at reviving an old set of Mesa patches that could help out in some CPU-bound scenarios.

Helland re-discovered some old Mesa patches from April 2015 for implementing quadratic probing in hash tables for being faster rather than the linear re-probing hash table as is used currently. Helland explained further in the patch, "This will allow us to remove the large static table and use a power of two hash table size that we can compute on the fly. We can use bitmasking instead of modulo to fit our hash in the table, and it's less code. By using the algorithm hash = sh + i/2 + i*i/2 we are guaranteed that all retries from the quad probing are distinct, and so we should be able to completely fill the table."

When re-basing these patches and testing against Mesa master, from looking at the perf analysis on shader-db he found the hash table operations indeed were reduced. The overall impact was about a 10% reduction in the shader-db run-time. That's promising, but he's looking for feedback if he should continue exploring this potential "win" and also how it affects the performance for real hardware with real games. In particular, with how it affects the Borderlands 2 Linux performance with that being a CPU-heavy game, as outlined with the call for Mesa GL threading.

Helland's comments in RFC: Quadratic probing for the win.
Related News
About The Author
Michael Larabel

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, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week