From: Rhys Perry Date: Wed, 11 Oct 2023 13:43:03 +0000 (+0100) Subject: radv: call lower_array_deref_of_vec before lower_io_arrays_to_elements X-Git-Tag: upstream/23.3.3~281 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9e451512431d9a8336acfcbd8ae2aa24fdec5f02;p=platform%2Fupstream%2Fmesa.git radv: call lower_array_deref_of_vec before lower_io_arrays_to_elements nir_lower_io_arrays_to_elements does not support array derefs of vectors, even when nir_deref_instr_is_known_out_of_bounds is fixed. They can occur with mesh shaders. Found by inspection. Signed-off-by: Rhys Perry Reviewed-by: Timur Kristóf Cc: mesa-stable Part-of: (cherry picked from commit ed12be533e2673b08e958be32fbe5d6af2737fbc) --- diff --git a/.pick_status.json b/.pick_status.json index e798933..1d6ce7f 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1294,7 +1294,7 @@ "description": "radv: call lower_array_deref_of_vec before lower_io_arrays_to_elements", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/amd/vulkan/nir/radv_nir_lower_io.c b/src/amd/vulkan/nir/radv_nir_lower_io.c index bc5ecfe..e78523a 100644 --- a/src/amd/vulkan/nir/radv_nir_lower_io.c +++ b/src/amd/vulkan/nir/radv_nir_lower_io.c @@ -41,9 +41,6 @@ radv_nir_lower_io_to_scalar_early(nir_shader *nir, nir_variable_mode mask) { bool progress = false; - NIR_PASS(progress, nir, nir_lower_array_deref_of_vec, mask, - nir_lower_direct_array_deref_of_vec_load | nir_lower_indirect_array_deref_of_vec_load | - nir_lower_direct_array_deref_of_vec_store | nir_lower_indirect_array_deref_of_vec_store); NIR_PASS(progress, nir, nir_lower_io_to_scalar_early, mask); if (progress) { /* Optimize the new vector code and then remove dead vars */ diff --git a/src/amd/vulkan/radv_pipeline_graphics.c b/src/amd/vulkan/radv_pipeline_graphics.c index d02c53f..9b648db 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.c +++ b/src/amd/vulkan/radv_pipeline_graphics.c @@ -1338,6 +1338,13 @@ radv_link_shaders(const struct radv_device *device, nir_shader *producer, nir_sh nir_link_xfb_varyings(producer, consumer); } + unsigned array_deref_of_vec_options = + nir_lower_direct_array_deref_of_vec_load | nir_lower_indirect_array_deref_of_vec_load | + nir_lower_direct_array_deref_of_vec_store | nir_lower_indirect_array_deref_of_vec_store; + + NIR_PASS(progress, producer, nir_lower_array_deref_of_vec, nir_var_shader_out, array_deref_of_vec_options); + NIR_PASS(progress, consumer, nir_lower_array_deref_of_vec, nir_var_shader_in, array_deref_of_vec_options); + nir_lower_io_arrays_to_elements(producer, consumer); nir_validate_shader(producer, "after nir_lower_io_arrays_to_elements"); nir_validate_shader(consumer, "after nir_lower_io_arrays_to_elements");