panvk: Lower copy_deref and indirect derefs before nir_lower_io

Neither nir_lower_io() nor nir_lower_indirect_derefs() know what to do
with copy_deref so we need to get rid of those first.  Also, there are
some NIR passes which can insert more copy_deref or propagate an
indirect load to the I/O variable so we want to lower those away right
before lowering I/O.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Christoph Pillmayer <christoph.pillmayern@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38334>
This commit is contained in:
Faith Ekstrand
2025-11-08 10:21:04 -05:00
committed by Marge Bot
parent d6dc0ea5ae
commit a8b6213983

View File

@@ -410,9 +410,6 @@ panvk_preprocess_nir(struct vk_physical_device *vk_pdev,
NIR_PASS(_, nir, nir_lower_global_vars_to_local);
NIR_PASS(_, nir, nir_split_var_copies);
NIR_PASS(_, nir, nir_lower_indirect_derefs,
nir_var_shader_in | nir_var_shader_out, UINT32_MAX);
NIR_PASS(_, nir, nir_opt_copy_prop_vars);
NIR_PASS(_, nir, nir_opt_combine_stores, nir_var_all);
NIR_PASS(_, nir, nir_opt_loop);
@@ -919,6 +916,10 @@ panvk_lower_nir(struct panvk_device *dev, nir_shader *nir,
pan_shader_preprocess(nir, compile_input->gpu_id);
/* Postprocess can add copies back in and lower_io can't handle them */
NIR_PASS(_, nir, nir_lower_var_copies);
NIR_PASS(_, nir, nir_lower_indirect_derefs,
nir_var_shader_in | nir_var_shader_out, UINT32_MAX);
NIR_PASS(_, nir, nir_lower_io, nir_var_shader_in | nir_var_shader_out,
glsl_type_size, nir_lower_io_use_interpolated_input_intrinsics);