[Mesa-dev] [PATCH] radv: don't lower indirects until after opts have run

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Thu Mar 8 08:42:15 UTC 2018


On Thu, Mar 8, 2018 at 9:37 AM, Timothy Arceri <tarceri at itsqueeze.com> wrote:
> Noticed while passing by. nNot sure if it impacts anything, but
> likely to impact GFX9 more than anything else since we lower
> inputs, outputs and locals there.
> ---
>  src/amd/vulkan/radv_shader.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
> index 85672e600d..094cae4f93 100644
> --- a/src/amd/vulkan/radv_shader.c
> +++ b/src/amd/vulkan/radv_shader.c
> @@ -271,7 +271,7 @@ radv_shader_compile_to_nir(struct radv_device *device,
>         nir_lower_var_copies(nir);
>         nir_lower_global_vars_to_local(nir);
>         nir_remove_dead_variables(nir, nir_var_local);
> -       ac_lower_indirect_derefs(nir, device->physical_device->rad_info.chip_class);
> +//ac_lower_indirect_derefs(nir, device->physical_device->rad_info.chip_class);

Now if you actually remove it here instead of commenting it, this patch is

Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
>         nir_lower_subgroups(nir, &(struct nir_lower_subgroups_options) {
>                         .subgroup_size = 64,
>                         .ballot_bit_size = 64,
> @@ -283,6 +283,14 @@ radv_shader_compile_to_nir(struct radv_device *device,
>
>         radv_optimize_nir(nir);
>
> +       /* Indirect lowering must be call after the radv_optimize_nir() loop
Nit: must be called

> +        * has been called at least once. Otherwise indirect lowering can
> +        * bloat the instruction count of the loop and cause it to be
> +        * considered too large for unrolling.
> +        */
> +       ac_lower_indirect_derefs(nir, device->physical_device->rad_info.chip_class);
> +       radv_optimize_nir(nir);
> +
>         return nir;
>  }
>
> --
> 2.14.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list