[Beignet] [PATCH] GBE: fix an image related bugs.
Zhigang Gong
zhigang.gong at intel.com
Sun Mar 15 18:42:25 PDT 2015
The bug was introduces when we removed the hacky invalid
register. Now we will not pass in a fixed count of coordinates
for the typed_write instruction.
Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
backend/src/backend/gen_insn_selection.cpp | 13 +++++++------
backend/src/ir/instruction.cpp | 28 +++++++++++++++++-----------
2 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp
index 2b166b1..c240261 100644
--- a/backend/src/backend/gen_insn_selection.cpp
+++ b/backend/src/backend/gen_insn_selection.cpp
@@ -4411,19 +4411,20 @@ namespace gbe
msgs[i] = sel.selReg(sel.reg(FAMILY_DWORD), TYPE_U32);
} else {
uint32_t valueID = 0;
- msgs[0] = sel.selReg(sel.reg(FAMILY_DWORD), TYPE_U32);
- for(uint32_t msgID = 1; msgID < 1 + dim; msgID++, valueID++)
+ uint32_t msgID = 0;
+ msgs[msgID++] = sel.selReg(sel.reg(FAMILY_DWORD), TYPE_U32);
+ for(; msgID < 1 + dim; msgID++, valueID++)
msgs[msgID] = sel.selReg(insn.getSrc(msgID - 1), insn.getCoordType());
// fake v.
if (dim < 2)
- msgs[2] = sel.selReg(sel.reg(FAMILY_DWORD), TYPE_U32);
+ msgs[msgID++] = sel.selReg(sel.reg(FAMILY_DWORD), TYPE_U32);
// fake w.
if (dim < 3)
- msgs[3] = sel.selReg(sel.reg(FAMILY_DWORD), TYPE_U32);
+ msgs[msgID++] = sel.selReg(sel.reg(FAMILY_DWORD), TYPE_U32);
// LOD.
- msgs[4] = sel.selReg(sel.reg(FAMILY_DWORD), TYPE_U32);
- for(uint32_t msgID = dim + 2; valueID < insn.getSrcNum(); msgID++, valueID++)
+ msgs[msgID++] = sel.selReg(sel.reg(FAMILY_DWORD), TYPE_U32);
+ for(; valueID < insn.getSrcNum(); msgID++, valueID++)
msgs[msgID] = sel.selReg(insn.getSrc(valueID), insn.getSrcType());
}
diff --git a/backend/src/ir/instruction.cpp b/backend/src/ir/instruction.cpp
index a2bc875..797552f 100644
--- a/backend/src/ir/instruction.cpp
+++ b/backend/src/ir/instruction.cpp
@@ -522,10 +522,13 @@ namespace ir {
this->outOpcode(out);
out << "." << this->getDstType()
<< "." << this->getSrcType()
- << " surface id " << (int)this->getImageIndex()
- << " coord u %" << this->getSrc(fn, 0)
- << " coord v %" << this->getSrc(fn, 1)
- << " coord w %" << this->getSrc(fn, 2)
+ << " surface id " << (int)this->getImageIndex();
+ out << " coord u %" << this->getSrc(fn, 0);
+ if (srcNum >= 2)
+ out << " coord v %" << this->getSrc(fn, 1);
+ if (srcNum >= 3)
+ out << " coord w %" << this->getSrc(fn, 2);
+ out
<< " %" << this->getDst(fn, 0)
<< " %" << this->getDst(fn, 1)
<< " %" << this->getDst(fn, 2)
@@ -567,15 +570,18 @@ namespace ir {
INLINE bool wellFormed(const Function &fn, std::string &why) const;
INLINE void out(std::ostream &out, const Function &fn) const {
this->outOpcode(out);
+ uint32_t srcID = 0;
out << "." << this->getSrcType()
<< " surface id " << (int)this->getImageIndex()
- << " coord u %" << this->getSrc(fn, 0)
- << " coord v %" << this->getSrc(fn, 1)
- << " coord w %" << this->getSrc(fn, 2)
- << " %" << this->getSrc(fn, 3)
- << " %" << this->getSrc(fn, 4)
- << " %" << this->getSrc(fn, 5)
- << " %" << this->getSrc(fn, 6);
+ << " coord u %" << this->getSrc(fn, srcID++);
+ if (srcNum >= 6)
+ out << " coord v %" << this->getSrc(fn, srcID++);
+ if (srcNum >= 7)
+ out << " coord w %" << this->getSrc(fn, srcID++);
+ out << " %" << this->getSrc(fn, srcID++);
+ out << " %" << this->getSrc(fn, srcID++);
+ out << " %" << this->getSrc(fn, srcID++);
+ out << " %" << this->getSrc(fn, srcID++);
}
Tuple src;
--
1.9.1
More information about the Beignet
mailing list