[Mesa-dev] [PATCH] i965/vec4: skip registers already marked as no_spill

Kenneth Graunke kenneth at whitecape.org
Mon Nov 14 07:00:52 UTC 2016


On Friday, November 11, 2016 9:41:11 AM PST Juan A. Suarez Romero wrote:
> Do not evaluate spill costs for registers that were already marked as
> no_spill.
> ---
>  src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
> index 228e04c..5a5be85 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
> @@ -385,7 +385,7 @@ vec4_visitor::evaluate_spill_costs(float *spill_costs, bool *no_spill)
>      */
>     foreach_block_and_inst(block, vec4_instruction, inst, cfg) {
>        for (unsigned int i = 0; i < 3; i++) {
> -         if (inst->src[i].file == VGRF) {
> +         if (inst->src[i].file == VGRF && !no_spill[inst->src[i].nr]) {
>              /* We will only unspill src[i] it it wasn't unspilled for the
>               * previous instruction, in which case we'll just reuse the scratch
>               * reg for this instruction.
> @@ -399,7 +399,7 @@ vec4_visitor::evaluate_spill_costs(float *spill_costs, bool *no_spill)
>           }
>        }
>  
> -      if (inst->dst.file == VGRF) {
> +      if (inst->dst.file == VGRF && !no_spill[inst->dst.nr]) {
>           spill_costs[inst->dst.nr] += loop_scale;
>           if (inst->dst.reladdr || inst->dst.offset % REG_SIZE != 0)
>              no_spill[inst->dst.nr] = true;
> 

Hmm, it seems pretty harmless to do this...also, the FS backend doesn't
have these checks either.

I'm guessing you're trying to avoid the overhead of calling
can_use_scratch_for_source()?  It's a bunch of list walking for a value
that ultimately won't matter.

Cutting that seems reasonable.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161113/891cf6b3/attachment.sig>


More information about the mesa-dev mailing list