Mesa (master): intel/fs: Handle flag read/write aliasing in needs_src_copy
Jason Ekstrand
jekstrand at kemper.freedesktop.org
Wed Oct 25 23:14:17 UTC 2017
Module: Mesa
Branch: master
Commit: fa6e74e33e5bc5f6fba8f9de76b8b059515e708f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa6e74e33e5bc5f6fba8f9de76b8b059515e708f
Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date: Wed Sep 6 18:33:38 2017 -0700
intel/fs: Handle flag read/write aliasing in needs_src_copy
In order to implement the ballot intrinsic, we do a MOV from flag
register to some GRF. If that GRF is used in a SEL, cmod propagation
helpfully changes it into a MOV from the flag register with a cmod.
This is perfectly valid but when lower_simd_width comes along, it simply
splits into two instructions which both have conditional modifiers.
This is a problem since we're reading the flag register. This commit
makes us check whether or not flags_written() overlaps with the flag
values that we are reading via the instruction source and, if we have
any interference, will force us to emit a copy of the source.
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Cc: mesa-stable at lists.freedesktop.org
---
src/intel/compiler/brw_fs.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp
index 30e8841242..4616529abc 100644
--- a/src/intel/compiler/brw_fs.cpp
+++ b/src/intel/compiler/brw_fs.cpp
@@ -5013,7 +5013,9 @@ needs_src_copy(const fs_builder &lbld, const fs_inst *inst, unsigned i)
{
return !(is_periodic(inst->src[i], lbld.dispatch_width()) ||
(inst->components_read(i) == 1 &&
- lbld.dispatch_width() <= inst->exec_size));
+ lbld.dispatch_width() <= inst->exec_size)) ||
+ (inst->flags_written() &
+ flag_mask(inst->src[i], type_sz(inst->src[i].type)));
}
/**
More information about the mesa-commit
mailing list