summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2019-05-14 23:03:29 -0500
committerJason Ekstrand <[email protected]>2019-05-16 02:13:09 +0000
commitc19acf321c6ac1d356add78a01c56edb7c22f5f0 (patch)
tree00a7f30192a57288a47b505b6ca086930df297f1 /src
parent2c14e2b5bfcef69ac173d3d512edf5d017f0be64 (diff)
intel/fs/ra: Add spill costs to the graph on-demand
Tested-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/intel/compiler/brw_fs_reg_allocate.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/intel/compiler/brw_fs_reg_allocate.cpp b/src/intel/compiler/brw_fs_reg_allocate.cpp
index aeb7214ba38..b7425ea6d58 100644
--- a/src/intel/compiler/brw_fs_reg_allocate.cpp
+++ b/src/intel/compiler/brw_fs_reg_allocate.cpp
@@ -396,7 +396,8 @@ void fs_visitor::calculate_payload_ranges(int payload_node_count,
class fs_reg_alloc {
public:
fs_reg_alloc(fs_visitor *fs):
- fs(fs), devinfo(fs->devinfo), compiler(fs->compiler), g(NULL)
+ fs(fs), devinfo(fs->devinfo), compiler(fs->compiler), g(NULL),
+ have_spill_costs(false)
{
mem_ctx = ralloc_context(NULL);
@@ -447,6 +448,7 @@ private:
int rsi;
ra_graph *g;
+ bool have_spill_costs;
int payload_node_count;
int *payload_last_use_ip;
@@ -796,9 +798,6 @@ fs_reg_alloc::build_interference_graph(bool allow_spilling)
*/
foreach_block_and_inst(block, fs_inst, inst, fs->cfg)
setup_inst_interference(inst);
-
- if (allow_spilling)
- set_spill_costs();
}
void
@@ -806,6 +805,7 @@ fs_reg_alloc::discard_interference_graph()
{
ralloc_free(g);
g = NULL;
+ have_spill_costs = false;
}
static void
@@ -937,11 +937,16 @@ fs_reg_alloc::set_spill_costs()
if (!no_spill[i])
ra_set_node_spill_cost(g, first_vgrf_node + i, adjusted_cost);
}
+
+ have_spill_costs = true;
}
int
fs_reg_alloc::choose_spill_reg()
{
+ if (!have_spill_costs)
+ set_spill_costs();
+
int node = ra_get_best_spill_node(g);
if (node < 0)
return -1;