Mesa (main): pan/bi: Avoid *FADD.v2f16 hazard in scheduler
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Feb 18 16:34:51 UTC 2022
Module: Mesa
Branch: main
Commit: 24d2bdb1e050134a25924487792ee0018f8478ae
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=24d2bdb1e050134a25924487792ee0018f8478ae
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Thu Feb 17 19:34:04 2022 -0500
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 at collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15072>
---
src/panfrost/bifrost/bi_schedule.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/panfrost/bifrost/bi_schedule.c b/src/panfrost/bifrost/bi_schedule.c
index 88162ecc86e..4c6770e7719 100644
--- a/src/panfrost/bifrost/bi_schedule.c
+++ b/src/panfrost/bifrost/bi_schedule.c
@@ -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;
}
More information about the mesa-commit
mailing list