anv: add analysis for push descriptor uses and store it in shader cache
We'll use this information to avoid : - binding table emission - allocation of surface states v2: Fix anv_nir_push_desc_ubo_fully_promoted() Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Emma Anholt <emma@anholt.net> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19050>
This commit is contained in:

committed by
Marge Bot

parent
01e282f23f
commit
ff91c5ca42
@@ -73,7 +73,8 @@ anv_shader_bin_create(struct anv_device *device,
|
||||
uint32_t prog_data_size,
|
||||
const struct brw_compile_stats *stats, uint32_t num_stats,
|
||||
const nir_xfb_info *xfb_info_in,
|
||||
const struct anv_pipeline_bind_map *bind_map)
|
||||
const struct anv_pipeline_bind_map *bind_map,
|
||||
const struct anv_push_descriptor_info *push_desc_info)
|
||||
{
|
||||
VK_MULTIALLOC(ma);
|
||||
VK_MULTIALLOC_DECL(&ma, struct anv_shader_bin, shader, 1);
|
||||
@@ -171,6 +172,8 @@ anv_shader_bin_create(struct anv_device *device,
|
||||
shader->xfb_info = NULL;
|
||||
}
|
||||
|
||||
typed_memcpy(&shader->push_desc_info, push_desc_info, 1);
|
||||
|
||||
shader->bind_map = *bind_map;
|
||||
typed_memcpy(surface_to_descriptor, bind_map->surface_to_descriptor,
|
||||
bind_map->surface_count);
|
||||
@@ -216,6 +219,10 @@ anv_shader_bin_serialize(struct vk_pipeline_cache_object *object,
|
||||
blob_write_uint32(blob, 0);
|
||||
}
|
||||
|
||||
blob_write_uint32(blob, shader->push_desc_info.used_descriptors);
|
||||
blob_write_uint32(blob, shader->push_desc_info.fully_promoted_ubo_descriptors);
|
||||
blob_write_uint8(blob, shader->push_desc_info.used_set_buffer);
|
||||
|
||||
blob_write_bytes(blob, shader->bind_map.surface_sha1,
|
||||
sizeof(shader->bind_map.surface_sha1));
|
||||
blob_write_bytes(blob, shader->bind_map.sampler_sha1,
|
||||
@@ -278,6 +285,11 @@ anv_shader_bin_deserialize(struct vk_device *vk_device,
|
||||
if (xfb_size)
|
||||
xfb_info = blob_read_bytes(blob, xfb_size);
|
||||
|
||||
struct anv_push_descriptor_info push_desc_info = {};
|
||||
push_desc_info.used_descriptors = blob_read_uint32(blob);
|
||||
push_desc_info.fully_promoted_ubo_descriptors = blob_read_uint32(blob);
|
||||
push_desc_info.used_set_buffer = blob_read_uint8(blob);
|
||||
|
||||
struct anv_pipeline_bind_map bind_map = {};
|
||||
blob_copy_bytes(blob, bind_map.surface_sha1, sizeof(bind_map.surface_sha1));
|
||||
blob_copy_bytes(blob, bind_map.sampler_sha1, sizeof(bind_map.sampler_sha1));
|
||||
@@ -308,7 +320,8 @@ anv_shader_bin_deserialize(struct vk_device *vk_device,
|
||||
key_data, key_size,
|
||||
kernel_data, kernel_size,
|
||||
&prog_data.base, prog_data_size,
|
||||
stats, num_stats, xfb_info, &bind_map);
|
||||
stats, num_stats, xfb_info, &bind_map,
|
||||
&push_desc_info);
|
||||
if (shader == NULL)
|
||||
return NULL;
|
||||
|
||||
@@ -350,7 +363,8 @@ anv_device_upload_kernel(struct anv_device *device,
|
||||
const struct brw_compile_stats *stats,
|
||||
uint32_t num_stats,
|
||||
const nir_xfb_info *xfb_info,
|
||||
const struct anv_pipeline_bind_map *bind_map)
|
||||
const struct anv_pipeline_bind_map *bind_map,
|
||||
const struct anv_push_descriptor_info *push_desc_info)
|
||||
{
|
||||
/* Use the default pipeline cache if none is specified */
|
||||
if (cache == NULL)
|
||||
@@ -362,7 +376,8 @@ anv_device_upload_kernel(struct anv_device *device,
|
||||
kernel_data, kernel_size,
|
||||
prog_data, prog_data_size,
|
||||
stats, num_stats,
|
||||
xfb_info, bind_map);
|
||||
xfb_info, bind_map,
|
||||
push_desc_info);
|
||||
if (shader == NULL)
|
||||
return NULL;
|
||||
|
||||
|
Reference in New Issue
Block a user