[Mesa-dev] [PATCH 4/8] nir: add some helpers for doing linking

Eric Anholt eric at anholt.net
Tue Sep 19 00:12:58 UTC 2017


Timothy Arceri <tarceri at itsqueeze.com> writes:

> The initial helpers as support for removing unused varyings between
> stages.
> ---
>  src/compiler/Makefile.sources          |   1 +
>  src/compiler/nir/nir.h                 |   6 ++
>  src/compiler/nir/nir_linking_helpers.c | 136 +++++++++++++++++++++++++++++++++
>  3 files changed, 143 insertions(+)
>  create mode 100644 src/compiler/nir/nir_linking_helpers.c
>
> diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
> index 0153df2d812..9c7f057eecf 100644
> --- a/src/compiler/Makefile.sources
> +++ b/src/compiler/Makefile.sources
> @@ -203,6 +203,7 @@ NIR_FILES = \
>  	nir/nir_instr_set.h \
>  	nir/nir_intrinsics.c \
>  	nir/nir_intrinsics.h \
> +	nir/nir_linking_helpers.c \
>  	nir/nir_liveness.c \
>  	nir/nir_loop_analyze.c \
>  	nir/nir_loop_analyze.h \
> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
> index e52a1006896..1e89c74d14c 100644
> --- a/src/compiler/nir/nir.h
> +++ b/src/compiler/nir/nir.h
> @@ -2448,6 +2448,12 @@ void nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint);
>  void nir_assign_var_locations(struct exec_list *var_list, unsigned *size,
>                                int (*type_size)(const struct glsl_type *));
>  
> +/* Some helpers to do very simple linking */
> +bool nir_remove_unwritten_outputs(nir_shader *shader);
> +bool nir_remove_unread_outputs(nir_shader *shader, uint64_t outputs_read);
> +bool nir_remove_unused_varyings(nir_shader *producer, nir_shader *consumer);
> +bool nir_compact_varyings(nir_shader *producer, nir_shader *consumer);

It looks like only one of these functions is actually defined by this
patch.  I was hoping to use nir_remove_unread_outputs() from vc4 for my
coordinate shaders.  Other than that,

Reviewed-by: Eric Anholt <eric at anholt.net>

Have you looked at extending linking to garbage collect unused
individual components?  That's where I think I'd get the most win in
vc4, and I recall being concerned about that when I was working on i965,
as well.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170918/0bf14776/attachment.sig>


More information about the mesa-dev mailing list