This appears to be a crash in a loop unrolling optimization pass (enabled only when -cl-fast-relaxed-math is set, hence only crashing then).

Disabling this pass unconditionally (see attached) avoids the crash, but may reduce performance.
Description: Disable loop unrolling, as it may crash

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=913141

--- beignet-1.3.2.orig/backend/src/llvm/llvm_to_gen.cpp
+++ beignet-1.3.2/backend/src/llvm/llvm_to_gen.cpp
@@ -182,25 +182,6 @@ namespace gbe
 #endif
       MPM.add(createGVNPass());                 // Remove redundancies
     }
-#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
-    // FIXME Workaround: we find that CustomLoopUnroll may increase register pressure greatly,
-    // and it may even make som cl kernel cannot compile because of limited scratch memory for spill.
-    // As we observe this under strict math. So we disable CustomLoopUnroll if strict math is enabled.
-    if (!strictMath) {
-#if !defined(__ANDROID__)
-      MPM.add(createCustomLoopUnrollPass()); //1024, 32, 1024, 512)); //Unroll loops
-#endif
-      MPM.add(createLoopUnrollPass()); //1024, 32, 1024, 512)); //Unroll loops
-      if(optLevel > 0) {
-#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 38
-        MPM.add(createSROAPass());
-#else
-        MPM.add(createSROAPass(/*RequiresDomTree*/ false));
-#endif
-        MPM.add(createGVNPass());                 // Remove redundancies
-      }
-    }
-#endif
     MPM.add(createMemCpyOptPass());             // Remove memcpy / form memset
     MPM.add(createSCCPPass());                  // Constant prop with SCCP
 

Reply via email to