From 6a5982cfe5e559a0fd4e0aa678b85bfd5dc5cd11 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Wed, 12 Nov 2025 14:01:37 +0000 Subject: [PATCH] aco/scheduler: fix register demand check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes deathloop/01f8d58bf245663b with gfx1201. Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Fixes: 668259ef0b91 ("aco/scheduler: move clauses through RAR dependencies") Part-of: --- src/amd/compiler/aco_scheduler.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/amd/compiler/aco_scheduler.cpp b/src/amd/compiler/aco_scheduler.cpp index de157af6a2c..6566b10b732 100644 --- a/src/amd/compiler/aco_scheduler.cpp +++ b/src/amd/compiler/aco_scheduler.cpp @@ -313,8 +313,9 @@ MoveState::downwards_move_clause(DownwardsCursor& cursor) /* RegisterDemand changes caused by the instructions being moved over. */ RegisterDemand insert_diff = insert_demand - clause_end_demand + rar_dep; - /* Check the new demand of the instructions being moved over. */ - if (RegisterDemand(cursor.total_demand - clause_diff).exceeds(max_registers)) + /* Check the new demand of the instructions being moved over. If we somehow split total_demand + * into before and after rar_dep, we could make this more accurate. */ + if (RegisterDemand(cursor.total_demand - clause_diff + rar_dep).exceeds(max_registers)) return move_fail_pressure; /* Check max demand for the moved clause instructions. */