[Mesa-dev] [PATCH 1/3] i965: Don't consider MRFs read that are first implicitly written.

Kenneth Graunke kenneth at whitecape.org
Tue Feb 12 18:10:01 PST 2013


Normally, SEND messages read existing MRF values, which were previously
written by some other instruction.  However, some meta-instructions
(like FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD) implicitly write MRFs before
reading them.  In that case, the existing MRF values aren't actually
read.

Furthermore, from the point of view of the scheduler, such instructions
are a single atomic operation, since it isn't split into message setup
and SEND until code generation (fs_generator) time.

By ignoring any MRFs clobbered by implicit writes, we remove false
read-after-write and write-after-read dependencies.

NOTE: This is a candidate for the 9.1 branch.

Cc: Eric Anholt <eric at anholt.net>
Cc: Ian Romanick <idr at freedesktop.org>
Cc: Matt Turner <mattst88 at gmail.com>
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_fs_schedule_instructions.cpp | 12 ++++++++++--
 1 file changed, 10 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 3fbca6c..166b79f 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_schedule_instructions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_schedule_instructions.cpp
@@ -495,7 +495,12 @@ instruction_scheduler::calculate_deps()
 	 }
       }
 
-      for (int i = 0; i < inst->mlen; i++) {
+      /* Meta-instructions that use implied MRF writes internally write to
+       * the first few MRFs (as part of post-scheduling code generation).
+       * This means the existing values are not actually read, so we shouldn't
+       * consider them for RAW dependencies.
+       */
+      for (int i = v->implied_mrf_writes(inst); i < inst->mlen; i++) {
 	 /* It looks like the MRF regs are released in the send
 	  * instruction once it's sent, not when the result comes
 	  * back.
@@ -600,7 +605,10 @@ instruction_scheduler::calculate_deps()
 	 }
       }
 
-      for (int i = 0; i < inst->mlen; i++) {
+      /* Again, we don't actually read the existing value of any MRFs
+       * implicitly written by this instruction.
+       */
+      for (int i = v->implied_mrf_writes(inst); i < inst->mlen; i++) {
 	 /* It looks like the MRF regs are released in the send
 	  * instruction once it's sent, not when the result comes
 	  * back.
-- 
1.8.1.3



More information about the mesa-dev mailing list