i965/fs: Take the shared mathbox into account in instruction scheduling.
authorEric Anholt <eric@anholt.net>
Wed, 19 Jan 2011 05:26:53 +0000 (21:26 -0800)
committerEric Anholt <eric@anholt.net>
Thu, 20 Jan 2011 00:30:00 +0000 (16:30 -0800)
I don't have evidence for this amounting to any improvement,
but it does codify a bit more what we understand so far about
the pipeline.

src/mesa/drivers/dri/i965/brw_fs_schedule_instructions.cpp

index 00aa99d..c8f0b27 100644 (file)
@@ -438,6 +438,21 @@ instruction_scheduler::schedule_instructions(fs_inst *next_block_header)
            instructions.push_tail(child);
         }
       }
+
+      /* Shared resource: the mathbox.  There's one per EU (on later
+       * generations, it's even more limited pre-gen6), so if we send
+       * something off to it then the next math isn't going to make
+       * progress until the first is done.
+       */
+      if (chosen->inst->is_math()) {
+        foreach_iter(exec_list_iterator, iter, instructions) {
+           schedule_node *n = (schedule_node *)iter.get();
+
+           if (n->inst->is_math())
+              n->unblocked_time = MAX2(n->unblocked_time,
+                                       time + chosen->latency);
+        }
+      }
    }
 
    assert(instructions_to_schedule == 0);