From 592d64611c6bde8bbdba4dd48f424c3b5aa75ea9 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Thu, 28 Jan 2021 11:04:02 +0000 Subject: [PATCH] aco: fix waves calculation for wave32 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fossil-db (GFX10.3, wave32): Totals from 176 (0.13% of 139391) affected shaders: SGPRs: 16648 -> 16640 (-0.05%) VGPRs: 18920 -> 19076 (+0.82%); split: -0.30%, +1.12% CodeSize: 2354172 -> 2354288 (+0.00%); split: -0.01%, +0.01% MaxWaves: 1618 -> 1627 (+0.56%); split: +0.68%, -0.12% Instrs: 435756 -> 435761 (+0.00%); split: -0.02%, +0.02% Cycles: 8858360 -> 8869960 (+0.13%); split: -0.01%, +0.14% VMEM: 55899 -> 57220 (+2.36%); split: +2.53%, -0.17% SMEM: 10323 -> 10374 (+0.49%); split: +0.73%, -0.23% VClause: 8307 -> 8290 (-0.20%); split: -0.24%, +0.04% SClause: 16573 -> 16577 (+0.02%); split: -0.01%, +0.03% Copies: 24641 -> 24652 (+0.04%); split: -0.24%, +0.28% Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_ir.cpp | 4 ++-- src/amd/compiler/aco_live_var_analysis.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/amd/compiler/aco_ir.cpp b/src/amd/compiler/aco_ir.cpp index 7aea65142fd..cce524e705d 100644 --- a/src/amd/compiler/aco_ir.cpp +++ b/src/amd/compiler/aco_ir.cpp @@ -103,8 +103,8 @@ void init_program(Program *program, Stage stage, struct radv_shader_info *info, program->vgpr_alloc_granule = 4; if (chip_class >= GFX10) { - program->physical_sgprs = 2560; /* doesn't matter as long as it's at least 128 * 20 */ - program->physical_vgprs = 512; + program->physical_sgprs = 5120; /* doesn't matter as long as it's at least 128 * 40 */ + program->physical_vgprs = program->wave_size == 32 ? 1024 : 512; program->sgpr_alloc_granule = 128; program->sgpr_limit = 108; /* includes VCC, which can be treated as s[106-107] on GFX10+ */ if (chip_class >= GFX10_3) diff --git a/src/amd/compiler/aco_live_var_analysis.cpp b/src/amd/compiler/aco_live_var_analysis.cpp index 81782cbbe4a..5c9e1d1836b 100644 --- a/src/amd/compiler/aco_live_var_analysis.cpp +++ b/src/amd/compiler/aco_live_var_analysis.cpp @@ -313,9 +313,6 @@ uint16_t get_addr_vgpr_from_waves(Program *program, uint16_t waves) void calc_min_waves(Program* program) { unsigned waves_per_workgroup = calc_waves_per_workgroup(program); - /* currently min_waves is in wave64 waves */ - if (program->wave_size == 32) - waves_per_workgroup = DIV_ROUND_UP(waves_per_workgroup, 2); unsigned simd_per_cu = program->chip_class >= GFX10 ? 2 : 4; bool wgp = program->chip_class >= GFX10; /* assume WGP is used on Navi */ @@ -331,6 +328,9 @@ void update_vgpr_sgpr_demand(Program* program, const RegisterDemand new_demand) max_waves_per_simd = 16; else if (program->family >= CHIP_POLARIS10 && program->family <= CHIP_VEGAM) max_waves_per_simd = 8; + if (program->wave_size == 32) + max_waves_per_simd *= 2; + unsigned simd_per_cu = program->chip_class >= GFX10 ? 2 : 4; bool wgp = program->chip_class >= GFX10; /* assume WGP is used on Navi */