From 50519598ff050cb0eeef5ae8b9bdbffd9f83bef8 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 17 Oct 2023 04:05:35 -0700 Subject: [PATCH] intel/brw: Skip discarding the interference graph We no longer need to reserve registers for constructing spill/fill messages. We have split sends and construct message headers in new temporary registers with a very short lifespan which are simply added to the existing interference graph as new nodes and allocated via the normal mechanism. This means that when we need to spill for the first time, we can avoid discarding and recomputing the entire interference graph. We also avoid needing to recreate all spill candidate information once ra_allocate() fails, because the graph remains valid, and none of the existing nodes had any changes to their interference. The existing spill candidates remain valid. This will slightly help improve compile time when needing to spill. Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/compiler/brw_fs_reg_allocate.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/intel/compiler/brw_fs_reg_allocate.cpp b/src/intel/compiler/brw_fs_reg_allocate.cpp index 77f1d93eb28..e5fb11ecdcd 100644 --- a/src/intel/compiler/brw_fs_reg_allocate.cpp +++ b/src/intel/compiler/brw_fs_reg_allocate.cpp @@ -288,7 +288,7 @@ private: int node_start_ip, int node_end_ip); void setup_inst_interference(const fs_inst *inst); - void build_interference_graph(bool allow_spilling); + void build_interference_graph(); void discard_interference_graph(); fs_reg build_lane_offsets(const fs_builder &bld, @@ -510,7 +510,7 @@ fs_reg_alloc::setup_inst_interference(const fs_inst *inst) } void -fs_reg_alloc::build_interference_graph(bool allow_spilling) +fs_reg_alloc::build_interference_graph() { /* Compute the RA node layout */ node_count = 0; @@ -1073,7 +1073,7 @@ fs_reg_alloc::spill_reg(unsigned spill_reg) bool fs_reg_alloc::assign_regs(bool allow_spilling, bool spill_all) { - build_interference_graph(fs->spilled_any_registers || spill_all); + build_interference_graph(); unsigned spilled = 0; while (1) { @@ -1107,15 +1107,6 @@ fs_reg_alloc::assign_regs(bool allow_spilling, bool spill_all) break; } - /* If we're going to spill but we've never spilled before, we need - * to re-build the interference graph with MRFs enabled to allow - * spilling. - */ - if (!fs->spilled_any_registers) { - discard_interference_graph(); - build_interference_graph(true); - } - spill_reg(reg); spilled++; }