[Beignet] [PATCH] GBE: fix a bug in legalize pass.
Zhigang Gong
zhigang.gong at linux.intel.com
Tue Oct 14 23:24:53 PDT 2014
Thanks for the testing, just pushed.
On Wed, Oct 15, 2014 at 07:15:31AM +0000, Zhu, BingbingX wrote:
> Hi,
> The patch fixed VIZ-4483 [Bisected HSW/IVB/BYT-M] conformance v1.2 "Half Ops" fail. (https://jira01.devtools.intel.com/i#browse/VIZ-4483)
> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Zhu, BingbingX
> Sent: Wednesday, October 15, 2014 3:09 PM
> To: Gong, Zhigang; beignet at lists.freedesktop.org
> Cc: Gong, Zhigang
> Subject: Re: [Beignet] [PATCH] GBE: fix a bug in legalize pass.
>
> After patch ,the bug has been fixed.
>
> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Zhigang Gong
> Sent: Wednesday, October 15, 2014 1:21 PM
> To: beignet at lists.freedesktop.org
> Cc: Gong, Zhigang
> Subject: [Beignet] [PATCH] GBE: fix a bug in legalize pass.
>
> The Shr/Shl llvm instructions require to have identical type for the two operands, so we can't set the shift count to i32 always.
>
> Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
> ---
> backend/src/llvm/llvm_legalize.cpp | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/backend/src/llvm/llvm_legalize.cpp b/backend/src/llvm/llvm_legalize.cpp
> index cec9ff6..d15549d 100644
> --- a/backend/src/llvm/llvm_legalize.cpp
> +++ b/backend/src/llvm/llvm_legalize.cpp
> @@ -176,7 +176,6 @@ namespace gbe {
> SmallVectorImpl<Value*> &v0 = iter->second;
>
> uint64_t shiftBits = dyn_cast<ConstantInt>(p->getOperand(1))->getZExtValue();
> - Type *intTy = IntegerType::get(p->getContext(), 32);
> Type *splitTy = v0[0]->getType();
>
> unsigned elemNum = v0.size();
> @@ -205,8 +204,8 @@ namespace gbe {
> v1.push_back(Builder.CreateShl(v0[0], unaligned));
>
> for (unsigned i = 0; i < elemNum - shift - 1; i++) {
> - Value *t0 = Builder.CreateLShr(v0[i], ConstantInt::get(intTy, szSplit-unaligned));
> - Value *t1 = Builder.CreateShl(v0[i + 1], ConstantInt::get(intTy, unaligned));
> + Value *t0 = Builder.CreateLShr(v0[i], ConstantInt::get(v0[0]->getType(), szSplit-unaligned));
> + Value *t1 = Builder.CreateShl(v0[i + 1], ConstantInt::get(v0[i
> + + 1]->getType(), unaligned));
> Value *t2 = Builder.CreateOr(t0, t1);
> v1.push_back(t2);
> }
> @@ -225,7 +224,6 @@ namespace gbe {
> GBE_ASSERT(iter != valueMap.end());
> SmallVectorImpl<Value*> &opVec = iter->second;
>
> - Type *intTy = IntegerType::get(p->getContext(), 32);
> unsigned szTotal = op1->getType()->getPrimitiveSizeInBits();
> unsigned elemNum = opVec.size();
> unsigned szSplit = szTotal / elemNum; @@ -247,13 +245,13 @@ namespace gbe {
> } else {
> // not aligned case
> for (unsigned s = elemShift; s < elemNum-1; s++) {
> - Value *t0 = Builder.CreateLShr(opVec[s], ConstantInt::get(intTy, unalign));
> - Value *t1 = Builder.CreateShl(opVec[s + 1], ConstantInt::get(intTy, szSplit - unalign));
> + Value *t0 = Builder.CreateLShr(opVec[s], ConstantInt::get(opVec[s]->getType(), unalign));
> + Value *t1 = Builder.CreateShl(opVec[s + 1],
> + ConstantInt::get(opVec[s + 1]->getType(), szSplit - unalign));
> Value *t2 = Builder.CreateOr(t0, t1);
> result.push_back(t2);
> }
> // last element only need lshr
> - result.push_back(Builder.CreateLShr(opVec[elemNum-1], ConstantInt::get(intTy, unalign)));
> + result.push_back(Builder.CreateLShr(opVec[elemNum-1],
> + ConstantInt::get(opVec[elemNum - 1]->getType(), unalign)));
>
> for (unsigned s = 0; s < elemShift; s++) {
> result.push_back(ConstantInt::getSigned(opVec[0]->getType(), 0));
> --
> 1.8.3.2
>
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list