[Mesa-dev] [PATCH 2/7] i965/fs: Add some optional debug printfs to scheduling.

Eric Anholt eric at anholt.net
Fri Dec 7 14:58:13 PST 2012


Seeing when instructions become available to schedule is really useful.
---
 .../dri/i965/brw_fs_schedule_instructions.cpp      |   21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_schedule_instructions.cpp b/src/mesa/drivers/dri/i965/brw_fs_schedule_instructions.cpp
index f57b23f..d48ad1e 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_schedule_instructions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_schedule_instructions.cpp
@@ -52,6 +52,8 @@
  * from in picking among those.
  */
 
+static bool debug = false;
+
 class schedule_node : public exec_node
 {
 public:
@@ -514,6 +516,11 @@ instruction_scheduler::schedule_instructions(fs_inst *next_block_header)
        */
       time = MAX2(time + 1, chosen_time);
 
+      if (debug) {
+         printf("clock %4d, scheduled: ", time);
+         v->dump_instruction(chosen->inst);
+      }
+
       /* Now that we've scheduled a new instruction, some of its
        * children can be promoted to the list of instructions ready to
        * be scheduled.  Update the children's unblocked time for this
@@ -527,6 +534,10 @@ instruction_scheduler::schedule_instructions(fs_inst *next_block_header)
 
 	 child->parent_count--;
 	 if (child->parent_count == 0) {
+            if (debug) {
+               printf("now available: ");
+               v->dump_instruction(child->inst);
+            }
 	    instructions.push_tail(child);
 	 }
       }
@@ -561,6 +572,11 @@ fs_visitor::schedule_instructions(bool post_reg_alloc)
    else
       grf_count = virtual_grf_count;
 
+   if (debug) {
+      printf("\nInstructions before scheduling (reg_alloc %d)\n", post_reg_alloc);
+      dump_instructions();
+   }
+
    instruction_scheduler sched(this, mem_ctx, grf_count, post_reg_alloc);
 
    while (!next_block_header->is_tail_sentinel()) {
@@ -584,5 +600,10 @@ fs_visitor::schedule_instructions(bool post_reg_alloc)
       sched.schedule_instructions(next_block_header);
    }
 
+   if (debug) {
+      printf("\nInstructions after scheduling (reg_alloc %d)\n", post_reg_alloc);
+      dump_instructions();
+   }
+
    this->live_intervals_valid = false;
 }
-- 
1.7.10.4



More information about the mesa-dev mailing list