[Mesa-dev] [PATCH] mesa/st: Only call nir_lower_io_to_scalar_early on scalar ISAs

Christian Gmeiner christian.gmeiner at gmail.com
Mon Oct 22 05:29:26 UTC 2018


Am So., 21. Okt. 2018 um 20:37 Uhr schrieb Alyssa Rosenzweig
<alyssa at rosenzweig.io>:
>
> On scalar ISAs, nir_lower_io_to_scalar_early enables significant
> optimizations. However, on vector ISAs, it is counterproductive and
> impedes optimal codegen. This patch only calls
> nir_lower_io_to_scalar_early for scalar ISAs. It appears that at present
> there are no upstreamed drivers using Gallium, NIR, and a vector ISA, so
> for existing code, this should be a no-op. However, this patch is
> necessary for the upcoming Panfrost (Midgard) and Lima (Utgard)
> compilers, which are vector.
>
> With this patch, Panfrost is able to consume NIR directly, rather than
> TGSI with the TGSI->NIR conversion.
>
> For how this affects Lima, see
> https://www.mail-archive.com/mesa-dev@lists.freedesktop.org/msg189216.html
>
> Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>

Reviewed-by: Christian Gmeiner <christian.gmeiner at gmail.com>

> ---
>  src/mesa/state_tracker/st_glsl_to_nir.cpp | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
> index 24776f7f9c..911284401e 100644
> --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
> @@ -665,7 +665,10 @@ st_link_nir(struct gl_context *ctx,
>           mask = (nir_variable_mode)(mask | nir_var_shader_out);
>
>        nir_shader *nir = shader->Program->nir;
> -      NIR_PASS_V(nir, nir_lower_io_to_scalar_early, mask);
> +
> +      if (is_scalar[i])
> +         NIR_PASS_V(nir, nir_lower_io_to_scalar_early, mask);
> +
>        st_nir_opts(nir, is_scalar[i]);
>     }
>

Do you need somebody to push it?

-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info


More information about the mesa-dev mailing list