diff options
author | Rhys Perry <pendingchaos02@gmail.com> | 2021-03-04 16:47:51 +0000 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-03-05 17:01:16 +0000 |
commit | 9f8a0b797ed9b8ad9bf49af8269a337b1152a744 (patch) | |
tree | 31e83e364c5ac0636d31bb44e70ce7622e342b0e | |
parent | 7c7e8942f82755c7c83e9dfce0019dd1d793f51f (diff) |
radv: cache pipeline statistics
Applications rarely require them, but this improves fossil-db replay time.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9411>
-rw-r--r-- | src/amd/vulkan/radv_pipeline.c | 15 | ||||
-rw-r--r-- | src/amd/vulkan/radv_private.h | 1 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index 808003beffe..364f8cd7eba 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -205,7 +205,7 @@ void radv_DestroyPipeline( radv_pipeline_destroy(device, pipeline, pAllocator); } -static uint32_t get_hash_flags(const struct radv_device *device) +static uint32_t get_hash_flags(const struct radv_device *device, bool stats) { uint32_t hash_flags = 0; @@ -225,6 +225,8 @@ static uint32_t get_hash_flags(const struct radv_device *device) hash_flags |= RADV_HASH_SHADER_MRT_NAN_FIXUP; if (device->instance->debug_flags & RADV_DEBUG_INVARIANT_GEOM) hash_flags |= RADV_HASH_SHADER_INVARIANT_GEOM; + if (stats) + hash_flags |= RADV_HASH_SHADER_KEEP_STATISTICS; return hash_flags; } @@ -3227,21 +3229,22 @@ VkResult radv_create_shaders(struct radv_pipeline *pipeline, } } - radv_hash_shaders(hash, pStages, pipeline->layout, pipeline_key, get_hash_flags(device)); + radv_hash_shaders(hash, pStages, pipeline->layout, pipeline_key, + get_hash_flags(device, keep_statistic_info)); memcpy(gs_copy_hash, hash, 20); gs_copy_hash[0] ^= 1; pipeline->pipeline_hash = *(uint64_t *)hash; bool found_in_application_cache = true; - if (modules[MESA_SHADER_GEOMETRY] && !keep_executable_info && !keep_statistic_info) { + if (modules[MESA_SHADER_GEOMETRY] && !keep_executable_info) { struct radv_shader_variant *variants[MESA_SHADER_STAGES] = {0}; radv_create_shader_variants_from_pipeline_cache(device, cache, gs_copy_hash, variants, &found_in_application_cache); pipeline->gs_copy_shader = variants[MESA_SHADER_GEOMETRY]; } - if (!keep_executable_info && !keep_statistic_info && + if (!keep_executable_info && radv_create_shader_variants_from_pipeline_cache(device, cache, hash, pipeline->shaders, &found_in_application_cache) && (!modules[MESA_SHADER_GEOMETRY] || pipeline->gs_copy_shader)) { @@ -3479,7 +3482,7 @@ VkResult radv_create_shaders(struct radv_pipeline *pipeline, disable_optimizations); } - if (!keep_executable_info && !keep_statistic_info && pipeline->gs_copy_shader) { + if (!keep_executable_info && pipeline->gs_copy_shader) { struct radv_shader_binary *gs_binaries[MESA_SHADER_STAGES] = {NULL}; struct radv_shader_variant *gs_variants[MESA_SHADER_STAGES] = {0}; @@ -3569,7 +3572,7 @@ VkResult radv_create_shaders(struct radv_pipeline *pipeline, } } - if (!keep_executable_info && !keep_statistic_info) { + if (!keep_executable_info) { radv_pipeline_cache_insert_shaders(device, cache, hash, pipeline->shaders, binaries); } diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index eb7b645b11d..8c9d66167d5 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -1637,6 +1637,7 @@ struct radv_shader_module; #define RADV_HASH_SHADER_DISCARD_TO_DEMOTE (1 << 5) #define RADV_HASH_SHADER_MRT_NAN_FIXUP (1 << 6) #define RADV_HASH_SHADER_INVARIANT_GEOM (1 << 7) +#define RADV_HASH_SHADER_KEEP_STATISTICS (1 << 8) void radv_hash_shaders(unsigned char *hash, |