pan/bi: Extend BLEND to take a register format
authorAlyssa Rosenzweig <alyssa@collabora.com>
Thu, 29 Jul 2021 20:58:13 +0000 (16:58 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 3 Mar 2022 00:41:43 +0000 (00:41 +0000)
Needed on Valhall.

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

src/panfrost/bifrost/ISA.xml
src/panfrost/bifrost/bifrost_compile.c
src/panfrost/bifrost/test/test-scheduler-predicates.cpp

index f5174d0..fb26ab6 100644 (file)
     <!-- not actually encoded, but used for IR -->
     <immediate name="sr_count" size="4" pseudo="true"/>
     <immediate name="sr_count_2" size="4" pseudo="true"/>
+    <mod name="register_format" size="4" pseudo="true">
+      <opt>f16</opt>
+      <opt>f32</opt>
+      <opt>s32</opt>
+      <opt>u32</opt>
+      <opt>s16</opt>
+      <opt>u16</opt>
+      <opt>f64</opt>
+      <opt>i64</opt>
+      <opt>auto</opt>
+    </mod>
   </ins>
 
   <ins name="+BRANCH.f16" mask="0xf8000" exact="0x68000" last="true" dests="0">
index e3a6f76..26fa88f 100644 (file)
@@ -517,6 +517,7 @@ bi_emit_blend_op(bi_builder *b, bi_index rgba, nir_alu_type T,
         unsigned sr_count_2 = (size_2 <= 16) ? 2 : 4;
         const struct panfrost_compile_inputs *inputs = b->shader->inputs;
         uint64_t blend_desc = inputs->blend.bifrost_blend_desc;
+        enum bi_register_format regfmt = bi_reg_fmt_for_nir(T);
 
         if (inputs->is_blend && inputs->blend.nr_samples > 1) {
                 /* Conversion descriptor comes from the compile inputs, pixel
@@ -530,7 +531,7 @@ bi_emit_blend_op(bi_builder *b, bi_index rgba, nir_alu_type T,
                                 bi_register(60),
                                 bi_imm_u32(blend_desc & 0xffffffff),
                                 bi_imm_u32(blend_desc >> 32),
-                                bi_null(), sr_count, 0);
+                                bi_null(), regfmt, sr_count, 0);
         } else {
                 /* Blend descriptor comes from the FAU RAM. By convention, the
                  * return address is stored in r48 and will be used by the
@@ -539,7 +540,7 @@ bi_emit_blend_op(bi_builder *b, bi_index rgba, nir_alu_type T,
                                 bi_register(60),
                                 bi_fau(BIR_FAU_BLEND_0 + rt, false),
                                 bi_fau(BIR_FAU_BLEND_0 + rt, true),
-                                rgba2, sr_count, sr_count_2);
+                                rgba2, regfmt, sr_count, sr_count_2);
         }
 
         assert(rt < 8);
index 93aaf7f..3a15e50 100644 (file)
@@ -81,7 +81,8 @@ TEST_F(SchedulerPredicates, LOAD)
 
 TEST_F(SchedulerPredicates, BLEND)
 {
-   bi_instr *blend = bi_blend_to(b, TMP(), TMP(), TMP(), TMP(), TMP(), TMP(), 4, 4);
+   bi_instr *blend = bi_blend_to(b, TMP(), TMP(), TMP(), TMP(), TMP(), TMP(),
+                                 BI_REGISTER_FORMAT_F32, 4, 4);
    ASSERT_FALSE(bi_can_fma(blend));
    ASSERT_TRUE(bi_can_add(blend));
    ASSERT_TRUE(bi_must_message(blend));