aco: apply clamp to v_fma_mix

fossil-db (Sienna Cichlid):
Totals from 2536 (1.88% of 134913) affected shaders:
CodeSize: 17314568 -> 17282960 (-0.18%)
Instrs: 3191438 -> 3187487 (-0.12%)
Latency: 59465090 -> 59407885 (-0.10%)
InvThroughput: 10271466 -> 10260512 (-0.11%)

fossil-db (Navi):
Totals from 2512 (1.86% of 134913) affected shaders:
CodeSize: 17194700 -> 17173396 (-0.12%)
Instrs: 3215093 -> 3212430 (-0.08%)
Latency: 60174315 -> 60142593 (-0.05%)
InvThroughput: 9491103 -> 9483979 (-0.08%)

fossil-db (Vega):
Totals from 2512 (1.86% of 135048) affected shaders:
CodeSize: 17186776 -> 17165472 (-0.12%)
Instrs: 3311166 -> 3308503 (-0.08%)
Latency: 65737409 -> 65716096 (-0.03%)
InvThroughput: 21735857 -> 21719792 (-0.07%)

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/14769>
This commit is contained in:
Rhys Perry
2022-01-17 17:54:47 +00:00
committed by Marge Bot
parent 35196b6d89
commit 21304b772c
+8 -3
View File
@@ -3017,11 +3017,13 @@ apply_omod_clamp(opt_ctx& ctx, aco_ptr<Instruction>& instr)
return false;
bool can_vop3 = can_use_VOP3(ctx, instr);
if (!instr->isSDWA() && !can_vop3)
bool is_mad_mix =
instr->opcode == aco_opcode::v_fma_mix_f32 || instr->opcode == aco_opcode::v_fma_mixlo_f16;
if (!instr->isSDWA() && !is_mad_mix && !can_vop3)
return false;
/* omod flushes -0 to +0 and has no effect if denormals are enabled */
bool can_use_omod = (can_vop3 || ctx.program->chip_class >= GFX9); /* SDWA omod is GFX9+ */
/* omod flushes -0 to +0 and has no effect if denormals are enabled. SDWA omod is GFX9+. */
bool can_use_omod = (can_vop3 || ctx.program->chip_class >= GFX9) && !instr->isVOP3P();
if (instr->definitions[0].bytes() == 4)
can_use_omod =
can_use_omod && ctx.fp_mode.denorm32 == 0 && !ctx.fp_mode.preserve_signed_zero_inf_nan32;
@@ -3048,6 +3050,9 @@ apply_omod_clamp(opt_ctx& ctx, aco_ptr<Instruction>& instr)
if (instr->isSDWA()) {
if (!apply_omod_clamp_helper(ctx, &instr->sdwa(), def_info))
return false;
} else if (instr->isVOP3P()) {
assert(def_info.is_clamp());
instr->vop3p().clamp = true;
} else {
to_VOP3(ctx, instr);
if (!apply_omod_clamp_helper(ctx, &instr->vop3(), def_info))