[beignet] 03/03: Fix (possibly vload/vstore related) compiler hang with LLVM 3.9

Rebecca Palmer rnpalmer-guest at moszumanska.debian.org
Sun Jan 15 15:06:17 UTC 2017


This is an automated email from the git hooks/post-receive script.

rnpalmer-guest pushed a commit to branch master
in repository beignet.

commit cee83a6239a3ab1af82144a4dd94a187330c299d
Author: Rebecca N. Palmer <rebecca_palmer at zoho.com>
Date:   Sun Jan 15 15:02:40 2017 +0000

    Fix (possibly vload/vstore related) compiler hang with LLVM 3.9
---
 debian/changelog                     |  2 +-
 debian/patches/fix-llvm39-hang.patch | 69 ++++++++++++++++++++++++++++++++++++
 debian/patches/series                |  1 +
 3 files changed, 71 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 878d1f6..e6cf302 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,7 @@
 beignet (1.2.1-2) UNRELEASED; urgency=medium
 
   * Fix invalid-iterator crash when compiling large kernels.
-  * Switch to LLVM 3.9.
+  * Switch to LLVM 3.9, and fix a hang caused by this.
   * Fail, don't assert, on failed context creation.  (Closes: #848792)
   * Better document #848368 workarounds.
   * Fix pocl link in documentation.
diff --git a/debian/patches/fix-llvm39-hang.patch b/debian/patches/fix-llvm39-hang.patch
new file mode 100644
index 0000000..4637541
--- /dev/null
+++ b/debian/patches/fix-llvm39-hang.patch
@@ -0,0 +1,69 @@
+Description: Fix compiler hang with LLVM 3.9
+
+Test case:
+OCL_STRICT_CONFORMANCE=0 utest_run -c vload_test_uchar
+(or any of the vload_test_*)
+
+I don't know whether this really fixes the problem (as opposed to
+just making it harder to trigger), but I also don't know whether the
+alternative fix of switching back to LLVM 3.8 does so, and I do
+know that using 3.8 with Mesa on 3.9 causes other problems (#848368).
+
+Origin: upstream https://cgit.freedesktop.org/beignet/commit/?id=75cb7ca04610a6750e73c32b9759a0742f495501
+Author: Yang Rong
+
+--- beignet-1.2.1.orig/backend/src/llvm/llvm_unroll.cpp
++++ beignet-1.2.1/backend/src/llvm/llvm_unroll.cpp
+@@ -103,13 +103,11 @@ namespace gbe {
+       }
+ 
+       void setUnrollID(Loop *L, bool enable) {
+-        if (!enable && disabledLoops.find(L) != disabledLoops.end())
+-           return;
++        assert(enable);
+         LLVMContext &Context = L->getHeader()->getContext();
+ #if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 6
+         SmallVector<Metadata *, 2> forceUnroll;
+         forceUnroll.push_back(MDString::get(Context, "llvm.loop.unroll.enable"));
+-        forceUnroll.push_back(ConstantAsMetadata::get(ConstantInt::get(Type::getInt1Ty(Context), enable)));
+         MDNode *forceUnrollNode = MDNode::get(Context, forceUnroll);
+         SmallVector<Metadata *, 4> Vals;
+         Vals.push_back(NULL);
+@@ -127,8 +125,6 @@ namespace gbe {
+         // Set operand 0 to refer to the loop id itself.
+         NewLoopID->replaceOperandWith(0, NewLoopID);
+         L->setLoopID(NewLoopID);
+-        if (!enable)
+-          disabledLoops.insert(L);
+       }
+ 
+       static bool hasPrivateLoadStore(Loop *L) {
+@@ -190,7 +186,8 @@ namespace gbe {
+ 
+         if (currTripCount > 32) {
+           shouldUnroll = false;
+-          setUnrollID(currL, false);
++          //Don't change the unrollID if doesn't force unroll.
++          //setUnrollID(currL, false);
+           return shouldUnroll;
+         }
+ 
+@@ -206,7 +203,8 @@ namespace gbe {
+               parentTripCount = SE->getSmallConstantTripCount(parentL, parentExitBlock);
+           }
+           if (parentTripCount != 0 && currTripCount * parentTripCount > 32) {
+-            setUnrollID(parentL, false);
++            //Don't change the unrollID if doesn't force unroll.
++            //setUnrollID(parentL, false);
+ #if LLVM_VERSION_MAJOR == 3 &&  LLVM_VERSION_MINOR >= 8
+             loopInfo.markAsRemoved(parentL);
+ #else
+@@ -243,8 +241,6 @@ namespace gbe {
+       virtual const char *getPassName() const {
+         return "SPIR backend: custom loop unrolling pass";
+       }
+-    private:
+-      std::set<Loop *> disabledLoops;
+ 
+     };
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 8dcd0c0..934798d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -12,3 +12,4 @@ llvm39-support.patch
 avoid-invalid-iterator.patch
 noassert-failed-context.patch
 add-appstream-metadata.patch
+fix-llvm39-hang.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/beignet.git



More information about the Pkg-opencl-commits mailing list