Mesa (master): i965/fs: Fix broken register spilling debug code.

Eric Anholt anholt at kemper.freedesktop.org
Thu Oct 31 01:09:52 UTC 2013


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

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Oct 16 12:02:41 2013 -0700

i965/fs: Fix broken register spilling debug code.

Now that reg spilling generates new vgrfs, we were looping forever if you
ever turned it on.

Instead, move the debug code into the register allocator right near where
we'd be doing spilling anyway, which should more accurately reflect how
register spilling occurs in the wild.

Reviewed-by: Paul Berry <stereotype441 at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_fs.cpp              |    7 -------
 src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp |   11 +++++++++++
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index a60941a..db48da2 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3098,13 +3098,6 @@ fs_visitor::run()
       assign_curb_setup();
       assign_urb_setup();
 
-      if (0) {
-	 /* Debug of register spilling: Go spill everything. */
-	 for (int i = 0; i < virtual_grf_count; i++) {
-	    spill_reg(i);
-	 }
-      }
-
       if (0)
 	 assign_regs_trivial();
       else {
diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
index 0b00b91..d86027e 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
@@ -476,6 +476,17 @@ fs_visitor::assign_regs()
    if (brw->gen >= 7)
       setup_mrf_hack_interference(g, first_mrf_hack_node);
 
+   /* Debug of register spilling: Go spill everything. */
+   if (0) {
+      int reg = choose_spill_reg(g);
+
+      if (reg != -1) {
+         spill_reg(reg);
+         ralloc_free(g);
+         return false;
+      }
+   }
+
    if (!ra_allocate_no_spills(g)) {
       /* Failed to allocate registers.  Spill a reg, and the caller will
        * loop back into here to try again.




More information about the mesa-commit mailing list