aco/ra: don't swap create_vector operand with definition blocker for SGPRs
authorRhys Perry <pendingchaos02@gmail.com>
Thu, 8 Dec 2022 19:33:58 +0000 (19:33 +0000)
committerMarge Bot <emma+marge@anholt.net>
Fri, 9 Dec 2022 15:58:43 +0000 (15:58 +0000)
There is no SGPR swap instruction, we always need 3 XORs.

fossil-db (navi21):
Totals from 76 (0.06% of 135636) affected shaders:
Instrs: 58400 -> 58347 (-0.09%); split: -0.10%, +0.01%
CodeSize: 312580 -> 312368 (-0.07%); split: -0.08%, +0.01%
Latency: 843333 -> 843180 (-0.02%); split: -0.02%, +0.00%
InvThroughput: 126431 -> 126412 (-0.02%)
Copies: 4008 -> 3955 (-1.32%); split: -1.47%, +0.15%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20240>

src/amd/compiler/aco_register_allocation.cpp

index 55df26c..f5091ce 100644 (file)
@@ -1075,7 +1075,8 @@ get_reg_for_create_vector_copy(ra_ctx& ctx, RegisterFile& reg_file,
       reg.reg_b += instr->operands[i].bytes();
    }
 
-   if (ctx.program->gfx_level <= GFX8)
+   /* GFX9+ has a VGPR swap instruction. */
+   if (ctx.program->gfx_level <= GFX8 || info.rc.type() == RegType::sgpr)
       return {};
 
    /* check if the previous position was in vector */