Mesa (main): pan/bi: Test avoiding FADD.v2f16 hazards in scheduler

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 18 16:34:51 UTC 2022


Module: Mesa
Branch: main
Commit: 8f4b3c749ed482a365671fce51e00fd3d6122a73
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f4b3c749ed482a365671fce51e00fd3d6122a73

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Thu Feb 17 19:40:03 2022 -0500

pan/bi: Test avoiding FADD.v2f16 hazards in scheduler

There are many of them, and integration testing of the scheduler won't hit every
case. Add targeted unit tests for the various scheduling hazards of this funny
instruction.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15072>

---

 .../bifrost/test/test-scheduler-predicates.cpp     | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/src/panfrost/bifrost/test/test-scheduler-predicates.cpp b/src/panfrost/bifrost/test/test-scheduler-predicates.cpp
index f43754d29ca..93aaf7fe196 100644
--- a/src/panfrost/bifrost/test/test-scheduler-predicates.cpp
+++ b/src/panfrost/bifrost/test/test-scheduler-predicates.cpp
@@ -107,3 +107,45 @@ TEST_F(SchedulerPredicates, RestrictionsOnModifiersOfSameCycleTemporaries)
       }
    }
 }
+
+TEST_F(SchedulerPredicates, RestrictionsOnFAddV2F16)
+{
+   bi_index x = bi_register(0);
+   bi_index y = bi_register(1);
+
+   /* Basic */
+   bi_instr *fadd = bi_fadd_v2f16_to(b, TMP(), x, x, BI_ROUND_NONE);
+
+   ASSERT_TRUE(bi_can_fma(fadd));
+   ASSERT_TRUE(bi_can_add(fadd));
+
+   /* With imbalanced abs */
+   fadd->src[0].abs = true;
+
+   ASSERT_TRUE(bi_can_fma(fadd));
+   ASSERT_TRUE(bi_can_add(fadd));
+
+   /* With equal abs */
+   fadd->src[1].abs = true;
+
+   ASSERT_FALSE(bi_can_fma(fadd));
+   ASSERT_TRUE(bi_can_add(fadd));
+
+   /* With equal abs but different sources */
+   fadd->src[1] = bi_abs(y);
+
+   ASSERT_TRUE(bi_can_fma(fadd));
+   ASSERT_TRUE(bi_can_add(fadd));
+
+   /* With clamp */
+   fadd->clamp = BI_CLAMP_CLAMP_M1_1;
+
+   ASSERT_TRUE(bi_can_fma(fadd));
+   ASSERT_FALSE(bi_can_add(fadd));
+
+   /* Impossible encoding (should never be seen) */
+   fadd->src[1] = fadd->src[0];
+
+   ASSERT_FALSE(bi_can_fma(fadd));
+   ASSERT_FALSE(bi_can_add(fadd));
+}



More information about the mesa-commit mailing list