radv/rt: handle creation feedback like graphics/compute pipelines
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28645>
This commit is contained in:
committed by
Marge Bot
parent
c73e5e08e0
commit
5db1ce3733
@@ -399,17 +399,22 @@ struct radv_ray_tracing_pipeline_cache_data {
|
||||
bool
|
||||
radv_ray_tracing_pipeline_cache_search(struct radv_device *device, struct vk_pipeline_cache *cache,
|
||||
struct radv_ray_tracing_pipeline *pipeline,
|
||||
const VkRayTracingPipelineCreateInfoKHR *pCreateInfo)
|
||||
const VkRayTracingPipelineCreateInfoKHR *pCreateInfo,
|
||||
bool *found_in_application_cache)
|
||||
{
|
||||
*found_in_application_cache = false;
|
||||
|
||||
if (device->cache_disabled)
|
||||
return false;
|
||||
|
||||
if (!cache)
|
||||
bool *found = found_in_application_cache;
|
||||
if (!cache) {
|
||||
cache = device->mem_cache;
|
||||
found = NULL;
|
||||
}
|
||||
|
||||
bool cache_hit = false;
|
||||
struct vk_pipeline_cache_object *object =
|
||||
vk_pipeline_cache_lookup_object(cache, pipeline->sha1, SHA1_DIGEST_LENGTH, &radv_pipeline_ops, &cache_hit);
|
||||
vk_pipeline_cache_lookup_object(cache, pipeline->sha1, SHA1_DIGEST_LENGTH, &radv_pipeline_ops, found);
|
||||
|
||||
if (!object)
|
||||
return false;
|
||||
@@ -438,14 +443,6 @@ radv_ray_tracing_pipeline_cache_search(struct radv_device *device, struct vk_pip
|
||||
|
||||
assert(idx == pipeline_obj->num_shaders);
|
||||
|
||||
if (cache_hit && cache != device->mem_cache) {
|
||||
const VkPipelineCreationFeedbackCreateInfo *creation_feedback =
|
||||
vk_find_struct_const(pCreateInfo->pNext, PIPELINE_CREATION_FEEDBACK_CREATE_INFO);
|
||||
if (creation_feedback)
|
||||
creation_feedback->pPipelineCreationFeedback->flags |=
|
||||
VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT;
|
||||
}
|
||||
|
||||
pipeline->base.base.cache_object = object;
|
||||
return complete;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,8 @@ void radv_pipeline_cache_insert(struct radv_device *device, struct vk_pipeline_c
|
||||
|
||||
bool radv_ray_tracing_pipeline_cache_search(struct radv_device *device, struct vk_pipeline_cache *cache,
|
||||
struct radv_ray_tracing_pipeline *pipeline,
|
||||
const VkRayTracingPipelineCreateInfoKHR *create_info);
|
||||
const VkRayTracingPipelineCreateInfoKHR *pCreateInfo,
|
||||
bool *found_in_application_cache);
|
||||
|
||||
void radv_ray_tracing_pipeline_cache_insert(struct radv_device *device, struct vk_pipeline_cache *cache,
|
||||
struct radv_ray_tracing_pipeline *pipeline, unsigned num_stages,
|
||||
|
||||
@@ -842,12 +842,13 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache, const VkRayTra
|
||||
VK_FROM_HANDLE(radv_device, device, _device);
|
||||
VK_FROM_HANDLE(vk_pipeline_cache, cache, _cache);
|
||||
VK_FROM_HANDLE(radv_pipeline_layout, pipeline_layout, pCreateInfo->layout);
|
||||
VkPipelineCreationFeedback pipeline_feedback = {
|
||||
.flags = VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT,
|
||||
};
|
||||
bool skip_shaders_cache = false;
|
||||
VkResult result;
|
||||
const VkPipelineCreationFeedbackCreateInfo *creation_feedback =
|
||||
vk_find_struct_const(pCreateInfo->pNext, PIPELINE_CREATION_FEEDBACK_CREATE_INFO);
|
||||
if (creation_feedback)
|
||||
creation_feedback->pPipelineCreationFeedback->flags = VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT;
|
||||
|
||||
int64_t pipeline_start = os_time_get_nano();
|
||||
|
||||
@@ -902,8 +903,14 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache, const VkRayTra
|
||||
}
|
||||
|
||||
bool cache_hit = false;
|
||||
if (!skip_shaders_cache)
|
||||
cache_hit = radv_ray_tracing_pipeline_cache_search(device, cache, pipeline, pCreateInfo);
|
||||
if (!skip_shaders_cache) {
|
||||
bool found_in_application_cache = true;
|
||||
|
||||
cache_hit =
|
||||
radv_ray_tracing_pipeline_cache_search(device, cache, pipeline, pCreateInfo, &found_in_application_cache);
|
||||
if (cache_hit && found_in_application_cache)
|
||||
pipeline_feedback.flags |= VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT;
|
||||
}
|
||||
|
||||
if (!cache_hit) {
|
||||
result = radv_rt_compile_shaders(device, cache, pCreateInfo, creation_feedback, stage_keys, pipeline,
|
||||
@@ -935,8 +942,10 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache, const VkRayTra
|
||||
}
|
||||
|
||||
fail:
|
||||
pipeline_feedback.duration = os_time_get_nano() - pipeline_start;
|
||||
|
||||
if (creation_feedback)
|
||||
creation_feedback->pPipelineCreationFeedback->duration = os_time_get_nano() - pipeline_start;
|
||||
*creation_feedback->pPipelineCreationFeedback = pipeline_feedback;
|
||||
|
||||
if (result == VK_SUCCESS)
|
||||
*pPipeline = radv_pipeline_to_handle(&pipeline->base.base);
|
||||
|
||||
Reference in New Issue
Block a user