[Mesa-dev] [PATCH 0/5] anv: Add a NIR cache

Eero Tamminen eero.t.tamminen at intel.com
Tue Oct 16 08:25:16 UTC 2018


Hi,

On 10/13/18 3:08 AM, Jason Ekstrand wrote:
> This patch series adds a simple NIR shader cache that sits right after
> spirv_to_nir and brw_preprocess_nir and before linking.  This should help
> alleviate some of the added overhead of link-time optimization since most
> of the NIR-level optimization is now cached prior to linking.
> 
> I have no numbers to back this series up; just intuition.

Fortunately approximate numbers of where the bottlenecks are, are easy
to come by for shader compilation.

1. Start use-case doing lot of shader compilation (shader-db?)
2. "sudo perf record -a"
3. ^C when shader compilation stops
4. "sudo perf report"

When I profiled GL shader compilation before Mesa switched to NIR,
linking phase was 2/3 of the cycles taken by the whole shader compilation.

(I.e. why shader cache needed to cache linking results to have 
significant impact.)


	- Eero

> Jason Ekstrand (5):
>    anv/pipeline: Move wpos and input attachment lowering to lower_nir
>    anv/pipeline: Hash shader modules and spec constants separately
>    compiler/types: Serialize/deserialize subpass input types correctly
>    anv/pipeline_cache: Add support for caching NIR
>    anv/pipeline: Cache the pre-lowered NIR
> 
>   src/compiler/glsl_types.cpp           |   4 +-
>   src/intel/vulkan/anv_pipeline.c       | 118 ++++++++++++++++++--------
>   src/intel/vulkan/anv_pipeline_cache.c | 100 ++++++++++++++++++++++
>   src/intel/vulkan/anv_private.h        |  18 ++++
>   4 files changed, 204 insertions(+), 36 deletions(-)
> 



More information about the mesa-dev mailing list