Skip to content

radv: Implement NIR caching behind RADV_PERFTEST=nircache.

Tatsuyuki Ishi requested to merge ishitatsuyuki/mesa:nir-caching-2 into main

Based on !27036 (merged).

NIR caching is useful for two use cases:

  • Shader permutations involving reused VS or FS.
  • GPL-like engine that compiles a separate (library) variant and an optimized (monolithic) variant, e.g. DXVK.

By caching the result of radv_shader_spirv_to_nir, permutations hitting the cache can have their compilation time reduced by 50% or more.

I'm posting this now so that we can agree on a design around the key (radv: Separate pipeline_key into pre-link and link-time structs.) first.

There are still open questions about the memory and storage footprint of NIR caches, which is why this is gated behind a perftest flag. In particular, Steam doesn't want to ship NIR cache since they are unnecessary in presence of a full precompiled shader cache.

In this MR, the cache entries do not reside in memory and are immediately written to the disk. Further design around how the caches are stored and how to coordinate cache type with Steam etc. is left as future work.

Edited by Tatsuyuki Ishi

Merge request reports