[Mesa-dev] [PATCH] i965/fs: Prefer picking texture ops when instruction scheduling.

Matt Turner mattst88 at gmail.com
Thu May 2 14:30:18 PDT 2013


Texture operations have very long (hundreds of cycles) latencies. If a
texture operation is ready to be scheduled, prefer it over other types
of instructions.

Typically this will mean the other instructions execute to completion
during the time it takes the texturing operation to return results, so
they're effectively free. It also helps to pipeline multiple texture
operations and overlap their latencies.
---
Mostly untested, and probably not useful until Eric's texture-grf branch
is completed.

 src/mesa/drivers/dri/i965/brw_fs_schedule_instructions.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

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 7567123..d81a386 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_schedule_instructions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_schedule_instructions.cpp
@@ -726,15 +726,21 @@ instruction_scheduler::schedule_instructions(fs_inst *next_block_header)
       int chosen_time = 0;
 
       if (post_reg_alloc) {
+         bool chosen_is_texture_op = false;
+
          /* Of the instructions closest ready to execute or the closest to
-          * being ready, choose the oldest one.
+          * being ready, choose the oldest one. Pick a texturing operation
+          * if it's available, since its latency is very high.
           */
          foreach_list(node, &instructions) {
             schedule_node *n = (schedule_node *)node;
 
-            if (!chosen || n->unblocked_time < chosen_time) {
+            if (!chosen ||
+                (n->unblocked_time < chosen_time &&
+                 (chosen_is_texture_op == n->inst->is_tex()))) {
                chosen = n;
                chosen_time = n->unblocked_time;
+               chosen_is_texture_op = n->inst->is_tex();
             }
          }
       } else {
-- 
1.8.1.5



More information about the mesa-dev mailing list