Mesa (staging/21.3): pan/bi: Avoid *FADD.v2f16 hazard in scheduler
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Feb 20 17:40:41 UTC 2022
Module: Mesa
Branch: staging/21.3
Commit: e7222259a3b722e4d5403e1652403a6111e00b7c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e7222259a3b722e4d5403e1652403a6111e00b7c
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>
(cherry picked from commit 24d2bdb1e050134a25924487792ee0018f8478ae)
---
.pick_status.json | 2 +-
src/panfrost/bifrost/bi_schedule.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/.pick_status.json b/.pick_status.json
index 3a4da06c144..a66aed88978 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -481,7 +481,7 @@
"description": "pan/bi: Avoid *FADD.v2f16 hazard in scheduler",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
diff --git a/src/panfrost/bifrost/bi_schedule.c b/src/panfrost/bifrost/bi_schedule.c
index cc0c128f1ea..421afdffc40 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