pan/bi: Avoid *FADD.v2f16 hazard in scheduler

Obscure encoding restriction. Fixes crash (assertion fail when instruction
packing) in asphalt9/2659.shader_test on Bifrost.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15072>
This commit is contained in:
Alyssa Rosenzweig 2022-02-17 19:34:04 -05:00 committed by Marge Bot
parent 8e0eb592d5
commit 24d2bdb1e0

View file

@ -490,6 +490,18 @@ bi_can_iaddc(bi_instr *ins)
ins->src[1].swizzle == BI_SWIZZLE_H01);
}
/*
* The encoding of *FADD.v2f16 only specifies a single abs flag. All abs
* encodings are permitted by swapping operands; however, this scheme fails if
* both operands are equal. Test for this case.
*/
static bool
bi_impacted_abs(bi_instr *I)
{
return I->src[0].abs && I->src[1].abs &&
bi_is_word_equiv(I->src[0], I->src[1]);
}
bool
bi_can_fma(bi_instr *ins)
{
@ -497,6 +509,10 @@ bi_can_fma(bi_instr *ins)
if (bi_can_iaddc(ins))
return true;
/* *FADD.v2f16 has restricted abs modifiers, use +FADD.v2f16 instead */
if (ins->op == BI_OPCODE_FADD_V2F16 && bi_impacted_abs(ins))
return false;
/* TODO: some additional fp16 constraints */
return bi_opcode_props[ins->op].fma;
}