intel/fs: Use regs_written() in spilling cost heuristic for improved accuracy.
authorFrancisco Jerez <currojerez@riseup.net>
Thu, 20 Apr 2017 18:44:01 +0000 (11:44 -0700)
committerFrancisco Jerez <currojerez@riseup.net>
Mon, 24 Apr 2017 17:59:56 +0000 (10:59 -0700)
This is what we use later on to compute the number of registers that
will actually get spilled to memory, so it's more likely to match
reality than the current open-coded approximation.

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/compiler/brw_fs_reg_allocate.cpp

index c981d72e4f2e664b7cecda4d7072a84c807b2e3c..2d4d46ef3348290561618e0b82ac560fb61eb8b6 100644 (file)
@@ -826,8 +826,7 @@ fs_visitor::choose_spill_reg(struct ra_graph *g)
       }
 
       if (inst->dst.file == VGRF)
-         spill_costs[inst->dst.nr] += DIV_ROUND_UP(inst->size_written, REG_SIZE)
-                                      * block_scale;
+         spill_costs[inst->dst.nr] += regs_written(inst) * block_scale;
 
       switch (inst->opcode) {