radv: Hash pipeline libraries separately

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22686>
This commit is contained in:
Friedrich Vock 2023-03-13 21:16:47 +01:00 committed by Marge Bot
parent a98b44cd34
commit c809c05f4f
3 changed files with 17 additions and 1 deletions

View file

@ -107,6 +107,14 @@ radv_hash_rt_shaders(unsigned char *hash, const VkRayTracingPipelineCreateInfoKH
_mesa_sha1_update(&ctx, &groups[i].handle, sizeof(struct radv_pipeline_group_handle));
}
if (pCreateInfo->pLibraryInfo) {
for (uint32_t i = 0; i < pCreateInfo->pLibraryInfo->libraryCount; ++i) {
RADV_FROM_HANDLE(radv_pipeline, lib_pipeline, pCreateInfo->pLibraryInfo->pLibraries[i]);
struct radv_ray_tracing_lib_pipeline *lib = radv_pipeline_to_ray_tracing_lib(lib_pipeline);
_mesa_sha1_update(&ctx, lib->sha1, SHA1_DIGEST_LENGTH);
}
}
const uint32_t pipeline_flags =
pCreateInfo->flags & (VK_PIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR |
VK_PIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHR |

View file

@ -374,6 +374,7 @@ radv_rt_pipeline_library_create(VkDevice _device, VkPipelineCache _cache,
RADV_FROM_HANDLE(radv_device, device, _device);
struct radv_ray_tracing_lib_pipeline *pipeline;
VkResult result = VK_SUCCESS;
bool keep_statistic_info = radv_pipeline_capture_shader_stats(device, pCreateInfo->flags);
VkRayTracingPipelineCreateInfoKHR local_create_info =
radv_create_merged_rt_create_info(pCreateInfo);
@ -391,6 +392,9 @@ radv_rt_pipeline_library_create(VkDevice _device, VkPipelineCache _cache,
radv_pipeline_init(device, &pipeline->base, RADV_PIPELINE_RAY_TRACING_LIB);
struct radv_pipeline_key key =
radv_generate_pipeline_key(device, &pipeline->base, pCreateInfo->flags);
pipeline->ctx = ralloc_context(NULL);
result = radv_rt_fill_group_info(device, pCreateInfo, pipeline->groups);
@ -419,6 +423,9 @@ radv_rt_pipeline_library_create(VkDevice _device, VkPipelineCache _cache,
memcpy(pipeline->group_infos, local_create_info.pGroups, size);
}
radv_hash_rt_shaders(pipeline->sha1, pCreateInfo, &key, pipeline->groups,
radv_get_hash_flags(device, keep_statistic_info));
*pPipeline = radv_pipeline_to_handle(&pipeline->base);
pipeline_fail:
@ -608,7 +615,7 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache,
struct radv_pipeline_key key = radv_generate_rt_pipeline_key(device, rt_pipeline, pCreateInfo->flags);
radv_hash_rt_shaders(hash, &local_create_info, &key, rt_pipeline->groups,
radv_hash_rt_shaders(hash, pCreateInfo, &key, rt_pipeline->groups,
radv_get_hash_flags(device, keep_statistic_info));
/* First check if we can get things from the cache before we take the expensive step of

View file

@ -2303,6 +2303,7 @@ struct radv_ray_tracing_lib_pipeline {
VkPipelineShaderStageCreateInfo *stages;
unsigned group_count;
VkRayTracingShaderGroupCreateInfoKHR *group_infos;
uint8_t sha1[SHA1_DIGEST_LENGTH];
struct radv_ray_tracing_group groups[];
};