radv: use nir_opt_uniform_access

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17558>
This commit is contained in:
Constantine Shablya 2022-07-15 17:01:34 +03:00 committed by Marge Bot
parent fa5559f272
commit d2754b12cd

View file

@ -4785,14 +4785,26 @@ radv_create_shaders(struct radv_pipeline *pipeline, struct radv_pipeline_layout
/* Wave and workgroup size should already be filled. */
assert(stages[i].info.wave_size && stages[i].info.workgroup_size);
if (!radv_use_llvm_for_stage(device, i)) {
nir_lower_non_uniform_access_options options = {
.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,
.callback = &non_uniform_access_callback,
.callback_data = NULL,
};
NIR_PASS(_, stages[i].nir, nir_lower_non_uniform_access, &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(stages[i].nir, lower_non_uniform_access_types)) {
NIR_PASS(_, stages[i].nir, nir_opt_non_uniform_access);
if (!radv_use_llvm_for_stage(device, i)) {
nir_lower_non_uniform_access_options options = {
.types = lower_non_uniform_access_types,
.callback = &non_uniform_access_callback,
.callback_data = NULL,
};
NIR_PASS(_, stages[i].nir, nir_lower_non_uniform_access, &options);
}
}
NIR_PASS(_, stages[i].nir, nir_lower_memory_model);