From 676b39d31f72a7590aa097d03507b0da97baa713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Wed, 9 Oct 2024 10:37:10 +0200 Subject: [PATCH] aco/scheduler: always respect min_waves on GFX10+ It could theoretically happen that for large workgroups, the scheduler used more registers than allowed. No fossil changes. Cc: mesa-stable Part-of: --- src/amd/compiler/aco_scheduler.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/amd/compiler/aco_scheduler.cpp b/src/amd/compiler/aco_scheduler.cpp index 93908a2c390..dfab79f5d85 100644 --- a/src/amd/compiler/aco_scheduler.cpp +++ b/src/amd/compiler/aco_scheduler.cpp @@ -1264,8 +1264,12 @@ schedule_program(Program* program) ctx.num_waves = std::max(ctx.num_waves / wave_fac, 1); assert(ctx.num_waves > 0); - ctx.mv.max_registers = {int16_t(get_addr_vgpr_from_waves(program, ctx.num_waves * wave_fac) - 2), - int16_t(get_addr_sgpr_from_waves(program, ctx.num_waves * wave_fac))}; + ctx.mv.max_registers = { + int16_t(get_addr_vgpr_from_waves( + program, std::max(ctx.num_waves * wave_fac, program->min_waves)) - + 2), + int16_t(get_addr_sgpr_from_waves( + program, std::max(ctx.num_waves * wave_fac, program->min_waves)))}; /* NGG culling shaders are very sensitive to position export scheduling. * Schedule less aggressively when early primitive export is used, and