Module: Mesa
Branch: staging/23.1
Commit: c87de178f2fd6e7df010195c17b7ffdb33d70d99
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c87de178f2fd6e7df010195c17b7ffdb33d70d99

Author: Gert Wollny <[email protected]>
Date:   Sun Aug  6 20:42:07 2023 +0200

r600/sfn: Take source uses into account when switching channels

When we switch the channels by re-creating vec4 values we have to
take into account that the source values may be used in an ALU op,
and with that we have to take read-port limitations into account.

Fixes: 18a8d148d862d4a0f5b83f4385f00cf8a4a71b6d
    r600/sfn: Cleanup copy-prop into vec4 source values

Signed-off-by: Gert Wollny <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24519>
(cherry picked from commit 807c0d6bb75ecf150f39480f2f492b4dd195d14d)

---

 .pick_status.json                              | 2 +-
 src/gallium/drivers/r600/sfn/sfn_optimizer.cpp | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index c2a1cf9d279..80fab8344fb 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -130,7 +130,7 @@
         "description": "r600/sfn: Take source uses into account when switching 
channels",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "18a8d148d862d4a0f5b83f4385f00cf8a4a71b6d"
     },
diff --git a/src/gallium/drivers/r600/sfn/sfn_optimizer.cpp 
b/src/gallium/drivers/r600/sfn/sfn_optimizer.cpp
index 767025b747b..06d2ebd64c3 100644
--- a/src/gallium/drivers/r600/sfn/sfn_optimizer.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_optimizer.cpp
@@ -544,6 +544,12 @@ CopyPropFwdVisitor::propagate_to(RegisterVec4& value, 
Instr *instr)
             allowed_mask &= alu->allowed_dest_chan_mask();
       }
 
+      for (auto u : src->uses()) {
+         auto alu = u->as_alu();
+         if (alu)
+            allowed_mask &= alu->allowed_src_chan_mask();
+      }
+
       if (!allowed_mask)
          return;
 

Reply via email to