pan/bi: Allow IADD.u32 on FMA as *IADDC

There's a common special case, slight boost in scheduler freedom.

total nops in shared programs: 101130 -> 101048 (-0.08%)
nops in affected programs: 1677 -> 1595 (-4.89%)
helped: 13
HURT: 0
helped stats (abs) min: 6 max: 8 x̄: 6.31 x̃: 6
helped stats (rel) min: 3.24% max: 25.00% x̄: 7.42% x̃: 4.48%
95% mean confidence interval for nops value: -6.76 -5.85
95% mean confidence interval for nops %-change: -12.02% -2.81%
Nops are helped.

total clauses in shared programs: 27076 -> 27075 (<.01%)
clauses in affected programs: 8 -> 7 (-12.50%)
helped: 1
HURT: 0

total quadwords in shared programs: 113142 -> 113113 (-0.03%)
quadwords in affected programs: 1935 -> 1906 (-1.50%)
helped: 13
HURT: 0
helped stats (abs) min: 2 max: 4 x̄: 2.23 x̃: 2
helped stats (rel) min: 0.95% max: 7.50% x̄: 2.16% x̃: 1.26%
95% mean confidence interval for quadwords value: -2.59 -1.87
95% mean confidence interval for quadwords %-change: -3.45% -0.88%
Quadwords are helped.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>
This commit is contained in:
Alyssa Rosenzweig
2021-05-06 13:10:00 -04:00
committed by Marge Bot
parent 7aefd6c1ba
commit 9d7e25a9a9
+20
View File
@@ -329,6 +329,15 @@ bi_back_to_back(bi_block *block)
/* Scheduler predicates */
/* IADDC.i32 can implement IADD.u32 if no saturation or swizzling is in use */
static bool
bi_can_iaddc(bi_instr *ins)
{
return (ins->op == BI_OPCODE_IADD_U32 && !ins->saturate &&
ins->src[0].swizzle == BI_SWIZZLE_H01 &&
ins->src[1].swizzle == BI_SWIZZLE_H01);
}
ASSERTED static bool
bi_can_fma(bi_instr *ins)
{
@@ -338,6 +347,10 @@ bi_can_fma(bi_instr *ins)
!bi_is_word_equiv(ins->src[0], ins->src[1]))
return false;
/* +IADD.i32 -> *IADDC.i32 */
if (bi_can_iaddc(ins))
return true;
/* TODO: some additional fp16 constraints */
return bi_opcode_props[ins->op].fma;
}
@@ -903,6 +916,13 @@ bi_take_instr(bi_context *ctx, struct bi_worklist st,
bi_update_worklist(st, idx);
bi_pop_instr(clause, tuple, instr, live_after_temp, fma);
/* Fixups */
if (instr->op == BI_OPCODE_IADD_U32 && fma) {
assert(bi_can_iaddc(instr));
instr->op = BI_OPCODE_IADDC_I32;
instr->src[2] = bi_zero();
}
return instr;
}