Mesa (staging/20.0): intel/fs/cse: Make HALT instruction act as CSE barrier.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 19 17:20:02 UTC 2020


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

Author: Francisco Jerez <currojerez at riseup.net>
Date:   Thu Jan 23 22:01:00 2020 -0800

intel/fs/cse: Make HALT instruction act as CSE barrier.

Found by inspection.  This seems particularly likely to cause problems
with instructions dependent on the current execution mask like
SHADER_OPCODE_FIND_LIVE_CHANNEL or the FS_OPCODE_LOAD_LIVE_CHANNELS
instruction I'm about to introduce, but one could imagine it leading
to data corruption if CSE ever managed to combine two instructions
before and after the FS_OPCODE_PLACEHOLDER_HALT, since the one before
may not be executed for some channels.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Cc: 20.0 <mesa-stable at lists.freedesktop.org>
(cherry picked from commit c9e33e5cbf6b8b953932f283e1f0abcb6c77eb1f)

---

 .pick_status.json                 |  2 +-
 src/intel/compiler/brw_fs_cse.cpp | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index bc127e931bb..fe1d94a1559 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1039,7 +1039,7 @@
         "description": "intel/fs/cse: Make HALT instruction act as CSE barrier.",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/intel/compiler/brw_fs_cse.cpp b/src/intel/compiler/brw_fs_cse.cpp
index b7c32f3907f..4751e11bcfe 100644
--- a/src/intel/compiler/brw_fs_cse.cpp
+++ b/src/intel/compiler/brw_fs_cse.cpp
@@ -317,6 +317,16 @@ fs_visitor::opt_cse_local(bblock_t *block, int &ip)
          }
       }
 
+      /* Discard jumps aren't represented in the CFG unfortunately, so we need
+       * to make sure that they behave as a CSE barrier, since we lack global
+       * dataflow information.  This is particularly likely to cause problems
+       * with instructions dependent on the current execution mask like
+       * SHADER_OPCODE_FIND_LIVE_CHANNEL.
+       */
+      if (inst->opcode == FS_OPCODE_DISCARD_JUMP ||
+          inst->opcode == FS_OPCODE_PLACEHOLDER_HALT)
+         aeb.make_empty();
+
       foreach_in_list_safe(aeb_entry, entry, &aeb) {
          /* Kill all AEB entries that write a different value to or read from
           * the flag register if we just wrote it.



More information about the mesa-commit mailing list