[Mesa-dev] [PATCH 6/6] radv: don't lower indirect derefs

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Thu Jul 6 22:25:51 UTC 2017


On Thu, Jul 6, 2017 at 9:50 PM, Connor Abbott <connora at valvesoftware.com> wrote:
> From: Connor Abbott <cwabbott0 at gmail.com>
>
> Radeonsi doesn't either. As of the last commit, these should be handled
> properly as long as LLVM has scratch support. We also should use
> nir_lower_io_to_temporaries() for inputs instead of generating an
> if-ladder, since that should be more efficient.
> ---
>  src/amd/vulkan/radv_pipeline.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
> index 237e146..0991304 100644
> --- a/src/amd/vulkan/radv_pipeline.c
> +++ b/src/amd/vulkan/radv_pipeline.c
> @@ -272,11 +272,17 @@ radv_shader_compile_to_nir(struct radv_device *device,
>
>         nir_shader_gather_info(nir, entry_point->impl);
>
> -       nir_variable_mode indirect_mask = 0;
> -       indirect_mask |= nir_var_shader_in;
> -       indirect_mask |= nir_var_local;
> +       if (device->llvm_supports_spill) {
> +               nir_lower_io_to_temporaries(nir, entry_point->impl,
> +                                           false /* outputs */,
> +                                           true /* inputs */);

We only need temporaries for VS/FS inputs, the other stages get the
inputs from ringbuffers and I think those have all been wired up for
indirect access. (might make sense to enable output temporaries for FS
and whatever maps to hardware VS?)

Also sounds like the current indirect index handling for inputs is
useless, you might be able to simplify that.

> +       } else {
> +               nir_variable_mode indirect_mask = 0;
> +               indirect_mask |= nir_var_shader_in;
> +               indirect_mask |= nir_var_local;
> +               nir_lower_indirect_derefs(nir, indirect_mask);
> +       }
>
> -       nir_lower_indirect_derefs(nir, indirect_mask);
>
>         static const nir_lower_tex_options tex_options = {
>           .lower_txp = ~0,
> --
> 2.9.4
>
> _______________________________________________
> 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