panvk: Wrap our descriptor lowering passes in NIR_PASS()

This allows us to do the validation after each step instead of once at
the end.

Since validation is done in nir_lower_descriptors(), we no longer
need to do it panvk_lower_nir(), and we don't need to return
progress information either. So adjust the prototype of
nir_lower_descriptors() accordingly.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32415>
This commit is contained in:
Boris Brezillon 2024-12-04 11:32:15 +01:00 committed by Marge Bot
parent 6564f56a55
commit 258979d69c
3 changed files with 8 additions and 9 deletions

View file

@ -191,7 +191,7 @@ panvk_shader_link_cleanup(struct panvk_shader_link *link)
}
#endif
bool panvk_per_arch(nir_lower_descriptors)(
void panvk_per_arch(nir_lower_descriptors)(
nir_shader *nir, struct panvk_device *dev,
const struct vk_pipeline_robustness_state *rs, uint32_t set_layout_count,
struct vk_descriptor_set_layout *const *set_layouts,

View file

@ -1198,7 +1198,7 @@ upload_shader_desc_info(struct panvk_device *dev, struct panvk_shader *shader,
shader->desc_info.used_set_mask = desc_info->used_set_mask;
}
bool
void
panvk_per_arch(nir_lower_descriptors)(
nir_shader *nir, struct panvk_device *dev,
const struct vk_pipeline_robustness_state *rs, uint32_t set_layout_count,
@ -1234,18 +1234,17 @@ panvk_per_arch(nir_lower_descriptors)(
for (uint32_t i = 0; i < set_layout_count; i++)
ctx.set_layouts[i] = to_panvk_descriptor_set_layout(set_layouts[i]);
progress = nir_shader_instructions_pass(nir, collect_instr_desc_access,
nir_metadata_all, &ctx);
NIR_PASS(progress, nir, nir_shader_instructions_pass,
collect_instr_desc_access, nir_metadata_all, &ctx);
if (!progress)
goto out;
create_copy_table(nir, &ctx);
upload_shader_desc_info(dev, shader, &ctx.desc_info);
progress = nir_shader_instructions_pass(nir, lower_descriptors_instr,
nir_metadata_control_flow, &ctx);
NIR_PASS(progress, nir, nir_shader_instructions_pass,
lower_descriptors_instr, nir_metadata_control_flow, &ctx);
out:
_mesa_hash_table_destroy(ctx.ht, NULL);
return progress;
}

View file

@ -515,8 +515,8 @@ panvk_lower_nir(struct panvk_device *dev, nir_shader *nir,
}
#endif
NIR_PASS(_, nir, panvk_per_arch(nir_lower_descriptors), dev, rs,
set_layout_count, set_layouts, shader);
panvk_per_arch(nir_lower_descriptors)(nir, dev, rs, set_layout_count,
set_layouts, shader);
NIR_PASS(_, nir, nir_split_var_copies);
NIR_PASS(_, nir, nir_lower_var_copies);