From 0c3d8e8e2e866ec7b6c4bcc687e8864c6cc02b7f Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Wed, 17 Jun 2020 14:56:55 +0100 Subject: [PATCH] aco: disable a*1.0 optimization if the instruction is precise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fossil-db (GFX10): Totals from 10370 (7.44% of 139391) affected shaders: SGPRs: 564072 -> 564016 (-0.01%); split: -0.01%, +0.00% VGPRs: 248312 -> 248532 (+0.09%); split: -0.02%, +0.11% CodeSize: 12866732 -> 13208904 (+2.66%); split: -0.00%, +2.66% MaxWaves: 190198 -> 190170 (-0.01%) Instrs: 2460818 -> 2545351 (+3.44%) fossil-db (GFX10.3): Totals from 10370 (7.44% of 139391) affected shaders: SGPRs: 563904 -> 564272 (+0.07%); split: -0.16%, +0.22% VGPRs: 289344 -> 295016 (+1.96%); split: -0.88%, +2.84% CodeSize: 13519204 -> 14197020 (+5.01%); split: -0.00%, +5.01% MaxWaves: 155946 -> 154566 (-0.88%) Instrs: 2719177 -> 2806919 (+3.23%); split: -0.00%, +3.23% Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_optimizer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index 3cffcb1d40e..b4a63e7e580 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -1313,7 +1313,8 @@ void label_instruction(opt_ctx &ctx, Block& block, aco_ptr& instr) } else if (instr->operands[!i].constantValue() == (fp16 ? 0x3800 : 0x3f000000)) { /* 0.5 */ ctx.info[instr->operands[i].tempId()].set_omod5(instr.get()); } else if (instr->operands[!i].constantValue() == (fp16 ? 0x3c00 : 0x3f800000) && - !(fp16 ? block.fp_mode.must_flush_denorms16_64 : block.fp_mode.must_flush_denorms32)) { /* 1.0 */ + !(fp16 ? block.fp_mode.must_flush_denorms16_64 : block.fp_mode.must_flush_denorms32) && + !instr->definitions[0].isPrecise()) { /* 1.0 */ ctx.info[instr->definitions[0].tempId()].set_temp(instr->operands[i].getTemp()); } else { continue;