diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index a9df9b6b8ae..6ac6c2e5c9b 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -375,29 +375,6 @@ radv_postprocess_nir(struct radv_device *device, const struct radv_graphics_stat }; NIR_PASS(_, stage->nir, radv_nir_opt_tid_function, &tid_options); - enum nir_lower_non_uniform_access_type lower_non_uniform_access_types = - nir_lower_non_uniform_ubo_access | nir_lower_non_uniform_ssbo_access | nir_lower_non_uniform_texture_access | - nir_lower_non_uniform_image_access; - - /* In practice, most shaders do not have non-uniform-qualified - * accesses (see - * https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17558#note_1475069) - * thus a cheaper and likely to fail check is run first. - */ - if (nir_has_non_uniform_access(stage->nir, lower_non_uniform_access_types)) { - if (!stage->key.optimisations_disabled) { - NIR_PASS(_, stage->nir, nir_opt_non_uniform_access); - } - - if (!radv_use_llvm_for_stage(pdev, stage->stage)) { - nir_lower_non_uniform_access_options options = { - .types = lower_non_uniform_access_types, - .callback = &non_uniform_access_callback, - .callback_data = NULL, - }; - NIR_PASS(_, stage->nir, nir_lower_non_uniform_access, &options); - } - } NIR_PASS(_, stage->nir, nir_lower_memory_model); nir_load_store_vectorize_options vectorize_opts = { @@ -435,6 +412,30 @@ radv_postprocess_nir(struct radv_device *device, const struct radv_graphics_stat } } + enum nir_lower_non_uniform_access_type lower_non_uniform_access_types = + nir_lower_non_uniform_ubo_access | nir_lower_non_uniform_ssbo_access | nir_lower_non_uniform_texture_access | + nir_lower_non_uniform_image_access; + + /* In practice, most shaders do not have non-uniform-qualified + * accesses (see + * https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17558#note_1475069) + * thus a cheaper and likely to fail check is run first. + */ + if (nir_has_non_uniform_access(stage->nir, lower_non_uniform_access_types)) { + if (!stage->key.optimisations_disabled) { + NIR_PASS(_, stage->nir, nir_opt_non_uniform_access); + } + + if (!radv_use_llvm_for_stage(pdev, stage->stage)) { + nir_lower_non_uniform_access_options options = { + .types = lower_non_uniform_access_types, + .callback = &non_uniform_access_callback, + .callback_data = NULL, + }; + NIR_PASS(_, stage->nir, nir_lower_non_uniform_access, &options); + } + } + NIR_PASS( _, stage->nir, ac_nir_lower_subdword_loads, (ac_nir_lower_subdword_options){.modes_1_comp = nir_var_mem_ubo | nir_var_mem_push_const,