From 8cc96d64b0badda3898f00c3691da300dd3a096f Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 1 Aug 2023 07:26:51 -0400 Subject: [PATCH] agx: Fix accounting for phis All affected shaders are in pubg. Presumably, with the new demand calculation, RA is hitting a higher target thread count at the expense of a little more live range splitting. total instructions in shared programs: 1773295 -> 1773310 (<.01%) instructions in affected programs: 6058 -> 6073 (0.25%) helped: 0 HURT: 15 Instructions are HURT. total bytes in shared programs: 11695360 -> 11695450 (<.01%) bytes in affected programs: 40496 -> 40586 (0.22%) helped: 0 HURT: 15 Bytes are HURT. total halfregs in shared programs: 530844 -> 530724 (-0.02%) halfregs in affected programs: 1785 -> 1665 (-6.72%) helped: 15 HURT: 0 Halfregs are helped. total threads in shared programs: 18909440 -> 18910400 (<.01%) threads in affected programs: 12480 -> 13440 (7.69%) helped: 15 HURT: 0 Threads are helped. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_register_allocate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/asahi/compiler/agx_register_allocate.c b/src/asahi/compiler/agx_register_allocate.c index 2a09876..06309b9 100644 --- a/src/asahi/compiler/agx_register_allocate.c +++ b/src/asahi/compiler/agx_register_allocate.c @@ -158,6 +158,12 @@ agx_calc_register_demand(agx_context *ctx, uint8_t *widths) unsigned late_kill_count = 0; agx_foreach_instr_in_block(block, I) { + /* Phis happen in parallel and are already accounted for in the live-in + * set, just skip them so we don't double count. + */ + if (I->op == AGX_OPCODE_PHI) + continue; + /* Handle late-kill registers from last instruction */ demand -= late_kill_count; late_kill_count = 0; -- 2.7.4