Mesa (master): aco/ra: Update register use bounds before recursing in get_regs_for_copies

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 13 18:31:39 UTC 2021


Module: Mesa
Branch: master
Commit: 67c1f32228de25dff56ec9c625af3001932e1d4b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=67c1f32228de25dff56ec9c625af3001932e1d4b

Author: Tony Wasserka <tony.wasserka at gmx.de>
Date:   Mon Nov 30 12:40:02 2020 +0100

aco/ra: Update register use bounds before recursing in get_regs_for_copies

Delaying the call to adjust_max_used_regs until after get_regs_for_copies
returns puts the RA context into a state where registers past max_used_gpr
may be blocked. This isn't an issue on its own, but it adds a surprising
corner case to get_reg_simple that is easily avoided now.

Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7799>

---

 src/amd/compiler/aco_register_allocation.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp
index 2557559b5c0..247219ee1c0 100644
--- a/src/amd/compiler/aco_register_allocation.cpp
+++ b/src/amd/compiler/aco_register_allocation.cpp
@@ -945,12 +945,11 @@ bool get_regs_for_copies(ra_ctx& ctx,
 
       /* mark the area as blocked */
       reg_file.block(PhysReg{reg_lo}, var.rc);
+      adjust_max_used_regs(ctx, var.rc, reg_lo);
 
       if (!get_regs_for_copies(ctx, reg_file, parallelcopies, new_vars, lb, ub, instr, def_reg_lo, def_reg_hi))
          return false;
 
-      adjust_max_used_regs(ctx, var.rc, reg_lo);
-
       /* create parallelcopy pair (without definition id) */
       Temp tmp = Temp(id, var.rc);
       Operand pc_op = Operand(tmp);



More information about the mesa-commit mailing list