From: Alyssa Rosenzweig Date: Fri, 18 Feb 2022 00:40:03 +0000 (-0500) Subject: pan/bi: Test avoiding FADD.v2f16 hazards in scheduler X-Git-Tag: upstream/22.3.5~12551 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8f4b3c749ed482a365671fce51e00fd3d6122a73;p=platform%2Fupstream%2Fmesa.git 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 Part-of: --- diff --git a/src/panfrost/bifrost/test/test-scheduler-predicates.cpp b/src/panfrost/bifrost/test/test-scheduler-predicates.cpp index f43754d..93aaf7f 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)); +}