mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 06:40:08 +01:00
aco/optimizer: label fcanonicalize like a copy if there is nothing to flush
Allows copy propagation into non alu instructions like phis. Foz-DB Navi21: Totals from 138 (0.17% of 79395) affected shaders: Instrs: 308135 -> 307792 (-0.11%); split: -0.12%, +0.01% CodeSize: 1567924 -> 1566484 (-0.09%); split: -0.10%, +0.01% VGPRs: 9696 -> 9720 (+0.25%) Latency: 1162719 -> 1161663 (-0.09%); split: -0.10%, +0.00% InvThroughput: 256944 -> 256590 (-0.14%); split: -0.15%, +0.01% VClause: 5631 -> 5626 (-0.09%); split: -0.14%, +0.05% Copies: 29962 -> 30028 (+0.22%); split: -0.10%, +0.32% Branches: 8241 -> 8237 (-0.05%) PreVGPRs: 7800 -> 7797 (-0.04%) VALU: 216243 -> 215898 (-0.16%); split: -0.17%, +0.01% SALU: 30768 -> 30767 (-0.00%) Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32355>
This commit is contained in:
parent
8197d744f5
commit
fd669fa69d
1 changed files with 8 additions and 3 deletions
|
|
@ -1882,6 +1882,7 @@ label_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
|
|||
/* TODO: try to move the negate/abs modifier to the consumer instead */
|
||||
bool uses_mods = instr->usesModifiers();
|
||||
bool fp16 = instr->opcode == aco_opcode::v_mul_f16;
|
||||
unsigned denorm_mode = fp16 ? ctx.fp_mode.denorm16_64 : ctx.fp_mode.denorm32;
|
||||
|
||||
for (unsigned i = 0; i < 2; i++) {
|
||||
if (instr->operands[!i].isConstant() && instr->operands[i].isTemp()) {
|
||||
|
|
@ -1910,8 +1911,12 @@ label_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
|
|||
ctx.info[instr->definitions[0].tempId()].set_abs(other);
|
||||
else if (!abs && neg && other.type() == RegType::vgpr)
|
||||
ctx.info[instr->definitions[0].tempId()].set_neg(other);
|
||||
else if (!abs && !neg)
|
||||
ctx.info[instr->definitions[0].tempId()].set_fcanonicalize(other);
|
||||
else if (!abs && !neg) {
|
||||
if (denorm_mode == fp_denorm_keep || ctx.info[other.id()].is_canonicalized())
|
||||
ctx.info[instr->definitions[0].tempId()].set_temp(other);
|
||||
else
|
||||
ctx.info[instr->definitions[0].tempId()].set_fcanonicalize(other);
|
||||
}
|
||||
} else if (uses_mods || (instr->definitions[0].isSZPreserve() &&
|
||||
instr->opcode != aco_opcode::v_mul_legacy_f32)) {
|
||||
continue; /* omod uses a legacy multiplication. */
|
||||
|
|
@ -1920,7 +1925,7 @@ label_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
|
|||
!instr->definitions[0].isInfPreserve()) ||
|
||||
instr->opcode == aco_opcode::v_mul_legacy_f32)) { /* 0.0 */
|
||||
ctx.info[instr->definitions[0].tempId()].set_constant(ctx.program->gfx_level, 0u);
|
||||
} else if ((fp16 ? ctx.fp_mode.denorm16_64 : ctx.fp_mode.denorm32) != fp_denorm_flush) {
|
||||
} else if (denorm_mode != fp_denorm_flush) {
|
||||
/* omod has no effect if denormals are enabled. */
|
||||
continue;
|
||||
} else if (instr->operands[!i].constantValue() ==
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue