intel/fs: Preserve meta data more often in brw_nir_move_interpolation_to_top
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 21 Mar 2023 03:57:47 +0000 (20:57 -0700)
committerMarge Bot <emma+marge@anholt.net>
Thu, 6 Apr 2023 19:07:50 +0000 (19:07 +0000)
This pass rarely makes any changes, so work a little harder to preserve
more meta data.

On my Ice Lake laptop (using a locked CPU speed and other measures to
prevent thermal throttling, etc.) using a debugoptimized build, improves
performance of Vulkan CTS "deqp-vk --deqp-case='dEQP-VK.*spir*'" by
-0.2% ± 0.1% (n = 5, pooled s = 0.431885).

v2: Add some parenthesis. Suggested by Lionel.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22299>

src/intel/compiler/brw_fs.cpp

index bf32b32..ba4354d 100644 (file)
@@ -7262,6 +7262,7 @@ brw_nir_move_interpolation_to_top(nir_shader *nir)
 
       nir_block *top = nir_start_block(f->impl);
       nir_cursor cursor = nir_before_instr(nir_block_first_instr(top));
+      bool impl_progress = false;
 
       for (nir_block *block = nir_block_cf_tree_next(top);
            block != NULL;
@@ -7292,13 +7293,17 @@ brw_nir_move_interpolation_to_top(nir_shader *nir)
             for (unsigned i = 0; i < ARRAY_SIZE(move); i++) {
                if (move[i]->block != top) {
                   nir_instr_move(cursor, move[i]);
-                  progress = true;
+                  impl_progress = true;
                }
             }
          }
       }
-      nir_metadata_preserve(f->impl, nir_metadata_block_index |
-                                     nir_metadata_dominance);
+
+      progress = progress || impl_progress;
+
+      nir_metadata_preserve(f->impl, impl_progress ? (nir_metadata_block_index |
+                                                      nir_metadata_dominance)
+                                                   : nir_metadata_all);
    }
 
    return progress;