[Mesa-dev] [PATCH v2 096/103] i965/vec4: prevent src/dst hazards during 64-bit register allocation

Iago Toral Quiroga itoral at igalia.com
Tue Oct 11 09:02:40 UTC 2016


8-wide compressed DF operations are executed as two separate 4-wide
DF operations. In that scenario, we have to be careful when we allocate
register space for their operands to prevent the case where the first
half of the instruction overwrites the source of the second half.

To do this we mark compressed instructions as having hazards to make
sure that ther register allocators assigns a register regions for the
destination that does not overlap with the region assigned for any
of its source operands.
---
 src/mesa/drivers/dri/i965/brw_vec4.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index d33fb65..edb8a84 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -194,7 +194,13 @@ vec4_instruction::has_source_and_destination_hazard() const
    case TES_OPCODE_ADD_INDIRECT_URB_OFFSET:
       return true;
    default:
-      return false;
+      /* 8-wide compressed DF operations are executed as two 4-wide operations,
+       * so we have a src/dst hazard if the first half of the instruction
+       * overwrites the source of the second half. Prevent this by marking
+       * compressed instructions as having src/dst hazards, so the register
+       * allocator assigns safe register regions for dst and srcs.
+       */
+      return size_written > REG_SIZE;
    }
 }
 
-- 
2.7.4



More information about the mesa-dev mailing list