[Mesa-dev] [PATCH v2 3/4] intel/nir: Split IO arrays into elements
Kenneth Graunke
kenneth at whitecape.org
Thu Aug 2 00:34:03 UTC 2018
On Tuesday, July 31, 2018 8:55:05 PM PDT Jason Ekstrand wrote:
> On Tue, Jul 31, 2018 at 3:00 PM Jason Ekstrand <jason at jlekstrand.net> wrote:
>
> > On July 31, 2018 14:54:54 Kenneth Graunke <kenneth at whitecape.org> wrote:
> >
> > > On Tuesday, July 31, 2018 12:22:02 PM PDT Jason Ekstrand wrote:
> > >> The NIR nir_lower_io_arrays_to_elements pass attempts to split I/O
> > >> variables which are arrays or matrices into a sequence of separate
> > >> variables. This can help link-time optimization by allowing us to
> > >> remove varyings at a more granular level.
> > >>
> > >> Shader-db results on Kaby Lake:
> > >>
> > >> total instructions in shared programs: 15177645 -> 15168494 (-0.06%)
> > >> instructions in affected programs: 79857 -> 70706 (-11.46%)
> > >> helped: 392
> > >> HURT: 0
> > >> ---
> > >> src/intel/compiler/brw_nir.c | 4 ++++
> > >> 1 file changed, 4 insertions(+)
> > >>
> > >> diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
> > >> index 17ccfa48af6..29ad68fdb2a 100644
> > >> --- a/src/intel/compiler/brw_nir.c
> > >> +++ b/src/intel/compiler/brw_nir.c
> > >> @@ -709,6 +709,10 @@ void
> > >> brw_nir_link_shaders(const struct brw_compiler *compiler,
> > >> nir_shader **producer, nir_shader **consumer)
> > >> {
> > >> + nir_lower_io_arrays_to_elements(*producer, *consumer);
> > >> + nir_validate_shader(*producer);
> > >> + nir_validate_shader(*consumer);
> > >> +
> > >> NIR_PASS_V(*producer, nir_remove_dead_variables, nir_var_shader_out);
> > >> NIR_PASS_V(*consumer, nir_remove_dead_variables, nir_var_shader_in);
> > >
> > > This actually passes the test suite? That's strange. When I was
> > > playing with this earlier, it was demoting gl_ClipDistance[1] from
> > > a float[1] compact array to a single float variable...but leaving it
> > > marked compact. var->data.compact = true makes no sense for non-arrays.
> > >
> > > I think our clip/cull distance handling assumes that it's an array,
> > > though. So...not sure whether the pass should unset compact, or skip
> > > over compact arrays...
> >
> > Yes, it passes just fine. I'm not sure exactly how it interacts with clip
> > distance lowering though.
> >
>
> Back at my computer finally. I did a bit of digging and the
> lower_io_arrays_to_elements pass ignores everything that isn't
> VARYING_SLOT_VARX. Clip distances are ignored since they're
> VARYING_SLOT_CLIP_DIST0/1. Hope that clears it up. :-)
>
> --Jason
Huh. Not sure what I was seeing then. Probably other local breakage.
Sounds like everything should work, then.
Series is:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180801/1efad57a/attachment.sig>
More information about the mesa-dev
mailing list