From 68014b0d9b667cd18e4d5738d36030e8f185b4b2 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Thu, 19 Sep 2024 13:27:04 +0200 Subject: [PATCH] broadcom/compiler: skip small immediates optimization on vpm instructions total instructions in shared programs: 11164938 -> 10890641 (-2.46%) instructions in affected programs: 6557250 -> 6282953 (-4.18%) helped: 59134 HURT: 9752 Instructions are helped. total threads in shared programs: 431068 -> 431034 (<.01%) threads in affected programs: 68 -> 34 (-50.00%) helped: 0 Threads are HURT. total uniforms in shared programs: 3880437 -> 5308006 (36.79%) uniforms in affected programs: 2669367 -> 4096936 (53.48%) helped: 2 HURT: 74046 Uniforms are HURT. total max-temps in shared programs: 2244298 -> 2226555 (-0.79%) max-temps in affected programs: 463611 -> 445868 (-3.83%) helped: 17473 HURT: 8040 Max-temps are helped. total spills in shared programs: 4312 -> 4318 (0.14%) spills in affected programs: 0 -> 6 helped: 0 HURT: 2 total fills in shared programs: 6508 -> 6514 (0.09%) fills in affected programs: 0 -> 6 helped: 0 HURT: 2 total sfu-stalls in shared programs: 14794 -> 15143 (2.36%) sfu-stalls in affected programs: 1261 -> 1610 (27.68%) helped: 238 HURT: 586 Inconclusive result (value mean confidence interval and %-change mean confidence interval disagree). total inst-and-stalls in shared programs: 11179732 -> 10905784 (-2.45%) inst-and-stalls in affected programs: 6570407 -> 6296459 (-4.17%) helped: 59126 HURT: 9786 Inst-and-stalls are helped. total nops in shared programs: 273422 -> 183945 (-32.72%) nops in affected programs: 139446 -> 49969 (-64.17%) helped: 60679 HURT: 2277 Nops are helped. Reviewed-by: Jose Maria Casanova Crespo Part-of: --- .../compiler/vir_opt_small_immediates.c | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/broadcom/compiler/vir_opt_small_immediates.c b/src/broadcom/compiler/vir_opt_small_immediates.c index 56f0bf20706..49773a8f85e 100644 --- a/src/broadcom/compiler/vir_opt_small_immediates.c +++ b/src/broadcom/compiler/vir_opt_small_immediates.c @@ -32,13 +32,36 @@ static bool debug; +static bool +skip_inst(struct qinst *inst) +{ + if (inst->qpu.type != V3D_QPU_INSTR_TYPE_ALU) + return true; + + if (!vir_is_add(inst)) + return false; + + switch (inst->qpu.alu.add.op) { + case V3D_QPU_A_LDVPMV_IN: + case V3D_QPU_A_LDVPMG_IN: + case V3D_QPU_A_LDVPMD_IN: + case V3D_QPU_A_LDVPMP: + case V3D_QPU_A_STVPMV: + case V3D_QPU_A_STVPMD: + case V3D_QPU_A_STVPMP: + return true; + default: + return false; + } +} + bool vir_opt_small_immediates(struct v3d_compile *c) { bool progress = false; vir_for_each_inst_inorder(inst, c) { - if (inst->qpu.type != V3D_QPU_INSTR_TYPE_ALU) + if (skip_inst(inst)) continue; /* The small immediate value sits in the raddr B field, so we