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

Author: Gert Wollny <[email protected]>
Date:   Fri Feb 24 10:14:01 2023 +0100

r600/sfn: be more conservative with channel use in multi-slot ops

The current approach to check the bank swizzle doesn't allow to
re-evaluate bank-swizzle for instructions that where emitted
earlier, so we might end up with impossile constellations when we
allow three uses of the same channel

Fixes: edabd5cd8425
  r600/sfn: check used channels when evaluating allowed mask

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8350

Signed-off-by: Gert Wollny <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21516>

---

 src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp 
b/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp
index 122ef85fff0..7779ff9cb39 100644
--- a/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp
@@ -507,8 +507,20 @@ uint8_t AluInstr::allowed_src_chan_mask() const
     * is not important to know which is the old channel that will
     * be freed by the channel switch.*/
    int mask = 0;
+
+   /* Be conservative about channel use when using more than two
+    * slots. Currently a constellatioon of
+    *
+    *  ALU d.x = f(r0.x, r1.y)
+    *  ALU _.y = f(r2.y, r3.x)
+    *  ALU _.z = f(r4.x, r5.y)
+    *
+    * will fail to be split. To get constellations like this to be scheduled
+    * properly will need some work on the bank swizzle check.
+    */
+   int maxuse = m_alu_slots > 2 ? 2 : 3;
    for (int i = 0; i < 4; ++i) {
-       if (chan_use_count[i] < 3)
+       if (chan_use_count[i] < maxuse)
            mask |= 1 << i;
    }
    return mask;

Reply via email to