agx: handle imm inlining into phis

allows better coalescing

total instructions in shared programs: 1881875 -> 1881745 (<.01%)
instructions in affected programs: 169787 -> 169657 (-0.08%)
helped: 288
HURT: 234
Instructions are helped.

total bytes in shared programs: 12332916 -> 12323788 (-0.07%)
bytes in affected programs: 1958846 -> 1949718 (-0.47%)
helped: 778
HURT: 108
Bytes are helped.

total halfregs in shared programs: 498490 -> 498126 (-0.07%)
halfregs in affected programs: 6960 -> 6596 (-5.23%)
helped: 102
HURT: 28
Halfregs are helped.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26963>
This commit is contained in:
Alyssa Rosenzweig
2023-12-24 13:53:24 -04:00
parent efeed6a6fc
commit 33229d4ace

View File

@@ -129,13 +129,10 @@ image_write_source_can_be_immediate(agx_instr *I, unsigned s)
}
static void
agx_optimizer_inline_imm(agx_instr **defs, agx_instr *I, unsigned srcs,
bool is_float)
agx_optimizer_inline_imm(agx_instr **defs, agx_instr *I, bool is_float)
{
for (unsigned s = 0; s < srcs; ++s) {
agx_foreach_ssa_src(I, s) {
agx_index src = I->src[s];
if (src.type != AGX_INDEX_NORMAL)
continue;
if (src.neg)
continue;
@@ -350,7 +347,7 @@ agx_optimizer_forward(agx_context *ctx)
I->op != AGX_OPCODE_IMAGE_LOAD && I->op != AGX_OPCODE_TEXTURE_LOAD &&
I->op != AGX_OPCODE_UNIFORM_STORE &&
I->op != AGX_OPCODE_BLOCK_IMAGE_STORE)
agx_optimizer_inline_imm(defs, I, info.nr_srcs, info.is_float);
agx_optimizer_inline_imm(defs, I, info.is_float);
if (I->op == AGX_OPCODE_IF_ICMP)
agx_optimizer_if_cmp(defs, I);