[Mesa-dev] [PATCH 0/6] anv: Rework the pipeline cache

Jason Ekstrand jason at jlekstrand.net
Thu Aug 25 22:28:12 UTC 2016


When looking at GPU hangs in the new dEQP-VK.syncronization.* tests, I
realized that our pipeline cache didn't follow the spec.  The spec requires
that the user be able to delete the pipeline cache after creating a
pipeline using it and then go on to use the pipeline.  This took me down
the following train of thought:

 1) The pipeline cache cannot own the backing storage for shader binaries
    and related metadata; it is now just a hash table lookup.

 2) We need to use a state pool for shader binaries.

 3) Thanks to how much state gets packed into a pipeline object, we are
    going to have lots of duplicated shaders.  This means we really need
    reference counting.

 4) So we need a little struct to store a reference count, anv_state for
    the shader binary, and the metadata (see patch 5).

 5) Now, anv_pipeline_cache is just a CPU-only hash table and a mutex.  We
    can just use the hash table from util/hash_table.h instead of
    hand-rolling one.  If we just embed the sha1 in anv_shader_bin then we
    can even do it without substantial extra memory allocation.

This lead to far more of a rewrite than I had intended but I think the end
result is nice and clean.

Jason Ekstrand (6):
  anv/descriptor_set: memset anv_descriptor_set_layout
  anv/pipeline: Fix bind maps for fragment output arrays
  anv: Remove unused fields from anv_pipeline_bind_map
  anv: Add pipeline_has_stage guards a few places
  anv: Add a struct for storing a compiled shader
  anv: Rework pipeline caching

 src/intel/vulkan/anv_cmd_buffer.c     |  30 +-
 src/intel/vulkan/anv_descriptor_set.c |   3 +-
 src/intel/vulkan/anv_device.c         |   4 +-
 src/intel/vulkan/anv_pipeline.c       | 147 ++++-----
 src/intel/vulkan/anv_pipeline_cache.c | 571 +++++++++++++++-------------------
 src/intel/vulkan/anv_private.h        | 120 +++++--
 src/intel/vulkan/genX_l3.c            |   8 +-
 src/intel/vulkan/genX_pipeline.c      |   3 +-
 src/intel/vulkan/genX_pipeline_util.h |  10 +-
 9 files changed, 458 insertions(+), 438 deletions(-)

-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list