<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 22, 2019 at 9:51 AM Eric Anholt <<a href="mailto:eric@anholt.net">eric@anholt.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Timothy Arceri <<a href="mailto:tarceri@itsqueeze.com" target="_blank">tarceri@itsqueeze.com</a>> writes:<br>
<br>
> shader-db results i965 (SKL):<br>
><br>
> total instructions in shared programs: 13219105 -> 13024761 (-1.47%)<br>
> instructions in affected programs: 1169457 -> 975113 (-16.62%)<br>
> helped: 599<br>
> HURT: 154<br>
><br>
> total cycles in shared programs: 333968972 -> 324822073 (-2.74%)<br>
> cycles in affected programs: 130032440 -> 120885541 (-7.03%)<br>
> helped: 590<br>
> HURT: 216<br>
><br>
> total spills in shared programs: 57947 -> 29130 (-49.73%)<br>
> spills in affected programs: 53364 -> 24547 (-54.00%)<br>
> helped: 351<br>
> HURT: 0<br>
><br>
> total fills in shared programs: 51310 -> 25468 (-50.36%)<br>
> fills in affected programs: 44882 -> 19040 (-57.58%)<br>
> helped: 351<br>
> HURT: 0<br>
> ---<br>
> src/compiler/nir/nir_lower_phis_to_scalar.c | 1 +<br>
> 1 file changed, 1 insertion(+)<br>
><br>
> diff --git a/src/compiler/nir/nir_lower_phis_to_scalar.c b/src/compiler/nir/nir_lower_phis_to_scalar.c<br>
> index 16001f73685..f6f702bca15 100644<br>
> --- a/src/compiler/nir/nir_lower_phis_to_scalar.c<br>
> +++ b/src/compiler/nir/nir_lower_phis_to_scalar.c<br>
> @@ -74,6 +74,7 @@ is_phi_src_scalarizable(nir_phi_src *src,<br>
> /* A phi is scalarizable if we're going to lower it */<br>
> return should_lower_phi(nir_instr_as_phi(src_instr), state);<br>
> <br>
> + case nir_instr_type_tex:<br>
> case nir_instr_type_load_const:<br>
> case nir_instr_type_ssa_undef:<br>
> /* These are trivially scalarizable */<br>
<br>
Sounds promising, but I would definitely not describe instr_type_tex as<br>
"trivially scalarizable" -- could you explain what's going on with this<br>
patch?<br></blockquote><div><br></div><div>I think I can for Intel though I'm not sure how this affects other drivers.</div><div><br></div><div>On Intel hardware, we almost always have to combine all the texture sources into one big message. Since having more than one source is very common, this means that we have to make a temporary copy of the sources anyway. Because we're copying them, having them contiguous (a vector in NIR terms) doesn't actually gain us anything. We may as well let NIR scalarize them and give more freedom to the register allocator and other NIR passes which may need to clean things up. We don't want to make the same choice for destinations as they are required to be contiguous.</div><div><br></div><div>Feel free to copy+paste that somewhere. I agree with Eric that they are not "trivially scalarizable" but they are safe to scalarize.</div><div><br></div><div>--Jason<br></div></div></div>