Mesa 23.1 Lands Improvement For Better Handling Steam's Shader Cache

Written by Michael Larabel in Mesa on 1 February 2023 at 07:15 AM EST. 5 Comments
MESA
An optimization to Mesa's shader database cache eviction handling has been merged to Mesa 23.1 with a focus on benefiting Steam's shader pre-caching.

Dmitry Osipenko of Collabora has seen his month-old merge request finally land to optimize the Mesa shader database cache eviction process. Osipenko explained in the MR:
Whenever mesa-db cache hits size limit, a half of cache is evicted. It works fine in general, but some use-cases are suffering from the large cache evictions. In particular a Steam shader pre-caching can easily fill up Mesa shader cache and in this case it's much more preferred to keep more entries in cache rather than remove half of the cache.

To mitigate large cache evictions, we will split mesa-db cache into multiple smaller parts such that only one part will be evicted at a time. In average this MR reduces cache eviction time by x40 and significantly improves cache hit rate after reaching the cache size limit.

This feature adds the MESA_DISK_CACHE_DATABASE_NUM_PARTS and MESA_DISK_CACHE_DATABASE_EVICTION_SCORE_2X_PERIOD environment variables for better controlling the mesa-db cache handling. With making use of the new feature for next quarter's Mesa 23.1 release, "This patch brings x40 performance improvement of cache eviction time using multipart cache vs a single file cache due to a smaller eviction portions and more optimized eviction algorithm."
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