[Mesa-stable] [PATCH] gk104/ir: fix tex use generation to be more careful about eliding uses
Ilia Mirkin
imirkin at alum.mit.edu
Sat Jun 18 19:25:41 UTC 2016
If we have a loop, instructions before the tex might be added as tex
uses, and those may in fact dominate all other uses of the tex results.
This however doesn't mean that we don't need a texbar after the tex.
Only check if uses dominate each other if they either both dominate the
tex, or are both dominated by the tex.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96565
Fixes: 7752bbc44 (gk104/ir: simplify and fool-proof texbar algorithm)
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Cc: "11.2 12.0" <mesa-stable at lists.freedesktop.org>
---
.../nouveau/codegen/nv50_ir_lowering_nvc0.cpp | 23 +++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
index 71013eb..2aeae53 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
@@ -172,16 +172,25 @@ NVC0LegalizePostRA::addTexUse(std::list<TexUse> &uses,
Instruction *usei, const Instruction *texi)
{
bool add = true;
+ bool dominated = insnDominatedBy(usei, texi);
for (std::list<TexUse>::iterator it = uses.begin();
it != uses.end();) {
- if (insnDominatedBy(usei, it->insn)) {
- add = false;
- break;
+ // Check if an existing use is on the "same side" of the tex instruction
+ // as the new use. If it is, then we can either discard the new use or
+ // remove the old one. Otherwise we have to keep both, since an earlier
+ // use may dominate a later one, but if the tex is in between, that
+ // doesn't matter.
+ if (dominated == insnDominatedBy(it->insn, texi)) {
+ if (insnDominatedBy(usei, it->insn)) {
+ add = false;
+ break;
+ }
+ if (insnDominatedBy(it->insn, usei)) {
+ it = uses.erase(it);
+ continue;
+ }
}
- if (insnDominatedBy(it->insn, usei))
- it = uses.erase(it);
- else
- ++it;
+ ++it;
}
if (add)
uses.push_back(TexUse(usei, texi));
--
2.7.3
More information about the mesa-stable
mailing list