[Mesa-dev] [PATCH 3/4] i965/fs: Mark predicated PLN instructions with dependency hints.

Kristian Høgsberg hoegsberg at gmail.com
Mon Jun 30 09:21:34 PDT 2014


On Sun, Jun 29, 2014 at 11:18:16PM -0700, Matt Turner wrote:
> To implement the unlit_centroid_workaround, previously we emitted
> 
>    (+f0) pln(8) g20<1>F g16.4<0,1,0>F g4<8,8,1>F { align1 1Q };
>    (-f0) pln(8) g20<1>F g16.4<0,1,0>F g2<8,8,1>F { align1 1Q };
> 
> where the flag register contains the channel enable bits from g0.
> 
> Since the predicates are complementary, the pair of pln instructions
> write to non-overlapping components of the destination, which is the
> case that the dependency control hints are designed for.
> 
> Typically setting dependency control hints on predicated instructions
> isn't safe (if an instruction doesn't execute due to the predicate, it
> won't update the scoreboard, leaving it in a bad state) but since we
> must have at least one channel executing (i.e., +f0 is true for some
> channel) by virtue of the fact that the thread is running, we can put
> the +f0 pln instruction last and set the hints:
> 
>    (-f0) pln(8) g20<1>F g16.4<0,1,0>F g2<8,8,1>F { align1 NoDDClr 1Q };
>    (+f0) pln(8) g20<1>F g16.4<0,1,0>F g4<8,8,1>F { align1 NoDDChk 1Q };

Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>

> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 3b7a170..5a3d1d3 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -1178,15 +1178,20 @@ fs_visitor::emit_general_interpolation(ir_variable *ir)
>  
>                    fs_inst *inst;
>                    inst = emit_linterp(attr, fs_reg(interp), interpolation_mode,
> +                                      false, false);
> +                  inst->predicate = BRW_PREDICATE_NORMAL;
> +                  inst->predicate_inverse = true;
> +                  if (brw->has_pln)
> +                     inst->no_dd_clear = true;
> +
> +                  inst = emit_linterp(attr, fs_reg(interp), interpolation_mode,
>                                        ir->data.centroid && !key->persample_shading,
>                                        ir->data.sample || key->persample_shading);
>                    inst->predicate = BRW_PREDICATE_NORMAL;
>                    inst->predicate_inverse = false;
> +                  if (brw->has_pln)
> +                     inst->no_dd_check = true;
>  
> -                  inst = emit_linterp(attr, fs_reg(interp), interpolation_mode,
> -                                      false, false);
> -                  inst->predicate = BRW_PREDICATE_NORMAL;
> -                  inst->predicate_inverse = true;
>                 } else {
>                    emit_linterp(attr, fs_reg(interp), interpolation_mode,
>                                 ir->data.centroid && !key->persample_shading,
> -- 
> 1.8.3.2
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list