From b729ad17422535a7d21fe47567bab96b20159afa Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Mon, 23 Jun 2025 12:50:29 +0200 Subject: [PATCH] nir/loop_analyze: consider movs/vecs free MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They are free more likely than not. Foz-DB Navi31: Totals from 462 (0.58% of 80251) affected shaders: Instrs: 1464013 -> 1868466 (+27.63%) CodeSize: 8476352 -> 10745544 (+26.77%) VGPRs: 27412 -> 27560 (+0.54%) SpillSGPRs: 0 -> 16 (+inf%) SpillVGPRs: 83 -> 76 (-8.43%) Scratch: 6072832 -> 6071808 (-0.02%) Latency: 19282476 -> 19552323 (+1.40%); split: -0.11%, +1.51% InvThroughput: 2198357 -> 2258490 (+2.74%); split: -0.47%, +3.21% VClause: 32986 -> 43491 (+31.85%) SClause: 72760 -> 126112 (+73.33%) Copies: 165286 -> 223368 (+35.14%) Branches: 60530 -> 79743 (+31.74%); split: -0.03%, +31.77% PreSGPRs: 24885 -> 25077 (+0.77%) PreVGPRs: 23004 -> 22494 (-2.22%); split: -2.26%, +0.04% VALU: 760978 -> 898136 (+18.02%) SALU: 187786 -> 252995 (+34.73%); split: -0.03%, +34.75% VMEM: 58469 -> 69164 (+18.29%); split: -0.07%, +18.36% SMEM: 87926 -> 158175 (+79.90%); split: -0.00%, +79.90% VOPD: 580 -> 732 (+26.21%); split: +31.38%, -5.17% Reviewed-by: Daniel Schürmann Part-of: --- src/compiler/nir/nir_loop_analyze.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compiler/nir/nir_loop_analyze.c b/src/compiler/nir/nir_loop_analyze.c index 3a0f380dcd1..17d22319b2a 100644 --- a/src/compiler/nir/nir_loop_analyze.c +++ b/src/compiler/nir/nir_loop_analyze.c @@ -108,6 +108,9 @@ instr_cost(loop_info_state *state, nir_instr *instr, if (can_constant_fold) return 0; + } else if (nir_op_is_vec_or_mov(alu->op)) { + /* movs and vecs are likely free. */ + return 0; } if (alu->op == nir_op_flrp) {