Mesa (master): intel/fs: Extend copy propagation dataflow analysis to copies with FIXED_GRF source.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 17 22:11:42 UTC 2020


Module: Mesa
Branch: master
Commit: 5153d06d92ebec3a536aaa9b4c225c107dfc5931
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5153d06d92ebec3a536aaa9b4c225c107dfc5931

Author: Francisco Jerez <currojerez at riseup.net>
Date:   Thu Jan  2 18:54:13 2020 -0800

intel/fs: Extend copy propagation dataflow analysis to copies with FIXED_GRF source.

This involves indexing the ACP tables used internally by
fs_copy_prop_dataflow::setup_initial_values() by reg_space() instead
of register number.  Both are nearly equivalent for virtual GRFs
(barring the single bit of entropy lost in the hash), and this makes
handling FIXED_GRFs straightforward.

Because we're only going to support FIXED_GRFs for the source of a
copy, this change is only strictly necessary during the second pass
that checks for source interference, but we also apply the same change
to the first pass for consistency.

Note that this shouldn't change the behavior of the copy propagation
pass until we start inserting FIXED_GRF entries into the ACP.  Even
then FIXED_GRF writes are extremely rare so this change will hardly
ever have an effect, but they aren't completely non-existing so we
need to handle them for correctness.

No functional nor shader-db changes.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/intel/compiler/brw_fs_copy_propagation.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/intel/compiler/brw_fs_copy_propagation.cpp b/src/intel/compiler/brw_fs_copy_propagation.cpp
index 73ac1b66340..e6eb174e0f2 100644
--- a/src/intel/compiler/brw_fs_copy_propagation.cpp
+++ b/src/intel/compiler/brw_fs_copy_propagation.cpp
@@ -194,7 +194,7 @@ fs_copy_prop_dataflow::setup_initial_values()
        * destinations.
        */
       for (int i = 0; i < num_acp; i++) {
-         unsigned idx = acp[i]->dst.nr & (acp_table_size - 1);
+         unsigned idx = reg_space(acp[i]->dst) & (acp_table_size - 1);
          acp_table[idx].push_tail(acp[i]);
       }
 
@@ -203,7 +203,7 @@ fs_copy_prop_dataflow::setup_initial_values()
             if (inst->dst.file != VGRF)
                continue;
 
-            unsigned idx = inst->dst.nr & (acp_table_size - 1);
+            unsigned idx = reg_space(inst->dst) & (acp_table_size - 1);
             foreach_in_list(acp_entry, entry, &acp_table[idx]) {
                if (regions_overlap(inst->dst, inst->size_written,
                                    entry->dst, entry->size_written))
@@ -220,16 +220,17 @@ fs_copy_prop_dataflow::setup_initial_values()
        * sources.
        */
       for (int i = 0; i < num_acp; i++) {
-         unsigned idx = acp[i]->src.nr & (acp_table_size - 1);
+         unsigned idx = reg_space(acp[i]->src) & (acp_table_size - 1);
          acp_table[idx].push_tail(acp[i]);
       }
 
       foreach_block (block, cfg) {
          foreach_inst_in_block(fs_inst, inst, block) {
-            if (inst->dst.file != VGRF)
+            if (inst->dst.file != VGRF &&
+                inst->dst.file != FIXED_GRF)
                continue;
 
-            unsigned idx = inst->dst.nr & (acp_table_size - 1);
+            unsigned idx = reg_space(inst->dst) & (acp_table_size - 1);
             foreach_in_list(acp_entry, entry, &acp_table[idx]) {
                if (regions_overlap(inst->dst, inst->size_written,
                                    entry->src, entry->size_read))



More information about the mesa-commit mailing list