[Mesa-dev] [PATCH] i965/fs: Clarify and optimize register coalescing interference check.

Jason Ekstrand jason at jlekstrand.net
Sat Nov 22 08:18:27 PST 2014


On Nov 21, 2014 1:06 PM, "Matt Turner" <mattst88 at gmail.com> wrote:
>
> With bblock_t::end_ip, we can skip entire blocks rather than checking
> every instruction in them. Also by making the loops nested (explicitly,
> it already was a nested loop), the continue seen at the end of the first
> hunk (when viewed with git show -w) will do what the programmer expects.
>
> No functional change.
> ---
>  .../drivers/dri/i965/brw_fs_register_coalesce.cpp  | 28
+++++++++++-----------
>  1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
> index 62788cd..9c8ca32 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
> @@ -126,26 +126,26 @@ can_coalesce_vars(brw::fs_live_variables
*live_intervals,
>        return false;
>
>     int start_ip = MIN2(start_to, start_from);
> -   int scan_ip = -1;
>
> -   foreach_block_and_inst(block, fs_inst, scan_inst, cfg) {
> -      scan_ip++;
> -
> -      if (scan_ip < start_ip)
> +   foreach_block(block, cfg) {
> +      if (start_ip > block->end_ip)
>           continue;
>
> -      if (scan_inst->is_control_flow())
> -         return false;

Is it just me, or did you loose this bit?  Maybe it wasn't needed.  Also,
continuing until we get to a late enough block is not the same as
continuing until we get to a certain instruction IP.  I'll have to look at
the old code some more before I can convince myself that this is not a
functional change.
--Jason

> +      int scan_ip = block->start_ip - 1;
>
> -      if (scan_ip <= live_intervals->start[var_to])
> -         continue;
> +      foreach_inst_in_block(fs_inst, scan_inst, block) {
> +         scan_ip++;
> +
> +         if (scan_ip <= live_intervals->start[var_to])
> +            continue;
>
> -      if (scan_ip > live_intervals->end[var_to])
> -         return true;
> +         if (scan_ip > live_intervals->end[var_to])
> +            return true;
>
> -      if (scan_inst->dst.equals(inst->dst) ||
> -          scan_inst->dst.equals(inst->src[0]))
> -         return false;
> +         if (scan_inst->dst.equals(inst->dst) ||
> +             scan_inst->dst.equals(inst->src[0]))
> +            return false;
> +      }
>     }
>
>     return true;
> --
> 2.0.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20141122/d7c80dc5/attachment-0001.html>


More information about the mesa-dev mailing list