From 7ed1aea9c5147d300f46c493345190b986dece02 Mon Sep 17 00:00:00 2001 From: Natalie Vock Date: Mon, 17 Feb 2025 18:42:47 +0100 Subject: [PATCH] aco/ra: Also consider blocked registers as not containing temps Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index f044df6ee5e..99349217e2a 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -329,6 +329,14 @@ public: return res; } + unsigned count_zero_or_blocked(PhysRegInterval reg_interval) const + { + unsigned res = 0; + for (PhysReg reg : reg_interval) + res += !regs[reg] || regs[reg] == 0xFFFFFFFF; + return res; + } + /* Returns true if any of the bytes in the given range are allocated or blocked */ bool test(PhysReg start, unsigned num_bytes) const { @@ -3877,8 +3885,8 @@ register_allocation(Program* program, ra_test_policy policy) ASSERTED PhysRegInterval vgpr_bounds = get_reg_bounds(ctx, RegType::vgpr, false); ASSERTED PhysRegInterval sgpr_bounds = get_reg_bounds(ctx, RegType::sgpr, false); - assert(register_file.count_zero(vgpr_bounds) == ctx.vgpr_bounds); - assert(register_file.count_zero(sgpr_bounds) == ctx.sgpr_bounds); + assert(register_file.count_zero_or_blocked(vgpr_bounds) == ctx.vgpr_bounds); + assert(register_file.count_zero_or_blocked(sgpr_bounds) == ctx.sgpr_bounds); } else if (should_compact_linear_vgprs(ctx, register_file)) { aco_ptr br = std::move(instructions.back()); instructions.pop_back();