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 <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25811>
This commit is contained in:
Kenneth Graunke 2023-10-17 04:05:35 -07:00 committed by Marge Bot
parent 29d6264627
commit 50519598ff

View file

@ -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++;
}