aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2014-09-16 13:14:09 -0700
committerJason Ekstrand <[email protected]>2014-09-30 10:29:13 -0700
commit2af4b0aeaff53190b0e17a971119d1b77ddad25b (patch)
tree2e485d221462dbcf949a9dab5df91c296a6ad882 /src/mesa/drivers/dri/i965
parenta25db10c1248d70cf7f4097833fa03fdccd98fe8 (diff)
i965/fs: Make compact_virtual_grfs an optimization pass
Previously we disabled compact_virtual_grfs when dumping optimizations. The idea here was to make it easier to diff the dumped shader because you didn't have a sudden renaming. However, sometimes a bug is affected by compact_virtual_grfs and, when this happens, you want to keep dumping instructions with compact_virtual_grfs enabled. By turning it into an optimization pass and dumping it along with the others, we retain the ability to diff because you can just diff against the compact_virtual_grf output. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp19
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.h2
2 files changed, 13 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index bd862abb896..eebc31c9564 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1770,12 +1770,10 @@ fs_visitor::split_virtual_grfs()
* to loop over all the virtual GRFs. Compacting them can save a lot of
* overhead.
*/
-void
+bool
fs_visitor::compact_virtual_grfs()
{
- if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER))
- return;
-
+ bool progress = false;
int remap_table[this->virtual_grf_count];
memset(remap_table, -1, sizeof(remap_table));
@@ -1793,7 +1791,12 @@ fs_visitor::compact_virtual_grfs()
/* Compact the GRF arrays. */
int new_index = 0;
for (int i = 0; i < this->virtual_grf_count; i++) {
- if (remap_table[i] != -1) {
+ if (remap_table[i] == -1) {
+ /* We just found an unused register. This means that we are
+ * actually going to compact something.
+ */
+ progress = true;
+ } else {
remap_table[i] = new_index;
virtual_grf_sizes[new_index] = virtual_grf_sizes[i];
invalidate_live_intervals();
@@ -1836,6 +1839,8 @@ fs_visitor::compact_virtual_grfs()
}
}
}
+
+ return progress;
}
/*
@@ -3276,8 +3281,6 @@ fs_visitor::run()
iteration++;
int pass_num = 0;
- compact_virtual_grfs();
-
OPT(remove_duplicate_mrf_writes);
OPT(opt_algebraic);
@@ -3291,6 +3294,8 @@ fs_visitor::run()
OPT(opt_saturate_propagation);
OPT(register_coalesce);
OPT(compute_to_mrf);
+
+ OPT(compact_virtual_grfs);
} while (progress);
if (lower_load_payload()) {
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index f0da0a014d7..ba40801d488 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -325,7 +325,7 @@ public:
int choose_spill_reg(struct ra_graph *g);
void spill_reg(int spill_reg);
void split_virtual_grfs();
- void compact_virtual_grfs();
+ bool compact_virtual_grfs();
void move_uniform_array_access_to_pull_constants();
void assign_constant_locations();
void demote_pull_constants();